From a1b59e5e5e5371adb2911548b2daf8539b195553 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Thu, 19 Aug 2021 08:51:29 -0700 Subject: [PATCH 001/131] install reorg/cleanup Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Assets/CMakeLists.txt | 9 + CMakeLists.txt | 11 +- Code/LauncherUnified/CMakeLists.txt | 24 +++ Registry/CMakeLists.txt | 16 ++ Templates/CMakeLists.txt | 9 + Tools/CMakeLists.txt | 10 ++ Tools/LyTestTools/CMakeLists.txt | 14 ++ Tools/RemoteConsole/CMakeLists.txt | 14 ++ cmake/Install.cmake | 86 +++++++++- cmake/Platform/Common/Install_common.cmake | 156 ++---------------- python/CMakeLists.txt | 24 +++ .../Platform/Linux/install_files_linux.cmake | 13 ++ python/Platform/Mac/install_files_mac.cmake | 13 ++ .../Windows/install_files_windows.cmake | 13 ++ scripts/CMakeLists.txt | 1 + scripts/bundler/CMakeLists.txt | 13 ++ scripts/o3de/CMakeLists.txt | 13 ++ 17 files changed, 288 insertions(+), 151 deletions(-) create mode 100644 Assets/CMakeLists.txt create mode 100644 Registry/CMakeLists.txt create mode 100644 Templates/CMakeLists.txt create mode 100644 Tools/CMakeLists.txt create mode 100644 Tools/LyTestTools/CMakeLists.txt create mode 100644 Tools/RemoteConsole/CMakeLists.txt create mode 100644 python/CMakeLists.txt create mode 100644 python/Platform/Linux/install_files_linux.cmake create mode 100644 python/Platform/Mac/install_files_mac.cmake create mode 100644 python/Platform/Windows/install_files_windows.cmake create mode 100644 scripts/bundler/CMakeLists.txt diff --git a/Assets/CMakeLists.txt b/Assets/CMakeLists.txt new file mode 100644 index 0000000000..11b30db8c3 --- /dev/null +++ b/Assets/CMakeLists.txt @@ -0,0 +1,9 @@ +# +# Copyright (c) Contributors to the Open 3D Engine Project. +# For complete copyright and license terms please see the LICENSE at the root of this distribution. +# +# SPDX-License-Identifier: Apache-2.0 OR MIT +# +# + +ly_install_directory(DIRECTORY .) diff --git a/CMakeLists.txt b/CMakeLists.txt index bd02eeb7ff..7a668af6a1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -64,14 +64,13 @@ include(cmake/Projects.cmake) if(NOT INSTALLED_ENGINE) # Add the rest of the targets + add_subdirectory(Assets) add_subdirectory(Code) + add_subdirectory(python) + add_subdirectory(Registry) add_subdirectory(scripts) - - # SPEC-1417 will investigate and fix this - if(NOT PAL_PLATFORM_NAME STREQUAL "Mac") - add_subdirectory(Tools/LyTestTools/tests/) - add_subdirectory(Tools/RemoteConsole/ly_remote_console/tests/) - endif() + add_subdirectory(Templates) + add_subdirectory(Tools) # Add external subdirectories listed in the engine.json. LY_EXTERNAL_SUBDIRS is a cache variable so the user can add extra # external subdirectories diff --git a/Code/LauncherUnified/CMakeLists.txt b/Code/LauncherUnified/CMakeLists.txt index 079156632c..d496e4fae6 100644 --- a/Code/LauncherUnified/CMakeLists.txt +++ b/Code/LauncherUnified/CMakeLists.txt @@ -94,3 +94,27 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS) endif() +################################################################################ +# Install +################################################################################ + +ly_install_files( + FILES + ${LY_ROOT_FOLDER}/Code/LauncherUnified/launcher_generator.cmake + ${LY_ROOT_FOLDER}/Code/LauncherUnified/launcher_project_files.cmake + ${LY_ROOT_FOLDER}/Code/LauncherUnified/LauncherProject.cpp + ${LY_ROOT_FOLDER}/Code/LauncherUnified/StaticModules.in + DESTINATION LauncherGenerator +) +ly_install_directory( + DIRECTORY Platform/${PAL_PLATFORM_NAME} + DESTINATION LauncherGenerator +) +ly_install_directory( + DIRECTORY Platform/Common + DESTINATION LauncherGenerator +) +ly_install_files( + FILES FindLauncherGenerator.cmake + DESTINATION cmake +) diff --git a/Registry/CMakeLists.txt b/Registry/CMakeLists.txt new file mode 100644 index 0000000000..4e0d433496 --- /dev/null +++ b/Registry/CMakeLists.txt @@ -0,0 +1,16 @@ +# +# Copyright (c) Contributors to the Open 3D Engine Project. +# For complete copyright and license terms please see the LICENSE at the root of this distribution. +# +# SPDX-License-Identifier: Apache-2.0 OR MIT +# +# + +ly_install_directory(DIRECTORY .) + +cmake_path(RELATIVE_PATH CMAKE_RUNTIME_OUTPUT_DIRECTORY BASE_DIRECTORY ${CMAKE_BINARY_DIR} OUTPUT_VARIABLE runtime_output_directory) + +ly_install_directory(DIRECTORY + ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$/Registry + DESTINATION ${runtime_output_directory}/${PAL_PLATFORM_NAME}/$ +) diff --git a/Templates/CMakeLists.txt b/Templates/CMakeLists.txt new file mode 100644 index 0000000000..11b30db8c3 --- /dev/null +++ b/Templates/CMakeLists.txt @@ -0,0 +1,9 @@ +# +# Copyright (c) Contributors to the Open 3D Engine Project. +# For complete copyright and license terms please see the LICENSE at the root of this distribution. +# +# SPDX-License-Identifier: Apache-2.0 OR MIT +# +# + +ly_install_directory(DIRECTORY .) diff --git a/Tools/CMakeLists.txt b/Tools/CMakeLists.txt new file mode 100644 index 0000000000..08958cd97e --- /dev/null +++ b/Tools/CMakeLists.txt @@ -0,0 +1,10 @@ +# +# Copyright (c) Contributors to the Open 3D Engine Project. +# For complete copyright and license terms please see the LICENSE at the root of this distribution. +# +# SPDX-License-Identifier: Apache-2.0 OR MIT +# +# + +add_subdirectory(LyTestTools) +add_subdirectory(RemoteConsole) diff --git a/Tools/LyTestTools/CMakeLists.txt b/Tools/LyTestTools/CMakeLists.txt new file mode 100644 index 0000000000..72321a8915 --- /dev/null +++ b/Tools/LyTestTools/CMakeLists.txt @@ -0,0 +1,14 @@ +# +# Copyright (c) Contributors to the Open 3D Engine Project. +# For complete copyright and license terms please see the LICENSE at the root of this distribution. +# +# SPDX-License-Identifier: Apache-2.0 OR MIT +# +# + +# SPEC-1417 will investigate and fix this +if(NOT PAL_PLATFORM_NAME STREQUAL "Mac") + add_subdirectory(tests) +endif() + +ly_install_directory(DIRECTORY .) diff --git a/Tools/RemoteConsole/CMakeLists.txt b/Tools/RemoteConsole/CMakeLists.txt new file mode 100644 index 0000000000..cabe27c7ea --- /dev/null +++ b/Tools/RemoteConsole/CMakeLists.txt @@ -0,0 +1,14 @@ +# +# Copyright (c) Contributors to the Open 3D Engine Project. +# For complete copyright and license terms please see the LICENSE at the root of this distribution. +# +# SPDX-License-Identifier: Apache-2.0 OR MIT +# +# + +# SPEC-1417 will investigate and fix this +if(NOT PAL_PLATFORM_NAME STREQUAL "Mac") + add_subdirectory(ly_remote_console/tests) +endif() + +ly_install_directory(DIRECTORY .) diff --git a/cmake/Install.cmake b/cmake/Install.cmake index 816fb2a372..81f323dc95 100644 --- a/cmake/Install.cmake +++ b/cmake/Install.cmake @@ -9,4 +9,88 @@ if(NOT INSTALLED_ENGINE) ly_get_absolute_pal_filename(pal_dir ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Platform/${PAL_PLATFORM_NAME}) include(${pal_dir}/Install_${PAL_PLATFORM_NAME_LOWERCASE}.cmake) -endif() \ No newline at end of file +endif() + +#! ly_install_directory: specifies a directory to be copied to the install layout at install time +# +# \arg:DIRECTORY directory to install +# \arg:DESTINATION (optional) destination to install the directory to (relative to CMAKE_PREFIX_PATH) +# \arg:EXCLUDE_PATTERNS (optional) patterns to exclude +# +# \notes: refer to cmake's install(DIRECTORY documentation for more information +# +function(ly_install_directory) + + set(options) + set(oneValueArgs DIRECTORY DESTINATION) + set(multiValueArgs EXCLUDE_PATTERNS) + + cmake_parse_arguments(ly_install_directory "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + if(NOT ly_install_directory_DIRECTORY) + message(FATAL_ERROR "You must provide a directory to install") + endif() + + if(NOT ly_install_directory_DESTINATION) + # maintain the same structure relative to LY_ROOT_FOLDER + set(ly_install_directory_DESTINATION ${ly_install_directory_DIRECTORY}) + if(${ly_install_directory_DESTINATION} STREQUAL ".") + set(ly_install_directory_DESTINATION ${CMAKE_CURRENT_LIST_DIR}) + else() + cmake_path(ABSOLUTE_PATH ly_install_directory_DESTINATION BASE_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}) + endif() + # take out the last directory since install asks for the destination of the folder, without including the fodler itself + cmake_path(GET ly_install_directory_DESTINATION PARENT_PATH ly_install_directory_DESTINATION) + cmake_path(RELATIVE_PATH ly_install_directory_DESTINATION BASE_DIRECTORY ${LY_ROOT_FOLDER}) + endif() + + unset(exclude_patterns) + if(ly_install_directory_EXCLUDE_PATTERNS) + foreach(exclude_pattern ${ly_install_directory_EXCLUDE_PATTERNS}) + list(APPEND exclude_patterns PATTERN ${exclude_pattern} EXCLUDE) + endforeach() + endif() + + install(DIRECTORY ${ly_install_directory_DIRECTORY} + DESTINATION ${ly_install_directory_DESTINATION} + COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME} # use the deafult for the time being + ${exclude_patterns} + ) + +endfunction() + +#! ly_install_files: specifies files to be copied to the install layout at install time +# +# \arg:FILES files to install +# \arg:DESTINATION (optional) destination to install the directory to (relative to CMAKE_PREFIX_PATH) +# \arg:PROGRAMS (optional) indicates if the files are programs that should be installed with EXECUTE permissions +# +# \notes: refer to cmake's install(DIRECTORY documentation for more information +# +function(ly_install_files) + + set(options PROGRAMS) + set(oneValueArgs DESTINATION) + set(multiValueArgs FILES) + + cmake_parse_arguments(ly_install_files "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + if(NOT ly_install_files_FILES) + message(FATAL_ERROR "You must provide a list of files to install") + endif() + if(NOT ly_install_files_DESTINATION) + message(FATAL_ERROR "You must provide a destination to install filest to") + endif() + + if(ly_install_files_PROGRAMS) + set(install_type PROGRAMS) + else() + set(install_type FILES) + endif() + + install(${install_type} ${ly_install_files_FILES} + DESTINATION ${ly_install_files_DESTINATION} + COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME} # use the deafult for the time being + ) + +endfunction() \ No newline at end of file diff --git a/cmake/Platform/Common/Install_common.cmake b/cmake/Platform/Common/Install_common.cmake index 2b56a1f0b4..bee2349e75 100644 --- a/cmake/Platform/Common/Install_common.cmake +++ b/cmake/Platform/Common/Install_common.cmake @@ -355,9 +355,16 @@ function(ly_setup_o3de_install) ly_setup_subdirectories() ly_setup_cmake_install() - ly_setup_target_generator() ly_setup_runtime_dependencies() - ly_setup_others() + ly_setup_assets() + + # Misc + install(FILES + ${LY_ROOT_FOLDER}/ctest_pytest.ini + ${LY_ROOT_FOLDER}/LICENSE.txt + ${LY_ROOT_FOLDER}/README.md + DESTINATION . + ) endfunction() @@ -488,75 +495,12 @@ endfunction()" list(REMOVE_DUPLICATES runtime_commands) list(JOIN runtime_commands " " runtime_commands_str) # the spaces are just to see the right identation in the cmake_install.cmake file - install(CODE "${runtime_commands_str}" - ) + install(CODE "${runtime_commands_str}") endfunction() -#! ly_setup_others: install directories required by the engine -function(ly_setup_others) - - # List of directories we want to install relative to engine root - set(DIRECTORIES_TO_INSTALL Tools/LyTestTools Tools/RemoteConsole) - foreach(dir ${DIRECTORIES_TO_INSTALL}) - - get_filename_component(install_path ${dir} DIRECTORY) - if (NOT install_path) - set(install_path .) - endif() - - install(DIRECTORY "${LY_ROOT_FOLDER}/${dir}" - DESTINATION ${install_path} - PATTERN "__pycache__" EXCLUDE - ) - - endforeach() - - # Scripts - file(GLOB o3de_scripts "${LY_ROOT_FOLDER}/scripts/o3de.*") - install(PROGRAMS - ${o3de_scripts} - DESTINATION ./scripts - ) - - install(DIRECTORY - ${LY_ROOT_FOLDER}/scripts/bundler - ${LY_ROOT_FOLDER}/scripts/o3de - DESTINATION ./scripts - PATTERN "__pycache__" EXCLUDE - PATTERN "CMakeLists.txt" EXCLUDE - PATTERN "tests" EXCLUDE - ) - - install(DIRECTORY "${LY_ROOT_FOLDER}/python" - DESTINATION . - REGEX "downloaded_packages" EXCLUDE - REGEX "runtime" EXCLUDE - REGEX ".*$\.sh" EXCLUDE - ) - - # For Mac/Linux shell scripts need to be installed as PROGRAMS to have execute permission - file(GLOB python_scripts "${LY_ROOT_FOLDER}/python/*.sh") - install(PROGRAMS - ${python_scripts} - DESTINATION ./python - ) - - # Registry - install(DIRECTORY - ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$/Registry - DESTINATION ./${runtime_output_directory}/${PAL_PLATFORM_NAME}/$ - ) - install(DIRECTORY - ${LY_ROOT_FOLDER}/Registry - DESTINATION . - ) - - # Engine Source Assets - install(DIRECTORY - ${LY_ROOT_FOLDER}/Assets - DESTINATION . - ) +#! ly_setup_assets: install asset directories required by the engine +function(ly_setup_assets) # Gem Source Assets and configuration files # Find all gem directories relative to the CMake Source Dir @@ -645,80 +589,4 @@ function(ly_setup_others) endforeach() - # Templates - install(DIRECTORY - ${LY_ROOT_FOLDER}/Templates - DESTINATION . - ) - - # Misc - install(FILES - ${LY_ROOT_FOLDER}/ctest_pytest.ini - ${LY_ROOT_FOLDER}/LICENSE.txt - ${LY_ROOT_FOLDER}/README.md - DESTINATION . - ) - -endfunction() - -#! ly_setup_target_generator: install source files needed for project launcher generation -function(ly_setup_target_generator) - - install(FILES - ${LY_ROOT_FOLDER}/Code/LauncherUnified/launcher_generator.cmake - ${LY_ROOT_FOLDER}/Code/LauncherUnified/launcher_project_files.cmake - ${LY_ROOT_FOLDER}/Code/LauncherUnified/LauncherProject.cpp - ${LY_ROOT_FOLDER}/Code/LauncherUnified/StaticModules.in - DESTINATION LauncherGenerator - ) - install(DIRECTORY ${LY_ROOT_FOLDER}/Code/LauncherUnified/Platform - DESTINATION LauncherGenerator - ) - install(FILES ${LY_ROOT_FOLDER}/Code/LauncherUnified/FindLauncherGenerator.cmake - DESTINATION cmake - ) - -endfunction() - -#! ly_add_install_paths: Adds the list of path to copy to the install layout relative to the same folder -# \arg:PATHS - Paths to copy over to the install layout. The DESTINATION sub argument is optional -# The INPUT sub-argument is required -# \arg:BASE_DIRECTORY(Optional) - Absolute path where a relative path from the each input path will be -# based off of. Defaults to LY_ROOT_FOLDER if not supplied -function(ly_add_install_paths) - set(options) - set(oneValueArgs BASE_DIRECTORY) - set(multiValueArgs PATHS) - cmake_parse_arguments(ly_add_install_paths "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - if(NOT ly_add_install_paths_PATHS) - message(FATAL_ERROR "ly_add_install_paths requires at least one input path to copy to the destination") - endif() - - # The default is the "." directory if not supplied - if(NOT ly_add_install_paths_BASE_DIRECTORY) - cmake_path(SET ly_add_install_paths_BASE_DIRECTORY ${LY_ROOT_FOLDER}) - endif() - - # Separate each path into an INPUT and DESTINATION parameter - set(options) - set(oneValueArgs INPUT DESTINATION) - set(multiValueArgs) - foreach(install_path IN LISTS ly_add_install_paths_PATHS) - string(REPLACE " " ";" install_path ${install_path}) - cmake_parse_arguments(install "${options}" "${oneValueArgs}" "${multiValueArgs}" ${install_path}) - if(NOT install_DESTINATION) - ly_get_engine_relative_source_dir(${install_INPUT} rel_to_root_input_path - BASE_DIRECTORY ${ly_add_install_paths_BASE_DIRECTORY}) - cmake_path(GET rel_to_root_input_path PARENT_PATH install_DESTINATION) - endif() - if(NOT install_DESTINATION) - cmake_path(SET install_DESTINATION .) - endif() - if(IS_DIRECTORY ${install_INPUT}) - install(DIRECTORY ${install_INPUT} DESTINATION ${install_DESTINATION}) - elseif(EXISTS ${install_INPUT}) - install(FILES ${install_INPUT} DESTINATION ${install_DESTINATION}) - endif() - endforeach() - endfunction() diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt new file mode 100644 index 0000000000..4e49c6396a --- /dev/null +++ b/python/CMakeLists.txt @@ -0,0 +1,24 @@ +# +# Copyright (c) Contributors to the Open 3D Engine Project. +# For complete copyright and license terms please see the LICENSE at the root of this distribution. +# +# SPDX-License-Identifier: Apache-2.0 OR MIT +# +# + +# common files to all platforms +ly_install_files( + FILES + get_python.cmake + readme.md + requirements.txt + DESTINATION python +) + +# platform specific files (they are PROGRAMS) +include(Platform/${PAL_PLATFORM_NAME}/install_files_${PAL_PLATFORM_NAME_LOWERCASE}.cmake) +ly_install_files( + FILES ${install_files} + PROGRAMS + DESTINATION python +) diff --git a/python/Platform/Linux/install_files_linux.cmake b/python/Platform/Linux/install_files_linux.cmake new file mode 100644 index 0000000000..e6ce1f2701 --- /dev/null +++ b/python/Platform/Linux/install_files_linux.cmake @@ -0,0 +1,13 @@ +# +# Copyright (c) Contributors to the Open 3D Engine Project. +# For complete copyright and license terms please see the LICENSE at the root of this distribution. +# +# SPDX-License-Identifier: Apache-2.0 OR MIT +# +# + +set(install_files + get_python.sh + pip.sh + python.sh +) diff --git a/python/Platform/Mac/install_files_mac.cmake b/python/Platform/Mac/install_files_mac.cmake new file mode 100644 index 0000000000..e6ce1f2701 --- /dev/null +++ b/python/Platform/Mac/install_files_mac.cmake @@ -0,0 +1,13 @@ +# +# Copyright (c) Contributors to the Open 3D Engine Project. +# For complete copyright and license terms please see the LICENSE at the root of this distribution. +# +# SPDX-License-Identifier: Apache-2.0 OR MIT +# +# + +set(install_files + get_python.sh + pip.sh + python.sh +) diff --git a/python/Platform/Windows/install_files_windows.cmake b/python/Platform/Windows/install_files_windows.cmake new file mode 100644 index 0000000000..df9a88ba1c --- /dev/null +++ b/python/Platform/Windows/install_files_windows.cmake @@ -0,0 +1,13 @@ +# +# Copyright (c) Contributors to the Open 3D Engine Project. +# For complete copyright and license terms please see the LICENSE at the root of this distribution. +# +# SPDX-License-Identifier: Apache-2.0 OR MIT +# +# + +set(install_files + get_python.bat + pip.cmd + python.cmd +) diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index 14cc7f0be1..5dcd739fb4 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -6,6 +6,7 @@ # # +add_subdirectory(bundler) add_subdirectory(detect_file_changes) add_subdirectory(commit_validation) add_subdirectory(o3de) diff --git a/scripts/bundler/CMakeLists.txt b/scripts/bundler/CMakeLists.txt new file mode 100644 index 0000000000..3642b34cbc --- /dev/null +++ b/scripts/bundler/CMakeLists.txt @@ -0,0 +1,13 @@ +# +# Copyright (c) Contributors to the Open 3D Engine Project. +# For complete copyright and license terms please see the LICENSE at the root of this distribution. +# +# SPDX-License-Identifier: Apache-2.0 OR MIT +# +# + +ly_install_directory(DIRECTORY . + EXCLUDE_PATTERNS + __pycache__ + CMakeLists.txt +) diff --git a/scripts/o3de/CMakeLists.txt b/scripts/o3de/CMakeLists.txt index 48b8a1e801..3c60fa4b16 100644 --- a/scripts/o3de/CMakeLists.txt +++ b/scripts/o3de/CMakeLists.txt @@ -7,3 +7,16 @@ # add_subdirectory(tests) + +file(GLOB o3de_scripts "${LY_ROOT_FOLDER}/scripts/o3de.*") +ly_install_files(FILES ${o3de_scripts} +PROGRAMS + DESTINATION ./scripts +) + +ly_install_directory(DIRECTORY . + EXCLUDE_PATTERNS + __pycache__ + CMakeLists.txt + tests +) From a97bccbf381f956f0c1e865a35ae481276116579 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Thu, 19 Aug 2021 14:01:50 -0700 Subject: [PATCH 002/131] some fixes Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Code/Framework/AzCore/AzCore/Math/Guid.h | 4 ++-- .../AzCore/Math/Internal/SimdMathCommon_simd.inl | 2 -- .../AzCore/AzCore/RTTI/BehaviorContext.h | 2 +- .../AzCore/Serialization/Json/JsonSerializer.cpp | 1 - .../AzCore/AzCore/std/string/string_view.h | 2 ++ .../AzCore/Debug/StackTracer_UnixLike.cpp | 2 +- .../GridMate/Carrier/SecureSocketDriver.cpp | 10 ---------- Code/Legacy/CryCommon/CryLibrary.h | 6 +++--- Code/Legacy/CryCommon/CryVersion.h | 2 +- Code/Legacy/CryCommon/IIndexedMesh.h | 1 - Code/Legacy/CryCommon/VectorMap.h | 2 -- Code/Legacy/CryCommon/WinBase.cpp | 10 +--------- Code/Legacy/CrySystem/LocalizedStringManager.cpp | 6 ++---- Code/Legacy/CrySystem/Log.cpp | 4 +--- Code/Legacy/CrySystem/XML/xml.cpp | 16 ++-------------- .../RHI/Code/Include/Atom/RHI/ConstantsData.h | 1 - .../Common/Clang/Configurations_clang.cmake | 5 ----- 17 files changed, 16 insertions(+), 60 deletions(-) diff --git a/Code/Framework/AzCore/AzCore/Math/Guid.h b/Code/Framework/AzCore/AzCore/Math/Guid.h index 53bab4d7ed..15c4c52742 100644 --- a/Code/Framework/AzCore/AzCore/Math/Guid.h +++ b/Code/Framework/AzCore/AzCore/Math/Guid.h @@ -66,9 +66,9 @@ typedef const GUID& REFIID; const GUID name \ = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } } -static REFGUID GUID_NULL() +REFGUID GUID_NULL() { - static const GUID guid = { 0x00000000L, 0x0000, 0x0000, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} }; + static GUID guid = { 0x00000000L, 0x0000, 0x0000, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} }; return guid; } diff --git a/Code/Framework/AzCore/AzCore/Math/Internal/SimdMathCommon_simd.inl b/Code/Framework/AzCore/AzCore/Math/Internal/SimdMathCommon_simd.inl index fc406f5862..c9909925c4 100644 --- a/Code/Framework/AzCore/AzCore/Math/Internal/SimdMathCommon_simd.inl +++ b/Code/Framework/AzCore/AzCore/Math/Internal/SimdMathCommon_simd.inl @@ -339,7 +339,6 @@ namespace AZ { const typename VecType::FloatType x_eq_0 = VecType::CmpEq(x, VecType::ZeroFloat()); const typename VecType::FloatType x_ge_0 = VecType::CmpGtEq(x, VecType::ZeroFloat()); - const typename VecType::FloatType x_le_0 = VecType::CmpLtEq(x, VecType::ZeroFloat()); const typename VecType::FloatType x_lt_0 = VecType::CmpLt(x, VecType::ZeroFloat()); const typename VecType::FloatType y_eq_0 = VecType::CmpEq(y, VecType::ZeroFloat()); @@ -363,7 +362,6 @@ namespace AZ typename VecType::FloatType swap_sign_mask_offset = VecType::And(x_lt_0, y_lt_0); swap_sign_mask_offset = VecType::And(swap_sign_mask_offset, VecType::CastToFloat(FastLoadConstant(Simd::g_negateMask))); - const typename VecType::FloatType offset0 = VecType::ZeroFloat(); typename VecType::FloatType offset1 = FastLoadConstant(g_Pi); offset1 = VecType::Xor(offset1, swap_sign_mask_offset); diff --git a/Code/Framework/AzCore/AzCore/RTTI/BehaviorContext.h b/Code/Framework/AzCore/AzCore/RTTI/BehaviorContext.h index 0c4eaf8383..86c6efdc9c 100644 --- a/Code/Framework/AzCore/AzCore/RTTI/BehaviorContext.h +++ b/Code/Framework/AzCore/AzCore/RTTI/BehaviorContext.h @@ -3775,7 +3775,7 @@ namespace AZ inline void OnDemandReflectFunctions(OnDemandReflectionOwner* onDemandReflection, AZStd::Internal::pack_traits_arg_sequence) { using PackExpander = bool[]; - PackExpander{ true, (BehaviorOnDemandReflectHelper::raw_fp_type>::QueueReflect(onDemandReflection), true)... }; + [[maybe_unused]] PackExpander pe = { true, (BehaviorOnDemandReflectHelper::raw_fp_type>::QueueReflect(onDemandReflection), true)... }; } // Assumes parameters array is big enough to store all parameters diff --git a/Code/Framework/AzCore/AzCore/Serialization/Json/JsonSerializer.cpp b/Code/Framework/AzCore/AzCore/Serialization/Json/JsonSerializer.cpp index 1fa0dd3c44..a7abfca86b 100644 --- a/Code/Framework/AzCore/AzCore/Serialization/Json/JsonSerializer.cpp +++ b/Code/Framework/AzCore/AzCore/Serialization/Json/JsonSerializer.cpp @@ -158,7 +158,6 @@ namespace AZ using namespace JsonSerializationResult; StoreTypeId storeTypeId = StoreTypeId::No; - Uuid resolvedTypeId = classData.m_typeId; const SerializeContext::ClassData* resolvedClassData = &classData; AZStd::any defaultPointerObject; diff --git a/Code/Framework/AzCore/AzCore/std/string/string_view.h b/Code/Framework/AzCore/AzCore/std/string/string_view.h index 9a98795554..267ea7b536 100644 --- a/Code/Framework/AzCore/AzCore/std/string/string_view.h +++ b/Code/Framework/AzCore/AzCore/std/string/string_view.h @@ -866,7 +866,9 @@ namespace AZStd constexpr size_t hash_string(RandomAccessIterator first, size_t length) { size_t hash = 14695981039346656037ULL; +#if AZ_COMPILER_MSVC >= 1924 constexpr size_t fnvPrime = 1099511628211ULL; +#endif const RandomAccessIterator last(first + length); for (; first != last; ++first) diff --git a/Code/Framework/AzCore/Platform/Common/UnixLike/AzCore/Debug/StackTracer_UnixLike.cpp b/Code/Framework/AzCore/Platform/Common/UnixLike/AzCore/Debug/StackTracer_UnixLike.cpp index abfabbbd54..f66a9d3b18 100644 --- a/Code/Framework/AzCore/Platform/Common/UnixLike/AzCore/Debug/StackTracer_UnixLike.cpp +++ b/Code/Framework/AzCore/Platform/Common/UnixLike/AzCore/Debug/StackTracer_UnixLike.cpp @@ -57,7 +57,7 @@ StackRecorder::Record(StackFrame* frames, unsigned int maxNumOfFrames, unsigned int skip = static_cast((suppressCount == 0) ? 1 : suppressCount); // Skip at least this function while ((unw_step(&cursor) > 0) && (count < maxNumOfFrames)) { - unw_word_t offset, pc; + unw_word_t pc; unw_get_reg(&cursor, UNW_REG_IP, &pc); if (pc == 0) { diff --git a/Code/Framework/GridMate/GridMate/Carrier/SecureSocketDriver.cpp b/Code/Framework/GridMate/GridMate/Carrier/SecureSocketDriver.cpp index 031e8561ec..630f81d89f 100644 --- a/Code/Framework/GridMate/GridMate/Carrier/SecureSocketDriver.cpp +++ b/Code/Framework/GridMate/GridMate/Carrier/SecureSocketDriver.cpp @@ -151,16 +151,6 @@ namespace GridMate writeBuffer.Write(PackByte(value)); } - AZ_INLINE static AZ::u32 CalculatePeerCRC32(const SecureSocketDriver::AddrPtr& from) - { - // Calculate CRC32 from remote address - AZ::u32 port = from->GetPort(); - AZ::Crc32 crc; - crc.Add(from->GetIP().c_str()); - crc.Add(&port, sizeof(port)); - return crc; - } - // Structures // struct RecordHeader // 13 bytes = DTLS1_RT_HEADER_LENGTH diff --git a/Code/Legacy/CryCommon/CryLibrary.h b/Code/Legacy/CryCommon/CryLibrary.h index a034a2a04b..6c13f0f9c6 100644 --- a/Code/Legacy/CryCommon/CryLibrary.h +++ b/Code/Legacy/CryCommon/CryLibrary.h @@ -97,14 +97,14 @@ static const char* GetModulePath() return getenv(gEnvName); } -static void SetModulePath(const char* pModulePath) +void SetModulePath(const char* pModulePath) { setenv(gEnvName, pModulePath ? pModulePath : "", true); } // bInModulePath is only ever set to false in RC, because rc needs to load dlls from a $PATH that // it has modified to include .. -static HMODULE CryLoadLibrary(const char* libName, bool bLazy = false, bool bInModulePath = true) +HMODULE CryLoadLibrary(const char* libName, bool bLazy = false, bool bInModulePath = true) { const char* libPath = nullptr; char pathBuffer[MAX_PATH] = {0}; @@ -161,7 +161,7 @@ static HMODULE CryLoadLibrary(const char* libName, bool bLazy = false, bool bInM return module; } -static bool CryFreeLibrary(void* lib) +bool CryFreeLibrary(void* lib) { if (lib) { diff --git a/Code/Legacy/CryCommon/CryVersion.h b/Code/Legacy/CryCommon/CryVersion.h index 0f84e02b6b..e6ed15408d 100644 --- a/Code/Legacy/CryCommon/CryVersion.h +++ b/Code/Legacy/CryCommon/CryVersion.h @@ -43,7 +43,7 @@ struct SFileVersion t[len] = 0; char* p; - char* next = nullptr; + [[maybe_unused]] char* next = nullptr; [[maybe_unused]] size_t strmax = sizeof(t); p = azstrtok(t, &strmax, ".", &next); if (!p) diff --git a/Code/Legacy/CryCommon/IIndexedMesh.h b/Code/Legacy/CryCommon/IIndexedMesh.h index 87c3df98bd..dbfbf3c71b 100644 --- a/Code/Legacy/CryCommon/IIndexedMesh.h +++ b/Code/Legacy/CryCommon/IIndexedMesh.h @@ -1520,7 +1520,6 @@ public: const int oldVertexCount = GetVertexCount(); const int oldFaceCount = GetFaceCount(); - const int nOldCoorCount = GetTexCoordCount(); if (GetTexCoordCount() != 0 && GetTexCoordCount() != oldVertexCount) { diff --git a/Code/Legacy/CryCommon/VectorMap.h b/Code/Legacy/CryCommon/VectorMap.h index 75b1562c4d..6fce90b4ec 100644 --- a/Code/Legacy/CryCommon/VectorMap.h +++ b/Code/Legacy/CryCommon/VectorMap.h @@ -411,7 +411,6 @@ typename VectorMap::iterator VectorMap::lower_bound(cons { int count = static_cast(m_entries.size()); iterator first = m_entries.begin(); - iterator last = m_entries.end(); for (; 0 < count; ) { // divide and conquer, find half that contains answer int count2 = count / 2; @@ -434,7 +433,6 @@ typename VectorMap::const_iterator VectorMap::lower_boun { int count = static_cast(m_entries.size()); const_iterator first = m_entries.begin(); - const_iterator last = m_entries.end(); for (; 0 < count; ) { // divide and conquer, find half that contains answer int count2 = count / 2; diff --git a/Code/Legacy/CryCommon/WinBase.cpp b/Code/Legacy/CryCommon/WinBase.cpp index ae646e9e1c..99e01f7194 100644 --- a/Code/Legacy/CryCommon/WinBase.cpp +++ b/Code/Legacy/CryCommon/WinBase.cpp @@ -1305,13 +1305,8 @@ const bool GetFilenameNoCase char* slash; const char* dirname; char* name; - FS_ERRNO_TYPE fsErr = 0; - FS_DIRENT_TYPE dirent; - uint64_t direntSize = 0; - FS_DIR_TYPE fd = FS_DIR_NULL; - if ( - (pAdjustedFilename) == (char*)-1) + if ((pAdjustedFilename) == (char*)-1) { return false; } @@ -1343,9 +1338,6 @@ const bool GetFilenameNoCase #endif // Scan for the file. - bool found = false; - bool skipScan = false; - if (slash) { *slash = '/'; diff --git a/Code/Legacy/CrySystem/LocalizedStringManager.cpp b/Code/Legacy/CrySystem/LocalizedStringManager.cpp index db77eda3e8..e4b149d84e 100644 --- a/Code/Legacy/CrySystem/LocalizedStringManager.cpp +++ b/Code/Legacy/CrySystem/LocalizedStringManager.cpp @@ -1926,11 +1926,9 @@ AZStd::string CLocalizedStringsManager::SLocalizedStringEntry::GetTranslatedText #endif //LOG_DECOMP_TIMES #if !defined(NDEBUG) - size_t len = -#endif - strnlen((const char*)decompressionBuffer, COMPRESSION_FIXED_BUFFER_LENGTH); + size_t len = strnlen((const char*)decompressionBuffer, COMPRESSION_FIXED_BUFFER_LENGTH); assert(len < COMPRESSION_FIXED_BUFFER_LENGTH && "Buffer not null-terminated"); - +#endif #if defined(LOG_DECOMP_TIMES) nAllocTicks = CryGetTicks(); diff --git a/Code/Legacy/CrySystem/Log.cpp b/Code/Legacy/CrySystem/Log.cpp index be2816c890..4965323695 100644 --- a/Code/Legacy/CrySystem/Log.cpp +++ b/Code/Legacy/CrySystem/Log.cpp @@ -444,8 +444,6 @@ void CLog::LogV(const ELogType type, [[maybe_unused]]int flags, const char* szFo return; } - LogStringType tempString; - char szBuffer[MAX_WARNING_LENGTH + 32]; char* szString = szBuffer; char* szAfterColour = szString; @@ -1297,7 +1295,7 @@ void CLog::CheckAndPruneBackupLogs() const AZStd::list fileInfoList; // Now that we've copied the new log over, lets check the size of the backup folder and trim it as necessary to keep it within appropriate limits - AZ::IO::Result res = fileSystem->FindFiles(LOG_BACKUP_PATH, "*", + fileSystem->FindFiles(LOG_BACKUP_PATH, "*", [&totalBackupDirectorySize, &fileSystem, &fileInfoList](const char* fileName) { AZ::u64 size; diff --git a/Code/Legacy/CrySystem/XML/xml.cpp b/Code/Legacy/CrySystem/XML/xml.cpp index adbfcc5f3e..d3fbaa9ec6 100644 --- a/Code/Legacy/CrySystem/XML/xml.cpp +++ b/Code/Legacy/CrySystem/XML/xml.cpp @@ -1760,21 +1760,9 @@ XmlNodeRef XmlParserImp::ParseFile(const char* filename, XmlString& errorString, { // not binary XML - refuse to load if in scripts dir and not in bin xml to help reduce hacking // wish we could compile the text xml parser out, but too much work to get everything moved over - static const char SCRIPTS_DIR[] = "Scripts/"; - AZStd::fixed_string<32> strScripts("S"); - strScripts += "c"; - strScripts += "r"; - strScripts += "i"; - strScripts += "p"; - strScripts += "t"; - strScripts += "s"; - strScripts += "/"; + AZStd::fixed_string<32> strScripts = {"Scripts/"}; // exclude files and PAKs from Mods folder - AZStd::fixed_string<8> modsStr("M"); - modsStr += "o"; - modsStr += "d"; - modsStr += "s"; - modsStr += "/"; + AZStd::fixed_string<8> modsStr = {"Mods/"}; if (_strnicmp(filename, strScripts.c_str(), strScripts.length()) == 0 && _strnicmp(adjustedFilename.c_str(), modsStr.c_str(), modsStr.length()) != 0 && _strnicmp(pakPath.c_str(), modsStr.c_str(), modsStr.length()) != 0) diff --git a/Gems/Atom/RHI/Code/Include/Atom/RHI/ConstantsData.h b/Gems/Atom/RHI/Code/Include/Atom/RHI/ConstantsData.h index ff1158e455..82b0b7146b 100644 --- a/Gems/Atom/RHI/Code/Include/Atom/RHI/ConstantsData.h +++ b/Gems/Atom/RHI/Code/Include/Atom/RHI/ConstantsData.h @@ -248,7 +248,6 @@ namespace AZ AZStd::array_view constantBytes = GetConstantRaw(inputIndex); const size_t elementSize = sizeof(T); const size_t elementOffset = arrayIndex * elementSize; - const size_t elementCount = DivideByMultiple(constantBytes.size(), elementSize); if (ValidateConstantAccess(inputIndex, ValidateConstantAccessExpect::ArrayElement, elementOffset, elementSize)) { return *reinterpret_cast(&constantBytes[elementOffset]); diff --git a/cmake/Platform/Common/Clang/Configurations_clang.cmake b/cmake/Platform/Common/Clang/Configurations_clang.cmake index 94584e342f..17a89fc1cd 100644 --- a/cmake/Platform/Common/Clang/Configurations_clang.cmake +++ b/cmake/Platform/Common/Clang/Configurations_clang.cmake @@ -33,11 +33,6 @@ ly_append_configurations_options( -Wno-tautological-compare -Wno-undefined-var-template -Wno-unknown-pragmas - -Wno-unused-function - -Wno-unused-private-field - -Wno-unused-value - -Wno-unused-variable - -Wno-unused-lambda-capture # Workaround for compiler seeing file case differently from what OS show in console. -Wno-nonportable-include-path From 63cd3db9569f94f0a61ab72e5f7de2ef85bce66b Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Thu, 19 Aug 2021 18:26:09 -0700 Subject: [PATCH 003/131] Removes LOADING_TIME_PROFILE_SECTION macros that are unused Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Code/Editor/CryEditDoc.cpp | 2 +- Code/Editor/GameEngine.cpp | 3 +-- Code/Legacy/CryCommon/ISystem.h | 5 ----- .../CrySystem/LevelSystem/LevelSystem.cpp | 12 ----------- .../LevelSystem/SpawnableLevelSystem.cpp | 5 ----- .../CrySystem/LocalizedStringManager.cpp | 1 - Code/Legacy/CrySystem/Log.cpp | 4 ---- Code/Legacy/CrySystem/System.cpp | 3 --- Code/Legacy/CrySystem/SystemInit.cpp | 21 ++----------------- Code/Legacy/CrySystem/XML/xml.cpp | 4 ---- 10 files changed, 4 insertions(+), 56 deletions(-) diff --git a/Code/Editor/CryEditDoc.cpp b/Code/Editor/CryEditDoc.cpp index e5988918f5..cb920da2de 100644 --- a/Code/Editor/CryEditDoc.cpp +++ b/Code/Editor/CryEditDoc.cpp @@ -342,7 +342,7 @@ void CCryEditDoc::Load(TDocMultiArchive& arrXmlAr, const QString& szFilename) // Register this level and its content hash as version GetIEditor()->GetSettingsManager()->AddToolVersion(fileName, levelHash); GetIEditor()->GetSettingsManager()->RegisterEvent(loadEvent); - LOADING_TIME_PROFILE_SECTION(gEnv->pSystem); + CAutoDocNotReady autoDocNotReady; HEAP_CHECK diff --git a/Code/Editor/GameEngine.cpp b/Code/Editor/GameEngine.cpp index 137d14c844..4b463efe0a 100644 --- a/Code/Editor/GameEngine.cpp +++ b/Code/Editor/GameEngine.cpp @@ -497,8 +497,7 @@ bool CGameEngine::LoadLevel( [[maybe_unused]] bool bDeleteAIGraph, bool bReleaseResources) { - LOADING_TIME_PROFILE_SECTION(GetIEditor()->GetSystem()); - m_bLevelLoaded = false; + m_bLevelLoaded = false; CLogFile::FormatLine("Loading map '%s' into engine...", m_levelPath.toUtf8().data()); // Switch the current directory back to the Primary CD folder first. // The engine might have trouble to find some files when the current diff --git a/Code/Legacy/CryCommon/ISystem.h b/Code/Legacy/CryCommon/ISystem.h index 74153eb39b..3e0abf56c6 100644 --- a/Code/Legacy/CryCommon/ISystem.h +++ b/Code/Legacy/CryCommon/ISystem.h @@ -1149,11 +1149,6 @@ struct DiskOperationInfo #endif -#define LOADING_TIME_PROFILE_SECTION -#define LOADING_TIME_PROFILE_SECTION_ARGS(...) -#define LOADING_TIME_PROFILE_SECTION_NAMED(sectionName) -#define LOADING_TIME_PROFILE_SECTION_NAMED_ARGS(sectionName, ...) - ////////////////////////////////////////////////////////////////////////// // CrySystem DLL Exports. ////////////////////////////////////////////////////////////////////////// diff --git a/Code/Legacy/CrySystem/LevelSystem/LevelSystem.cpp b/Code/Legacy/CrySystem/LevelSystem/LevelSystem.cpp index bb2f36e69c..47029e8b51 100644 --- a/Code/Legacy/CrySystem/LevelSystem/LevelSystem.cpp +++ b/Code/Legacy/CrySystem/LevelSystem/LevelSystem.cpp @@ -45,8 +45,6 @@ void CLevelInfo::GetMemoryUsage(ICrySizer* pSizer) const ////////////////////////////////////////////////////////////////////////// bool CLevelInfo::OpenLevelPak() { - LOADING_TIME_PROFILE_SECTION; - bool usePrefabSystemForLevels = false; AzFramework::ApplicationRequests::Bus::BroadcastResult( usePrefabSystemForLevels, &AzFramework::ApplicationRequests::IsPrefabSystemForLevelsEnabled); @@ -69,8 +67,6 @@ bool CLevelInfo::OpenLevelPak() ////////////////////////////////////////////////////////////////////////// void CLevelInfo::CloseLevelPak() { - LOADING_TIME_PROFILE_SECTION; - bool usePrefabSystemForLevels = false; AzFramework::ApplicationRequests::Bus::BroadcastResult( usePrefabSystemForLevels, &AzFramework::ApplicationRequests::IsPrefabSystemForLevelsEnabled); @@ -190,7 +186,6 @@ CLevelSystem::CLevelSystem(ISystem* pSystem, const char* levelsFolder) , m_pCurrentLevel(0) , m_pLoadingLevelInfo(0) { - LOADING_TIME_PROFILE_SECTION; CRY_ASSERT(pSystem); //if (!gEnv->IsEditor()) @@ -297,8 +292,6 @@ void CLevelSystem::ScanFolder(const char* subfolder, bool modFolder) AZStd::unordered_set pakList; - const bool allowFileSystem = true; - const uint32_t skipPakFiles = 1; AZ::IO::ArchiveFileIterator handle = pPak->FindFirst(search.c_str(), AZ::IO::IArchive::eFileSearchType_AllowOnDiskOnly); if (handle) @@ -566,8 +559,6 @@ ILevel* CLevelSystem::LoadLevelInternal(const char* _levelName) // Not remove a scope!!! { - LOADING_TIME_PROFILE_SECTION; - //m_levelLoadStartTime = gEnv->pTimer->GetAsyncTime(); CLevelInfo* pLevelInfo = GetLevelInfoInternal(levelName); @@ -582,7 +573,6 @@ ILevel* CLevelSystem::LoadLevelInternal(const char* _levelName) m_bLevelLoaded = false; - const bool bLoadingSameLevel = azstricmp(m_lastLevelName.c_str(), levelName) == 0; m_lastLevelName = levelName; delete m_pCurrentLevel; @@ -746,8 +736,6 @@ void CLevelSystem::OnLoadingStart(const char* levelName) GetISystem()->GetISystemEventDispatcher()->OnSystemEvent(ESYSTEM_EVENT_LEVEL_LOAD_START, 0, 0); - LOADING_TIME_PROFILE_SECTION(gEnv->pSystem); - for (AZStd::vector::const_iterator it = m_listeners.begin(); it != m_listeners.end(); ++it) { (*it)->OnLoadingStart(levelName); diff --git a/Code/Legacy/CrySystem/LevelSystem/SpawnableLevelSystem.cpp b/Code/Legacy/CrySystem/LevelSystem/SpawnableLevelSystem.cpp index b37b257f5b..f866ee2864 100644 --- a/Code/Legacy/CrySystem/LevelSystem/SpawnableLevelSystem.cpp +++ b/Code/Legacy/CrySystem/LevelSystem/SpawnableLevelSystem.cpp @@ -58,7 +58,6 @@ namespace LegacyLevelSystem SpawnableLevelSystem::SpawnableLevelSystem(ISystem* pSystem) : m_pSystem(pSystem) { - LOADING_TIME_PROFILE_SECTION; CRY_ASSERT(pSystem); m_fLastLevelLoadTime = 0; @@ -248,8 +247,6 @@ namespace LegacyLevelSystem // This scope is specifically used for marking a loading time profile section { - LOADING_TIME_PROFILE_SECTION; - m_bLevelLoaded = false; m_lastLevelName = levelName; gEnv->pConsole->SetScrollMax(600); @@ -388,8 +385,6 @@ namespace LegacyLevelSystem GetISystem()->GetISystemEventDispatcher()->OnSystemEvent(ESYSTEM_EVENT_LEVEL_LOAD_START, 0, 0); - LOADING_TIME_PROFILE_SECTION(gEnv->pSystem); - for (auto& listener : m_listeners) { listener->OnLoadingStart(levelName); diff --git a/Code/Legacy/CrySystem/LocalizedStringManager.cpp b/Code/Legacy/CrySystem/LocalizedStringManager.cpp index e4b149d84e..68e3667781 100644 --- a/Code/Legacy/CrySystem/LocalizedStringManager.cpp +++ b/Code/Legacy/CrySystem/LocalizedStringManager.cpp @@ -872,7 +872,6 @@ inline YesNoType ToYesNoType(const char* szString) // Loads a string-table from a Excel XML Spreadsheet file. bool CLocalizedStringsManager::DoLoadExcelXmlSpreadsheet(const char* sFileName, uint8 nTagID, bool bReload) { - LOADING_TIME_PROFILE_SECTION_ARGS(sFileName) if (!m_pLanguage) { return false; diff --git a/Code/Legacy/CrySystem/Log.cpp b/Code/Legacy/CrySystem/Log.cpp index 4965323695..27612bf786 100644 --- a/Code/Legacy/CrySystem/Log.cpp +++ b/Code/Legacy/CrySystem/Log.cpp @@ -397,7 +397,6 @@ void CLog::LogV(const ELogType type, [[maybe_unused]]int flags, const char* szFo } FUNCTION_PROFILER(GetISystem(), PROFILE_SYSTEM); - LOADING_TIME_PROFILE_SECTION(GetISystem()); bool bfile = false, bconsole = false; const char* szCommand = szFormat; @@ -573,8 +572,6 @@ void CLog::LogPlus(const char* szFormat, ...) return; } - LOADING_TIME_PROFILE_SECTION(GetISystem()); - if (!szFormat) { return; @@ -1187,7 +1184,6 @@ void CLog::LogToFile(const char* szFormat, ...) ////////////////////////////////////////////////////////////////////// void CLog::CreateBackupFile() const { - LOADING_TIME_PROFILE_SECTION; if (!m_backupLogs) { return; diff --git a/Code/Legacy/CrySystem/System.cpp b/Code/Legacy/CrySystem/System.cpp index d848160b3e..452ebea302 100644 --- a/Code/Legacy/CrySystem/System.cpp +++ b/Code/Legacy/CrySystem/System.cpp @@ -1044,15 +1044,12 @@ IXmlUtils* CSystem::GetXmlUtils() ////////////////////////////////////////////////////////////////////////// XmlNodeRef CSystem::LoadXmlFromFile(const char* sFilename, bool bReuseStrings) { - LOADING_TIME_PROFILE_SECTION_ARGS(sFilename); - return m_pXMLUtils->LoadXmlFromFile(sFilename, bReuseStrings); } ////////////////////////////////////////////////////////////////////////// XmlNodeRef CSystem::LoadXmlFromBuffer(const char* buffer, size_t size, bool bReuseStrings, bool bSuppressWarnings) { - LOADING_TIME_PROFILE_SECTION return m_pXMLUtils->LoadXmlFromBuffer(buffer, size, bReuseStrings, bSuppressWarnings); } diff --git a/Code/Legacy/CrySystem/SystemInit.cpp b/Code/Legacy/CrySystem/SystemInit.cpp index 08292a6353..dcfeb90484 100644 --- a/Code/Legacy/CrySystem/SystemInit.cpp +++ b/Code/Legacy/CrySystem/SystemInit.cpp @@ -432,8 +432,6 @@ AZStd::unique_ptr CSystem::LoadDynamiclibrary(const cha ////////////////////////////////////////////////////////////////////////// AZStd::unique_ptr CSystem::LoadDLL(const char* dllName) { - LOADING_TIME_PROFILE_SECTION(GetISystem()); - AZ_TracePrintf(AZ_TRACE_SYSTEM_WINDOW, "Loading DLL: %s", dllName); AZStd::unique_ptr handle = LoadDynamiclibrary(dllName); @@ -612,8 +610,6 @@ AZStd::wstring GetErrorStringUnsupportedGPU(const char* gpuName, unsigned int gp ///////////////////////////////////////////////////////////////////////////////// bool CSystem::InitConsole() { - LOADING_TIME_PROFILE_SECTION(GetISystem()); - if (m_env.pConsole) { m_env.pConsole->Init(this); @@ -662,7 +658,6 @@ ICVar* CSystem::attachVariable (const char* szVarName, int* pContainer, const ch ///////////////////////////////////////////////////////////////////////////////// bool CSystem::InitFileSystem() { - LOADING_TIME_PROFILE_SECTION; using namespace AzFramework::AssetSystem; if (m_pUserCallback) @@ -748,11 +743,8 @@ void CSystem::ShutdownFileSystem() ///////////////////////////////////////////////////////////////////////////////// bool CSystem::InitFileSystem_LoadEngineFolders(const SSystemInitParams&) { - LOADING_TIME_PROFILE_SECTION; - { - LoadConfiguration(m_systemConfigName.c_str()); - AZ_Printf(AZ_TRACE_SYSTEM_WINDOW, "Loading system configuration from %s...", m_systemConfigName.c_str()); - } + LoadConfiguration(m_systemConfigName.c_str()); + AZ_Printf(AZ_TRACE_SYSTEM_WINDOW, "Loading system configuration from %s...", m_systemConfigName.c_str()); #if defined(AZ_PLATFORM_ANDROID) AZ::Android::Utils::SetLoadFilesToMemory(m_sys_load_files_to_memory->GetString()); @@ -783,8 +775,6 @@ bool CSystem::InitFileSystem_LoadEngineFolders(const SSystemInitParams&) ////////////////////////////////////////////////////////////////////////// bool CSystem::InitAudioSystem(const SSystemInitParams& initParams) { - LOADING_TIME_PROFILE_SECTION(GetISystem()); - if (!Audio::Gem::AudioSystemGemRequestBus::HasHandlers()) { // AudioSystem Gem has not been enabled for this project. @@ -826,8 +816,6 @@ bool CSystem::InitAudioSystem(const SSystemInitParams& initParams) ////////////////////////////////////////////////////////////////////////// bool CSystem::InitVTuneProfiler() { - LOADING_TIME_PROFILE_SECTION(GetISystem()); - #ifdef PROFILE_WITH_VTUNE WIN_HMODULE hModule = LoadDLL("VTuneApi.dll"); @@ -855,7 +843,6 @@ bool CSystem::InitVTuneProfiler() ////////////////////////////////////////////////////////////////////////// void CSystem::InitLocalization() { - LOADING_TIME_PROFILE_SECTION(GetISystem()); // Set the localization folder ICVar* pCVar = m_env.pConsole != 0 ? m_env.pConsole->GetCVar("sys_localization_folder") : 0; if (pCVar) @@ -917,8 +904,6 @@ void CSystem::OpenBasicPaks() } bBasicPaksLoaded = true; - LOADING_TIME_PROFILE_SECTION; - // open pak files constexpr AZStd::string_view paksFolder = "@assets@/*.pak"; // (@assets@ assumed) m_env.pCryPak->OpenPacks(paksFolder); @@ -1153,8 +1138,6 @@ bool CSystem::Init(const SSystemInitParams& startupParams) gEnv = &m_env; } - LOADING_TIME_PROFILE_SECTION; - SetSystemGlobalState(ESYSTEM_GLOBAL_STATE_INIT); gEnv->mMainThreadId = GetCurrentThreadId(); //Set this ASAP on startup diff --git a/Code/Legacy/CrySystem/XML/xml.cpp b/Code/Legacy/CrySystem/XML/xml.cpp index d3fbaa9ec6..ccc878b8f1 100644 --- a/Code/Legacy/CrySystem/XML/xml.cpp +++ b/Code/Legacy/CrySystem/XML/xml.cpp @@ -1675,8 +1675,6 @@ XmlNodeRef XmlParserImp::ParseBuffer(const char* buffer, size_t bufLen, XmlStrin ////////////////////////////////////////////////////////////////////////// XmlNodeRef XmlParserImp::ParseFile(const char* filename, XmlString& errorString, bool bCleanPools) { - LOADING_TIME_PROFILE_SECTION(GetISystem()); - if (!filename) { return 0; @@ -1739,8 +1737,6 @@ XmlNodeRef XmlParserImp::ParseFile(const char* filename, XmlString& errorString, if (g_bEnableBinaryXmlLoading) { - LOADING_TIME_PROFILE_SECTION_NAMED("XMLBinaryReader::Parse"); - XMLBinary::XMLBinaryReader reader; XMLBinary::XMLBinaryReader::EResult result; root = reader.LoadFromBuffer(XMLBinary::XMLBinaryReader::eBufferMemoryHandling_TakeOwnership, pFileContents, fileSize, result); From cf6c7c4d8d3b7f23847939a5506ee50e5345629a Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Thu, 19 Aug 2021 18:26:43 -0700 Subject: [PATCH 004/131] some unused fixes Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../AzCore/Component/ComponentApplication.cpp | 2 +- .../AzCore/Component/EntitySerializer.cpp | 9 +++---- .../AzCore/AzCore/Component/EntityUtils.cpp | 2 +- .../AzCore/Serialization/AZStdContainers.inl | 2 +- .../AzCore/AzCore/Serialization/DataPatch.cpp | 1 - .../Serialization/std/VariantReflection.inl | 4 +-- .../AzFramework/FileTag/FileTag.cpp | 2 +- .../EntityVisibilityBoundsUnionSystem.cpp | 3 --- .../Process/ProcessWatcher_Linux.cpp | 2 -- .../TcpTransport/TcpListenThread.cpp | 6 ++--- .../AzNetworking/UdpTransport/DtlsSocket.cpp | 2 +- .../AzNetworking/UdpTransport/UdpSocket.cpp | 1 - .../AzNetworking/Utilities/Endian.h | 4 +-- Code/Framework/AzTest/AzTest/Utils.cpp | 1 - Code/LauncherUnified/Launcher.cpp | 4 +-- .../AWSCognitoUserManagementController.cpp | 2 +- .../Source/PostProcessing/BloomBlurPass.cpp | 2 -- .../RHI/Code/Include/Atom/RHI.Reflect/Bits.h | 26 ++----------------- .../Code/Include/Atom/RHI/IndexBufferView.h | 4 +-- .../Include/Atom/RHI/IndirectBufferView.h | 4 +-- .../Code/Include/Atom/RHI/StreamBufferView.h | 4 +-- .../RHI/Code/Source/RHI/DrawPacketBuilder.cpp | 2 +- .../Code/Source/RHI/PipelineStateCache.cpp | 2 +- .../Code/Source/RHI/AsyncUploadQueue.cpp | 10 +------ .../Code/Source/RHI/BufferPoolResolver.cpp | 1 - .../Code/Source/RHI/CommandListAllocator.cpp | 2 +- .../Vulkan/Code/Source/RHI/CommandQueue.cpp | 2 +- .../RHI/Vulkan/Code/Source/RHI/Device.cpp | 1 - .../Code/Source/RHI/NullDescriptorManager.cpp | 1 - .../Code/Source/RHI/StreamingImagePool.cpp | 1 - .../Source/Animation/UiAnimationSystem.cpp | 1 - 31 files changed, 28 insertions(+), 82 deletions(-) diff --git a/Code/Framework/AzCore/AzCore/Component/ComponentApplication.cpp b/Code/Framework/AzCore/AzCore/Component/ComponentApplication.cpp index 5114ea19ec..17da3fd1e9 100644 --- a/Code/Framework/AzCore/AzCore/Component/ComponentApplication.cpp +++ b/Code/Framework/AzCore/AzCore/Component/ComponentApplication.cpp @@ -1294,7 +1294,7 @@ namespace AZ void Visit(AZStd::string_view path, AZStd::string_view, AZ::SettingsRegistryInterface::Type, AZStd::string_view value) override { // Remove last path segment and check if the key corresponds to the Modules array - AZStd::optional moduleIndex = AZ::StringFunc::TokenizeLast(path, "/"); + AZ::StringFunc::TokenizeLast(path, "/"); if (path.ends_with("/Modules")) { // Remove the "Modules" path segment to be at the GemName key diff --git a/Code/Framework/AzCore/AzCore/Component/EntitySerializer.cpp b/Code/Framework/AzCore/AzCore/Component/EntitySerializer.cpp index 16452be76d..df6aacd50b 100644 --- a/Code/Framework/AzCore/AzCore/Component/EntitySerializer.cpp +++ b/Code/Framework/AzCore/AzCore/Component/EntitySerializer.cpp @@ -89,12 +89,9 @@ namespace AZ result.Combine(componentLoadResult); } - { - JSR::ResultCode runtimeActiveLoadResult = - ContinueLoadingFromJsonObjectField(&entityInstance->m_isRuntimeActiveByDefault, - azrtti_typeidm_isRuntimeActiveByDefault)>(), - inputValue, "IsRuntimeActive", context); - } + ContinueLoadingFromJsonObjectField(&entityInstance->m_isRuntimeActiveByDefault, + azrtti_typeidm_isRuntimeActiveByDefault)>(), + inputValue, "IsRuntimeActive", context); return context.Report( result, diff --git a/Code/Framework/AzCore/AzCore/Component/EntityUtils.cpp b/Code/Framework/AzCore/AzCore/Component/EntityUtils.cpp index 8241400aac..fcc8cd6424 100644 --- a/Code/Framework/AzCore/AzCore/Component/EntityUtils.cpp +++ b/Code/Framework/AzCore/AzCore/Component/EntityUtils.cpp @@ -165,7 +165,7 @@ namespace AZ AZStd::fixed_vector knownBaseClasses = { typeToExamine }; // avoid allocating heap here if possible. 64 types are 64*sizeof(Uuid) which is only 1k. bool foundBaseClass = false; - auto enumerateBaseVisitor = [&foundBaseClass, &baseClassVisitor, &knownBaseClasses](const AZ::SerializeContext::ClassData* classData, const TypeId& examineTypeId) + auto enumerateBaseVisitor = [&baseClassVisitor, &knownBaseClasses](const AZ::SerializeContext::ClassData* classData, const TypeId& examineTypeId) { if (!classData) { diff --git a/Code/Framework/AzCore/AzCore/Serialization/AZStdContainers.inl b/Code/Framework/AzCore/AzCore/Serialization/AZStdContainers.inl index 9eb65dec76..bae79a6fe7 100644 --- a/Code/Framework/AzCore/AzCore/Serialization/AZStdContainers.inl +++ b/Code/Framework/AzCore/AzCore/Serialization/AZStdContainers.inl @@ -1320,7 +1320,7 @@ namespace AZ (void)classElement; void* reserveElement{}; using DummyArray = bool[]; - DummyArray{ true, (ReserveElementTuple(tupleRef, classElement, reserveElement))... }; + [[maybe_unused]] DummyArray dummy = { true, (ReserveElementTuple(tupleRef, classElement, reserveElement))... }; return reserveElement; } diff --git a/Code/Framework/AzCore/AzCore/Serialization/DataPatch.cpp b/Code/Framework/AzCore/AzCore/Serialization/DataPatch.cpp index edc0e8398b..01a98667fa 100644 --- a/Code/Framework/AzCore/AzCore/Serialization/DataPatch.cpp +++ b/Code/Framework/AzCore/AzCore/Serialization/DataPatch.cpp @@ -135,7 +135,6 @@ namespace AZ AZStd::list m_dynamicClassElements; ///< Storage for class elements that represent dynamic serializable fields. }; - static bool ConvertLegacyBoolToEnum(AZ::SerializeContext& context, AZStd::any& patchAny, const DataNode& sourceNode); static void ReportDataPatchMismatch(SerializeContext* context, const SerializeContext::ClassElement* classElement, const TypeId& patchDataTypeId); //========================================================================= diff --git a/Code/Framework/AzCore/AzCore/Serialization/std/VariantReflection.inl b/Code/Framework/AzCore/AzCore/Serialization/std/VariantReflection.inl index 391133dd9f..70972bb846 100644 --- a/Code/Framework/AzCore/AzCore/Serialization/std/VariantReflection.inl +++ b/Code/Framework/AzCore/AzCore/Serialization/std/VariantReflection.inl @@ -483,9 +483,9 @@ namespace AZ } private: static void ObjectStreamWriter(SerializeContext::EnumerateInstanceCallContext& callContext, const void* variantPtr, - const SerializeContext::ClassData& variantClassData, const SerializeContext::ClassElement* variantClassElement) + [[maybe_unused]] const SerializeContext::ClassData& variantClassData, const SerializeContext::ClassElement* variantClassElement) { - auto alternativeVisitor = [&callContext, &variantClassData, variantClassElement](auto&& elementAlt) + auto alternativeVisitor = [&callContext, variantClassElement](auto&& elementAlt) { using AltType = AZStd::remove_cvref_t; const SerializeContext& context = *callContext.m_context; diff --git a/Code/Framework/AzFramework/AzFramework/FileTag/FileTag.cpp b/Code/Framework/AzFramework/AzFramework/FileTag/FileTag.cpp index 87866581d3..c402e6c5bc 100644 --- a/Code/Framework/AzFramework/AzFramework/FileTag/FileTag.cpp +++ b/Code/Framework/AzFramework/AzFramework/FileTag/FileTag.cpp @@ -366,7 +366,7 @@ namespace AzFramework AZStd::set tags; AZStd::string resolvedFilePath = ResolveFilePath(filePath); - auto found = AZStd::find_if(m_fileTagsMap.begin(), m_fileTagsMap.end(), [filePath, resolvedFilePath, this](auto& entry) -> bool + auto found = AZStd::find_if(m_fileTagsMap.begin(), m_fileTagsMap.end(), [filePath, resolvedFilePath](auto& entry) -> bool { return resolvedFilePath == ResolveFilePath(entry.first); }); diff --git a/Code/Framework/AzFramework/AzFramework/Visibility/EntityVisibilityBoundsUnionSystem.cpp b/Code/Framework/AzFramework/AzFramework/Visibility/EntityVisibilityBoundsUnionSystem.cpp index bfa9dfcf9e..f1be8c506d 100644 --- a/Code/Framework/AzFramework/AzFramework/Visibility/EntityVisibilityBoundsUnionSystem.cpp +++ b/Code/Framework/AzFramework/AzFramework/Visibility/EntityVisibilityBoundsUnionSystem.cpp @@ -54,9 +54,6 @@ namespace AzFramework if (auto instance_it = m_entityVisibilityBoundsUnionInstanceMapping.find(entity); instance_it == m_entityVisibilityBoundsUnionInstanceMapping.end()) { - AZ::TransformInterface* transformInterface = entity->GetTransform(); - const AZ::Vector3 entityPosition = transformInterface->GetWorldTranslation(); - EntityVisibilityBoundsUnionInstance instance; instance.m_localEntityBoundsUnion = CalculateEntityLocalBoundsUnion(entity); instance.m_visibilityEntry.m_typeFlags = VisibilityEntry::TYPE_Entity; diff --git a/Code/Framework/AzFramework/Platform/Linux/AzFramework/Process/ProcessWatcher_Linux.cpp b/Code/Framework/AzFramework/Platform/Linux/AzFramework/Process/ProcessWatcher_Linux.cpp index 8deed820d3..eb60b8e6ae 100644 --- a/Code/Framework/AzFramework/Platform/Linux/AzFramework/Process/ProcessWatcher_Linux.cpp +++ b/Code/Framework/AzFramework/Platform/Linux/AzFramework/Process/ProcessWatcher_Linux.cpp @@ -202,8 +202,6 @@ namespace AzFramework bool ProcessLauncher::LaunchProcess(const ProcessLaunchInfo& processLaunchInfo, ProcessData& processData) { - bool result = false; - // note that the convention here is that it uses windows-shell style escaping of combined args with spaces in it // (so surrounding with quotes like param="hello world") // this is so that the callers (which could be numerous) do not have to worry about this and sprinkle ifdefs diff --git a/Code/Framework/AzNetworking/AzNetworking/TcpTransport/TcpListenThread.cpp b/Code/Framework/AzNetworking/AzNetworking/TcpTransport/TcpListenThread.cpp index 758cff3337..9a3c038a73 100644 --- a/Code/Framework/AzNetworking/AzNetworking/TcpTransport/TcpListenThread.cpp +++ b/Code/Framework/AzNetworking/AzNetworking/TcpTransport/TcpListenThread.cpp @@ -64,7 +64,7 @@ namespace AzNetworking { --m_listenPortCount; - auto visitor = [this, &tcpNetworkInterface](ListenPort& listenPort) + auto visitor = [&tcpNetworkInterface](ListenPort& listenPort) { if (listenPort.m_tcpNetworkInterface == &tcpNetworkInterface) { @@ -120,7 +120,7 @@ namespace AzNetworking auto readCallback = [this, newConnection, connectionLength](SocketFd socketFd) { - auto visitor = [this, newConnection, connectionLength, socketFd](ListenPort& listenPort) + auto visitor = [this, newConnection, socketFd](ListenPort& listenPort) { if (listenPort.m_listenSocket.GetSocketFd() == socketFd) { @@ -132,7 +132,7 @@ namespace AzNetworking auto writeCallback = [](SocketFd) {}; m_tcpSocketManager.ProcessEvents(updateRateMs, readCallback, writeCallback); - auto cleanupUnused = [this](AZ::ThreadSafeDeque::DequeType& deque) + auto cleanupUnused = [](AZ::ThreadSafeDeque::DequeType& deque) { AZStd::remove_if(deque.begin(), deque.end(), [](ListenPort& listenPort) { return listenPort.m_tcpNetworkInterface == nullptr; }); }; diff --git a/Code/Framework/AzNetworking/AzNetworking/UdpTransport/DtlsSocket.cpp b/Code/Framework/AzNetworking/AzNetworking/UdpTransport/DtlsSocket.cpp index 1944995bac..ee784b6ffb 100644 --- a/Code/Framework/AzNetworking/AzNetworking/UdpTransport/DtlsSocket.cpp +++ b/Code/Framework/AzNetworking/AzNetworking/UdpTransport/DtlsSocket.cpp @@ -86,7 +86,7 @@ namespace AzNetworking #if AZ_TRAIT_USE_OPENSSL uint8_t encrpytedSendBuffer[MaxUdpTransmissionUnit]; // Write out the packet we were requested to send - const int32_t sentBytesRaw = SSL_write(dtlsEndpoint.m_sslSocket, data, size); + SSL_write(dtlsEndpoint.m_sslSocket, data, size); const int32_t sentBytesEnc = BIO_read(dtlsEndpoint.m_writeBio, encrpytedSendBuffer, sizeof(encrpytedSendBuffer)); // Track encryption metrics diff --git a/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpSocket.cpp b/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpSocket.cpp index 997fc323a9..44f6562c84 100644 --- a/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpSocket.cpp +++ b/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpSocket.cpp @@ -160,7 +160,6 @@ namespace AzNetworking const AZ::TimeMs jitterMs = aznumeric_cast(m_random.GetRandom()) % (connectionQuality.m_varianceMs > AZ::TimeMs{ 0 } ? connectionQuality.m_varianceMs : AZ::TimeMs{ 1 }); - const AZ::TimeMs currTimeMs = AZ::GetElapsedTimeMs(); const AZ::TimeMs deferTimeMs = (connectionQuality.m_latencyMs) + jitterMs; DeferredData deferred = DeferredData(address, data, size, encrypt, dtlsEndpoint); diff --git a/Code/Framework/AzNetworking/AzNetworking/Utilities/Endian.h b/Code/Framework/AzNetworking/AzNetworking/Utilities/Endian.h index 08ca785f72..67165c380d 100644 --- a/Code/Framework/AzNetworking/AzNetworking/Utilities/Endian.h +++ b/Code/Framework/AzNetworking/AzNetworking/Utilities/Endian.h @@ -14,14 +14,14 @@ #include #if AZ_TRAIT_NEEDS_HTONLL -static const uint64_t htonll(uint64_t value) +const uint64_t htonll(uint64_t value) { const uint32_t hiValue = htonl(static_cast(value >> 32)); const uint32_t loValue = htonl(static_cast(value & 0x00000000FFFFFFFF)); return static_cast(hiValue) << 32 | static_cast(loValue); } -static const uint64_t ntohll(uint64_t value) +const uint64_t ntohll(uint64_t value) { return htonll(value); } diff --git a/Code/Framework/AzTest/AzTest/Utils.cpp b/Code/Framework/AzTest/AzTest/Utils.cpp index 0fe701ca5a..e8885e6996 100644 --- a/Code/Framework/AzTest/AzTest/Utils.cpp +++ b/Code/Framework/AzTest/AzTest/Utils.cpp @@ -121,7 +121,6 @@ namespace AZ char** SplitCommandLine(int& size, char* const cmdLine) { std::vector tokens; - char* next_token = nullptr; char* tok = azstrtok(cmdLine, 0, " ", &next_token); while (tok != NULL) { diff --git a/Code/LauncherUnified/Launcher.cpp b/Code/LauncherUnified/Launcher.cpp index 30db54dab2..07da69cbe9 100644 --- a/Code/LauncherUnified/Launcher.cpp +++ b/Code/LauncherUnified/Launcher.cpp @@ -451,8 +451,6 @@ namespace O3DELauncher // The command line overrides are stored in the following fixed strings // until the ComponentApplication constructor can parse the command line parameters FixedValueString projectNameOptionOverride; - FixedValueString projectPathOptionOverride; - FixedValueString enginePathOptionOverride; // Insert the project_name option to the front const AZStd::string_view launcherProjectName = GetProjectName(); @@ -467,6 +465,8 @@ namespace O3DELauncher // Non-host platforms cannot use the project path that is #defined within the launcher. // In this case the the result of AZ::Utils::GetDefaultAppRoot is used instead #if !AZ_TRAIT_OS_IS_HOST_OS_PLATFORM + FixedValueString projectPathOptionOverride; + FixedValueString enginePathOptionOverride; AZStd::string_view projectPath; // Make sure the defaultAppRootPath variable is in scope long enough until the projectPath string_view is used below AZStd::optional defaultAppRootPath = AZ::Utils::GetDefaultAppRootPath(); diff --git a/Gems/AWSClientAuth/Code/Source/UserManagement/AWSCognitoUserManagementController.cpp b/Gems/AWSClientAuth/Code/Source/UserManagement/AWSCognitoUserManagementController.cpp index 19827f7013..42ee0065ad 100644 --- a/Gems/AWSClientAuth/Code/Source/UserManagement/AWSCognitoUserManagementController.cpp +++ b/Gems/AWSClientAuth/Code/Source/UserManagement/AWSCognitoUserManagementController.cpp @@ -229,7 +229,7 @@ namespace AWSClientAuth AZ::JobContext* jobContext = nullptr; AWSCore::AWSCoreRequestBus::BroadcastResult(jobContext, &AWSCore::AWSCoreRequests::GetDefaultJobContext); - AZ::Job* enableMFAJob = AZ::CreateJobFunction([this, cognitoIdentityProviderClient, accessToken]() + AZ::Job* enableMFAJob = AZ::CreateJobFunction([cognitoIdentityProviderClient, accessToken]() { Aws::CognitoIdentityProvider::Model::SetUserMFAPreferenceRequest confirmForgotPasswordRequest; Aws::CognitoIdentityProvider::Model::SMSMfaSettingsType settings; diff --git a/Gems/Atom/Feature/Common/Code/Source/PostProcessing/BloomBlurPass.cpp b/Gems/Atom/Feature/Common/Code/Source/PostProcessing/BloomBlurPass.cpp index 3fcff54eaa..b91990f6c9 100644 --- a/Gems/Atom/Feature/Common/Code/Source/PostProcessing/BloomBlurPass.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/PostProcessing/BloomBlurPass.cpp @@ -271,8 +271,6 @@ namespace AZ void BloomBlurPass::BuildKernelData() { - RHI::Size sourceImageSize; - m_weightData.clear(); m_offsetData.clear(); m_kernelRadiusData.clear(); diff --git a/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/Bits.h b/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/Bits.h index 6659383c2f..973076fe71 100644 --- a/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/Bits.h +++ b/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/Bits.h @@ -280,27 +280,5 @@ namespace AZ } } - -// Emits an error when padding is introduced into a struct. -#if defined (AZ_COMPILER_MSVC) - -#define AZ_ASSERT_NO_ALIGNMENT_PADDING_BEGIN \ - __pragma(warning(push)) \ - __pragma(warning(error : 4820)) - -#define AZ_ASSERT_NO_ALIGNMENT_PADDING_END \ - __pragma(warning(pop)) - -#elif defined (AZ_COMPILER_CLANG) || defined (AZ_COMPILER_GCC) - -#define AZ_ASSERT_NO_ALIGNMENT_PADDING_BEGIN \ - _Pragma("GCC diagnostic push") \ - _Pragma("GCC diagnostic error \"-Wpadded\"") - -#define AZ_ASSERT_NO_ALIGNMENT_PADDING_END \ - _Pragma("GCC diagnostic pop") - -#else -#define AZ_ASSERT_NO_ALIGNMENT_PADDING_BEGIN -#define AZ_ASSERT_NO_ALIGNMENT_PADDING_END -#endif +#define AZ_ASSERT_NO_ALIGNMENT_PADDING_BEGIN AZ_PUSH_DISABLE_WARNING(4820, "-Wpadded") +#define AZ_ASSERT_NO_ALIGNMENT_PADDING_END AZ_POP_DISABLE_WARNING diff --git a/Gems/Atom/RHI/Code/Include/Atom/RHI/IndexBufferView.h b/Gems/Atom/RHI/Code/Include/Atom/RHI/IndexBufferView.h index 7219709109..d512b1a12d 100644 --- a/Gems/Atom/RHI/Code/Include/Atom/RHI/IndexBufferView.h +++ b/Gems/Atom/RHI/Code/Include/Atom/RHI/IndexBufferView.h @@ -26,7 +26,7 @@ namespace AZ AZ_ASSERT_NO_ALIGNMENT_PADDING_BEGIN - class IndexBufferView + class alignas(8) IndexBufferView { public: IndexBufferView() = default; @@ -58,8 +58,6 @@ namespace AZ uint32_t m_byteOffset = 0; uint32_t m_byteCount = 0; IndexFormat m_format = IndexFormat::Uint32; - // Padding the size so it's 8 bytes aligned - uint32_t m_pad = 0; }; AZ_ASSERT_NO_ALIGNMENT_PADDING_END diff --git a/Gems/Atom/RHI/Code/Include/Atom/RHI/IndirectBufferView.h b/Gems/Atom/RHI/Code/Include/Atom/RHI/IndirectBufferView.h index 7014fd030c..5622b66adf 100644 --- a/Gems/Atom/RHI/Code/Include/Atom/RHI/IndirectBufferView.h +++ b/Gems/Atom/RHI/Code/Include/Atom/RHI/IndirectBufferView.h @@ -21,7 +21,7 @@ namespace AZ //! Provides a view into a buffer, to be used as an indirect buffer. The content of the view is a contiguous //! list of commands sequences. It is provided to the RHI back-end at draw time. - class IndirectBufferView + class alignas(8) IndirectBufferView { public: IndirectBufferView() = default; @@ -59,8 +59,6 @@ namespace AZ uint32_t m_byteOffset = 0; uint32_t m_byteCount = 0; uint32_t m_byteStride = 0; - // Padding the size so it's 8 bytes aligned - uint32_t m_pad = 0; }; AZ_ASSERT_NO_ALIGNMENT_PADDING_END diff --git a/Gems/Atom/RHI/Code/Include/Atom/RHI/StreamBufferView.h b/Gems/Atom/RHI/Code/Include/Atom/RHI/StreamBufferView.h index 9c9a16e8df..068c44db73 100644 --- a/Gems/Atom/RHI/Code/Include/Atom/RHI/StreamBufferView.h +++ b/Gems/Atom/RHI/Code/Include/Atom/RHI/StreamBufferView.h @@ -31,7 +31,7 @@ namespace AZ * or interleaved in a single StreamBufferView (one view having multiple StreamChannelDescriptors). * - The view will correspond to a single StreamBufferDescriptor. */ - class StreamBufferView + class alignas(8) StreamBufferView { public: StreamBufferView() = default; @@ -64,8 +64,6 @@ namespace AZ uint32_t m_byteOffset = 0; uint32_t m_byteCount = 0; uint32_t m_byteStride = 0; - // Padding the size so it's 8 bytes aligned - uint32_t m_pad = 0; }; AZ_ASSERT_NO_ALIGNMENT_PADDING_END diff --git a/Gems/Atom/RHI/Code/Source/RHI/DrawPacketBuilder.cpp b/Gems/Atom/RHI/Code/Source/RHI/DrawPacketBuilder.cpp index 7bfaed0a31..ebda9732df 100644 --- a/Gems/Atom/RHI/Code/Source/RHI/DrawPacketBuilder.cpp +++ b/Gems/Atom/RHI/Code/Source/RHI/DrawPacketBuilder.cpp @@ -119,7 +119,7 @@ namespace AZ LinearAllocator linearAllocator; linearAllocator.Init(linearAllocatorDesc); - const VirtualAddress drawPacketOffset = linearAllocator.Allocate( + [[maybe_unused]] const VirtualAddress drawPacketOffset = linearAllocator.Allocate( sizeof(DrawPacket), AZStd::alignment_of::value); diff --git a/Gems/Atom/RHI/Code/Source/RHI/PipelineStateCache.cpp b/Gems/Atom/RHI/Code/Source/RHI/PipelineStateCache.cpp index 69eee86108..7f026453d7 100644 --- a/Gems/Atom/RHI/Code/Source/RHI/PipelineStateCache.cpp +++ b/Gems/Atom/RHI/Code/Source/RHI/PipelineStateCache.cpp @@ -177,7 +177,7 @@ namespace AZ */ AZStd::vector threadLibraries; - m_threadLibrarySet.ForEach([this, handle, &threadLibraries](const ThreadLibrarySet& threadLibrarySet) + m_threadLibrarySet.ForEach([handle, &threadLibraries](const ThreadLibrarySet& threadLibrarySet) { const ThreadLibraryEntry& threadLibraryEntry = threadLibrarySet[handle.GetIndex()]; diff --git a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/AsyncUploadQueue.cpp b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/AsyncUploadQueue.cpp index 8f44abccef..529e0bc10e 100644 --- a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/AsyncUploadQueue.cpp +++ b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/AsyncUploadQueue.cpp @@ -63,7 +63,6 @@ namespace AZ const uint8_t* sourceData = reinterpret_cast(request.m_sourceData); const size_t byteCount = request.m_byteCount; - const size_t byteOffset = request.m_byteOffset; auto* buffer = static_cast(request.m_buffer); RHI::BufferPool* bufferPool = static_cast(buffer->GetPool()); @@ -189,8 +188,6 @@ namespace AZ // Set pipeline barriers before copy. EmmitPrologueMemoryBarrier(request, residentMip); - const uint16_t arraySize = image->GetDescriptor().m_arraySize; - const uint16_t imageMipLevels = image->GetDescriptor().m_mipLevels; const static uint32_t bufferOffsetAlign = 4; // refer VkBufferImageCopy in the spec. // Variables for split subresource slice. @@ -213,11 +210,7 @@ namespace AZ // ImageHeight must be bigger than or equal to the Image's row count. Images with a RowCount that is less than the ImageHeight indicates a block compression. // Images with a RowCount which is higher than the ImageHeight indicates a planar image, which is not supported for streaming images. - if (subresourceLayout.m_size.m_height < subresourceLayout.m_rowCount) - { - AZ_Error("StreamingImage", false, "AsyncUploadQueue::QueueUpload expects ImageHeight '%d' to be bigger than or equal to the image's RowCount '%d'.", subresourceLayout.m_size.m_height, subresourceLayout.m_rowCount); - RHI::AsyncWorkHandle::Null; - } + AZ_Error("StreamingImage", subresourceLayout.m_size.m_height < subresourceLayout.m_rowCount, "AsyncUploadQueue::QueueUpload expects ImageHeight '%d' to be bigger than or equal to the image's RowCount '%d'.", subresourceLayout.m_size.m_height, subresourceLayout.m_rowCount); // The final staging size for each CopyTextureRegion command uint32_t stagingSize = stagingSlicePitch; @@ -596,7 +589,6 @@ namespace AZ uint32_t residentMip) { const auto& image = static_cast(*request.m_image); - const RHI::ImageBindFlags bindFlags = image.GetDescriptor().m_bindFlags; const VkImageLayout layout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL; const uint32_t beforeMip = residentMip; const uint32_t afterMip = beforeMip - static_cast(request.m_mipSlices.size()); diff --git a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/BufferPoolResolver.cpp b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/BufferPoolResolver.cpp index ba67f11c32..a94e610b49 100644 --- a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/BufferPoolResolver.cpp +++ b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/BufferPoolResolver.cpp @@ -94,7 +94,6 @@ namespace AZ void BufferPoolResolver::Resolve(CommandList& commandList) { auto& device = static_cast(commandList.GetDevice()); - VkBufferCopy bufCopy{}; for (const BufferUploadPacket& packet : m_uploadPackets) { Buffer* stagingBuffer = packet.m_stagingBuffer.get(); diff --git a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/CommandListAllocator.cpp b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/CommandListAllocator.cpp index 09179c7110..bac7a69c9a 100644 --- a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/CommandListAllocator.cpp +++ b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/CommandListAllocator.cpp @@ -100,7 +100,7 @@ namespace AZ commandPoolAllocatorDescriptor.m_collectLatency = descriptor.m_frameCountMax; commadPoolAllocator.Init(commandPoolAllocatorDescriptor); - m_commandListSubAllocators[queueFamilyIndex].SetInitFunction([this, &commadPoolAllocator] + m_commandListSubAllocators[queueFamilyIndex].SetInitFunction([&commadPoolAllocator] (Internal::CommandListSubAllocator& subAllocator) { subAllocator.Init(commadPoolAllocator); diff --git a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/CommandQueue.cpp b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/CommandQueue.cpp index 6929b63ac4..fdb583d10f 100644 --- a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/CommandQueue.cpp +++ b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/CommandQueue.cpp @@ -109,7 +109,7 @@ namespace AZ { // The queue doesn't have an explicit way to signal a fence, so // we submit an empty work batch with only a fence to signal. - QueueCommand([this, &fence](void* queue) + QueueCommand([&fence](void* queue) { Queue* vulkanQueue = static_cast(queue); vulkanQueue->SubmitCommandBuffers( diff --git a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/Device.cpp b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/Device.cpp index 15a532f832..4f800f114b 100644 --- a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/Device.cpp +++ b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/Device.cpp @@ -190,7 +190,6 @@ namespace AZ if (majorVersion >= 1 && minorVersion >= 2) { vulkan12Features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES; - VkPhysicalDeviceVulkan12Features physicalDeviceVulkan12Features = physicalDevice.GetPhysicalDeviceVulkan12Features(); vulkan12Features.drawIndirectCount = physicalDevice.GetPhysicalDeviceVulkan12Features().drawIndirectCount; vulkan12Features.shaderFloat16 = physicalDevice.GetPhysicalDeviceVulkan12Features().shaderFloat16; vulkan12Features.shaderInt8 = physicalDevice.GetPhysicalDeviceVulkan12Features().shaderInt8; diff --git a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/NullDescriptorManager.cpp b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/NullDescriptorManager.cpp index 316144f323..6d16cdc284 100644 --- a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/NullDescriptorManager.cpp +++ b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/NullDescriptorManager.cpp @@ -73,7 +73,6 @@ namespace AZ Device& device = static_cast(GetDevice()); const uint32_t imageDimension = 8; - const uint32_t pixelSize = 4; // fill out the different options for the types of image null descriptors m_imageNullDescriptor.m_images.resize(static_cast(ImageTypes::Count)); diff --git a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/StreamingImagePool.cpp b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/StreamingImagePool.cpp index 586470da0a..d00e597ae6 100644 --- a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/StreamingImagePool.cpp +++ b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/StreamingImagePool.cpp @@ -153,7 +153,6 @@ namespace AZ } const VkMemoryRequirements memoryRequirements = GetMemoryRequirements(image.GetDescriptor(), targetMipLevel); - const uint16_t residentMipLevelBefore = static_cast(image.GetResidentMipLevel()); RHI::HeapMemoryUsage& memoryUsage = m_memoryUsage.GetHeapMemoryUsage(RHI::HeapMemoryLevel::Device); const size_t imageSizeBefore = image.GetResidentSizeInBytes(); diff --git a/Gems/LyShine/Code/Source/Animation/UiAnimationSystem.cpp b/Gems/LyShine/Code/Source/Animation/UiAnimationSystem.cpp index 35fde93e83..c2a2e16db7 100644 --- a/Gems/LyShine/Code/Source/Animation/UiAnimationSystem.cpp +++ b/Gems/LyShine/Code/Source/Animation/UiAnimationSystem.cpp @@ -106,7 +106,6 @@ void UiAnimationSystem::DoNodeStaticInitialisation() bool UiAnimationSystem::Load(const char* pszFile, const char* pszMission) { INDENT_LOG_DURING_SCOPE (true, "UI Animation system is loading the file '%s' (mission='%s')", pszFile, pszMission); - LOADING_TIME_PROFILE_SECTION(GetISystem()); XmlNodeRef rootNode = m_pSystem->LoadXmlFromFile(pszFile); if (!rootNode) From a35464ca08cd7152ddd541512e87a749541af5a2 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Fri, 20 Aug 2021 10:09:44 -0700 Subject: [PATCH 005/131] more fixes Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Code/Framework/AzCore/AzCore/RTTI/RTTI.h | 2 +- .../AzFramework/Archive/Archive.cpp | 1 - .../AzFramework/Archive/ZipDirCache.cpp | 1 - .../AzFramework/Script/ScriptComponent.cpp | 2 +- .../TcpTransport/TcpListenThread.cpp | 2 +- Code/Legacy/CrySystem/AZCoreLogSink.h | 2 +- .../LevelSystem/SpawnableLevelSystem.cpp | 1 - .../LevelSystem/SpawnableLevelSystem.h | 2 - Code/Legacy/CrySystem/System.cpp | 5 +- Code/Legacy/CrySystem/SystemInit.cpp | 13 ----- .../Public/Framework/JsonObjectHandler.h | 1 - .../Code/Source/Framework/HttpRequestJob.cpp | 2 +- .../Code/Source/NoClipControllerComponent.cpp | 4 +- .../DirectionalLightFeatureProcessor.cpp | 2 +- .../Code/Source/Decals/AsyncLoadTracker.h | 1 - .../DiffuseProbeGrid.cpp | 1 - .../ProfilingCaptureSystemComponent.cpp | 6 +-- .../RayTracing/RayTracingFeatureProcessor.cpp | 2 - .../ProjectedShadowFeatureProcessor.cpp | 1 - .../RPI/Code/Source/RPI.Public/Culling.cpp | 2 +- .../Code/Source/RPI.Public/MeshDrawPacket.cpp | 2 +- .../Source/RPI.Public/Pass/PassLibrary.cpp | 2 - .../Include/Atom/Utils/ImGuiCpuProfiler.inl | 7 +-- .../Include/Atom/Utils/ImGuiGpuProfiler.inl | 2 +- .../Include/Atom/Utils/StableDynamicArray.inl | 4 +- .../Source/PerViewportDynamicDrawManager.cpp | 2 +- .../AtomLyIntegration/AtomFont/AtomFont.h | 1 - .../AtomFont/Code/Source/AtomFont.cpp | 7 +-- ...AtomViewportDisplayInfoSystemComponent.cpp | 1 - Gems/AudioSystem/Code/Source/Engine/ATL.cpp | 2 - .../Code/Source/Engine/ATLAudioObject.cpp | 3 +- .../Code/Source/Engine/ATLComponents.cpp | 4 +- .../Code/Source/Engine/ATLComponents.h | 2 - .../Code/Source/Engine/AudioSystem.cpp | 2 +- .../Code/Source/Engine/FileCacheManager.cpp | 2 +- .../CommandSystem/Source/ActorCommands.cpp | 2 - .../Source/Importer/ChunkProcessors.cpp | 6 --- .../Code/EMotionFX/Source/RagdollInstance.cpp | 1 - .../Code/EMotionFX/Source/SpringSolver.cpp | 1 - .../Code/Include/GradientSignal/SmoothStep.h | 1 - Gems/ImGui/Code/Source/ImGuiManager.cpp | 53 ------------------- Gems/ImGui/Code/Source/ImGuiManager.h | 1 - Gems/LyShine/Code/Source/Animation/2DSpline.h | 1 - 43 files changed, 28 insertions(+), 134 deletions(-) diff --git a/Code/Framework/AzCore/AzCore/RTTI/RTTI.h b/Code/Framework/AzCore/AzCore/RTTI/RTTI.h index 1f133c3256..1dddf76556 100644 --- a/Code/Framework/AzCore/AzCore/RTTI/RTTI.h +++ b/Code/Framework/AzCore/AzCore/RTTI/RTTI.h @@ -517,7 +517,7 @@ namespace AZ bool result = GetTypeId() == id; using dummy = bool[]; - dummy{ true, (IsTypeOfInternal(result, id), true)... }; + [[maybe_unused]] dummy d = { true, (IsTypeOfInternal(result, id), true)... }; return result; } diff --git a/Code/Framework/AzFramework/AzFramework/Archive/Archive.cpp b/Code/Framework/AzFramework/AzFramework/Archive/Archive.cpp index 5bcdc3d719..8688f6b878 100644 --- a/Code/Framework/AzFramework/AzFramework/Archive/Archive.cpp +++ b/Code/Framework/AzFramework/AzFramework/Archive/Archive.cpp @@ -2330,7 +2330,6 @@ namespace AZ::IO // we only want to record ASSET access // assets are identified as things which start with no alias, or with the @assets@ alias auto assetPath = AZ::IO::FileIOBase::GetInstance()->ConvertToAlias(szFilename); - constexpr AZStd::string_view assetsAlias{ "@assets@" }; if (assetPath && assetPath->Native().starts_with("@assets@")) { IResourceList* pList = GetResourceList(m_eRecordFileOpenList); diff --git a/Code/Framework/AzFramework/AzFramework/Archive/ZipDirCache.cpp b/Code/Framework/AzFramework/AzFramework/Archive/ZipDirCache.cpp index d74f69e27b..81f26d78b8 100644 --- a/Code/Framework/AzFramework/AzFramework/Archive/ZipDirCache.cpp +++ b/Code/Framework/AzFramework/AzFramework/Archive/ZipDirCache.cpp @@ -887,7 +887,6 @@ namespace AZ::IO::ZipDir { FileRecordList arrFiles(GetRoot()); arrFiles.SortByFileOffset(); - FileRecordList::ZipStats Stats = arrFiles.GetStats(); // we back up our file entries, because we'll need to restore them // in case the operation fails diff --git a/Code/Framework/AzFramework/AzFramework/Script/ScriptComponent.cpp b/Code/Framework/AzFramework/AzFramework/Script/ScriptComponent.cpp index 292cce29ec..0791c8d3dc 100644 --- a/Code/Framework/AzFramework/AzFramework/Script/ScriptComponent.cpp +++ b/Code/Framework/AzFramework/AzFramework/Script/ScriptComponent.cpp @@ -290,7 +290,7 @@ namespace AzFramework namespace Internal { - static AZStd::string PrintLuaValue(lua_State* lua, int stackIdx, int depth = 0) + AZStd::string PrintLuaValue(lua_State* lua, int stackIdx, int depth = 0) { constexpr int MaxDepth = 4; if (depth > MaxDepth) diff --git a/Code/Framework/AzNetworking/AzNetworking/TcpTransport/TcpListenThread.cpp b/Code/Framework/AzNetworking/AzNetworking/TcpTransport/TcpListenThread.cpp index 9a3c038a73..e65f01509e 100644 --- a/Code/Framework/AzNetworking/AzNetworking/TcpTransport/TcpListenThread.cpp +++ b/Code/Framework/AzNetworking/AzNetworking/TcpTransport/TcpListenThread.cpp @@ -118,7 +118,7 @@ namespace AzNetworking const int32_t connectionLength = aznumeric_cast(sizeof(newConnection)); memset(&newConnection, 0, connectionLength); - auto readCallback = [this, newConnection, connectionLength](SocketFd socketFd) + auto readCallback = [this, newConnection](SocketFd socketFd) { auto visitor = [this, newConnection, socketFd](ListenPort& listenPort) { diff --git a/Code/Legacy/CrySystem/AZCoreLogSink.h b/Code/Legacy/CrySystem/AZCoreLogSink.h index d9e815841c..e824c4c172 100644 --- a/Code/Legacy/CrySystem/AZCoreLogSink.h +++ b/Code/Legacy/CrySystem/AZCoreLogSink.h @@ -51,10 +51,10 @@ public: static bool IsCryLogReady() { - static bool hasSetCVar = false; bool ready = gEnv && gEnv->pSystem && gEnv->pLog; #ifdef _RELEASE + static bool hasSetCVar = false; if(!hasSetCVar && ready) { // AZ logging only has a concept of 3 levels (error, warning, info) but cry logging has 4 levels (..., messaging). If info level is set, we'll turn on messaging as well diff --git a/Code/Legacy/CrySystem/LevelSystem/SpawnableLevelSystem.cpp b/Code/Legacy/CrySystem/LevelSystem/SpawnableLevelSystem.cpp index f866ee2864..0ac7b0bdce 100644 --- a/Code/Legacy/CrySystem/LevelSystem/SpawnableLevelSystem.cpp +++ b/Code/Legacy/CrySystem/LevelSystem/SpawnableLevelSystem.cpp @@ -56,7 +56,6 @@ namespace LegacyLevelSystem //------------------------------------------------------------------------ SpawnableLevelSystem::SpawnableLevelSystem(ISystem* pSystem) - : m_pSystem(pSystem) { CRY_ASSERT(pSystem); diff --git a/Code/Legacy/CrySystem/LevelSystem/SpawnableLevelSystem.h b/Code/Legacy/CrySystem/LevelSystem/SpawnableLevelSystem.h index 858a0b24f0..0a7b821262 100644 --- a/Code/Legacy/CrySystem/LevelSystem/SpawnableLevelSystem.h +++ b/Code/Legacy/CrySystem/LevelSystem/SpawnableLevelSystem.h @@ -66,8 +66,6 @@ class SpawnableLevelSystem void LogLoadingTime(); - ISystem* m_pSystem{nullptr}; - AZStd::string m_lastLevelName; float m_fLastLevelLoadTime{0.0f}; float m_fLastTime{0.0f}; diff --git a/Code/Legacy/CrySystem/System.cpp b/Code/Legacy/CrySystem/System.cpp index 452ebea302..28940e32ac 100644 --- a/Code/Legacy/CrySystem/System.cpp +++ b/Code/Legacy/CrySystem/System.cpp @@ -1259,9 +1259,6 @@ ILocalizationManager* CSystem::GetLocalizationManager() ////////////////////////////////////////////////////////////////////////// void CSystem::debug_GetCallStackRaw(void** callstack, uint32& callstackLength) { - uint32 callstackCapacity = callstackLength; - uint32 nNumStackFramesToSkip = 1; - memset(callstack, 0, sizeof(void*) * callstackLength); #if !defined(ANDROID) @@ -1269,6 +1266,8 @@ void CSystem::debug_GetCallStackRaw(void** callstack, uint32& callstackLength) #endif #if AZ_LEGACY_CRYSYSTEM_TRAIT_CAPTURESTACK + uint32 nNumStackFramesToSkip = 1; + uint32 callstackCapacity = callstackLength; if (callstackCapacity > 0x40) { callstackCapacity = 0x40; diff --git a/Code/Legacy/CrySystem/SystemInit.cpp b/Code/Legacy/CrySystem/SystemInit.cpp index dcfeb90484..665ba126c2 100644 --- a/Code/Legacy/CrySystem/SystemInit.cpp +++ b/Code/Legacy/CrySystem/SystemInit.cpp @@ -1858,19 +1858,6 @@ void CSystem::CreateSystemVars() "Usage: e_EntitySuppressionLevel [0-infinity]\n" "Default is 0 (off)"); -#if defined(WIN32) || defined(WIN64) - const uint32 nJobSystemDefaultCoreNumber = 8; -#define AZ_RESTRICTED_SECTION_IMPLEMENTED -#elif defined(AZ_RESTRICTED_PLATFORM) -#define AZ_RESTRICTED_SECTION SYSTEMINIT_CPP_SECTION_11 -#include AZ_RESTRICTED_FILE(SystemInit_cpp) -#endif -#if defined(AZ_RESTRICTED_SECTION_IMPLEMENTED) -#undef AZ_RESTRICTED_SECTION_IMPLEMENTED -#else - const uint32 nJobSystemDefaultCoreNumber = 4; -#endif - m_sys_firstlaunch = REGISTER_INT("sys_firstlaunch", 0, 0, "Indicates that the game was run for the first time."); diff --git a/Gems/AWSCore/Code/Include/Public/Framework/JsonObjectHandler.h b/Gems/AWSCore/Code/Include/Public/Framework/JsonObjectHandler.h index 85461ff644..57eabe3593 100644 --- a/Gems/AWSCore/Code/Include/Public/Framework/JsonObjectHandler.h +++ b/Gems/AWSCore/Code/Include/Public/Framework/JsonObjectHandler.h @@ -67,7 +67,6 @@ namespace AWSCore AZStd::string GetContent() { - std::istream::pos_type pos = m_is.tellg(); m_is.seekg(0); std::istreambuf_iterator eos; AZStd::string content{ std::istreambuf_iterator(m_is),eos }; diff --git a/Gems/AWSCore/Code/Source/Framework/HttpRequestJob.cpp b/Gems/AWSCore/Code/Source/Framework/HttpRequestJob.cpp index ee9459b9af..7c41695fe1 100644 --- a/Gems/AWSCore/Code/Source/Framework/HttpRequestJob.cpp +++ b/Gems/AWSCore/Code/Source/Framework/HttpRequestJob.cpp @@ -42,7 +42,7 @@ namespace AWSCore // This will run the code fed to the macro, and then assign 0 to a static int (note the ,0 at the end) #define AWS_CORE_ONCE_PASTE(x) (x) -#define AWS_CORE_ONCE(x) static int AZ_JOIN(init, __LINE__)((AWS_CORE_ONCE_PASTE(x), 0)) +#define AWS_CORE_ONCE(x) static [[maybe_unused]] int AZ_JOIN(init, __LINE__)((AWS_CORE_ONCE_PASTE(x), 0)) #define AWS_CORE_HTTP_METHOD_ENTRY(x) { HttpRequestJob::HttpMethod::HTTP_##x, HttpMethodInfo{ Aws::Http::HttpMethod::HTTP_##x, #x } } diff --git a/Gems/Atom/Component/DebugCamera/Code/Source/NoClipControllerComponent.cpp b/Gems/Atom/Component/DebugCamera/Code/Source/NoClipControllerComponent.cpp index b2d2a4bb15..d9979c455b 100644 --- a/Gems/Atom/Component/DebugCamera/Code/Source/NoClipControllerComponent.cpp +++ b/Gems/Atom/Component/DebugCamera/Code/Source/NoClipControllerComponent.cpp @@ -388,9 +388,9 @@ namespace AZ m_properties = properties; } - void NoClipControllerComponent::SetTouchSensitivity([[maybe_unused]] float touchSensitivity) + void NoClipControllerComponent::SetTouchSensitivity(float touchSensitivity) { - m_properties.m_touchSensitivity; + m_properties.m_touchSensitivity = touchSensitivity; } void NoClipControllerComponent::SetPosition(AZ::Vector3 position) diff --git a/Gems/Atom/Feature/Common/Code/Source/CoreLights/DirectionalLightFeatureProcessor.cpp b/Gems/Atom/Feature/Common/Code/Source/CoreLights/DirectionalLightFeatureProcessor.cpp index 6a418117fc..0d089a26bf 100644 --- a/Gems/Atom/Feature/Common/Code/Source/CoreLights/DirectionalLightFeatureProcessor.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/CoreLights/DirectionalLightFeatureProcessor.cpp @@ -471,7 +471,7 @@ namespace AZ const RPI::RenderPipelineId& renderPipelineId) { ShadowProperty& property = m_shadowProperties.GetData(handle.GetIndex()); - auto update = [this, handle, &property, &baseCameraConfiguration](const RPI::View* view) + auto update = [&property, &baseCameraConfiguration](const RPI::View* view) { CascadeShadowCameraConfiguration& cameraConfig = property.m_cameraConfigurations[view]; if (!cameraConfig.HasSameConfiguration(baseCameraConfiguration)) diff --git a/Gems/Atom/Feature/Common/Code/Source/Decals/AsyncLoadTracker.h b/Gems/Atom/Feature/Common/Code/Source/Decals/AsyncLoadTracker.h index dd035afec6..8e03cc51fe 100644 --- a/Gems/Atom/Feature/Common/Code/Source/Decals/AsyncLoadTracker.h +++ b/Gems/Atom/Feature/Common/Code/Source/Decals/AsyncLoadTracker.h @@ -97,7 +97,6 @@ namespace AZ { const auto iter = AZStd::find(vec.begin(), vec.end(), elementToErase); AZ_Assert(iter != vec.end(), "EraseFromVector failed to find the given object"); - const auto indexToRemove = AZStd::distance(vec.begin(), iter); AZStd::swap(*iter, vec.back()); vec.pop_back(); } diff --git a/Gems/Atom/Feature/Common/Code/Source/DiffuseGlobalIllumination/DiffuseProbeGrid.cpp b/Gems/Atom/Feature/Common/Code/Source/DiffuseGlobalIllumination/DiffuseProbeGrid.cpp index a4d24b7cb1..4d58948b98 100644 --- a/Gems/Atom/Feature/Common/Code/Source/DiffuseGlobalIllumination/DiffuseProbeGrid.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/DiffuseGlobalIllumination/DiffuseProbeGrid.cpp @@ -731,7 +731,6 @@ namespace AZ } const RHI::ShaderResourceGroupLayout* srgLayout = m_classificationSrg->GetLayout(); - RHI::ShaderInputConstantIndex constantIndex; RHI::ShaderInputImageIndex imageIndex; imageIndex = srgLayout->FindShaderInputImageIndex(AZ::Name("m_probeRayTrace")); diff --git a/Gems/Atom/Feature/Common/Code/Source/ProfilingCaptureSystemComponent.cpp b/Gems/Atom/Feature/Common/Code/Source/ProfilingCaptureSystemComponent.cpp index 7c6dfcf744..db9da271bc 100644 --- a/Gems/Atom/Feature/Common/Code/Source/ProfilingCaptureSystemComponent.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/ProfilingCaptureSystemComponent.cpp @@ -453,7 +453,7 @@ namespace AZ RHI::CpuProfiler::Get()->SetProfilerEnabled(true); } - const bool captureStarted = m_cpuFrameTimeStatisticsCapture.StartCapture([this, outputFilePath, wasEnabled]() + const bool captureStarted = m_cpuFrameTimeStatisticsCapture.StartCapture([outputFilePath, wasEnabled]() { JsonSerializerSettings serializationSettings; serializationSettings.m_keepDefaults = true; @@ -603,7 +603,7 @@ namespace AZ RHI::CpuProfiler::Get()->SetProfilerEnabled(true); } - const bool captureStarted = m_cpuProfilingStatisticsCapture.StartCapture([this, outputFilePath, wasEnabled]() + const bool captureStarted = m_cpuProfilingStatisticsCapture.StartCapture([outputFilePath, wasEnabled]() { // Blocking call for a single frame of data, avoid thread overhead AZStd::ring_buffer singleFrameData(1); @@ -669,7 +669,7 @@ namespace AZ bool ProfilingCaptureSystemComponent::CaptureBenchmarkMetadata(const AZStd::string& benchmarkName, const AZStd::string& outputFilePath) { - const bool captureStarted = m_benchmarkMetadataCapture.StartCapture([this, benchmarkName, outputFilePath]() + const bool captureStarted = m_benchmarkMetadataCapture.StartCapture([benchmarkName, outputFilePath]() { JsonSerializerSettings serializationSettings; serializationSettings.m_keepDefaults = true; diff --git a/Gems/Atom/Feature/Common/Code/Source/RayTracing/RayTracingFeatureProcessor.cpp b/Gems/Atom/Feature/Common/Code/Source/RayTracing/RayTracingFeatureProcessor.cpp index 31899b9bb6..ea89f64b73 100644 --- a/Gems/Atom/Feature/Common/Code/Source/RayTracing/RayTracingFeatureProcessor.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/RayTracing/RayTracingFeatureProcessor.cpp @@ -458,9 +458,7 @@ namespace AZ void RayTracingFeatureProcessor::UpdateRayTracingMaterialSrg() { const RHI::ShaderResourceGroupLayout* srgLayout = m_rayTracingMaterialSrg->GetLayout(); - RHI::ShaderInputImageIndex imageIndex; RHI::ShaderInputBufferIndex bufferIndex; - RHI::ShaderInputConstantIndex constantIndex; bufferIndex = srgLayout->FindShaderInputBufferIndex(AZ::Name("m_materialInfo")); m_rayTracingMaterialSrg->SetBufferView(bufferIndex, m_materialInfoBuffer->GetBufferView()); diff --git a/Gems/Atom/Feature/Common/Code/Source/Shadows/ProjectedShadowFeatureProcessor.cpp b/Gems/Atom/Feature/Common/Code/Source/Shadows/ProjectedShadowFeatureProcessor.cpp index 0e42c5520e..68dac8f773 100644 --- a/Gems/Atom/Feature/Common/Code/Source/Shadows/ProjectedShadowFeatureProcessor.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/Shadows/ProjectedShadowFeatureProcessor.cpp @@ -418,7 +418,6 @@ namespace AZ::Render } const FilterParameter& filter = m_shadowData.GetElement(shadowProperty.m_shadowId.GetIndex()); const float boundaryWidthAngle = shadow.m_boundaryScale * 2.0f; - constexpr float SmallAngle = 0.01f; const float fieldOfView = GetMax(shadowProperty.m_desc.m_fieldOfViewYRadians, MinimumFieldOfView); const float ratioToEntireWidth = boundaryWidthAngle / fieldOfView; const float widthInPixels = ratioToEntireWidth * filter.m_shadowmapSize; diff --git a/Gems/Atom/RPI/Code/Source/RPI.Public/Culling.cpp b/Gems/Atom/RPI/Code/Source/RPI.Public/Culling.cpp index 841607404a..d7299998db 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Public/Culling.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Public/Culling.cpp @@ -596,7 +596,7 @@ namespace AZ jobData->m_maskedOcclusionCulling = maskedOcclusionCulling; #endif - auto nodeVisitorLambda = [this, jobData, &parentJob, &frustum, &worklist](const AzFramework::IVisibilityScene::NodeData& nodeData) -> void + auto nodeVisitorLambda = [jobData, &parentJob, &worklist](const AzFramework::IVisibilityScene::NodeData& nodeData) -> void { AZ_PROFILE_SCOPE(AzRender, "nodeVisitorLambda()"); AZ_Assert(nodeData.m_entries.size() > 0, "should not get called with 0 entries"); diff --git a/Gems/Atom/RPI/Code/Source/RPI.Public/MeshDrawPacket.cpp b/Gems/Atom/RPI/Code/Source/RPI.Public/MeshDrawPacket.cpp index 7fd7133cee..4ecef9dba5 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Public/MeshDrawPacket.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Public/MeshDrawPacket.cpp @@ -88,7 +88,7 @@ namespace AZ } else { - itEntry->second == value; + itEntry->second = value; } } } diff --git a/Gems/Atom/RPI/Code/Source/RPI.Public/Pass/PassLibrary.cpp b/Gems/Atom/RPI/Code/Source/RPI.Public/Pass/PassLibrary.cpp index ca49843efb..8eedf3aa1f 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Public/Pass/PassLibrary.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Public/Pass/PassLibrary.cpp @@ -247,8 +247,6 @@ namespace AZ void PassLibrary::OnAssetReloaded(Data::Asset asset) { - Data::AssetId assetId = asset->GetId(); - // Handle pass asset reload Data::Asset passAsset = { asset.GetAs(), AZ::Data::AssetLoadBehavior::PreLoad }; if (passAsset && passAsset->GetPassTemplate()) diff --git a/Gems/Atom/Utils/Code/Include/Atom/Utils/ImGuiCpuProfiler.inl b/Gems/Atom/Utils/Code/Include/Atom/Utils/ImGuiCpuProfiler.inl index a225646761..27d89d0cba 100644 --- a/Gems/Atom/Utils/Code/Include/Atom/Utils/ImGuiCpuProfiler.inl +++ b/Gems/Atom/Utils/Code/Include/Atom/Utils/ImGuiCpuProfiler.inl @@ -367,14 +367,12 @@ namespace AZ const AZ::RHI::CpuTimingStatistics& cpuTimingStatistics = m_cpuTimingStatisticsWhenPause; - const AZStd::sys_time_t ticksPerSecond = AZStd::GetTimeTicksPerSecond(); - - const auto ShowTimeInMs = [ticksPerSecond](AZStd::sys_time_t duration) + const auto ShowTimeInMs = [](AZStd::sys_time_t duration) { ImGui::Text("%.2f ms", CpuProfilerImGuiHelper::TicksToMs(duration)); }; - const auto ShowRow = [ticksPerSecond, &ShowTimeInMs](const char* regionLabel, AZStd::sys_time_t duration) + const auto ShowRow = [&ShowTimeInMs](const char* regionLabel, AZStd::sys_time_t duration) { ImGui::Text(regionLabel); ImGui::NextColumn(); @@ -591,7 +589,6 @@ namespace AZ else if (io.MouseWheel != 0 && io.KeyCtrl) // Zooming { // We want zooming to be relative to the mouse's current position - const float mouseVel = io.MouseWheel; const float mouseX = ImGui::GetMousePos().x; // Find the normalized position of the cursor relative to the window diff --git a/Gems/Atom/Utils/Code/Include/Atom/Utils/ImGuiGpuProfiler.inl b/Gems/Atom/Utils/Code/Include/Atom/Utils/ImGuiGpuProfiler.inl index e6bde136f8..c6f5f8c725 100644 --- a/Gems/Atom/Utils/Code/Include/Atom/Utils/ImGuiGpuProfiler.inl +++ b/Gems/Atom/Utils/Code/Include/Atom/Utils/ImGuiGpuProfiler.inl @@ -1333,7 +1333,7 @@ namespace AZ inline PassEntry* ImGuiGpuProfiler::CreatePassEntries(RHI::Ptr rootPass) { AZStd::unordered_map passEntryDatabase; - const auto addPassEntry = [&passEntryDatabase, this](const RPI::Pass* pass, PassEntry* parent) -> PassEntry* + const auto addPassEntry = [&passEntryDatabase](const RPI::Pass* pass, PassEntry* parent) -> PassEntry* { // If parent a nullptr, it's assumed to be the rootpass. if (parent == nullptr) diff --git a/Gems/Atom/Utils/Code/Include/Atom/Utils/StableDynamicArray.inl b/Gems/Atom/Utils/Code/Include/Atom/Utils/StableDynamicArray.inl index 25f3f528ab..870ed04b33 100644 --- a/Gems/Atom/Utils/Code/Include/Atom/Utils/StableDynamicArray.inl +++ b/Gems/Atom/Utils/Code/Include/Atom/Utils/StableDynamicArray.inl @@ -305,7 +305,7 @@ namespace AZ template size_t StableDynamicArray::Page::Reserve() { - for (m_bitStartIndex; m_bitStartIndex < NumUint64_t; ++m_bitStartIndex) + for (; m_bitStartIndex < NumUint64_t; ++m_bitStartIndex) { if (m_bits[m_bitStartIndex] != FullBits) { @@ -462,7 +462,7 @@ namespace AZ } // skip the empty bitfields in the page - for (m_bitGroupIndex; m_bitGroupIndex < Page::NumUint64_t && m_page->m_bits.at(m_bitGroupIndex) == 0; ++m_bitGroupIndex) + for (; m_bitGroupIndex < Page::NumUint64_t && m_page->m_bits.at(m_bitGroupIndex) == 0; ++m_bitGroupIndex) { } diff --git a/Gems/AtomLyIntegration/AtomBridge/Code/Source/PerViewportDynamicDrawManager.cpp b/Gems/AtomLyIntegration/AtomBridge/Code/Source/PerViewportDynamicDrawManager.cpp index 414dd7cdf0..c0627d38da 100644 --- a/Gems/AtomLyIntegration/AtomBridge/Code/Source/PerViewportDynamicDrawManager.cpp +++ b/Gems/AtomLyIntegration/AtomBridge/Code/Source/PerViewportDynamicDrawManager.cpp @@ -86,7 +86,7 @@ namespace AZ::AtomBridge context.second->SetOutputScope(pipeline.get()); } }); - viewportData.m_viewportDestroyedHandler = AZ::Event::Handler([this, viewportId](AzFramework::ViewportId id) + viewportData.m_viewportDestroyedHandler = AZ::Event::Handler([this](AzFramework::ViewportId id) { AZStd::lock_guard lock(m_mutexDrawContexts); m_viewportData.erase(id); diff --git a/Gems/AtomLyIntegration/AtomFont/Code/Include/AtomLyIntegration/AtomFont/AtomFont.h b/Gems/AtomLyIntegration/AtomFont/Code/Include/AtomLyIntegration/AtomFont/AtomFont.h index f5883232eb..6d361c01ae 100644 --- a/Gems/AtomLyIntegration/AtomFont/Code/Include/AtomLyIntegration/AtomFont/AtomFont.h +++ b/Gems/AtomLyIntegration/AtomFont/Code/Include/AtomLyIntegration/AtomFont/AtomFont.h @@ -136,7 +136,6 @@ namespace AZ FontMap m_fonts; FontFamilyMap m_fontFamilies; //!< Map font family names to weak ptrs so we can construct shared_ptrs but not keep a ref ourselves. FontFamilyReverseLookupMap m_fontFamilyReverseLookup; //GetViewportSize(); AzFramework::CameraState cameraState; AzFramework::SetCameraClippingVolumeFromPerspectiveFovMatrixRH(cameraState, currentView->GetViewToClipMatrix()); const AZ::Transform transform = currentView->GetCameraTransform(); diff --git a/Gems/AudioSystem/Code/Source/Engine/ATL.cpp b/Gems/AudioSystem/Code/Source/Engine/ATL.cpp index ff56300b85..f49cc1304a 100644 --- a/Gems/AudioSystem/Code/Source/Engine/ATL.cpp +++ b/Gems/AudioSystem/Code/Source/Engine/ATL.cpp @@ -1155,7 +1155,6 @@ namespace Audio EAudioRequestStatus eResult = eARS_FAILURE; const TAudioObjectID nATLObjectID = pAudioObject->GetID(); - const TAudioControlID nATLTriggerID = pTrigger->GetID(); const TObjectTriggerImplStates& rTriggerImplStates = pAudioObject->GetTriggerImpls(); for (auto const triggerImpl : pTrigger->m_cImplPtrs) @@ -1357,7 +1356,6 @@ namespace Audio { EAudioRequestStatus eResult = eARS_FAILURE; - const TAudioObjectID nATLObjectID = pAudioObject->GetID(); const TAudioControlID nATLTriggerID = pTrigger->GetID(); TObjectEventSet rEvents = pAudioObject->GetActiveEvents(); diff --git a/Gems/AudioSystem/Code/Source/Engine/ATLAudioObject.cpp b/Gems/AudioSystem/Code/Source/Engine/ATLAudioObject.cpp index 980757ffca..c8548efa04 100644 --- a/Gems/AudioSystem/Code/Source/Engine/ATLAudioObject.cpp +++ b/Gems/AudioSystem/Code/Source/Engine/ATLAudioObject.cpp @@ -1042,7 +1042,8 @@ namespace Audio auxGeom.SetRenderFlags(newRenderFlags); const bool drawRays = CVars::s_debugDrawOptions.AreAllFlagsActive(DebugDraw::Options::DrawRays); - const bool drawLabels = CVars::s_debugDrawOptions.AreAllFlagsActive(DebugDraw::Options::RayLabels); + // ToDo: Update to work with Atom? LYN-3677 + //const bool drawLabels = CVars::s_debugDrawOptions.AreAllFlagsActive(DebugDraw::Options::RayLabels); size_t numRays = m_obstOccType == eAOOCT_SINGLE_RAY ? 1 : s_maxRaysPerObject; for (size_t rayIndex = 0; rayIndex < numRays; ++rayIndex) diff --git a/Gems/AudioSystem/Code/Source/Engine/ATLComponents.cpp b/Gems/AudioSystem/Code/Source/Engine/ATLComponents.cpp index 91340ca9bb..996a2a80b6 100644 --- a/Gems/AudioSystem/Code/Source/Engine/ATLComponents.cpp +++ b/Gems/AudioSystem/Code/Source/Engine/ATLComponents.cpp @@ -284,10 +284,9 @@ namespace Audio /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// - CAudioObjectManager::CAudioObjectManager(CAudioEventManager& refAudioEventManager) + CAudioObjectManager::CAudioObjectManager([[maybe_unused]] CAudioEventManager& refAudioEventManager) : m_cObjectPool(Audio::CVars::s_AudioObjectPoolSize, AudioObjectIDFactory::s_minValidAudioObjectID) , m_fTimeSinceLastVelocityUpdateMS(0.0f) - , m_refAudioEventManager(refAudioEventManager) #if !defined(AUDIO_RELEASE) , m_pDebugNameStore(nullptr) #endif // !AUDIO_RELEASE @@ -1777,7 +1776,6 @@ namespace Audio static float const fItemPlayingColor[4] = { 0.3f, 0.6f, 0.3f, 0.9f }; static float const fItemLoadingColor[4] = { 0.9f, 0.2f, 0.2f, 0.9f }; static float const fItemOtherColor[4] = { 0.8f, 0.8f, 0.8f, 0.9f }; - static float const fNoImplColor[4] = { 1.0f, 0.6f, 0.6f, 0.9f }; rAuxGeom.Draw2dLabel(fPosX, fPosY, 1.6f, fHeaderColor, false, "Audio Events [%zu]", m_cActiveAudioEvents.size()); fPosX += 20.0f; diff --git a/Gems/AudioSystem/Code/Source/Engine/ATLComponents.h b/Gems/AudioSystem/Code/Source/Engine/ATLComponents.h index 17a1b65afe..efdee4fd2f 100644 --- a/Gems/AudioSystem/Code/Source/Engine/ATLComponents.h +++ b/Gems/AudioSystem/Code/Source/Engine/ATLComponents.h @@ -160,8 +160,6 @@ namespace Audio CInstanceManager m_cObjectPool; float m_fTimeSinceLastVelocityUpdateMS; - CAudioEventManager& m_refAudioEventManager; - AudioRaycastManager m_raycastManager; }; diff --git a/Gems/AudioSystem/Code/Source/Engine/AudioSystem.cpp b/Gems/AudioSystem/Code/Source/Engine/AudioSystem.cpp index 43ab47266a..09732fa52f 100644 --- a/Gems/AudioSystem/Code/Source/Engine/AudioSystem.cpp +++ b/Gems/AudioSystem/Code/Source/Engine/AudioSystem.cpp @@ -293,7 +293,7 @@ namespace Audio PushRequestBlocking(request); m_audioSystemThread.Deactivate(); - const bool bSuccess = m_oATL.ShutDown(); + m_oATL.ShutDown(); m_bSystemInitialized = false; } diff --git a/Gems/AudioSystem/Code/Source/Engine/FileCacheManager.cpp b/Gems/AudioSystem/Code/Source/Engine/FileCacheManager.cpp index 791c86eba8..b106c4f9d2 100644 --- a/Gems/AudioSystem/Code/Source/Engine/FileCacheManager.cpp +++ b/Gems/AudioSystem/Code/Source/Engine/FileCacheManager.cpp @@ -841,7 +841,7 @@ namespace Audio streamer->SetRequestCompleteCallback( audioFileEntry->m_asyncStreamRequest, - [this](AZ::IO::FileRequestHandle request) + [](AZ::IO::FileRequestHandle request) { AZ_PROFILE_FUNCTION(Audio); AudioFileCacheManagerNotficationBus::QueueBroadcast( diff --git a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/ActorCommands.cpp b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/ActorCommands.cpp index da5366f6cf..85bb726822 100644 --- a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/ActorCommands.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/ActorCommands.cpp @@ -145,7 +145,6 @@ namespace CommandSystem AZStd::vector nodeNames; AzFramework::StringFunc::Tokenize(attachmentNodes.c_str(), nodeNames, ";", false, true); - const size_t numNodeNames = nodeNames.size(); // Remove the given nodes from the attachment node list by unsetting the flag. if (AzFramework::StringFunc::Equal(nodeAction.c_str(), "remove")) @@ -224,7 +223,6 @@ namespace CommandSystem AZStd::vector nodeNames; AzFramework::StringFunc::Tokenize(nodesExcludedFromBounds.c_str(), nodeNames, ";", false, true); - const size_t numNodeNames = nodeNames.size(); // Remove the selected nodes from the bounding volume calculations. if (AzFramework::StringFunc::Equal(nodeAction.c_str(), "remove")) diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/Importer/ChunkProcessors.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/Importer/ChunkProcessors.cpp index 7d800f8928..fad160407b 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/Importer/ChunkProcessors.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/Importer/ChunkProcessors.cpp @@ -1585,9 +1585,6 @@ namespace EMotionFX // get the expression name const char* morphTargetName = SharedHelperData::ReadString(file, importParams.m_sharedData, endianType); - // get the level of detail of the expression part - const uint32 morphTargetLOD = morphTargetChunk.m_lod; - if (GetLogging()) { MCore::LogDetailedInfo(" + Morph Target:"); @@ -1732,9 +1729,6 @@ namespace EMotionFX // get the expression name const char* morphTargetName = SharedHelperData::ReadString(file, importParams.m_sharedData, endianType); - // get the level of detail of the expression part - const uint32 morphTargetLOD = morphTargetChunk.m_lod; - if (GetLogging()) { MCore::LogDetailedInfo(" + Morph Target:"); diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/RagdollInstance.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/RagdollInstance.cpp index c7da3430b1..b139133c49 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/RagdollInstance.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/RagdollInstance.cpp @@ -500,7 +500,6 @@ namespace EMotionFX const Physics::RagdollNodeState& targetJointPose = ragdollTargetPose[ragdollJointIndex.GetValue()]; const Physics::RagdollNodeState& targetParentJointPose = ragdollTargetPose[ragdollParentJointIndex.GetValue()]; - const float strength = targetJointPose.m_strength; if (targetParentJointPose.m_simulationType == Physics::SimulationType::Dynamic) { diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/SpringSolver.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/SpringSolver.cpp index 83cbc41a36..adf0a0cc2b 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/SpringSolver.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/SpringSolver.cpp @@ -310,7 +310,6 @@ namespace EMotionFX SetParentParticle(parentParticleIndex); // Register the joint, which creates a particle internally. - const bool isPinned = (parentParticleIndex != InvalidIndex) ? joint->IsPinned() : true; SpringSolver::Particle* particle = AddJoint(joint); if (!particle) { diff --git a/Gems/GradientSignal/Code/Include/GradientSignal/SmoothStep.h b/Gems/GradientSignal/Code/Include/GradientSignal/SmoothStep.h index f60cf4804c..0489fa4893 100644 --- a/Gems/GradientSignal/Code/Include/GradientSignal/SmoothStep.h +++ b/Gems/GradientSignal/Code/Include/GradientSignal/SmoothStep.h @@ -37,7 +37,6 @@ namespace GradientSignal float output = 0.0f; const float value = AZ::GetClamp(inputValue, 0.0f, 1.0f); - const float valueFalloffRange = AZ::GetClamp(m_falloffRange, 0.0f, 1.0f); const float valueFalloffStrength = AZ::GetClamp(m_falloffStrength, 0.0f, 1.0f); float min = m_falloffMidpoint - m_falloffRange / 2.0f; diff --git a/Gems/ImGui/Code/Source/ImGuiManager.cpp b/Gems/ImGui/Code/Source/ImGuiManager.cpp index 427af6d7dc..6fc1ea8b71 100644 --- a/Gems/ImGui/Code/Source/ImGuiManager.cpp +++ b/Gems/ImGui/Code/Source/ImGuiManager.cpp @@ -81,59 +81,6 @@ namespace const auto& it = AZStd::find(touches.cbegin(), touches.cend(), inputChannelId); return it != touches.cend() ? static_cast(it - touches.cbegin()) : UINT_MAX; } - - /** - Utility function to map an AzFrameworkInput controller button to its integer index. - - @param inputChannelId the ID for an AzFrameworkInput controller button. - @return the index of the indicated button, or -1 if not found. - */ - unsigned int GetAzControllerButtonIndex(const InputChannelId& inputChannelId) - { - const auto& buttons = InputDeviceGamepad::Button::All; - const auto& triggers = InputDeviceGamepad::Trigger::All; - const auto& it = AZStd::find(buttons.cbegin(), buttons.cend(), inputChannelId); - if (it != buttons.cend()) - { - return static_cast(it - buttons.cbegin()); - } - else - { - const auto& it2 = AZStd::find(triggers.cbegin(), triggers.cend(), inputChannelId); - if (it2 != triggers.cend()) - { - return static_cast(it2 - triggers.cbegin()) + AZ_ARRAY_SIZE(InputDeviceGamepad::Button::All); - } - } - - return UINT_MAX; - } - - /** - Utility function to map an AzFrameworkInput thumbstick movement to its integer index. - - @param inputChannelId the ID for an AzFrameworkInput thumbstick movement. - @return the index of the indicated button, or -1 if not found. - */ - unsigned int GetAzControllerThumbstickIndex(const InputChannelId& inputChannelId) - { - const auto& thumbstickMovements = InputDeviceGamepad::ThumbStickDirection::All; - const auto& it = AZStd::find(thumbstickMovements.cbegin(), thumbstickMovements.cend(), inputChannelId); - return it != thumbstickMovements.cend() ? static_cast(it - thumbstickMovements.cbegin()) : UINT_MAX; - } - - /** - Utility function to map an AzFrameworkInput thumbstick movement amountto its integer index. - - @param inputChannelId the ID for an AzFrameworkInput thumbstick movement amount. - @return the index of the indicated button, or -1 if not found. - */ - unsigned int GetAzControllerThumbstickAmountIndex(const InputChannelId& inputChannelId) - { - const auto& thumbstickMovementAmounts = InputDeviceGamepad::ThumbStickAxis1D::All; - const auto& it = AZStd::find(thumbstickMovementAmounts.cbegin(), thumbstickMovementAmounts.cend(), inputChannelId); - return it != thumbstickMovementAmounts.cend() ? static_cast(it - thumbstickMovementAmounts.cbegin()) : UINT_MAX; - } } void ImGuiManager::Initialize() diff --git a/Gems/ImGui/Code/Source/ImGuiManager.h b/Gems/ImGui/Code/Source/ImGuiManager.h index 20695c0825..acb022277c 100644 --- a/Gems/ImGui/Code/Source/ImGuiManager.h +++ b/Gems/ImGui/Code/Source/ImGuiManager.h @@ -81,7 +81,6 @@ namespace ImGui private: ImGuiContext* m_imguiContext = nullptr; - int m_fontTextureId = -1; DisplayState m_clientMenuBarState = DisplayState::Hidden; DisplayState m_editorWindowState = DisplayState::Hidden; diff --git a/Gems/LyShine/Code/Source/Animation/2DSpline.h b/Gems/LyShine/Code/Source/Animation/2DSpline.h index b831bd669a..92494ed78f 100644 --- a/Gems/LyShine/Code/Source/Animation/2DSpline.h +++ b/Gems/LyShine/Code/Source/Animation/2DSpline.h @@ -694,7 +694,6 @@ namespace UiSpline Vec2 interpolate_tangent(float time, float& u) { Vec2 tangent; - const float epsilon = 0.001f; int curr = seek_key(time); int next = curr + 1; assert(0 <= curr && next < num_keys()); From 7daef6ab03cc3c66274d417a6a26ecd414992aab Mon Sep 17 00:00:00 2001 From: jckand-amzn Date: Fri, 20 Aug 2021 15:58:43 -0500 Subject: [PATCH 006/131] Converting Editor Main tests to use TestAutomationBase, and preparing for optimization Signed-off-by: jckand-amzn --- .../Gem/PythonTests/editor/CMakeLists.txt | 11 +- ...ditorWorkflows_LevelEntityComponentCRUD.py | 120 ++++++++++-------- .../PythonTests/editor/test_Editor_Main.py | 43 +++++++ .../editor/test_Editor_Main_Optimized.py | 38 ++++++ 4 files changed, 154 insertions(+), 58 deletions(-) create mode 100644 AutomatedTesting/Gem/PythonTests/editor/test_Editor_Main.py create mode 100644 AutomatedTesting/Gem/PythonTests/editor/test_Editor_Main_Optimized.py diff --git a/AutomatedTesting/Gem/PythonTests/editor/CMakeLists.txt b/AutomatedTesting/Gem/PythonTests/editor/CMakeLists.txt index fa35bb25c6..770a46c178 100644 --- a/AutomatedTesting/Gem/PythonTests/editor/CMakeLists.txt +++ b/AutomatedTesting/Gem/PythonTests/editor/CMakeLists.txt @@ -11,8 +11,8 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS AND PAL_TRAIT_ NAME AutomatedTesting::EditorTests_Main TEST_SUITE main TEST_SERIAL - PATH ${CMAKE_CURRENT_LIST_DIR} - PYTEST_MARKS "SUITE_main and not REQUIRES_gpu" + PATH ${CMAKE_CURRENT_LIST_DIR}/test_Editor_Main.py + PYTEST_MARKS "not REQUIRES_gpu" RUNTIME_DEPENDENCIES Legacy::Editor AZ::AssetProcessor @@ -25,8 +25,7 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS AND PAL_TRAIT_ NAME AutomatedTesting::EditorTests_Periodic TEST_SUITE periodic TEST_SERIAL - PATH ${CMAKE_CURRENT_LIST_DIR} - PYTEST_MARKS "SUITE_periodic and not REQUIRES_gpu" + PATH ${CMAKE_CURRENT_LIST_DIR}/test_Editor_Periodic.py RUNTIME_DEPENDENCIES Legacy::Editor AZ::AssetProcessor @@ -40,8 +39,8 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS AND PAL_TRAIT_ TEST_SUITE main TEST_SERIAL TEST_REQUIRES gpu - PATH ${CMAKE_CURRENT_LIST_DIR} - PYTEST_MARKS "SUITE_main and REQUIRES_gpu" + PATH ${CMAKE_CURRENT_LIST_DIR}/test_Editor_Main.py + PYTEST_MARKS "REQUIRES_gpu" RUNTIME_DEPENDENCIES Legacy::Editor AZ::AssetProcessor diff --git a/AutomatedTesting/Gem/PythonTests/editor/EditorScripts/BasicEditorWorkflows_LevelEntityComponentCRUD.py b/AutomatedTesting/Gem/PythonTests/editor/EditorScripts/BasicEditorWorkflows_LevelEntityComponentCRUD.py index 994fc661ed..906e28bf8d 100644 --- a/AutomatedTesting/Gem/PythonTests/editor/EditorScripts/BasicEditorWorkflows_LevelEntityComponentCRUD.py +++ b/AutomatedTesting/Gem/PythonTests/editor/EditorScripts/BasicEditorWorkflows_LevelEntityComponentCRUD.py @@ -5,36 +5,44 @@ For complete copyright and license terms please see the LICENSE at the root of t SPDX-License-Identifier: Apache-2.0 OR MIT """ -""" -C6351273: Create a new level -C6384955: Basic Workflow: Entity Manipulation in the Outliner -C16929880: Add Delete Components -C15167490: Save a level -C15167491: Export a level -""" -import os -import sys -from PySide2 import QtWidgets - -import azlmbr.bus as bus -import azlmbr.editor as editor -import azlmbr.entity as entity -import azlmbr.math as math -import azlmbr.paths - -sys.path.append(os.path.join(azlmbr.paths.devroot, 'AutomatedTesting', 'Gem', 'PythonTests')) -from editor_python_test_tools.editor_test_helper import EditorTestHelper -import editor_python_test_tools.pyside_utils as pyside_utils -import editor_python_test_tools.hydra_editor_utils as hydra +class Tests: + level_created = ( + "New level created successfully", + "Failed to create new level" + ) + new_entity_created = ( + "New entity created successfully", + "Failed to create a new entity" + ) + child_entity_created = ( + "New child entity created successfully", + "Failed to create new child entity" + ) + component_added = ( + "Component added to entity successfully", + "Failed to add component to entity" + ) + component_updated = ( + "Component property updated successfully", + "Failed to update component property" + ) + component_removed = ( + "Component removed from entity successfully", + "Failed to remove component from entity" + ) + level_saved_and_exported = ( + "Level saved and exported successfully", + "Failed to save/export level" + ) -class TestBasicEditorWorkflows(EditorTestHelper): - def __init__(self): - EditorTestHelper.__init__(self, log_prefix="BasicEditorWorkflows_LevelEntityComponent", args=["level"]) +def RunTest(): + + import editor_python_test_tools.pyside_utils as pyside_utils @pyside_utils.wrap_async - async def run_test(self): + async def BasicEditorWorkflows_LevelEntityComponentCRUD(): """ Summary: Open O3DE editor and check if basic Editor workflows are completable. @@ -55,6 +63,18 @@ class TestBasicEditorWorkflows(EditorTestHelper): :return: None """ + import os + from PySide2 import QtWidgets + + import azlmbr.bus as bus + import azlmbr.editor as editor + import azlmbr.entity as entity + import azlmbr.math as math + import azlmbr.paths + + import editor_python_test_tools.hydra_editor_utils as hydra + from editor_python_test_tools.utils import Report + def find_entity_by_name(entity_name): search_filter = entity.SearchFilter() search_filter.names = [entity_name] @@ -64,6 +84,7 @@ class TestBasicEditorWorkflows(EditorTestHelper): return None # 1) Create a new level + level = "tmp_level" editor_window = pyside_utils.get_editor_main_window() new_level_action = pyside_utils.get_action_for_menu_path(editor_window, "File", "New Level") pyside_utils.trigger_action_async(new_level_action) @@ -71,21 +92,17 @@ class TestBasicEditorWorkflows(EditorTestHelper): new_level_dlg = active_modal_widget.findChild(QtWidgets.QWidget, "CNewLevelDialog") if new_level_dlg: if new_level_dlg.windowTitle() == "New Level": - self.log("New Level dialog opened") + Report.info("New Level dialog opened") grp_box = new_level_dlg.findChild(QtWidgets.QGroupBox, "STATIC_GROUP1") level_name = grp_box.findChild(QtWidgets.QLineEdit, "LEVEL") - level_name.setText(self.args["level"]) + level_name.setText(level) button_box = new_level_dlg.findChild(QtWidgets.QDialogButtonBox, "buttonBox") button_box.button(QtWidgets.QDialogButtonBox.Ok).click() # Verify new level was created successfully level_create_success = await pyside_utils.wait_for_condition(lambda: editor.EditorToolsApplicationRequestBus( - bus.Broadcast, "GetCurrentLevelName") == self.args["level"], 5.0) - self.test_success = level_create_success - self.log(f"Create and load new level: {level_create_success}") - - # Execute EditorTestHelper setup since level was created outside of EditorTestHelper's methods - self.test_success = self.test_success and self.after_level_load() + bus.Broadcast, "GetCurrentLevelName") == level, 5.0) + Report.critical_result(Tests.level_created, level_create_success) # 2) Delete existing entities, and create and manipulate new entities via Entity Inspector search_filter = azlmbr.entity.SearchFilter() @@ -99,8 +116,7 @@ class TestBasicEditorWorkflows(EditorTestHelper): # Find the new entity parent_entity_id = find_entity_by_name("Entity1") parent_entity_success = await pyside_utils.wait_for_condition(lambda: parent_entity_id is not None, 5.0) - self.test_success = self.test_success and parent_entity_success - self.log(f"New entity creation: {parent_entity_success}") + Report.critical_result(Tests.new_entity_created, parent_entity_success) # TODO: Replace Hydra call to creates child entity and add components with context menu triggering - LYN-3951 # Create a new child entity @@ -111,29 +127,26 @@ class TestBasicEditorWorkflows(EditorTestHelper): # Verify entity hierarchy child_entity.get_parent_info() - self.test_success = self.test_success and child_entity.parent_id == parent_entity_id - self.log(f"Create entity hierarchy: {child_entity.parent_id == parent_entity_id}") + Report.result(Tests.child_entity_created, child_entity.parent_id == parent_entity_id) # 3) Add/configure a component on an entity # Add component and verify success child_entity.add_component("Box Shape") - component_add_success = self.wait_for_condition(lambda: hydra.has_components(child_entity.id, ["Box Shape"]), 5.0) - self.test_success = self.test_success and component_add_success - self.log(f"Add component: {component_add_success}") + component_add_success = await pyside_utils.wait_for_condition(lambda: hydra.has_components(child_entity.id, + ["Box Shape"]), 5.0) + Report.result(Tests.component_added, component_add_success) # Update the component dimensions_to_set = math.Vector3(16.0, 16.0, 16.0) child_entity.get_set_test(0, "Box Shape|Box Configuration|Dimensions", dimensions_to_set) box_shape_dimensions = hydra.get_component_property_value(child_entity.components[0], "Box Shape|Box Configuration|Dimensions") - self.test_success = self.test_success and box_shape_dimensions == dimensions_to_set - self.log(f"Component update: {box_shape_dimensions == dimensions_to_set}") + Report.result(Tests.component_updated, box_shape_dimensions == dimensions_to_set) # Remove the component child_entity.remove_component("Box Shape") - component_rem_success = self.wait_for_condition(lambda: not hydra.has_components(child_entity.id, ["Box Shape"]), - 5.0) - self.test_success = self.test_success and component_rem_success - self.log(f"Remove component: {component_rem_success}") + component_rem_success = await pyside_utils.wait_for_condition(lambda: not hydra.has_components(child_entity.id, + ["Box Shape"]), 5.0) + Report.result(Tests.component_removed, component_rem_success) # 4) Save the level save_level_action = pyside_utils.get_action_for_menu_path(editor_window, "File", "Save") @@ -143,12 +156,15 @@ class TestBasicEditorWorkflows(EditorTestHelper): export_action = pyside_utils.get_action_for_menu_path(editor_window, "Game", "Export to Engine") pyside_utils.trigger_action_async(export_action) level_pak_file = os.path.join( - "AutomatedTesting", "Levels", self.args["level"], "level.pak" + "AutomatedTesting", "Levels", level, "level.pak" ) - export_success = self.wait_for_condition(lambda: os.path.exists(level_pak_file), 5.0) - self.test_success = self.test_success and export_success - self.log(f"Save and Export: {export_success}") + export_success = await pyside_utils.wait_for_condition(lambda: os.path.exists(level_pak_file), 5.0) + Report.result(Tests.level_saved_and_exported, export_success) + + BasicEditorWorkflows_LevelEntityComponentCRUD() -test = TestBasicEditorWorkflows() -test.run() +if __name__ == "__main__": + + from editor_python_test_tools.utils import Report + Report.start_test(RunTest) diff --git a/AutomatedTesting/Gem/PythonTests/editor/test_Editor_Main.py b/AutomatedTesting/Gem/PythonTests/editor/test_Editor_Main.py new file mode 100644 index 0000000000..26b254ae71 --- /dev/null +++ b/AutomatedTesting/Gem/PythonTests/editor/test_Editor_Main.py @@ -0,0 +1,43 @@ +""" +Copyright (c) Contributors to the Open 3D Engine Project. +For complete copyright and license terms please see the LICENSE at the root of this distribution. + +SPDX-License-Identifier: Apache-2.0 OR MIT +""" + +import os +import pytest +import sys + +import ly_test_tools.environment.file_system as file_system + +sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/../automatedtesting_shared') +from base import TestAutomationBase + + +@pytest.fixture +def remove_test_level(request, workspace, project): + file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", "tmp_level")], True, True) + + def teardown(): + file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", "tmp_level")], True, True) + + request.addfinalizer(teardown) + + +@pytest.mark.SUITE_main +@pytest.mark.parametrize("launcher_platform", ['windows_editor']) +@pytest.mark.parametrize("project", ["AutomatedTesting"]) +class TestAutomation(TestAutomationBase): + + def test_BasicEditorWorkflows_LevelEntityComponentCRUD(self, request, workspace, editor, launcher_platform, + remove_test_level): + from .EditorScripts import BasicEditorWorkflows_LevelEntityComponentCRUD as test_module + self._run_test(request, workspace, editor, test_module, batch_mode=False, autotest_mode=False) + + @pytest.mark.REQUIRES_gpu + def test_BasicEditorWorkflows_GPU_LevelEntityComponentCRUD(self, request, workspace, editor, launcher_platform, + remove_test_level): + from .EditorScripts import BasicEditorWorkflows_LevelEntityComponentCRUD as test_module + self._run_test(request, workspace, editor, test_module, batch_mode=False, autotest_mode=False, + use_null_renderer=False) diff --git a/AutomatedTesting/Gem/PythonTests/editor/test_Editor_Main_Optimized.py b/AutomatedTesting/Gem/PythonTests/editor/test_Editor_Main_Optimized.py new file mode 100644 index 0000000000..ac9c46e4e7 --- /dev/null +++ b/AutomatedTesting/Gem/PythonTests/editor/test_Editor_Main_Optimized.py @@ -0,0 +1,38 @@ +""" +Copyright (c) Contributors to the Open 3D Engine Project. +For complete copyright and license terms please see the LICENSE at the root of this distribution. + +SPDX-License-Identifier: Apache-2.0 OR MIT +""" + +import os +import pytest + +import ly_test_tools.environment.file_system as file_system +from ly_test_tools.o3de.editor_test import EditorSingleTest, EditorSharedTest, EditorParallelTest, EditorTestSuite + + +@pytest.mark.SUITE_main +@pytest.mark.parametrize("launcher_platform", ['windows_editor']) +@pytest.mark.parametrize("project", ["AutomatedTesting"]) +class TestAutomation(EditorTestSuite): + + class test_BasicEditorWorkflows_LevelEntityComponentCRUD(EditorSingleTest): + # Disable -BatchMode and -autotest_mode + EditorTestSuite.global_extra_cmdline_args = [] + # Custom teardown to remove slice asset created during test + def teardown(self, request, workspace, editor, editor_test_results, launcher_platform): + file_system.delete([os.path.join(workspace.paths.engine_root(), "AutomatedTesting", "Levels", "tmp_level")], + True, True) + from .EditorScripts import BasicEditorWorkflows_LevelEntityComponentCRUD as test_module + + @pytest.mark.REQUIRES_gpu + class test_BasicEditorWorkflows_GPU_LevelEntityComponentCRUD(EditorSingleTest): + # Disable -BatchMode, -autotest_mode, and null renderer + EditorTestSuite.global_extra_cmdline_args = [] + use_null_renderer = False + # Custom teardown to remove slice asset created during test + def teardown(self, request, workspace, editor, editor_test_results, launcher_platform): + file_system.delete([os.path.join(workspace.paths.engine_root(), "AutomatedTesting", "Levels", "tmp_level")], + True, True) + from .EditorScripts import BasicEditorWorkflows_LevelEntityComponentCRUD as test_module \ No newline at end of file From 182d41056254938e75fb36e05584f904a48e147b Mon Sep 17 00:00:00 2001 From: jckand-amzn Date: Fri, 20 Aug 2021 16:29:48 -0500 Subject: [PATCH 007/131] Updating base.py to allow for turning off batch and autotest modes Signed-off-by: jckand-amzn --- .../Gem/PythonTests/automatedtesting_shared/base.py | 10 +++++++--- .../BasicEditorWorkflows_LevelEntityComponentCRUD.py | 11 ++++++----- .../PythonTests/editor/test_Editor_Main_Optimized.py | 6 ++++-- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/AutomatedTesting/Gem/PythonTests/automatedtesting_shared/base.py b/AutomatedTesting/Gem/PythonTests/automatedtesting_shared/base.py index e6c28be2a5..f5cd66cbbe 100755 --- a/AutomatedTesting/Gem/PythonTests/automatedtesting_shared/base.py +++ b/AutomatedTesting/Gem/PythonTests/automatedtesting_shared/base.py @@ -51,8 +51,8 @@ class TestAutomationBase: cls.asset_processor.teardown() cls._kill_ly_processes() - - def _run_test(self, request, workspace, editor, testcase_module, extra_cmdline_args=[], use_null_renderer=True): + def _run_test(self, request, workspace, editor, testcase_module, extra_cmdline_args=[], batch_mode=True, + autotest_mode=True, use_null_renderer=True): test_starttime = time.time() self.logger = logging.getLogger(__name__) errors = [] @@ -90,9 +90,13 @@ class TestAutomationBase: editor_starttime = time.time() self.logger.debug("Running automated test") testcase_module_filepath = self._get_testcase_module_filepath(testcase_module) - pycmd = ["--runpythontest", testcase_module_filepath, "-BatchMode", "-autotest_mode", f"-pythontestcase={request.node.originalname}"] + pycmd = ["--runpythontest", testcase_module_filepath, f"-pythontestcase={request.node.originalname}"] if use_null_renderer: pycmd += ["-rhi=null"] + if batch_mode: + pycmd += ["-BatchMode"] + if autotest_mode: + pycmd += ["-autotest_mode"] pycmd += extra_cmdline_args editor.args.extend(pycmd) # args are added to the WinLauncher start command editor.start(backupFiles = False, launch_ap = False) diff --git a/AutomatedTesting/Gem/PythonTests/editor/EditorScripts/BasicEditorWorkflows_LevelEntityComponentCRUD.py b/AutomatedTesting/Gem/PythonTests/editor/EditorScripts/BasicEditorWorkflows_LevelEntityComponentCRUD.py index 906e28bf8d..9c5880ab1e 100644 --- a/AutomatedTesting/Gem/PythonTests/editor/EditorScripts/BasicEditorWorkflows_LevelEntityComponentCRUD.py +++ b/AutomatedTesting/Gem/PythonTests/editor/EditorScripts/BasicEditorWorkflows_LevelEntityComponentCRUD.py @@ -37,12 +37,12 @@ class Tests: ) -def RunTest(): +def BasicEditorWorkflows_LevelEntityComponentCRUD(): import editor_python_test_tools.pyside_utils as pyside_utils @pyside_utils.wrap_async - async def BasicEditorWorkflows_LevelEntityComponentCRUD(): + async def run_test(): """ Summary: Open O3DE editor and check if basic Editor workflows are completable. @@ -139,7 +139,8 @@ def RunTest(): # Update the component dimensions_to_set = math.Vector3(16.0, 16.0, 16.0) child_entity.get_set_test(0, "Box Shape|Box Configuration|Dimensions", dimensions_to_set) - box_shape_dimensions = hydra.get_component_property_value(child_entity.components[0], "Box Shape|Box Configuration|Dimensions") + box_shape_dimensions = hydra.get_component_property_value(child_entity.components[0], + "Box Shape|Box Configuration|Dimensions") Report.result(Tests.component_updated, box_shape_dimensions == dimensions_to_set) # Remove the component @@ -161,10 +162,10 @@ def RunTest(): export_success = await pyside_utils.wait_for_condition(lambda: os.path.exists(level_pak_file), 5.0) Report.result(Tests.level_saved_and_exported, export_success) - BasicEditorWorkflows_LevelEntityComponentCRUD() + run_test() if __name__ == "__main__": from editor_python_test_tools.utils import Report - Report.start_test(RunTest) + Report.start_test(BasicEditorWorkflows_LevelEntityComponentCRUD) diff --git a/AutomatedTesting/Gem/PythonTests/editor/test_Editor_Main_Optimized.py b/AutomatedTesting/Gem/PythonTests/editor/test_Editor_Main_Optimized.py index ac9c46e4e7..dffba9b983 100644 --- a/AutomatedTesting/Gem/PythonTests/editor/test_Editor_Main_Optimized.py +++ b/AutomatedTesting/Gem/PythonTests/editor/test_Editor_Main_Optimized.py @@ -20,6 +20,7 @@ class TestAutomation(EditorTestSuite): class test_BasicEditorWorkflows_LevelEntityComponentCRUD(EditorSingleTest): # Disable -BatchMode and -autotest_mode EditorTestSuite.global_extra_cmdline_args = [] + # Custom teardown to remove slice asset created during test def teardown(self, request, workspace, editor, editor_test_results, launcher_platform): file_system.delete([os.path.join(workspace.paths.engine_root(), "AutomatedTesting", "Levels", "tmp_level")], @@ -30,9 +31,10 @@ class TestAutomation(EditorTestSuite): class test_BasicEditorWorkflows_GPU_LevelEntityComponentCRUD(EditorSingleTest): # Disable -BatchMode, -autotest_mode, and null renderer EditorTestSuite.global_extra_cmdline_args = [] - use_null_renderer = False + EditorTestSuite.use_null_renderer = False + # Custom teardown to remove slice asset created during test def teardown(self, request, workspace, editor, editor_test_results, launcher_platform): file_system.delete([os.path.join(workspace.paths.engine_root(), "AutomatedTesting", "Levels", "tmp_level")], True, True) - from .EditorScripts import BasicEditorWorkflows_LevelEntityComponentCRUD as test_module \ No newline at end of file + from .EditorScripts import BasicEditorWorkflows_LevelEntityComponentCRUD as test_module From 9245a31196fe120943a1af20033b09db4948746b Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Fri, 20 Aug 2021 14:48:42 -0700 Subject: [PATCH 008/131] more fixes for Code Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Code/Editor/EditorViewportWidget.cpp | 18 ++++++------ Code/Framework/AzCore/AzCore/Math/Guid.h | 2 +- .../AzCore/AzCore/Memory/AllocatorScope.h | 2 +- Code/Framework/AzCore/AzCore/RTTI/RTTI.h | 4 +-- Code/Framework/AzCore/AzCore/base.h | 2 +- Code/Framework/AzCore/Tests/AZStd/Variant.cpp | 2 -- .../Tests/Asset/AssetDataStreamTests.cpp | 2 +- .../Asset/AssetManagerStreamingTests.cpp | 2 +- .../Tests/Debug/LocalFileEventLoggerTests.cpp | 4 ++- Code/Framework/AzCore/Tests/EBus.cpp | 4 +-- Code/Framework/AzCore/Tests/EnumTests.cpp | 2 +- .../AzCore/Tests/GenericStreamTests.cpp | 2 +- Code/Framework/AzCore/Tests/Jobs.cpp | 2 +- Code/Framework/AzCore/Tests/Math/CrcTests.cpp | 2 +- .../Framework/AzCore/Tests/Name/NameTests.cpp | 4 --- Code/Framework/AzCore/Tests/Rtti.cpp | 5 ++-- .../Json/BasicContainerSerializerTests.cpp | 5 ---- .../Serialization/Json/IntSerializerTests.cpp | 1 + .../Json/JsonSerializationTests.cpp | 1 - .../Json/MathMatrixSerializerTests.cpp | 2 +- .../StreamStackEntryConformityTests.h | 2 +- .../AzFramework/Tests/ArchiveTests.cpp | 3 +- .../SpawnableEntitiesManagerTests.cpp | 14 +++++++--- .../Components/DockBarButton.cpp | 1 - .../Components/FilteredSearchWidget.cpp | 2 +- .../Components/Widgets/Eyedropper.h | 2 +- .../Components/Widgets/GradientSlider.cpp | 3 +- .../Components/Widgets/Slider.cpp | 4 +-- .../Components/WindowDecorationWrapper.cpp | 1 - .../AzQtComponents/Utilities/ScreenGrabber.h | 2 +- .../Utilities/ScreenGrabber_win.cpp | 2 +- Code/Framework/AzTest/AzTest/Utils.cpp | 1 + .../Application/ToolsApplication.cpp | 5 ---- .../AssetDatabase/AssetDatabaseConnection.cpp | 28 +++++++++++++++++++ .../AssetDatabase/AssetDatabaseConnection.h | 20 ------------- .../Component/EditorComponentAPIComponent.cpp | 2 +- .../Entity/EditorEntityHelpers.cpp | 2 +- .../SliceEditorEntityOwnershipService.cpp | 1 - .../Manipulators/EditorVertexSelection.cpp | 2 +- .../Instance/InstanceToTemplatePropagator.cpp | 2 -- .../Prefab/PrefabPublicHandler.cpp | 3 -- .../AzToolsFramework/Slice/SliceUtilities.cpp | 6 ++-- .../Thumbnails/LoadingThumbnail.cpp | 1 - .../Thumbnails/LoadingThumbnail.h | 1 - .../UI/Layer/LayerUiHandler.cpp | 3 -- .../UI/Outliner/EntityOutlinerListModel.cpp | 6 +--- .../UI/Prefab/PrefabIntegrationManager.cpp | 14 +++++----- .../PropertyEditor/EntityPropertyEditor.cpp | 4 +-- .../UI/PropertyEditor/PropertyAssetCtrl.cpp | 2 +- .../ReflectedPropertyEditor.cpp | 2 +- .../UI/Slice/SlicePushWidget.cpp | 2 +- .../UI/UICore/QTreeViewStateSaver.hxx | 1 - Code/Legacy/CryCommon/CryLibrary.h | 4 +-- .../LevelSystem/SpawnableLevelSystem.cpp | 2 +- 54 files changed, 97 insertions(+), 121 deletions(-) diff --git a/Code/Editor/EditorViewportWidget.cpp b/Code/Editor/EditorViewportWidget.cpp index c305b1be6c..71461f14f2 100644 --- a/Code/Editor/EditorViewportWidget.cpp +++ b/Code/Editor/EditorViewportWidget.cpp @@ -1975,12 +1975,12 @@ Vec3 EditorViewportWidget::ViewToWorld( { AZ_PROFILE_FUNCTION(Editor); - AZ_UNUSED(collideWithTerrain) - AZ_UNUSED(onlyTerrain) - AZ_UNUSED(bTestRenderMesh) - AZ_UNUSED(bSkipVegetation) - AZ_UNUSED(bSkipVegetation) - AZ_UNUSED(collideWithObject) + AZ_UNUSED(collideWithTerrain); + AZ_UNUSED(onlyTerrain); + AZ_UNUSED(bTestRenderMesh); + AZ_UNUSED(bSkipVegetation); + AZ_UNUSED(bSkipVegetation); + AZ_UNUSED(collideWithObject); auto ray = m_renderViewport->ViewportScreenToWorldRay(AzToolsFramework::ViewportInteraction::ScreenPointFromQPoint(vp)); if (!ray.has_value()) @@ -2004,9 +2004,9 @@ Vec3 EditorViewportWidget::ViewToWorld( ////////////////////////////////////////////////////////////////////////// Vec3 EditorViewportWidget::ViewToWorldNormal(const QPoint& vp, bool onlyTerrain, bool bTestRenderMesh) { - AZ_UNUSED(vp) - AZ_UNUSED(onlyTerrain) - AZ_UNUSED(bTestRenderMesh) + AZ_UNUSED(vp); + AZ_UNUSED(onlyTerrain); + AZ_UNUSED(bTestRenderMesh); AZ_PROFILE_FUNCTION(Editor); diff --git a/Code/Framework/AzCore/AzCore/Math/Guid.h b/Code/Framework/AzCore/AzCore/Math/Guid.h index 15c4c52742..e2a56f86d8 100644 --- a/Code/Framework/AzCore/AzCore/Math/Guid.h +++ b/Code/Framework/AzCore/AzCore/Math/Guid.h @@ -66,7 +66,7 @@ typedef const GUID& REFIID; const GUID name \ = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } } -REFGUID GUID_NULL() +inline static REFGUID GUID_NULL() { static GUID guid = { 0x00000000L, 0x0000, 0x0000, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} }; return guid; diff --git a/Code/Framework/AzCore/AzCore/Memory/AllocatorScope.h b/Code/Framework/AzCore/AzCore/Memory/AllocatorScope.h index 3d97a3042d..7637db3967 100644 --- a/Code/Framework/AzCore/AzCore/Memory/AllocatorScope.h +++ b/Code/Framework/AzCore/AzCore/Memory/AllocatorScope.h @@ -22,7 +22,7 @@ namespace AZ { // Note the parameter pack expansion, this creates the equivalent of a fold expression // For each type, call InitAllocator(), then put 0 in the initializer list - std::initializer_list init{(InitAllocator(), 0)...}; + [[maybe_unused]] std::initializer_list init{(InitAllocator(), 0)...}; } void DeactivateAllocators() diff --git a/Code/Framework/AzCore/AzCore/RTTI/RTTI.h b/Code/Framework/AzCore/AzCore/RTTI/RTTI.h index 1dddf76556..fa081a9497 100644 --- a/Code/Framework/AzCore/AzCore/RTTI/RTTI.h +++ b/Code/Framework/AzCore/AzCore/RTTI/RTTI.h @@ -493,7 +493,7 @@ namespace AZ const void* result = GetTypeId() == asType ? instance : nullptr; using dummy = bool[]; - dummy{ true, (CastInternal(result, instance, asType), true)... }; + [[maybe_unused]] dummy d { true, (CastInternal(result, instance, asType), true)... }; return result; } @@ -534,7 +534,7 @@ namespace AZ callback(GetActualUuid(instance), instance); using dummy = bool[]; - dummy{ true, (RttiHelper{}.EnumHierarchy(callback, instance), true)... }; + [[maybe_unused]] dummy d = { true, (RttiHelper{}.EnumHierarchy(callback, instance), true)... }; } TypeTraits GetTypeTraits() const override { diff --git a/Code/Framework/AzCore/AzCore/base.h b/Code/Framework/AzCore/AzCore/base.h index 20f5c17b27..f6ae39dcda 100644 --- a/Code/Framework/AzCore/AzCore/base.h +++ b/Code/Framework/AzCore/AzCore/base.h @@ -293,7 +293,7 @@ namespace AZ #define AZ_DEFAULT_COPY_MOVE(_Class) AZ_DEFAULT_COPY(_Class) AZ_DEFAULT_MOVE(_Class) // Macro that can be used to avoid unreferenced variable warnings -#define AZ_UNUSED(x) (void)x; +#define AZ_UNUSED(x) (void)x #define AZ_DEFINE_ENUM_BITWISE_OPERATORS(EnumType) \ inline constexpr EnumType operator | (EnumType a, EnumType b) \ diff --git a/Code/Framework/AzCore/Tests/AZStd/Variant.cpp b/Code/Framework/AzCore/Tests/AZStd/Variant.cpp index 824a99fa88..700574323c 100644 --- a/Code/Framework/AzCore/Tests/AZStd/Variant.cpp +++ b/Code/Framework/AzCore/Tests/AZStd/Variant.cpp @@ -318,8 +318,6 @@ namespace UnitTest using TestVariant2 = AZStd::variant; static_assert(sizeof(TestVariant1) == sizeof(TestVariant2), "with different permutations variants of same types should be the same size"); using UnorderedVariant3 = AZStd::variant, TestAlignedStorage>; - constexpr size_t testVariant1Size = sizeof(TestVariant1); - constexpr size_t unorderedVariant3Size = sizeof(UnorderedVariant3); static_assert(sizeof(TestVariant1) == sizeof(UnorderedVariant3), "with different permutations variants of same types should be the same size"); } diff --git a/Code/Framework/AzCore/Tests/Asset/AssetDataStreamTests.cpp b/Code/Framework/AzCore/Tests/Asset/AssetDataStreamTests.cpp index efcc62682a..27903495f1 100644 --- a/Code/Framework/AzCore/Tests/Asset/AssetDataStreamTests.cpp +++ b/Code/Framework/AzCore/Tests/Asset/AssetDataStreamTests.cpp @@ -297,7 +297,7 @@ TEST_F(AssetDataStreamTest, IsFullyLoaded_FileDoesNotReadAllData_DataIsNotFullyL using ::testing::_; ON_CALL(m_mockStreamer, GetReadRequestResult(_, _, _, _)) - .WillByDefault([this, incompleteAssetSize]( + .WillByDefault([this]( [[maybe_unused]] FileRequestHandle request, void*& buffer, AZ::u64& numBytesRead, diff --git a/Code/Framework/AzCore/Tests/Asset/AssetManagerStreamingTests.cpp b/Code/Framework/AzCore/Tests/Asset/AssetManagerStreamingTests.cpp index 0fd792b444..46ff4ff3e7 100644 --- a/Code/Framework/AzCore/Tests/Asset/AssetManagerStreamingTests.cpp +++ b/Code/Framework/AzCore/Tests/Asset/AssetManagerStreamingTests.cpp @@ -72,7 +72,7 @@ namespace UnitTest }); ON_CALL(m_mockStreamer, GetRequestStatus(_)) - .WillByDefault([this]([[maybe_unused]] FileRequestHandle request) + .WillByDefault([]([[maybe_unused]] FileRequestHandle request) { // Return whatever request status has been set in this class return IO::IStreamerTypes::RequestStatus::Completed; diff --git a/Code/Framework/AzCore/Tests/Debug/LocalFileEventLoggerTests.cpp b/Code/Framework/AzCore/Tests/Debug/LocalFileEventLoggerTests.cpp index 11f32de42f..242ac0e65d 100644 --- a/Code/Framework/AzCore/Tests/Debug/LocalFileEventLoggerTests.cpp +++ b/Code/Framework/AzCore/Tests/Debug/LocalFileEventLoggerTests.cpp @@ -226,8 +226,10 @@ namespace AZ::Debug AZStd::thread threads[totalThreads]; for (size_t threadIndex = 0; threadIndex < totalThreads; ++threadIndex) { - threads[threadIndex] = AZStd::thread([&startLogging, &totalRecordsWritten, &message, recordsPerThreadCount]() + threads[threadIndex] = AZStd::thread([&startLogging, &message, &totalRecordsWritten]() { + AZ_UNUSED(message); + while (!startLogging) { AZStd::this_thread::yield(); diff --git a/Code/Framework/AzCore/Tests/EBus.cpp b/Code/Framework/AzCore/Tests/EBus.cpp index c30c9ed62d..10216a0485 100644 --- a/Code/Framework/AzCore/Tests/EBus.cpp +++ b/Code/Framework/AzCore/Tests/EBus.cpp @@ -2837,7 +2837,7 @@ namespace UnitTest handlerList.emplace_back(i, maxSleep); } - auto work = [maxSleep, threadCount]() + auto work = []() { char sentinel[64] = { 0 }; char* end = sentinel + AZ_ARRAY_SIZE(sentinel); @@ -2923,7 +2923,7 @@ namespace UnitTest MyEventGroupImpl handler; - auto work = [maxSleep, &handler]() + auto work = [&handler]() { for (int i = 1; i < cycleCount; ++i) { diff --git a/Code/Framework/AzCore/Tests/EnumTests.cpp b/Code/Framework/AzCore/Tests/EnumTests.cpp index 7f123a23b4..4c19d3f574 100644 --- a/Code/Framework/AzCore/Tests/EnumTests.cpp +++ b/Code/Framework/AzCore/Tests/EnumTests.cpp @@ -81,7 +81,7 @@ namespace UnitTest auto EnumerateTestEnum = []() constexpr -> bool { int count = 0; - for (TestEnumEnumeratorValueAndString enumMember : TestEnumMembers) + for ([[maybe_unused]] TestEnumEnumeratorValueAndString enumMember : TestEnumMembers) { ++count; } diff --git a/Code/Framework/AzCore/Tests/GenericStreamTests.cpp b/Code/Framework/AzCore/Tests/GenericStreamTests.cpp index 5f6190ac76..4f21c1e593 100644 --- a/Code/Framework/AzCore/Tests/GenericStreamTests.cpp +++ b/Code/Framework/AzCore/Tests/GenericStreamTests.cpp @@ -62,7 +62,7 @@ public: // Reroute the mock stream to our output MemoryStream for writing. ON_CALL(m_mockGenericStream, Write(_, _)) - .WillByDefault([this, &outputStream](AZ::IO::SizeType bytes, const void* buffer) + .WillByDefault([&outputStream](AZ::IO::SizeType bytes, const void* buffer) { return outputStream.Write(bytes, buffer); }); diff --git a/Code/Framework/AzCore/Tests/Jobs.cpp b/Code/Framework/AzCore/Tests/Jobs.cpp index 0eb46a0051..b88e1f5b32 100644 --- a/Code/Framework/AzCore/Tests/Jobs.cpp +++ b/Code/Framework/AzCore/Tests/Jobs.cpp @@ -1361,7 +1361,7 @@ namespace UnitTest AZ::JobCompletion completion; // Push a parent job that pushes the work as child jobs (requires the current job, so this is a real world test of "functor with current job as param") - AZ::Job* parentJob = AZ::CreateJobFunction([this, &jobData, JobCount](AZ::Job& thisJob) + AZ::Job* parentJob = AZ::CreateJobFunction([this, &jobData](AZ::Job& thisJob) { EXPECT_EQ(m_jobManager->GetCurrentJob(), &thisJob); diff --git a/Code/Framework/AzCore/Tests/Math/CrcTests.cpp b/Code/Framework/AzCore/Tests/Math/CrcTests.cpp index 04d2e3d8cb..0255c1ad6d 100644 --- a/Code/Framework/AzCore/Tests/Math/CrcTests.cpp +++ b/Code/Framework/AzCore/Tests/Math/CrcTests.cpp @@ -56,7 +56,7 @@ namespace Benchmark // This function only exist to calculate AZ::Crc32 values at compile time for (auto _ : state) { - constexpr auto resultArray = Crc32Internal::GenerateTestCrc32Values(); + [[maybe_unused]] constexpr auto resultArray = Crc32Internal::GenerateTestCrc32Values(); } } diff --git a/Code/Framework/AzCore/Tests/Name/NameTests.cpp b/Code/Framework/AzCore/Tests/Name/NameTests.cpp index 3b6310b1de..6cbf6f1b88 100644 --- a/Code/Framework/AzCore/Tests/Name/NameTests.cpp +++ b/Code/Framework/AzCore/Tests/Name/NameTests.cpp @@ -582,7 +582,6 @@ namespace UnitTest TEST_F(NameTest, ConcurrencyDataTest_EachThreadCreatesOneName_NoCollision) { - const uint32_t maxUniqueHashes = std::numeric_limits::max(); AZ::NameDictionary::Destroy(); AZ::NameDictionary::Create(); @@ -592,7 +591,6 @@ namespace UnitTest TEST_F(NameTest, ConcurrencyDataTest_EachThreadCreatesOneName_HighCollisions) { - const uint32_t maxUniqueHashes = 25; AZ::NameDictionary::Destroy(); AZ::NameDictionary::Create(); @@ -602,7 +600,6 @@ namespace UnitTest TEST_F(NameTest, ConcurrencyDataTest_EachThreadRepeatedlyCreatesAndReleasesOneName_NoCollision) { - const uint32_t maxUniqueHashes = std::numeric_limits::max(); AZ::NameDictionary::Destroy(); AZ::NameDictionary::Create(); @@ -613,7 +610,6 @@ namespace UnitTest TEST_F(NameTest, ConcurrencyDataTest_EachThreadRepeatedlyCreatesAndReleasesOneName_HighCollisions) { - const uint32_t maxUniqueHashes = 25; AZ::NameDictionary::Destroy(); AZ::NameDictionary::Create(); diff --git a/Code/Framework/AzCore/Tests/Rtti.cpp b/Code/Framework/AzCore/Tests/Rtti.cpp index 862482d10a..935df848c2 100644 --- a/Code/Framework/AzCore/Tests/Rtti.cpp +++ b/Code/Framework/AzCore/Tests/Rtti.cpp @@ -171,7 +171,6 @@ namespace UnitTest AZ_TEST_ASSERT(AzGenericTypeInfo::Uuid() == templateUuid); // Check all combinations return a valid id. - Uuid nullId = Uuid::CreateNull(); AZ_TEST_ASSERT(AzGenericTypeInfo::Uuid() == AZ::Uuid("{911B2EA8-CCB1-4F0C-A535-540AD00173AE}")); AZ_TEST_ASSERT(AzGenericTypeInfo::Uuid() == AZ::Uuid("{6BAE9836-EC49-466A-85F2-F4B1B70839FB}")); AZ_TEST_ASSERT(AzGenericTypeInfo::Uuid() == AZ::Uuid("{C9F9C644-CCC3-4F77-A792-F5B5DBCA746E}")); @@ -460,8 +459,8 @@ namespace UnitTest TEST_F(Rtti, IsAbstract) { // compile time proof that the two non-abstract classes are not abstract at compile time: - ExampleFullImplementationClass one; - ExampleCombined two; + [[maybe_unused]] ExampleFullImplementationClass one; + [[maybe_unused]] ExampleCombined two; ASSERT_NE(GetRttiHelper(), nullptr); ASSERT_NE(GetRttiHelper(), nullptr); diff --git a/Code/Framework/AzCore/Tests/Serialization/Json/BasicContainerSerializerTests.cpp b/Code/Framework/AzCore/Tests/Serialization/Json/BasicContainerSerializerTests.cpp index 6839afac6d..3bc574c2ce 100644 --- a/Code/Framework/AzCore/Tests/Serialization/Json/BasicContainerSerializerTests.cpp +++ b/Code/Framework/AzCore/Tests/Serialization/Json/BasicContainerSerializerTests.cpp @@ -144,11 +144,6 @@ namespace JsonSerializationTests { return false; } - - auto compare = [](const int* lhs, const int* rhs) -> bool - { - return *lhs == *rhs; - }; return AZStd::equal(lhs.begin(), lhs.end(), rhs.begin(), SimplePointerTestDescriptionCompare{}); } }; diff --git a/Code/Framework/AzCore/Tests/Serialization/Json/IntSerializerTests.cpp b/Code/Framework/AzCore/Tests/Serialization/Json/IntSerializerTests.cpp index c971535f0b..9aca0b8e47 100644 --- a/Code/Framework/AzCore/Tests/Serialization/Json/IntSerializerTests.cpp +++ b/Code/Framework/AzCore/Tests/Serialization/Json/IntSerializerTests.cpp @@ -544,6 +544,7 @@ namespace JsonSerializationTests ResultCode result = this->m_serializer->Store(convertedValue, &value, nullptr, azrtti_typeid::DataType>(), *this->m_jsonSerializationContext); + EXPECT_EQ(Outcomes::Success, result.GetOutcome()); if constexpr (AZStd::is_signed::DataType>::value) { diff --git a/Code/Framework/AzCore/Tests/Serialization/Json/JsonSerializationTests.cpp b/Code/Framework/AzCore/Tests/Serialization/Json/JsonSerializationTests.cpp index 76624a0d44..20d956cd8a 100644 --- a/Code/Framework/AzCore/Tests/Serialization/Json/JsonSerializationTests.cpp +++ b/Code/Framework/AzCore/Tests/Serialization/Json/JsonSerializationTests.cpp @@ -560,7 +560,6 @@ namespace JsonSerializationTests { using namespace AZ::JsonSerializationResult; - TemplatedClass instance; ResultCode result = AZ::JsonSerialization::Store(*m_jsonDocument, m_jsonDocument->GetAllocator(), nullptr, nullptr, azrtti_typeid(), *m_serializationSettings); diff --git a/Code/Framework/AzCore/Tests/Serialization/Json/MathMatrixSerializerTests.cpp b/Code/Framework/AzCore/Tests/Serialization/Json/MathMatrixSerializerTests.cpp index 1126aeb662..be51b3bf74 100644 --- a/Code/Framework/AzCore/Tests/Serialization/Json/MathMatrixSerializerTests.cpp +++ b/Code/Framework/AzCore/Tests/Serialization/Json/MathMatrixSerializerTests.cpp @@ -469,6 +469,7 @@ namespace JsonSerializationTests *this->m_jsonDocument, *this->m_jsonDeserializationContext); + ASSERT_EQ(Outcomes::Success, result.GetOutcome()); EXPECT_TRUE(defaultValue == output); } @@ -503,7 +504,6 @@ namespace JsonSerializationTests using namespace AZ::JsonSerializationResult; using Descriptor = typename JsonMathMatrixSerializerTests::Descriptor; - const auto defaultValue = Descriptor::MatrixType::CreateIdentity(); rapidjson::Value& objectValue = this->m_jsonDocument->SetObject(); auto input = Descriptor::MatrixType::CreateIdentity(); DataHelper::AddData(objectValue, input, this->m_jsonDocument->GetAllocator()); diff --git a/Code/Framework/AzCore/Tests/Streamer/StreamStackEntryConformityTests.h b/Code/Framework/AzCore/Tests/Streamer/StreamStackEntryConformityTests.h index e6084fe115..7162b6efa0 100644 --- a/Code/Framework/AzCore/Tests/Streamer/StreamStackEntryConformityTests.h +++ b/Code/Framework/AzCore/Tests/Streamer/StreamStackEntryConformityTests.h @@ -250,7 +250,7 @@ namespace AZ::IO constexpr s32 minValue = std::numeric_limits::min(); EXPECT_CALL(*mock, UpdateStatus(_)) - .WillOnce([minValue](StreamStackEntry::Status& status) + .WillOnce([](StreamStackEntry::Status& status) { status.m_numAvailableSlots = minValue; }); diff --git a/Code/Framework/AzFramework/Tests/ArchiveTests.cpp b/Code/Framework/AzFramework/Tests/ArchiveTests.cpp index 11495ec5d7..2caaf6ee71 100644 --- a/Code/Framework/AzFramework/Tests/ArchiveTests.cpp +++ b/Code/Framework/AzFramework/Tests/ArchiveTests.cpp @@ -84,7 +84,7 @@ namespace UnitTest for (AZ::u32 threadIdx = 0; threadIdx < numThreads; ++threadIdx) { - auto threadFunctor = [&testFunction, testIteration, threadIdx, &successCount]() + auto threadFunctor = [&testFunction, &successCount]() { // Add some variability to thread timing by yielding each thread AZStd::this_thread::yield(); @@ -769,7 +769,6 @@ namespace UnitTest AZStd::intrusive_ptr pArchive = archive->OpenArchive(testArchivePath, nullptr, AZ::IO::INestedArchive::FLAGS_CREATE_NEW); EXPECT_NE(nullptr, pArchive); - char fillBuffer[32] = "Test"; EXPECT_EQ(0, pArchive->UpdateFile("foundit.dat", const_cast("test"), 4, AZ::IO::INestedArchive::METHOD_COMPRESS, AZ::IO::INestedArchive::LEVEL_BEST)); pArchive.reset(); diff --git a/Code/Framework/AzFramework/Tests/Spawnable/SpawnableEntitiesManagerTests.cpp b/Code/Framework/AzFramework/Tests/Spawnable/SpawnableEntitiesManagerTests.cpp index f68af08f4a..407ab1d21f 100644 --- a/Code/Framework/AzFramework/Tests/Spawnable/SpawnableEntitiesManagerTests.cpp +++ b/Code/Framework/AzFramework/Tests/Spawnable/SpawnableEntitiesManagerTests.cpp @@ -313,7 +313,7 @@ namespace UnitTest FillSpawnable(NumEntities); CreateEntityReferences(refScheme); - auto callback = [this, refScheme, NumEntities] + auto callback = [this, refScheme] (AzFramework::EntitySpawnTicket::Id, AzFramework::SpawnableConstEntityContainerView entities) { ValidateEntityReferences(refScheme, NumEntities, entities); @@ -346,7 +346,7 @@ namespace UnitTest FillSpawnable(NumEntities); CreateEntityReferences(refScheme); - auto callback = [this, refScheme, NumEntities] + auto callback = [this, refScheme] (AzFramework::EntitySpawnTicket::Id, AzFramework::SpawnableConstEntityContainerView entities) { ValidateEntityReferences(refScheme, NumEntities, entities); @@ -572,6 +572,8 @@ namespace UnitTest auto callback = [this, refScheme, NumEntities](AzFramework::EntitySpawnTicket::Id, AzFramework::SpawnableConstEntityContainerView entities) { + AZ_UNUSED(refScheme); + AZ_UNUSED(NumEntities); ValidateEntityReferences(refScheme, NumEntities, entities); }; @@ -592,6 +594,8 @@ namespace UnitTest auto callback = [this, refScheme, NumEntities](AzFramework::EntitySpawnTicket::Id, AzFramework::SpawnableConstEntityContainerView entities) { + AZ_UNUSED(refScheme); + AZ_UNUSED(NumEntities); ValidateEntityReferences(refScheme, NumEntities, entities); }; @@ -617,7 +621,7 @@ namespace UnitTest CreateEntityReferences(refScheme); auto callback = - [this, refScheme, NumEntities](AzFramework::EntitySpawnTicket::Id, AzFramework::SpawnableConstEntityContainerView entities) + [](AzFramework::EntitySpawnTicket::Id, AzFramework::SpawnableConstEntityContainerView entities) { size_t numElements = entities.size(); @@ -671,7 +675,7 @@ namespace UnitTest CreateEntityReferences(refScheme); auto callback = - [this, refScheme, NumEntities](AzFramework::EntitySpawnTicket::Id, AzFramework::SpawnableConstEntityContainerView entities) + [](AzFramework::EntitySpawnTicket::Id, AzFramework::SpawnableConstEntityContainerView entities) { size_t numElements = entities.size(); @@ -719,6 +723,8 @@ namespace UnitTest auto callback = [this, refScheme, NumEntities](AzFramework::EntitySpawnTicket::Id, AzFramework::SpawnableConstEntityContainerView entities) { + AZ_UNUSED(refScheme); + AZ_UNUSED(NumEntities); ValidateEntityReferences(refScheme, NumEntities, entities); }; diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Components/DockBarButton.cpp b/Code/Framework/AzQtComponents/AzQtComponents/Components/DockBarButton.cpp index 113516c350..e48121c118 100644 --- a/Code/Framework/AzQtComponents/AzQtComponents/Components/DockBarButton.cpp +++ b/Code/Framework/AzQtComponents/AzQtComponents/Components/DockBarButton.cpp @@ -141,7 +141,6 @@ namespace AzQtComponents } QRect buttonRect = style->subControlRect(QStyle::CC_ToolButton, option, QStyle::SC_ToolButton, widget); - QRect menuRect = style->subControlRect(QStyle::CC_ToolButton, option, QStyle::SC_ToolButtonMenu, widget); painter->save(); diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Components/FilteredSearchWidget.cpp b/Code/Framework/AzQtComponents/AzQtComponents/Components/FilteredSearchWidget.cpp index b924eb9776..7fb9942032 100644 --- a/Code/Framework/AzQtComponents/AzQtComponents/Components/FilteredSearchWidget.cpp +++ b/Code/Framework/AzQtComponents/AzQtComponents/Components/FilteredSearchWidget.cpp @@ -852,7 +852,7 @@ namespace AzQtComponents { FilterCriteriaButton* button = createCriteriaButton(filter, index); connect(button, &FilterCriteriaButton::RequestClose, this, [this, index]() { SetFilterStateByIndex(index, false); }); - connect(button, &FilterCriteriaButton::ExtraButtonClicked, this, [this, index](FilterCriteriaButton::ExtraButtonType type) + connect(button, &FilterCriteriaButton::ExtraButtonClicked, this, [](FilterCriteriaButton::ExtraButtonType type) { switch (type) { diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/Eyedropper.h b/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/Eyedropper.h index 68627f534a..741a22e47e 100644 --- a/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/Eyedropper.h +++ b/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/Eyedropper.h @@ -72,7 +72,7 @@ namespace AzQtComponents void release(bool selected); - QToolButton* m_button; + [[maybe_unused]] QToolButton* m_button; int m_contextSize; int m_sampleSize; diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/GradientSlider.cpp b/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/GradientSlider.cpp index a1ebd6c16c..1ffff57ade 100644 --- a/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/GradientSlider.cpp +++ b/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/GradientSlider.cpp @@ -30,7 +30,7 @@ GradientSlider::GradientSlider(Qt::Orientation orientation, QWidget* parent) setMouseTracking(true); - m_colorFunction = [this](qreal value) { + m_colorFunction = [](qreal value) { return QColor::fromRgbF(value, value, value); }; @@ -115,7 +115,6 @@ void GradientSlider::mouseMoveEvent(QMouseEvent* event) int intValue = Slider::valueFromPosition(this, event->pos(), width(), height(), rect().bottom()); qreal value = (aznumeric_cast(intValue - minimum()) / aznumeric_cast(maximum() - minimum())); - QColor rgb = m_colorFunction(value); const QString toolTipText = m_toolTipFunction(value); diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/Slider.cpp b/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/Slider.cpp index f5de3c0c30..14ac2010bc 100644 --- a/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/Slider.cpp +++ b/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/Slider.cpp @@ -490,11 +490,11 @@ QRect Slider::sliderGrooveRect(const Style* style, const QStyleOptionSlider* opt return {}; } -bool Slider::polish(Style* style, QWidget* widget, const Slider::Config& config) +bool Slider::polish([[maybe_unused]] Style* style, QWidget* widget, const Slider::Config& config) { Q_UNUSED(config); - auto polishSlider = [style](auto slider) + auto polishSlider = [](auto slider) { // Qt's stylesheet parsing doesn't set custom properties on things specified via // pseudo-states, such as horizontal/vertical, so we implement our own diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Components/WindowDecorationWrapper.cpp b/Code/Framework/AzQtComponents/AzQtComponents/Components/WindowDecorationWrapper.cpp index 5561ec0c0f..804ea841dd 100644 --- a/Code/Framework/AzQtComponents/AzQtComponents/Components/WindowDecorationWrapper.cpp +++ b/Code/Framework/AzQtComponents/AzQtComponents/Components/WindowDecorationWrapper.cpp @@ -65,7 +65,6 @@ namespace AzQtComponents return false; } - const quint16 currentMajorVersion = 2; quint16 majorVersion = 0; quint16 minorVersion = 0; diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Utilities/ScreenGrabber.h b/Code/Framework/AzQtComponents/AzQtComponents/Utilities/ScreenGrabber.h index b5bbdb6ade..a32aeda3fc 100644 --- a/Code/Framework/AzQtComponents/AzQtComponents/Utilities/ScreenGrabber.h +++ b/Code/Framework/AzQtComponents/AzQtComponents/Utilities/ScreenGrabber.h @@ -31,7 +31,7 @@ namespace AzQtComponents private: QSize m_size; - Eyedropper* m_owner; + [[maybe_unused]] Eyedropper* m_owner; QScopedPointer m_internal; }; diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Utilities/ScreenGrabber_win.cpp b/Code/Framework/AzQtComponents/AzQtComponents/Utilities/ScreenGrabber_win.cpp index 56d0663f88..ba23bea557 100644 --- a/Code/Framework/AzQtComponents/AzQtComponents/Utilities/ScreenGrabber_win.cpp +++ b/Code/Framework/AzQtComponents/AzQtComponents/Utilities/ScreenGrabber_win.cpp @@ -217,7 +217,7 @@ namespace AzQtComponents } ScreenGrabber::ScreenGrabber(const QSize size, Eyedropper* parent /* = nullptr */) - : QObject(static_cast(parent)) + : QObject(parent) , m_size(size) , m_owner(parent) { diff --git a/Code/Framework/AzTest/AzTest/Utils.cpp b/Code/Framework/AzTest/AzTest/Utils.cpp index e8885e6996..7c2c964504 100644 --- a/Code/Framework/AzTest/AzTest/Utils.cpp +++ b/Code/Framework/AzTest/AzTest/Utils.cpp @@ -121,6 +121,7 @@ namespace AZ char** SplitCommandLine(int& size, char* const cmdLine) { std::vector tokens; + [[maybe_unused]] char* next_token = nullptr; char* tok = azstrtok(cmdLine, 0, " ", &next_token); while (tok != NULL) { diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Application/ToolsApplication.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Application/ToolsApplication.cpp index 3e895465e5..ba9a659ba4 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Application/ToolsApplication.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Application/ToolsApplication.cpp @@ -87,11 +87,6 @@ namespace AzToolsFramework { namespace Internal { - static const char* s_engineConfigFileName = "engine.json"; - static const char* s_engineConfigEngineVersionKey = "O3DEVersion"; - - static const char* s_startupLogWindow = "Startup"; - template void DeleteEntities(const IdContainerType& entityIds) { diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/AssetDatabase/AssetDatabaseConnection.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/AssetDatabase/AssetDatabaseConnection.cpp index 7daf573c99..2e8e4ef639 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/AssetDatabase/AssetDatabaseConnection.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/AssetDatabase/AssetDatabaseConnection.cpp @@ -939,6 +939,34 @@ namespace AzToolsFramework jobinfo.m_warningCount = jobDatabaseEntry.m_warningCount; jobinfo.m_errorCount = jobDatabaseEntry.m_errorCount; } + + bool GetDatabaseInfoResult(const char* callName, SQLite::Statement* statement, AssetDatabaseConnection::databaseInfoHandler handler); + bool GetScanFolderResult(const char* callName, SQLite::Statement* statement, AssetDatabaseConnection::scanFolderHandler handler); + bool GetSourceResult(const char* callName, SQLite::Statement* statement, AssetDatabaseConnection::sourceHandler handler); + bool GetSourceAndScanfolderResult(const char* callName, SQLite::Statement* statement, AssetDatabaseConnection::combinedSourceScanFolderHandler handler); + bool GetSourceDependencyResult(const char* callName, SQLite::Statement* statement, AssetDatabaseConnection::sourceFileDependencyHandler handler); + bool GetJobResultSimple(const char* name, SQLite::Statement* statement, AssetDatabaseConnection::jobHandler handler); + bool GetJobResult( + const char* callName, + SQLite::Statement* statement, + AssetDatabaseConnection::jobHandler handler, + AZ::Uuid builderGuid = AZ::Uuid::CreateNull(), + const char* jobKey = nullptr, + AssetSystem::JobStatus status = AssetSystem::JobStatus::Any); + bool GetProductResultSimple(const char* name, SQLite::Statement* statement, AssetDatabaseConnection::productHandler handler); + bool GetProductResult( + const char* callName, + SQLite::Statement* statement, + AssetDatabaseConnection::productHandler handler, + AZ::Uuid builderGuid = AZ::Uuid::CreateNull(), + const char* jobKey = nullptr, + AssetSystem::JobStatus status = AssetSystem::JobStatus::Any); + bool GetLegacySubIDsResult(const char* callname, SQLite::Statement* statement, AssetDatabaseConnection::legacySubIDsHandler handler); + bool GetProductDependencyResult(const char* callName, SQLite::Statement* statement, AssetDatabaseConnection::productDependencyHandler handler); + bool GetProductDependencyAndPathResult(const char* callName, SQLite::Statement* statement, AssetDatabaseConnection::productDependencyAndPathHandler handler); + bool GetMissingProductDependencyResult(const char* callName, SQLite::Statement* statement, AssetDatabaseConnection::missingProductDependencyHandler handler); + bool GetCombinedDependencyResult(const char* callName, SQLite::Statement* statement, AssetDatabaseConnection::combinedProductDependencyHandler handler); + bool GetFileResult(const char* callName, SQLite::Statement* statement, AssetDatabaseConnection::fileHandler handler); } ////////////////////////////////////////////////////////////////////////// diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/AssetDatabase/AssetDatabaseConnection.h b/Code/Framework/AzToolsFramework/AzToolsFramework/AssetDatabase/AssetDatabaseConnection.h index 8672ad4a15..a59dbfbda4 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/AssetDatabase/AssetDatabaseConnection.h +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/AssetDatabase/AssetDatabaseConnection.h @@ -655,26 +655,6 @@ namespace AzToolsFramework // before every query, since validating it essentially must makes sure it exists. AZStd::unordered_set m_validatedTables; }; - - namespace - { - //boiler plate - bool GetDatabaseInfoResult(const char* callName, SQLite::Statement* statement, AssetDatabaseConnection::databaseInfoHandler handler); - bool GetScanFolderResult(const char* callName, SQLite::Statement* statement, AssetDatabaseConnection::scanFolderHandler handler); - bool GetSourceResult(const char* callName, SQLite::Statement* statement, AssetDatabaseConnection::sourceHandler handler); - bool GetSourceAndScanfolderResult(const char* callName, SQLite::Statement* statement, AssetDatabaseConnection::combinedSourceScanFolderHandler handler); - bool GetSourceDependencyResult(const char* callName, SQLite::Statement* statement, AssetDatabaseConnection::sourceFileDependencyHandler handler); - bool GetJobResultSimple(const char* name, SQLite::Statement* statement, AssetDatabaseConnection::jobHandler handler); - bool GetJobResult(const char* callName, SQLite::Statement* statement, AssetDatabaseConnection::jobHandler handler, AZ::Uuid builderGuid = AZ::Uuid::CreateNull(), const char* jobKey = nullptr, AssetSystem::JobStatus status = AssetSystem::JobStatus::Any); - bool GetProductResultSimple(const char* name, SQLite::Statement* statement, AssetDatabaseConnection::productHandler handler); - bool GetProductResult(const char* callName, SQLite::Statement* statement, AssetDatabaseConnection::productHandler handler, AZ::Uuid builderGuid = AZ::Uuid::CreateNull(), const char* jobKey = nullptr, AssetSystem::JobStatus status = AssetSystem::JobStatus::Any); - bool GetLegacySubIDsResult(const char* callname, SQLite::Statement* statement, AssetDatabaseConnection::legacySubIDsHandler handler); - bool GetProductDependencyResult(const char* callName, SQLite::Statement* statement, AssetDatabaseConnection::productDependencyHandler handler); - bool GetProductDependencyAndPathResult(const char* callName, SQLite::Statement* statement, AssetDatabaseConnection::productDependencyAndPathHandler handler); - bool GetMissingProductDependencyResult(const char* callName, SQLite::Statement* statement, AssetDatabaseConnection::missingProductDependencyHandler handler); - bool GetCombinedDependencyResult(const char* callName, SQLite::Statement* statement, AssetDatabaseConnection::combinedProductDependencyHandler handler); - bool GetFileResult(const char* callName, SQLite::Statement* statement, AssetDatabaseConnection::fileHandler handler); - } } // namespace AssetDatabase }// namespace AzToolsFramework diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Component/EditorComponentAPIComponent.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Component/EditorComponentAPIComponent.cpp index 68ea0119d9..30a7c603bd 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Component/EditorComponentAPIComponent.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Component/EditorComponentAPIComponent.cpp @@ -262,7 +262,7 @@ namespace AzToolsFramework m_serializeContext->EnumerateDerived( [&typeNameList, entityType](const AZ::SerializeContext::ClassData* componentClass, const AZ::Uuid& knownType) -> bool { - AZ_UNUSED(knownType) + AZ_UNUSED(knownType); if (!componentClass->m_editData) { diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Entity/EditorEntityHelpers.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Entity/EditorEntityHelpers.cpp index 0b0358d613..6ed133c830 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Entity/EditorEntityHelpers.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Entity/EditorEntityHelpers.cpp @@ -1324,7 +1324,7 @@ namespace AzToolsFramework AZ::SliceComponent::EntityAncestorList::const_iterator ancestorIter = ancestors.begin(); // Skip the first, that would be a regular slice root and not a subslice root, which was already checked. ++ancestorIter; - for (ancestorIter; ancestorIter != ancestors.end(); ++ancestorIter) + for (; ancestorIter != ancestors.end(); ++ancestorIter) { const AZ::SliceComponent::Ancestor& ancestor = *ancestorIter; if (!ancestor.m_entity || !SliceUtilities::IsRootEntity(*ancestor.m_entity)) diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Entity/SliceEditorEntityOwnershipService.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Entity/SliceEditorEntityOwnershipService.cpp index 7ac3b7be8f..9e7e48cbaa 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Entity/SliceEditorEntityOwnershipService.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Entity/SliceEditorEntityOwnershipService.cpp @@ -98,7 +98,6 @@ namespace AzToolsFramework void SliceEditorEntityOwnershipService::OnSlicePreInstantiate(const AZ::Data::AssetId& sliceAssetId, const AZ::SliceComponent::SliceInstanceAddress& sliceAddress) { AZ_PROFILE_FUNCTION(AzToolsFramework); - const AzFramework::SliceInstantiationTicket ticket = *AzFramework::SliceInstantiationResultBus::GetCurrentBusId(); // Start an undo that will wrap the entire slice instantiation event (unable to do this at a higher level since this is queued up by AzFramework and there's no undo concept at that level) ToolsApplicationRequests::Bus::Broadcast(&ToolsApplicationRequests::Bus::Events::BeginUndoBatch, "Slice Instantiation"); diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Manipulators/EditorVertexSelection.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Manipulators/EditorVertexSelection.cpp index f49df5d029..9bb452eb71 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Manipulators/EditorVertexSelection.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Manipulators/EditorVertexSelection.cpp @@ -895,7 +895,7 @@ namespace AzToolsFramework // calculate average position of selected vertices for translation manipulator MidpointCalculator midpointCalculator; m_translationManipulator->Process( - [this, &midpointCalculator, fixedVertices](typename IndexedTranslationManipulator::VertexLookup& vertex) + [&midpointCalculator, fixedVertices](typename IndexedTranslationManipulator::VertexLookup& vertex) { Vertex v; bool found = false; diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Instance/InstanceToTemplatePropagator.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Instance/InstanceToTemplatePropagator.cpp index 36b39f3a72..6b281bcbae 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Instance/InstanceToTemplatePropagator.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Instance/InstanceToTemplatePropagator.cpp @@ -262,8 +262,6 @@ namespace AzToolsFramework void InstanceToTemplatePropagator::AddPatchesToLink(const PrefabDom& patches, Link& link) { PrefabDom& linkDom = link.GetLinkDom(); - PrefabDomValueReference linkPatchesReference = - PrefabDomUtils::FindPrefabDomValue(linkDom, PrefabDomUtils::PatchesName); /* If the original allocator the patches were created with gets destroyed, then the patches would become garbage in the diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.cpp index cdb1e9a2ad..24cd0f0252 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.cpp @@ -1298,9 +1298,6 @@ namespace AzToolsFramework command->RunRedo(); } - const auto instanceTemplateId = instancePtr->GetTemplateId(); - auto parentContainerEntityId = parentInstance.GetContainerEntityId(); - instancePtr->DetachNestedInstances( [&](AZStd::unique_ptr detachedNestedInstance) { diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Slice/SliceUtilities.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Slice/SliceUtilities.cpp index 02fc2c2c40..6668b5bc3d 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Slice/SliceUtilities.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Slice/SliceUtilities.cpp @@ -461,7 +461,7 @@ namespace AzToolsFramework msgBox.setStandardButtons(QMessageBox::Cancel); msgBox.setDefaultButton(QMessageBox::Yes); msgBox.setDetailedText(message.c_str()); - const int response = msgBox.exec(); + msgBox.exec(); if (msgBox.clickedButton() == moveButton) { @@ -2043,7 +2043,7 @@ namespace AzToolsFramework QAction* confirmSelected = new QAction(detachMenu); confirmationMessageBox->addAction(confirmSelected); - QObject::connect(reassignToAction, &QAction::triggered, [reassignToAction, confirmationMessageBox, selectedEntity, ancestors, currentAncestorIndex]() mutable + QObject::connect(reassignToAction, &QAction::triggered, [confirmationMessageBox, ancestors, currentAncestorIndex]() mutable { if (confirmationMessageBox->exec() == QDialog::Accepted) { @@ -4200,8 +4200,6 @@ namespace AzToolsFramework if (canPush) { - AZ::Data::AssetId targetSliceAssetId = sliceAncestryToPushTo.at(0).m_sliceAddress.GetReference()->GetSliceAsset().GetId(); - //remember we're trying to push to this root, so we don't try to push to any others size_t ancestrySize = sliceAncestryToPushTo.size(); rootAncestorPushList.push_back(sliceAncestryToPushTo[ancestrySize-1].m_sliceAddress.GetReference()->GetSliceAsset().GetId()); diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Thumbnails/LoadingThumbnail.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Thumbnails/LoadingThumbnail.cpp index 91f70f619a..6b8f331de7 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Thumbnails/LoadingThumbnail.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Thumbnails/LoadingThumbnail.cpp @@ -23,7 +23,6 @@ namespace AzToolsFramework LoadingThumbnail::LoadingThumbnail() : Thumbnail(MAKE_TKEY(ThumbnailKey)) - , m_angle(0) { auto absoluteIconPath = AZ::IO::FixedMaxPath(AZ::Utils::GetEnginePath()) / LoadingIconPath; m_loadingMovie.setFileName(absoluteIconPath.c_str()); diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Thumbnails/LoadingThumbnail.h b/Code/Framework/AzToolsFramework/AzToolsFramework/Thumbnails/LoadingThumbnail.h index 811e2e09b7..cbf7ec5489 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Thumbnails/LoadingThumbnail.h +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Thumbnails/LoadingThumbnail.h @@ -37,7 +37,6 @@ namespace AzToolsFramework void OnTick(float deltaTime, AZ::ScriptTimePoint /*time*/) override; private: - float m_angle; QMovie m_loadingMovie; }; } // namespace Thumbnailer diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Layer/LayerUiHandler.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Layer/LayerUiHandler.cpp index d3dd556ae2..b0eee96abc 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Layer/LayerUiHandler.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Layer/LayerUiHandler.cpp @@ -111,9 +111,6 @@ namespace AzToolsFramework painter, option.rect.left() - 1, option.rect.top(), option.rect.bottom(), m_layerBorderBottomColor, layerColor); } - QModelIndex nameColumn = index.sibling(index.row(), EntityOutlinerListModel::Column::ColumnName); - QModelIndex sibling = index.sibling(index.row() + 1, index.column()); - QPoint lineBottomLeft(option.rect.bottomLeft()); QPoint lineTopLeft(option.rect.topLeft()); diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Outliner/EntityOutlinerListModel.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Outliner/EntityOutlinerListModel.cpp index 380d6876da..b9180f8ef6 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Outliner/EntityOutlinerListModel.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Outliner/EntityOutlinerListModel.cpp @@ -1106,8 +1106,6 @@ namespace AzToolsFramework QMimeData* EntityOutlinerListModel::mimeData(const QModelIndexList& indexes) const { AZ_PROFILE_FUNCTION(AzToolsFramework); - AZ::TypeId uuid1 = AZ::AzTypeInfo::Uuid(); - AZ::TypeId uuid2 = AZ::AzTypeInfo::Uuid(); EditorEntityIdContainer entityIdList; for (const QModelIndex& index : indexes) @@ -1334,13 +1332,11 @@ namespace AzToolsFramework QueueEntityUpdate(entityId); } - void EntityOutlinerListModel::OnEntityInfoUpdatedRemoveChildBegin(AZ::EntityId parentId, AZ::EntityId childId) + void EntityOutlinerListModel::OnEntityInfoUpdatedRemoveChildBegin([[maybe_unused]] AZ::EntityId parentId, [[maybe_unused]] AZ::EntityId childId) { //add/remove operations trigger selection change signals which assert and break undo/redo operations in progress in inspector etc. //so disallow selection updates until change is complete emit EnableSelectionUpdates(false); - auto parentIndex = GetIndexFromEntity(parentId); - auto childIndex = GetIndexFromEntity(childId); beginResetModel(); } diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Prefab/PrefabIntegrationManager.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Prefab/PrefabIntegrationManager.cpp index c17b96411e..d7fdb604fe 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Prefab/PrefabIntegrationManager.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Prefab/PrefabIntegrationManager.cpp @@ -157,7 +157,7 @@ namespace AzToolsFramework QAction* createAction = menu->addAction(QObject::tr("Create Prefab...")); createAction->setToolTip(QObject::tr("Creates a prefab out of the currently selected entities.")); - QObject::connect(createAction, &QAction::triggered, createAction, [this, selectedEntities] { + QObject::connect(createAction, &QAction::triggered, createAction, [selectedEntities] { ContextMenu_CreatePrefab(selectedEntities); }); } @@ -171,7 +171,7 @@ namespace AzToolsFramework instantiateAction->setToolTip(QObject::tr("Instantiates a prefab file in the scene.")); QObject::connect( - instantiateAction, &QAction::triggered, instantiateAction, [this] { ContextMenu_InstantiatePrefab(); }); + instantiateAction, &QAction::triggered, instantiateAction, [] { ContextMenu_InstantiatePrefab(); }); } menu->addSeparator(); @@ -196,7 +196,7 @@ namespace AzToolsFramework QAction* editAction = menu->addAction(QObject::tr("Edit Prefab")); editAction->setToolTip(QObject::tr("Edit the prefab in focus mode.")); - QObject::connect(editAction, &QAction::triggered, editAction, [this, selectedEntity] { + QObject::connect(editAction, &QAction::triggered, editAction, [selectedEntity] { ContextMenu_EditPrefab(selectedEntity); }); @@ -213,7 +213,7 @@ namespace AzToolsFramework QAction* saveAction = menu->addAction(QObject::tr("Save Prefab to file")); saveAction->setToolTip(QObject::tr("Save the changes to the prefab to disk.")); - QObject::connect(saveAction, &QAction::triggered, saveAction, [this, selectedEntity] { + QObject::connect(saveAction, &QAction::triggered, saveAction, [selectedEntity] { ContextMenu_SavePrefab(selectedEntity); }); @@ -229,7 +229,7 @@ namespace AzToolsFramework } QAction* deleteAction = menu->addAction(QObject::tr("Delete")); - QObject::connect(deleteAction, &QAction::triggered, deleteAction, [this] { ContextMenu_DeleteSelected(); }); + QObject::connect(deleteAction, &QAction::triggered, deleteAction, [] { ContextMenu_DeleteSelected(); }); if (selectedEntities.size() == 0 || (selectedEntities.size() == 1 && s_prefabPublicInterface->IsLevelInstanceContainerEntity(selectedEntities[0]))) { @@ -247,7 +247,7 @@ namespace AzToolsFramework QAction* detachPrefabAction = menu->addAction(QObject::tr("Detach Prefab...")); QObject::connect( detachPrefabAction, &QAction::triggered, detachPrefabAction, - [this, selectedEntity] + [selectedEntity] { ContextMenu_DetachPrefab(selectedEntity); }); @@ -994,7 +994,7 @@ namespace AzToolsFramework msgBox.setStandardButtons(QMessageBox::Cancel); msgBox.setDefaultButton(QMessageBox::Yes); msgBox.setDetailedText(message.c_str()); - const int response = msgBox.exec(); + msgBox.exec(); if (msgBox.clickedButton() == moveButton) { diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/EntityPropertyEditor.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/EntityPropertyEditor.cpp index 223a573c55..001cd12349 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/EntityPropertyEditor.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/EntityPropertyEditor.cpp @@ -2491,7 +2491,7 @@ namespace AzToolsFramework QAction* revertAction = revertMenu->addAction(QObject::tr("Entity")); revertAction->setToolTip(QObject::tr("This will revert all component properties on this entity to the last saved.")); - QObject::connect(revertAction, &QAction::triggered, [this, relevantEntities] + QObject::connect(revertAction, &QAction::triggered, [relevantEntities] { SliceEditorEntityOwnershipServiceRequestBus::Broadcast( &SliceEditorEntityOwnershipServiceRequests::ResetEntitiesToSliceDefaults, relevantEntities); @@ -4394,7 +4394,6 @@ namespace AzToolsFramework { ResetDrag(event); - Qt::MouseButtons realButtons = QApplication::mouseButtons(); if (QApplication::overrideCursor() && !(event->buttons() & Qt::LeftButton)) { QApplication::restoreOverrideCursor(); @@ -4606,7 +4605,6 @@ namespace AzToolsFramework bool EntityPropertyEditor::GetComponentsAtDropEventPosition(QDropEvent* event, AZ::Entity::ComponentArrayType& targetComponents) { const QPoint globalPos(mapToGlobal(event->pos())); - const QRect globalRect(GetInflatedRectFromPoint(globalPos, kComponentEditorDropTargetPrecision)); //get component editor(s) where drop will occur ComponentEditor* targetComponentEditor = GetReorderDropTarget( diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyAssetCtrl.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyAssetCtrl.cpp index 4d95479e33..ee43eb7e2c 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyAssetCtrl.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyAssetCtrl.cpp @@ -548,7 +548,7 @@ namespace AzToolsFramework // Connect pressed to opening the error dialog // Must capture this for call to QObject::connect - connect(m_errorButton, &QPushButton::pressed, this, [this, errorLog]() { + connect(m_errorButton, &QPushButton::pressed, this, [errorLog]() { // Create the dialog for the log panel, and set the layout QDialog* logDialog = new QDialog(); logDialog->setMinimumSize(1024, 400); diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/ReflectedPropertyEditor.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/ReflectedPropertyEditor.cpp index 87df1eff1b..c87f0e03ba 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/ReflectedPropertyEditor.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/ReflectedPropertyEditor.cpp @@ -2141,7 +2141,7 @@ namespace AzToolsFramework AZStd::shared_ptr keyToAdd(nullptr); bool createdElement = pContainerNode->CreateContainerElement(CreateContainerElementSelectClassCallback, - [this, pContainerNode, promptForValue, &keyToAdd](void* dataPtr, const AZ::SerializeContext::ClassElement* classElement, bool noDefaultData, AZ::SerializeContext*) -> bool + [pContainerNode, promptForValue, &keyToAdd](void* dataPtr, const AZ::SerializeContext::ClassElement* classElement, bool noDefaultData, AZ::SerializeContext*) -> bool { bool handled = false; diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Slice/SlicePushWidget.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Slice/SlicePushWidget.cpp index 04754ac8a4..c276fc5c5a 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Slice/SlicePushWidget.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Slice/SlicePushWidget.cpp @@ -2529,7 +2529,7 @@ namespace AzToolsFramework AZ_Warning("SlicePush", levelSlice, "SlicePushWidget::CalculateReferenceCount could not find root slice, displayed counts will be inaccurate!"); size_t instanceCount = 0; AZ::Data::AssetBus::EnumerateHandlersId(assetId, - [&instanceCount, assetId, levelSlice] (AZ::Data::AssetEvents* handler) -> bool + [&instanceCount, assetId] (AZ::Data::AssetEvents* handler) -> bool { AZ::SliceComponent* component = azrtti_cast(handler); if (component) diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/UICore/QTreeViewStateSaver.hxx b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/UICore/QTreeViewStateSaver.hxx index 408791558a..f0f6711cda 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/UICore/QTreeViewStateSaver.hxx +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/UICore/QTreeViewStateSaver.hxx @@ -132,7 +132,6 @@ namespace AzToolsFramework QPointer m_dataModel; QPointer m_selectionModel; AZStd::intrusive_ptr m_data; - bool m_defaultToExpandIndexes = false; Q_DISABLE_COPY(QTreeViewStateSaver) }; diff --git a/Code/Legacy/CryCommon/CryLibrary.h b/Code/Legacy/CryCommon/CryLibrary.h index 6c13f0f9c6..31cc91cbe7 100644 --- a/Code/Legacy/CryCommon/CryLibrary.h +++ b/Code/Legacy/CryCommon/CryLibrary.h @@ -97,14 +97,14 @@ static const char* GetModulePath() return getenv(gEnvName); } -void SetModulePath(const char* pModulePath) +inline static void SetModulePath(const char* pModulePath) { setenv(gEnvName, pModulePath ? pModulePath : "", true); } // bInModulePath is only ever set to false in RC, because rc needs to load dlls from a $PATH that // it has modified to include .. -HMODULE CryLoadLibrary(const char* libName, bool bLazy = false, bool bInModulePath = true) +inline static HMODULE CryLoadLibrary(const char* libName, bool bLazy = false, bool bInModulePath = true) { const char* libPath = nullptr; char pathBuffer[MAX_PATH] = {0}; diff --git a/Code/Legacy/CrySystem/LevelSystem/SpawnableLevelSystem.cpp b/Code/Legacy/CrySystem/LevelSystem/SpawnableLevelSystem.cpp index 0ac7b0bdce..72d74ea1c1 100644 --- a/Code/Legacy/CrySystem/LevelSystem/SpawnableLevelSystem.cpp +++ b/Code/Legacy/CrySystem/LevelSystem/SpawnableLevelSystem.cpp @@ -55,7 +55,7 @@ namespace LegacyLevelSystem AZ_CONSOLEFREEFUNC(UnloadLevel, AZ::ConsoleFunctorFlags::Null, "Unloads the current level"); //------------------------------------------------------------------------ - SpawnableLevelSystem::SpawnableLevelSystem(ISystem* pSystem) + SpawnableLevelSystem::SpawnableLevelSystem([[maybe_unused]] ISystem* pSystem) { CRY_ASSERT(pSystem); From ea2f74dc0f9d119b9a74197d5789735427a84c04 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Fri, 20 Aug 2021 14:51:12 -0700 Subject: [PATCH 009/131] more fixes for Gems Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../Code/Source/Framework/HttpRequestJob.cpp | 2 +- .../Code/Tests/MetricsManagerTest.cpp | 2 +- .../Code/Source/CameraComponent.cpp | 4 +- .../Source/Engine/AudioSystemImpl_wwise.cpp | 10 +- .../Code/EMotionFX/Source/Attachment.h | 2 +- .../Code/EMotionFX/Source/RagdollInstance.cpp | 2 - .../SimulatedObject/SimulatedJointWidget.cpp | 4 +- .../Code/Tests/AnimGraphCopyPasteTests.cpp | 2 - .../Code/Tests/AnimGraphEventTests.cpp | 6 +- .../Code/Tests/AnimGraphRefCountTests.cpp | 6 +- ...AnimGraphStateMachineInterruptionTests.cpp | 15 +- .../Tests/AnimGraphStateMachineSyncTests.cpp | 8 +- .../Code/Tests/BlendTreeBlendNNodeTests.cpp | 2 - .../Code/Tests/BlendTreeRagdollNodeTests.cpp | 1 - .../Tests/BlendTreeTwoLinkIKNodeTests.cpp | 2 - .../ActorComponentRagdollTests.cpp | 1 - .../Code/Tests/MotionExtractionBusTests.cpp | 2 - .../Code/Tests/Prefabs/LeftArmSkeleton.h | 2 +- .../Code/Tests/SimulatedObjectSetupTests.cpp | 1 - .../Code/Source/PythonMarshalComponent.cpp | 6 +- .../Code/Source/Ai/NavigationComponent.cpp | 2 +- .../Tests/BundlingSystemComponentTests.cpp | 2 - .../Code/Source/Animation/AzEntityNode.cpp | 11 +- Gems/LyShine/Code/Source/LyShine.cpp | 3 +- Gems/LyShine/Code/Source/LyShine.h | 2 - .../Code/Source/LyShineSystemComponent.cpp | 2 - Gems/LyShine/Code/Source/Sprite.cpp | 4 - .../internal/test_UiTransform2dComponent.cpp | 2 - Gems/LyShine/Code/Source/UiImageComponent.cpp | 2 - .../Code/Source/UiImageSequenceComponent.cpp | 2 - Gems/LyShine/Code/Source/UiRenderer.cpp | 2 - .../Code/Source/UiScrollBoxComponent.cpp | 1 - Gems/LyShine/Code/Source/UiTextComponent.cpp | 3 - .../Code/Source/UiTransform2dComponent.cpp | 2 +- .../Source/World/UiCanvasOnMeshComponent.cpp | 184 ------------------ Gems/Maestro/Code/Source/Cinematics/Movie.cpp | 3 - .../Code/Source/Cinematics/SceneNode.cpp | 1 - .../Cinematics/Tests/EntityNodeTest.cpp | 1 - .../LocalPredictionPlayerInputComponent.cpp | 2 - .../Debug/MultiplayerDebugSystemComponent.cpp | 2 - .../Source/MultiplayerSystemComponent.cpp | 4 +- .../EntityReplication/PropertySubscriber.h | 1 - .../ServerToClientReplicationWindow.cpp | 7 +- .../ServerToClientReplicationWindow.h | 1 - .../Code/Tests/System/FabricCookerTest.cpp | 3 - Gems/PhysX/Code/Source/Utils.cpp | 4 - .../PhysXCharactersRagdollBenchmarks.cpp | 1 - .../Code/Tests/CharacterControllerTests.cpp | 2 - .../Code/Tests/PhysXMultithreadingTest.cpp | 2 - .../PhysX/Code/Tests/PhysXSceneQueryTests.cpp | 16 +- Gems/PhysX/Code/Tests/PhysXSceneTests.cpp | 2 +- Gems/PhysX/Code/Tests/PhysXSpecificTest.cpp | 2 +- .../ScriptCanvas/Core/NodeFunctionGeneric.h | 2 +- .../Operators/Containers/OperatorErase.cpp | 2 +- .../Operators/Containers/OperatorFront.cpp | 2 +- .../Operators/Containers/OperatorInsert.cpp | 2 +- .../Operators/Containers/OperatorPushBack.cpp | 2 +- .../Libraries/Spawning/SpawnNodeable.cpp | 2 +- .../ScriptEvents/ScriptEventsAssetRef.h | 1 - .../Tests/Tests/ScriptEventsTest_Core.cpp | 20 -- .../SurfaceData/Tests/SurfaceDataTestMocks.h | 2 +- Gems/Twitch/Code/Source/TwitchREST.cpp | 10 +- .../Source/Components/BlockerComponent.cpp | 2 +- .../Components/MeshBlockerComponent.cpp | 2 +- .../Code/Source/PrefabInstanceSpawner.cpp | 2 +- Gems/Vegetation/Code/Tests/VegetationTest.h | 1 - 66 files changed, 62 insertions(+), 348 deletions(-) diff --git a/Gems/AWSCore/Code/Source/Framework/HttpRequestJob.cpp b/Gems/AWSCore/Code/Source/Framework/HttpRequestJob.cpp index 7c41695fe1..7c9ec045e9 100644 --- a/Gems/AWSCore/Code/Source/Framework/HttpRequestJob.cpp +++ b/Gems/AWSCore/Code/Source/Framework/HttpRequestJob.cpp @@ -42,7 +42,7 @@ namespace AWSCore // This will run the code fed to the macro, and then assign 0 to a static int (note the ,0 at the end) #define AWS_CORE_ONCE_PASTE(x) (x) -#define AWS_CORE_ONCE(x) static [[maybe_unused]] int AZ_JOIN(init, __LINE__)((AWS_CORE_ONCE_PASTE(x), 0)) +#define AWS_CORE_ONCE(x) [[maybe_unused]] static int AZ_JOIN(init, __LINE__)((AWS_CORE_ONCE_PASTE(x), 0)) #define AWS_CORE_HTTP_METHOD_ENTRY(x) { HttpRequestJob::HttpMethod::HTTP_##x, HttpMethodInfo{ Aws::Http::HttpMethod::HTTP_##x, #x } } diff --git a/Gems/AWSMetrics/Code/Tests/MetricsManagerTest.cpp b/Gems/AWSMetrics/Code/Tests/MetricsManagerTest.cpp index 2d9990ad1e..3f87a1079d 100644 --- a/Gems/AWSMetrics/Code/Tests/MetricsManagerTest.cpp +++ b/Gems/AWSMetrics/Code/Tests/MetricsManagerTest.cpp @@ -290,7 +290,7 @@ namespace AWSMetrics for (int index = 0; index < MaxNumMetricsEvents; ++index) { - producers.emplace_back(AZStd::thread([this, index]() + producers.emplace_back(AZStd::thread([index]() { AZStd::vector metricsAttributes; metricsAttributes.emplace_back(AZStd::move(MetricsAttribute(AwsMetricsAttributeKeyEventName, AttrValue))); diff --git a/Gems/Atom/Component/DebugCamera/Code/Source/CameraComponent.cpp b/Gems/Atom/Component/DebugCamera/Code/Source/CameraComponent.cpp index 217cf0f061..ca62918aa3 100644 --- a/Gems/Atom/Component/DebugCamera/Code/Source/CameraComponent.cpp +++ b/Gems/Atom/Component/DebugCamera/Code/Source/CameraComponent.cpp @@ -257,8 +257,8 @@ namespace AZ void CameraComponent::OnViewportResized(uint32_t width, uint32_t height) { - AZ_UNUSED(width) - AZ_UNUSED(height) + AZ_UNUSED(width); + AZ_UNUSED(height); UpdateAspectRatio(); UpdateViewToClipMatrix(); } diff --git a/Gems/AudioEngineWwise/Code/Source/Engine/AudioSystemImpl_wwise.cpp b/Gems/AudioEngineWwise/Code/Source/Engine/AudioSystemImpl_wwise.cpp index 738806a912..56f4fd879a 100644 --- a/Gems/AudioEngineWwise/Code/Source/Engine/AudioSystemImpl_wwise.cpp +++ b/Gems/AudioEngineWwise/Code/Source/Engine/AudioSystemImpl_wwise.cpp @@ -1779,8 +1779,8 @@ namespace Audio AK::MemoryMgr::CategoryStats categoryStats; AK::MemoryMgr::GetCategoryStats(memInfo.m_poolId, categoryStats); - memInfo.m_memoryUsed = categoryStats.uUsed; - memInfo.m_peakUsed = categoryStats.uPeakUsed; + memInfo.m_memoryUsed = static_cast(categoryStats.uUsed); + memInfo.m_peakUsed = static_cast(categoryStats.uPeakUsed); memInfo.m_numAllocs = categoryStats.uAllocs; memInfo.m_numFrees = categoryStats.uFrees; } @@ -1789,9 +1789,9 @@ namespace Audio AK::MemoryMgr::GetGlobalStats(globalStats); auto& memInfo = m_debugMemoryInfo.back(); - memInfo.m_memoryReserved = globalStats.uReserved; - memInfo.m_memoryUsed = globalStats.uUsed; - memInfo.m_peakUsed = globalStats.uMax; + memInfo.m_memoryReserved = static_cast(globalStats.uReserved); + memInfo.m_memoryUsed = static_cast(globalStats.uUsed); + memInfo.m_peakUsed = static_cast(globalStats.uMax); // return the memory infos... return m_debugMemoryInfo; diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/Attachment.h b/Gems/EMotionFX/Code/EMotionFX/Source/Attachment.h index 67a62ac7f6..d2cd9cdc6f 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/Attachment.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/Attachment.h @@ -63,7 +63,7 @@ namespace EMotionFX * This can be implemented for say skin attachments, which copy over joint transforms from the actor instance they are attached to. * @param outPose The pose that will be modified. */ - virtual void UpdateJointTransforms(Pose& outPose) { AZ_UNUSED(outPose) }; + virtual void UpdateJointTransforms(Pose& outPose) { AZ_UNUSED(outPose); }; /** * Get the actor instance object of the attachment. diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/RagdollInstance.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/RagdollInstance.cpp index b139133c49..426f6da473 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/RagdollInstance.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/RagdollInstance.cpp @@ -433,7 +433,6 @@ namespace EMotionFX } const EMotionFX::TransformData* transformData = m_actorInstance->GetTransformData(); - const size_t transformCount = transformData->GetNumTransforms(); const EMotionFX::Skeleton* skeleton = m_actorInstance->GetActor()->GetSkeleton(); const size_t jointCount = skeleton->GetNumNodes(); @@ -498,7 +497,6 @@ namespace EMotionFX const AZ::Vector3 currentPos = currentNodeState.m_position; const AZ::Vector3 currentParentPos = currentParentJointPose.m_position; - const Physics::RagdollNodeState& targetJointPose = ragdollTargetPose[ragdollJointIndex.GetValue()]; const Physics::RagdollNodeState& targetParentJointPose = ragdollTargetPose[ragdollParentJointIndex.GetValue()]; if (targetParentJointPose.m_simulationType == Physics::SimulationType::Dynamic) diff --git a/Gems/EMotionFX/Code/Source/Editor/Plugins/SimulatedObject/SimulatedJointWidget.cpp b/Gems/EMotionFX/Code/Source/Editor/Plugins/SimulatedObject/SimulatedJointWidget.cpp index 4dd8b94303..1e35a084fa 100644 --- a/Gems/EMotionFX/Code/Source/Editor/Plugins/SimulatedObject/SimulatedJointWidget.cpp +++ b/Gems/EMotionFX/Code/Source/Editor/Plugins/SimulatedObject/SimulatedJointWidget.cpp @@ -441,8 +441,8 @@ namespace EMotionFX void SimulatedJointWidget::UpdateDetailsView(const QItemSelection& selected, const QItemSelection& deselected) { - AZ_UNUSED(selected) - AZ_UNUSED(deselected) + AZ_UNUSED(selected); + AZ_UNUSED(deselected); const SimulatedObjectModel* model = m_plugin->GetSimulatedObjectModel(); const QItemSelectionModel* selectionModel = model->GetSelectionModel(); diff --git a/Gems/EMotionFX/Code/Tests/AnimGraphCopyPasteTests.cpp b/Gems/EMotionFX/Code/Tests/AnimGraphCopyPasteTests.cpp index 4feb8cd86a..dee1bd5ca2 100644 --- a/Gems/EMotionFX/Code/Tests/AnimGraphCopyPasteTests.cpp +++ b/Gems/EMotionFX/Code/Tests/AnimGraphCopyPasteTests.cpp @@ -184,7 +184,6 @@ namespace EMotionFX void VerifyAfterOperation() { const AZStd::vector conditionTypeIds = GetConditionTypeIds(); - const size_t numConditionTypes = conditionTypeIds.size(); const bool cutMode = GetParam(); if (cutMode) { @@ -419,7 +418,6 @@ namespace EMotionFX AZStd::string result; MCore::CommandGroup commandGroup; const bool cutMode = GetParam(); - const AnimGraphConnectionId oldtransitionId = m_transition->GetId(); // Add transition actions to the node. AnimGraphParameterAction* action1 = aznew AnimGraphParameterAction(); diff --git a/Gems/EMotionFX/Code/Tests/AnimGraphEventTests.cpp b/Gems/EMotionFX/Code/Tests/AnimGraphEventTests.cpp index 1b88092917..bd3fa10b24 100644 --- a/Gems/EMotionFX/Code/Tests/AnimGraphEventTests.cpp +++ b/Gems/EMotionFX/Code/Tests/AnimGraphEventTests.cpp @@ -88,7 +88,7 @@ namespace EMotionFX void SimulateTest(float simulationTime, float expectedFps, float fpsVariance) { Simulate(simulationTime, expectedFps, fpsVariance, - /*preCallback*/[this](AnimGraphInstance*) + /*preCallback*/[](AnimGraphInstance*) { }, /*postCallback*/[this](AnimGraphInstance*) @@ -102,8 +102,8 @@ namespace EMotionFX EXPECT_EQ(this->m_eventHandler->m_numTransitionsStarted, numStates); EXPECT_EQ(this->m_eventHandler->m_numTransitionsEnded, numStates); }, - /*preUpdateCallback*/[this](AnimGraphInstance*, float, float, int) {}, - /*postUpdateCallback*/[this](AnimGraphInstance*, float, float, int) {}); + /*preUpdateCallback*/[](AnimGraphInstance*, float, float, int) {}, + /*postUpdateCallback*/[](AnimGraphInstance*, float, float, int) {}); const int numStates = GetParam().m_numStates; if (numStates > 1) diff --git a/Gems/EMotionFX/Code/Tests/AnimGraphRefCountTests.cpp b/Gems/EMotionFX/Code/Tests/AnimGraphRefCountTests.cpp index 8b51f5b814..54f945d95f 100644 --- a/Gems/EMotionFX/Code/Tests/AnimGraphRefCountTests.cpp +++ b/Gems/EMotionFX/Code/Tests/AnimGraphRefCountTests.cpp @@ -32,12 +32,10 @@ namespace EMotionFX this->m_animGraphInstance->SetAutoReleaseRefDatas(false); this->m_animGraphInstance->SetAutoReleasePoses(false); }, - /*postCallback*/[this](AnimGraphInstance*){}, - /*preUpdateCallback*/[this](AnimGraphInstance*, float, float, int){}, + /*postCallback*/[](AnimGraphInstance*){}, + /*preUpdateCallback*/[](AnimGraphInstance*, float, float, int){}, /*postUpdateCallback*/[this](AnimGraphInstance*, float, float, int) { - const uint32 threadIndex = this->m_actorInstance->GetThreadIndex(); - // Check if data and pose ref counts are back to 0 for all nodes. const size_t numNodes = this->m_animGraph->GetNumNodes(); for (size_t i = 0; i < numNodes; ++i) diff --git a/Gems/EMotionFX/Code/Tests/AnimGraphStateMachineInterruptionTests.cpp b/Gems/EMotionFX/Code/Tests/AnimGraphStateMachineInterruptionTests.cpp index 39fc296d9f..b0f070d203 100644 --- a/Gems/EMotionFX/Code/Tests/AnimGraphStateMachineInterruptionTests.cpp +++ b/Gems/EMotionFX/Code/Tests/AnimGraphStateMachineInterruptionTests.cpp @@ -137,9 +137,9 @@ namespace EMotionFX m_eventHandler->m_numStatesEnded -= 1; Simulate(20.0f/*simulationTime*/, 60.0f/*expectedFps*/, 0.0f/*fpsVariance*/, - /*preCallback*/[this]([[maybe_unused]] AnimGraphInstance* animGraphInstance){}, - /*postCallback*/[this]([[maybe_unused]] AnimGraphInstance* animGraphInstance){}, - /*preUpdateCallback*/[this](AnimGraphInstance*, float, float, int) {}, + /*preCallback*/[]([[maybe_unused]] AnimGraphInstance* animGraphInstance){}, + /*postCallback*/[]([[maybe_unused]] AnimGraphInstance* animGraphInstance){}, + /*preUpdateCallback*/[](AnimGraphInstance*, float, float, int) {}, /*postUpdateCallback*/[this](AnimGraphInstance* animGraphInstance, [[maybe_unused]] float time, [[maybe_unused]] float timeDelta, int frame) { const std::vector& activeObjectsAtFrame = GetParam().m_activeObjectsAtFrame; @@ -457,14 +457,11 @@ namespace EMotionFX float prevBlendWeight = 0.0f; Simulate(2.0f /*simulationTime*/, 10.0f /*expectedFps*/, 0.0f /*fpsVariance*/, - /*preCallback*/[this]([[maybe_unused]] AnimGraphInstance* animGraphInstance) {}, - /*postCallback*/[this]([[maybe_unused]] AnimGraphInstance* animGraphInstance) {}, - /*preUpdateCallback*/[this](AnimGraphInstance*, float, float, int) {}, + /*preCallback*/[]([[maybe_unused]] AnimGraphInstance* animGraphInstance) {}, + /*postCallback*/[]([[maybe_unused]] AnimGraphInstance* animGraphInstance) {}, + /*preUpdateCallback*/[](AnimGraphInstance*, float, float, int) {}, /*postUpdateCallback*/[this, &prevGotInterrupted, &prevBlendWeight](AnimGraphInstance* animGraphInstance, [[maybe_unused]] float time, [[maybe_unused]] float timeDelta, [[maybe_unused]] int frame) { - const AnimGraphStateMachine_InterruptionPropertiesTestData param = GetParam(); - - const AnimGraphStateTransition::EInterruptionMode interruptionMode = m_transitionLeft->GetInterruptionMode(); const float maxInterruptionBlendWeight = m_transitionLeft->GetMaxInterruptionBlendWeight(); const bool gotInterrupted = m_transitionLeft->GotInterrupted(animGraphInstance); const bool gotInterruptedThisFrame = gotInterrupted && !prevGotInterrupted; diff --git a/Gems/EMotionFX/Code/Tests/AnimGraphStateMachineSyncTests.cpp b/Gems/EMotionFX/Code/Tests/AnimGraphStateMachineSyncTests.cpp index 37996abbd8..d95140a23b 100644 --- a/Gems/EMotionFX/Code/Tests/AnimGraphStateMachineSyncTests.cpp +++ b/Gems/EMotionFX/Code/Tests/AnimGraphStateMachineSyncTests.cpp @@ -100,13 +100,11 @@ namespace EMotionFX TEST_P(AnimGraphStateMachineSyncFixture, PlayspeedTests) { - const AnimGraphStateMachineSyncParam param = GetParam(); - bool transitioned = false; Simulate(2.0f/*simulationTime*/, 10.0f/*expectedFps*/, 0.0f/*fpsVariance*/, - /*preCallback*/[this]([[maybe_unused]] AnimGraphInstance* animGraphInstance){}, - /*postCallback*/[this]([[maybe_unused]] AnimGraphInstance* animGraphInstance){}, - /*preUpdateCallback*/[this](AnimGraphInstance*, float, float, int){}, + /*preCallback*/[]([[maybe_unused]] AnimGraphInstance* animGraphInstance){}, + /*postCallback*/[]([[maybe_unused]] AnimGraphInstance* animGraphInstance){}, + /*preUpdateCallback*/[](AnimGraphInstance*, float, float, int){}, /*postUpdateCallback*/[this, &transitioned](AnimGraphInstance* animGraphInstance, [[maybe_unused]] float time, [[maybe_unused]] float timeDelta, [[maybe_unused]] int frame) { if (m_rootStateMachine->IsTransitionActive(m_transition, animGraphInstance)) diff --git a/Gems/EMotionFX/Code/Tests/BlendTreeBlendNNodeTests.cpp b/Gems/EMotionFX/Code/Tests/BlendTreeBlendNNodeTests.cpp index 1f5fb9a512..53744aeb6b 100644 --- a/Gems/EMotionFX/Code/Tests/BlendTreeBlendNNodeTests.cpp +++ b/Gems/EMotionFX/Code/Tests/BlendTreeBlendNNodeTests.cpp @@ -332,9 +332,7 @@ namespace EMotionFX EXPECT_NEAR(durationA, durationN, epsilon); // Node B gets synced to the blend N node which got synced to node A. - const float timeRatio = durationA / durationB; const float timeRatio2 = durationB / durationA; - const float factorA = AZ::Lerp(1.0f, timeRatio, blendWeight); const float factorB = AZ::Lerp(timeRatio2, 1.0f, blendWeight); const float primaryMotionPlaySpeed = m_motionNodes[motionIndexA]->GetDefaultPlaySpeed(); const float interpolatedSpeed = AZ::Lerp(playSpeedA, primaryMotionPlaySpeed, blendWeight); diff --git a/Gems/EMotionFX/Code/Tests/BlendTreeRagdollNodeTests.cpp b/Gems/EMotionFX/Code/Tests/BlendTreeRagdollNodeTests.cpp index 85504675db..a01d333e95 100644 --- a/Gems/EMotionFX/Code/Tests/BlendTreeRagdollNodeTests.cpp +++ b/Gems/EMotionFX/Code/Tests/BlendTreeRagdollNodeTests.cpp @@ -115,7 +115,6 @@ namespace EMotionFX { AddRagdollNodeConfig(ragdollNodes, jointName.c_str()); } - const size_t numRagdollNodes = ragdollNodes.size(); // Create the ragdoll instance and check if the ragdoll root node is set correctly. TestRagdoll testRagdoll; diff --git a/Gems/EMotionFX/Code/Tests/BlendTreeTwoLinkIKNodeTests.cpp b/Gems/EMotionFX/Code/Tests/BlendTreeTwoLinkIKNodeTests.cpp index eab445ddfe..5d57c74d10 100644 --- a/Gems/EMotionFX/Code/Tests/BlendTreeTwoLinkIKNodeTests.cpp +++ b/Gems/EMotionFX/Code/Tests/BlendTreeTwoLinkIKNodeTests.cpp @@ -165,8 +165,6 @@ namespace EMotionFX if (weight) { const AZ::Vector3 expectedPosition(goalX, goalY, goalZ); - const AZ::Vector3 dist = (expectedPosition - testJointNewPos).GetAbs(); - const float length = dist.GetLength(); EXPECT_TRUE(PosePositionCompareClose(testJointNewPos, expectedPosition, 0.0001f)) << "Joint position should be similar to expected position."; } diff --git a/Gems/EMotionFX/Code/Tests/Integration/ActorComponentRagdollTests.cpp b/Gems/EMotionFX/Code/Tests/Integration/ActorComponentRagdollTests.cpp index 809dd67573..4c9eb2c32c 100644 --- a/Gems/EMotionFX/Code/Tests/Integration/ActorComponentRagdollTests.cpp +++ b/Gems/EMotionFX/Code/Tests/Integration/ActorComponentRagdollTests.cpp @@ -61,7 +61,6 @@ namespace EMotionFX TEST_F(EntityComponentFixture, ActorComponent_ActivateRagdoll) { AZ::EntityId entityId(740216387); - AZ::Crc32 worldId(174592); AzPhysics::SceneEvents::OnSceneSimulationFinishEvent sceneFinishSimEvent; diff --git a/Gems/EMotionFX/Code/Tests/MotionExtractionBusTests.cpp b/Gems/EMotionFX/Code/Tests/MotionExtractionBusTests.cpp index d8b8a2a430..170f4d2d75 100644 --- a/Gems/EMotionFX/Code/Tests/MotionExtractionBusTests.cpp +++ b/Gems/EMotionFX/Code/Tests/MotionExtractionBusTests.cpp @@ -132,8 +132,6 @@ namespace EMotionFX EXPECT_TRUE(hasCustomMotionExtractionController) << "MotionExtractionBus is not found."; - const float deltaTimeInv = (timeDelta > 0.0f) ? (1.0f / timeDelta) : 0.0f; - AZ::Transform currentTransform = AZ::Transform::CreateIdentity(); AZ::TransformBus::EventResult(currentTransform, m_entityId, &AZ::TransformBus::Events::GetWorldTM); diff --git a/Gems/EMotionFX/Code/Tests/Prefabs/LeftArmSkeleton.h b/Gems/EMotionFX/Code/Tests/Prefabs/LeftArmSkeleton.h index 2af9da3306..b9ddac817b 100644 --- a/Gems/EMotionFX/Code/Tests/Prefabs/LeftArmSkeleton.h +++ b/Gems/EMotionFX/Code/Tests/Prefabs/LeftArmSkeleton.h @@ -80,7 +80,7 @@ namespace EMotionFX .WillRepeatedly(Return(nodeName)); AZ::u32 i = 0; - std::initializer_list {(([&]() { + [[maybe_unused]] std::initializer_list dummy = {(([&]() { EXPECT_CALL(*node, GetChildIndex(i)) .WillRepeatedly(Return(children)); ++i; diff --git a/Gems/EMotionFX/Code/Tests/SimulatedObjectSetupTests.cpp b/Gems/EMotionFX/Code/Tests/SimulatedObjectSetupTests.cpp index f37f571982..2660931e07 100644 --- a/Gems/EMotionFX/Code/Tests/SimulatedObjectSetupTests.cpp +++ b/Gems/EMotionFX/Code/Tests/SimulatedObjectSetupTests.cpp @@ -406,7 +406,6 @@ namespace SimulatedObjectSetupTests const float newGravityFactor = 1.2f; const float newFriction = 0.3f; const bool newPinned = true; - const bool newStretchable = true; joint.SetConeAngleLimit(newConeAngleLimit); joint.SetMass(newMass); diff --git a/Gems/EditorPythonBindings/Code/Source/PythonMarshalComponent.cpp b/Gems/EditorPythonBindings/Code/Source/PythonMarshalComponent.cpp index af21420b62..257df31778 100644 --- a/Gems/EditorPythonBindings/Code/Source/PythonMarshalComponent.cpp +++ b/Gems/EditorPythonBindings/Code/Source/PythonMarshalComponent.cpp @@ -1376,7 +1376,6 @@ namespace EditorPythonBindings class TypeConverterPair final : public PythonMarshalComponent::TypeConverter { - AZ::GenericClassInfo* m_genericClassInfo = nullptr; const AZ::SerializeContext::ClassData* m_classData = nullptr; const AZ::TypeId m_typeId = {}; @@ -1403,9 +1402,8 @@ namespace EditorPythonBindings } public: - TypeConverterPair(AZ::GenericClassInfo* genericClassInfo, const AZ::SerializeContext::ClassData* classData, const AZ::TypeId& typeId) - : m_genericClassInfo(genericClassInfo) - , m_classData(classData) + TypeConverterPair([[maybe_unused]] AZ::GenericClassInfo* genericClassInfo, const AZ::SerializeContext::ClassData* classData, const AZ::TypeId& typeId) + : m_classData(classData) , m_typeId(typeId) { } diff --git a/Gems/LmbrCentral/Code/Source/Ai/NavigationComponent.cpp b/Gems/LmbrCentral/Code/Source/Ai/NavigationComponent.cpp index fbeb26706e..9086f40ede 100644 --- a/Gems/LmbrCentral/Code/Source/Ai/NavigationComponent.cpp +++ b/Gems/LmbrCentral/Code/Source/Ai/NavigationComponent.cpp @@ -748,7 +748,7 @@ namespace LmbrCentral PathFollowResult result; - const bool arrived = pathFollower->Update( + [[maybe_unused]] const bool arrived = pathFollower->Update( result, AZVec3ToLYVec3(agentPosition), AZVec3ToLYVec3(agentVelocity), diff --git a/Gems/LmbrCentral/Code/Tests/BundlingSystemComponentTests.cpp b/Gems/LmbrCentral/Code/Tests/BundlingSystemComponentTests.cpp index ada7975b62..08251eb716 100644 --- a/Gems/LmbrCentral/Code/Tests/BundlingSystemComponentTests.cpp +++ b/Gems/LmbrCentral/Code/Tests/BundlingSystemComponentTests.cpp @@ -138,7 +138,6 @@ namespace UnitTest // cache as test/bundle/staticdata.pak and should be loaded below // The Pak has a catalog describing the contents which should automatically update our central asset catalog const char testCSVAsset[] = "staticdata/csv/bundlingsystemtestgameproperties.csv"; - const char testCSVAssetPak[] = "test/bundle/staticdata.pak"; const char testMTLAsset[] = "materials/water_test.mtl"; const char testMTLAssetPak[] = "test/TestMaterials.pak"; @@ -167,7 +166,6 @@ namespace UnitTest const char testCSVAssetPak[] = "test/bundle/staticdata.pak"; // This asset lives only within LmbrCentral/Assets/Test/Bundle/ping.pak - const char testDDSAsset[] = "textures/test/ping.dds"; const char testDDSAssetPak[] = "test/bundle/ping.pak"; size_t bundleCount{ 0 }; diff --git a/Gems/LyShine/Code/Source/Animation/AzEntityNode.cpp b/Gems/LyShine/Code/Source/Animation/AzEntityNode.cpp index 814d1404b4..4d178e2f10 100644 --- a/Gems/LyShine/Code/Source/Animation/AzEntityNode.cpp +++ b/Gems/LyShine/Code/Source/Animation/AzEntityNode.cpp @@ -56,16 +56,7 @@ namespace param.flags = (IUiAnimNode::ESupportedParamFlags)flags; nodeParams.push_back(param); } - - // Quat::IsEquivalent has numerical problems with very similar values - bool CompareRotation(const Quat& q1, const Quat& q2, float epsilon) - { - return (fabs_tpl(q1.v.x - q2.v.x) <= epsilon) - && (fabs_tpl(q1.v.y - q2.v.y) <= epsilon) - && (fabs_tpl(q1.v.z - q2.v.z) <= epsilon) - && (fabs_tpl(q1.w - q2.w) <= epsilon); - } -}; +} ////////////////////////////////////////////////////////////////////////// CUiAnimAzEntityNode::CUiAnimAzEntityNode(const int id) diff --git a/Gems/LyShine/Code/Source/LyShine.cpp b/Gems/LyShine/Code/Source/LyShine.cpp index 694a9665a8..974f3cb022 100644 --- a/Gems/LyShine/Code/Source/LyShine.cpp +++ b/Gems/LyShine/Code/Source/LyShine.cpp @@ -124,10 +124,9 @@ AllocateConstIntCVar(CLyShine, CV_ui_RunUnitTestsOnStartup); #endif //////////////////////////////////////////////////////////////////////////////////////////////////// -CLyShine::CLyShine(ISystem* system) +CLyShine::CLyShine([[maybe_unused]] ISystem* system) : AzFramework::InputChannelEventListener(AzFramework::InputChannelEventListener::GetPriorityUI()) , AzFramework::InputTextEventListener(AzFramework::InputTextEventListener::GetPriorityUI()) - , m_system(system) , m_draw2d(new CDraw2d) , m_uiRenderer(new UiRenderer) , m_uiCanvasManager(new UiCanvasManager) diff --git a/Gems/LyShine/Code/Source/LyShine.h b/Gems/LyShine/Code/Source/LyShine.h index 19a4e664e5..065ad59f80 100644 --- a/Gems/LyShine/Code/Source/LyShine.h +++ b/Gems/LyShine/Code/Source/LyShine.h @@ -155,8 +155,6 @@ private: // static member functions private: // data - ISystem* m_system; // store a pointer to system rather than relying on env.pSystem - std::unique_ptr m_draw2d; // using a pointer rather than an instance to avoid including Draw2d.h std::unique_ptr m_uiRenderer; // using a pointer rather than an instance to avoid including UiRenderer.h AZStd::shared_ptr m_uiRendererForEditor; diff --git a/Gems/LyShine/Code/Source/LyShineSystemComponent.cpp b/Gems/LyShine/Code/Source/LyShineSystemComponent.cpp index f05cbc04d4..d3d2d5655e 100644 --- a/Gems/LyShine/Code/Source/LyShineSystemComponent.cpp +++ b/Gems/LyShine/Code/Source/LyShineSystemComponent.cpp @@ -342,8 +342,6 @@ namespace LyShine // Build a map of entity Ids to their parent Ids, for faster lookup during processing. for (AZ::Entity* exportParentEntity : exportSliceEntities) { - AZ::EntityId exportParentId = exportParentEntity->GetId(); - UiElementComponent* exportParentComponent = exportParentEntity->FindComponent(); if (!exportParentComponent) { diff --git a/Gems/LyShine/Code/Source/Sprite.cpp b/Gems/LyShine/Code/Source/Sprite.cpp index 7f293e57a3..5c7adae481 100644 --- a/Gems/LyShine/Code/Source/Sprite.cpp +++ b/Gems/LyShine/Code/Source/Sprite.cpp @@ -509,20 +509,16 @@ ISprite::Borders CSprite::GetTextureSpaceCellUvBorders(int cellIndex) const if (CellIndexWithinRange(cellIndex)) { const float cellWidth = GetCellUvSize(cellIndex).GetX(); - const float cellMinUCoord = GetCellUvCoords(cellIndex).TopLeft().GetX(); const float cellNormalizedLeftBorder = GetCellUvBorders(cellIndex).m_left * cellWidth; textureSpaceBorders.m_left = cellNormalizedLeftBorder; - const float cellMaxUCoord = GetCellUvCoords(cellIndex).TopRight().GetX(); const float cellNormalizedRightBorder = GetCellUvBorders(cellIndex).m_right * cellWidth; textureSpaceBorders.m_right = cellNormalizedRightBorder; const float cellHeight = GetCellUvSize(cellIndex).GetY(); - const float cellMinVCoord = GetCellUvCoords(cellIndex).TopLeft().GetY(); const float cellNormalizedTopBorder = GetCellUvBorders(cellIndex).m_top * cellHeight; textureSpaceBorders.m_top = cellNormalizedTopBorder; - const float cellMaxVCoord = GetCellUvCoords(cellIndex).BottomLeft().GetY(); const float cellNormalizedBottomBorder = GetCellUvBorders(cellIndex).m_bottom * cellHeight; textureSpaceBorders.m_bottom = cellNormalizedBottomBorder; } diff --git a/Gems/LyShine/Code/Source/Tests/internal/test_UiTransform2dComponent.cpp b/Gems/LyShine/Code/Source/Tests/internal/test_UiTransform2dComponent.cpp index 89b88cd8f6..bea66101fa 100644 --- a/Gems/LyShine/Code/Source/Tests/internal/test_UiTransform2dComponent.cpp +++ b/Gems/LyShine/Code/Source/Tests/internal/test_UiTransform2dComponent.cpp @@ -904,7 +904,6 @@ namespace AZ::EntityId testElemId = CreateElementWithTransform2dComponent(canvas, "UiTransfrom2DTestElement:Offsets"); - AZ::Vector2 parentSize(canvas->GetCanvasSize()); UiTransform2dInterface::Offsets expectedOffsets(-50, -50, 50, 50); UiTransform2dInterface::Offsets actualOffsets; @@ -971,7 +970,6 @@ namespace AZ::EntityId testElemId = CreateElementWithTransform2dComponent(canvas, "UiTransfrom2DTestElement:LocalSize"); - AZ::Vector2 parentSize(canvas->GetCanvasSize()); float expectedWidth = 100; float actualWidth = 1; float expectedHeight = 100; diff --git a/Gems/LyShine/Code/Source/UiImageComponent.cpp b/Gems/LyShine/Code/Source/UiImageComponent.cpp index d279beeee9..e01e87aadd 100644 --- a/Gems/LyShine/Code/Source/UiImageComponent.cpp +++ b/Gems/LyShine/Code/Source/UiImageComponent.cpp @@ -1536,7 +1536,6 @@ void UiImageComponent::RenderSingleQuad(const AZ::Vector2* positions, const AZ:: IDraw2d::Rounding pixelRounding = IsPixelAligned() ? IDraw2d::Rounding::Nearest : IDraw2d::Rounding::None; const uint32 numVertices = 4; SVF_P2F_C4B_T2F_F4B vertices[numVertices]; - const float z = 1.0f; // depth test disabled, if writing Z this will write at far plane for (int i = 0; i < numVertices; ++i) { AZ::Vector2 roundedPoint = Draw2dHelper::RoundXY(positions[i], pixelRounding); @@ -1596,7 +1595,6 @@ void UiImageComponent::RenderLinearFilledQuad(const AZ::Vector2* positions, cons IDraw2d::Rounding pixelRounding = IsPixelAligned() ? IDraw2d::Rounding::Nearest : IDraw2d::Rounding::None; const uint32 numVertices = 4; SVF_P2F_C4B_T2F_F4B vertices[numVertices]; - const float z = 1.0f; // depth test disabled, if writing Z this will write at far plane for (int i = 0; i < numVertices; ++i) { diff --git a/Gems/LyShine/Code/Source/UiImageSequenceComponent.cpp b/Gems/LyShine/Code/Source/UiImageSequenceComponent.cpp index 086aed9f58..d16242fa05 100644 --- a/Gems/LyShine/Code/Source/UiImageSequenceComponent.cpp +++ b/Gems/LyShine/Code/Source/UiImageSequenceComponent.cpp @@ -105,7 +105,6 @@ void UiImageSequenceComponent::Render(LyShine::IRenderGraph* renderGraph) if (m_isRenderCacheDirty) { - const int defaultIndex = 0; uint32 packedColor = 0xffffffff; switch (m_imageType) { @@ -542,7 +541,6 @@ void UiImageSequenceComponent::RenderSingleQuad(const AZ::Vector2* positions, co IDraw2d::Rounding pixelRounding = IsPixelAligned() ? IDraw2d::Rounding::Nearest : IDraw2d::Rounding::None; const uint32 numVertices = 4; SVF_P2F_C4B_T2F_F4B vertices[numVertices]; - const float z = 1.0f; // depth test disabled, if writing Z this will write at far plane for (int i = 0; i < numVertices; ++i) { AZ::Vector2 roundedPoint = Draw2dHelper::RoundXY(positions[i], pixelRounding); diff --git a/Gems/LyShine/Code/Source/UiRenderer.cpp b/Gems/LyShine/Code/Source/UiRenderer.cpp index c52c249d20..07a9f77007 100644 --- a/Gems/LyShine/Code/Source/UiRenderer.cpp +++ b/Gems/LyShine/Code/Source/UiRenderer.cpp @@ -313,8 +313,6 @@ AZ::Vector2 UiRenderer::GetViewportSize() auto windowContext = viewportContext->GetWindowContext(); const AZ::RHI::Viewport& viewport = windowContext->GetViewport(); - const float viewX = viewport.m_minX; - const float viewY = viewport.m_minY; const float viewWidth = viewport.m_maxX - viewport.m_minX; const float viewHeight = viewport.m_maxY - viewport.m_minY; return AZ::Vector2(viewWidth, viewHeight); diff --git a/Gems/LyShine/Code/Source/UiScrollBoxComponent.cpp b/Gems/LyShine/Code/Source/UiScrollBoxComponent.cpp index 88317b840f..8b634b32fb 100644 --- a/Gems/LyShine/Code/Source/UiScrollBoxComponent.cpp +++ b/Gems/LyShine/Code/Source/UiScrollBoxComponent.cpp @@ -1500,7 +1500,6 @@ AZ::Vector2 UiScrollBoxComponent::ConstrainOffset(AZ::Vector2 proposedOffset, AZ // add the requested scroll offset to the content rect to get the proposed position // The content has already need moved by the requested offset all but latestOffsetDelta - UiTransformInterface::Rect origContentRect = contentRect; contentRect.MoveBy(latestOffsetDelta); if (contentRect.GetWidth() <= parentRect.GetWidth()) diff --git a/Gems/LyShine/Code/Source/UiTextComponent.cpp b/Gems/LyShine/Code/Source/UiTextComponent.cpp index f9544a9954..2afd1cac73 100644 --- a/Gems/LyShine/Code/Source/UiTextComponent.cpp +++ b/Gems/LyShine/Code/Source/UiTextComponent.cpp @@ -2662,8 +2662,6 @@ void UiTextComponent::GetClickableTextRects(UiClickableTextInterface::ClickableT AZ::Vector2 pos = CalculateAlignedPositionWithYOffset(points); const DrawBatchLines& drawBatchLines = GetDrawBatchLines(); - int requestFontSize = GetRequestFontSize(); - STextDrawContext fontContext(GetTextDrawContextPrototype(requestFontSize, drawBatchLines.fontSizeScale)); float newlinePosYIncrement = 0.0f; for (auto& drawBatchLine : drawBatchLines.batchLines) @@ -3344,7 +3342,6 @@ void UiTextComponent::GetTextRect(UiTransformInterface::RectPoints& rect, const // get the "no scale rotate" element box UiTransformInterface::RectPoints elemRect; EBUS_EVENT_ID(GetEntityId(), UiTransformBus, GetCanvasSpacePointsNoScaleRotate, elemRect); - AZ::Vector2 elemSize = elemRect.GetAxisAlignedSize(); // given the text alignment work out the box of the actual text rect = elemRect; diff --git a/Gems/LyShine/Code/Source/UiTransform2dComponent.cpp b/Gems/LyShine/Code/Source/UiTransform2dComponent.cpp index 48b2c2a8c4..48165fa8d7 100644 --- a/Gems/LyShine/Code/Source/UiTransform2dComponent.cpp +++ b/Gems/LyShine/Code/Source/UiTransform2dComponent.cpp @@ -1454,7 +1454,7 @@ AZ::EntityId UiTransform2dComponent::GetAncestorWithSameDimensionScaleToDevice(S LyShine::EntityArray UiTransform2dComponent::GetDescendantsWithSameDimensionScaleToDevice(ScaleToDeviceMode scaleToDeviceMode) const { // Check if any descendants have their scale to device mode set in the same dimension - auto HasSameDimensionScaleToDevice = [this, scaleToDeviceMode](const AZ::Entity* entity) + auto HasSameDimensionScaleToDevice = [scaleToDeviceMode](const AZ::Entity* entity) { ScaleToDeviceMode descendantScaleToDeviceMode = ScaleToDeviceMode::None; EBUS_EVENT_ID_RESULT(descendantScaleToDeviceMode, entity->GetId(), UiTransformBus, GetScaleToDeviceMode); diff --git a/Gems/LyShine/Code/Source/World/UiCanvasOnMeshComponent.cpp b/Gems/LyShine/Code/Source/World/UiCanvasOnMeshComponent.cpp index 81a68a5a9e..395e0dfc32 100644 --- a/Gems/LyShine/Code/Source/World/UiCanvasOnMeshComponent.cpp +++ b/Gems/LyShine/Code/Source/World/UiCanvasOnMeshComponent.cpp @@ -101,190 +101,6 @@ namespace } #endif - //////////////////////////////////////////////////////////////////////////////////////////////////// - bool GetBarycentricCoordinates(const Vec3& a, const Vec3& b, const Vec3& c, const Vec3& p, float& u, float& v, float& w, float fBorder) - { - // Compute vectors - Vec3 v0 = b - a; - Vec3 v1 = c - a; - Vec3 v2 = p - a; - - // Compute dot products - float dot00 = v0.Dot(v0); - float dot01 = v0.Dot(v1); - float dot02 = v0.Dot(v2); - float dot11 = v1.Dot(v1); - float dot12 = v1.Dot(v2); - - // Compute barycentric coordinates - float invDenom = 1.f / (dot00 * dot11 - dot01 * dot01); - v = (dot11 * dot02 - dot01 * dot12) * invDenom; - w = (dot00 * dot12 - dot01 * dot02) * invDenom; - u = 1.f - v - w; - - // Check if point is in triangle - return (u >= -fBorder) && (v >= -fBorder) && (w >= -fBorder); - } - - //////////////////////////////////////////////////////////////////////////////////////////////////// - bool SnapToPlaneAndGetBarycentricCoordinates(const Vec3& a, const Vec3& b, const Vec3& c, const Vec3& p, float& u, float& v, float& w) - { - // get face normal - Vec3 uVec = b - a; - Vec3 vVec = c - a; - Vec3 faceNormal = uVec.cross(vVec); - faceNormal.NormalizeSafe(); - Vec3 aToPt = p - a; - float dist = aToPt.Dot(faceNormal); - float distSq = dist * dist; - float triLenSq = uVec.len2() + vVec.len2(); - - // Is the point "close enough" to the plane of the triangle? - if (distSq < triLenSq * 0.1f) - { - // snap the point to the plane of the triangle - Vec3 coplanarP = p - dist * faceNormal; - - return GetBarycentricCoordinates(a, b, c, coplanarP, u, v, w, 0.0f); - } - - return false; - } - - //////////////////////////////////////////////////////////////////////////////////////////////////// - Vec2 ConvertBarycentricCoordsToUVCoords(float u, float v, float w, Vec2 uv0, Vec2 uv1, Vec2 uv2) - { - float arrVertWeight[3] = { max(0.f, u), max(0.f, v), max(0.f, w) }; - float fDiv = 1.f / (arrVertWeight[0] + arrVertWeight[1] + arrVertWeight[2]); - arrVertWeight[0] *= fDiv; - arrVertWeight[1] *= fDiv; - arrVertWeight[2] *= fDiv; - - Vec2 uvResult = uv0 * arrVertWeight[0] + uv1 * arrVertWeight[1] + uv2 * arrVertWeight[2]; - return uvResult; - } - - //////////////////////////////////////////////////////////////////////////////////////////////////// - bool GetTexCoordFromRayHitOnIndexedMesh( - int triIndex, - Vec3 hitPoint, - [[maybe_unused]] const IPhysicalEntity* collider, - [[maybe_unused]] int partIndex, - const Matrix34& slotWorldTM, - const IIndexedMesh* indexedMesh, - Vec2& texCoord) - { - IIndexedMesh::SMeshDescription meshDesc; - indexedMesh->GetMeshDescription(meshDesc); - -#if UI_CANVAS_ON_MESH_DEBUG - DrawSphere(hitPoint, debugHitColor, debugDrawSphereSize); -#endif - - // triIndex is -1 if this is not a mesh collision (i.e. collided with a parametric primitive) - if (triIndex >= 0 && triIndex * 3 <= meshDesc.m_nIndexCount) - { - // convert TriIndex into the indices into the index buffer - int i0 = triIndex * 3; - int i1 = i0 + 1; - int i2 = i0 + 2; - - // get the vertex indices from the index buffer - int vIndex0 = meshDesc.m_pIndices[i0]; - int vIndex1 = meshDesc.m_pIndices[i1]; - int vIndex2 = meshDesc.m_pIndices[i2]; - - // get verts in local space - Vec3 v0 = meshDesc.m_pVerts[vIndex0]; - Vec3 v1 = meshDesc.m_pVerts[vIndex1]; - Vec3 v2 = meshDesc.m_pVerts[vIndex2]; - - // get verts in world space - Vec3 wv0 = slotWorldTM.TransformPoint(v0); - Vec3 wv1 = slotWorldTM.TransformPoint(v1); - Vec3 wv2 = slotWorldTM.TransformPoint(v2); - - -#if UI_CANVAS_ON_MESH_DEBUG - DrawCollisionMeshTrianglePoints(triIndex, collider, partIndex, slotWorldTM); -#endif - - float u, v, w; - if (SnapToPlaneAndGetBarycentricCoordinates(wv0, wv1, wv2, hitPoint, u, v, w)) - { -#if UI_CANVAS_ON_MESH_DEBUG - DrawTrianglePoints(wv0, wv1, wv2, debugRenderMeshAttempt1Color, debugDrawSphereSize); -#endif - - // get the texcoord for each vert of the triangle - Vec2 uv0 = meshDesc.m_pTexCoord[vIndex0].GetUV(); - Vec2 uv1 = meshDesc.m_pTexCoord[vIndex1].GetUV(); - Vec2 uv2 = meshDesc.m_pTexCoord[vIndex2].GetUV(); - - texCoord = ConvertBarycentricCoordsToUVCoords(u, v, w, uv0, uv1, uv2); - - return true; - } - } - - // If we got here then EITHER, the iPrim is 0xffffffff meaning that the collision - // was a primitive rather than a mesh collision OR the iPrim is not the right - // triangle index in the render mesh. This sometimes happens, presumably due to - // some modifications that are made automatically to the collision mesh by the - // physics system or something to do with how the IndexedMesh is generated on - // demand in IStatObj:::GetIndexedMesh. - // We do have the collision point though. So we go through all the triangles in - // the render mesh and try to find the right triangle. - // NOTE: This could be optimized by converting the hit point to local space. - // NOTE: Currently we use the first triangle where the point is "close enough" to the plane - // of the triangle and the barycentric calculation says that the point is within the - // triangle. This "close enough" test is rather arbitrary and could get a false positive in - // some edge cases. - // Another approach would be to go through all the triangles doing the barycentric - // test and keep track of which one that passes is closest to the plane of the triangle. - int triCount = meshDesc.m_nIndexCount / 3; - for (int i = 0; i < triCount; ++i) - { - // convert TriIndex into the indices into the index buffer - int i0 = i * 3; - int i1 = i0 + 1; - int i2 = i0 + 2; - - // get the vertex indices from the index buffer - int vIndex0 = meshDesc.m_pIndices[i0]; - int vIndex1 = meshDesc.m_pIndices[i1]; - int vIndex2 = meshDesc.m_pIndices[i2]; - - // get verts in local space - Vec3 v0 = meshDesc.m_pVerts[vIndex0]; - Vec3 v1 = meshDesc.m_pVerts[vIndex1]; - Vec3 v2 = meshDesc.m_pVerts[vIndex2]; - - // get verts in world space - Vec3 wv0 = slotWorldTM.TransformPoint(v0); - Vec3 wv1 = slotWorldTM.TransformPoint(v1); - Vec3 wv2 = slotWorldTM.TransformPoint(v2); - - float u, v, w; - if (SnapToPlaneAndGetBarycentricCoordinates(wv0, wv1, wv2, hitPoint, u, v, w)) - { -#if UI_CANVAS_ON_MESH_DEBUG - DrawTrianglePoints(wv0, wv1, wv2, debugRenderMeshAttempt2Color, debugDrawSphereSize); -#endif - - // get the texcoord for each vert of the triangle - Vec2 uv0 = meshDesc.m_pTexCoord[vIndex0].GetUV(); - Vec2 uv1 = meshDesc.m_pTexCoord[vIndex1].GetUV(); - Vec2 uv2 = meshDesc.m_pTexCoord[vIndex2].GetUV(); - - texCoord = ConvertBarycentricCoordsToUVCoords(u, v, w, uv0, uv1, uv2); - - return true; - } - } - - return false; - } } // Anonymous namespace //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/Gems/Maestro/Code/Source/Cinematics/Movie.cpp b/Gems/Maestro/Code/Source/Cinematics/Movie.cpp index cf51ef3729..e89e5afa15 100644 --- a/Gems/Maestro/Code/Source/Cinematics/Movie.cpp +++ b/Gems/Maestro/Code/Source/Cinematics/Movie.cpp @@ -973,9 +973,6 @@ void CMovieSystem::StillUpdate() ////////////////////////////////////////////////////////////////////////// void CMovieSystem::ShowPlayedSequencesDebug() { - f32 green[4] = {0, 1, 0, 1}; - f32 purple[4] = {1, 0, 1, 1}; - f32 white[4] = {1, 1, 1, 1}; float y = 10.0f; std::vector names; diff --git a/Gems/Maestro/Code/Source/Cinematics/SceneNode.cpp b/Gems/Maestro/Code/Source/Cinematics/SceneNode.cpp index d4b894dc92..0d91bad440 100644 --- a/Gems/Maestro/Code/Source/Cinematics/SceneNode.cpp +++ b/Gems/Maestro/Code/Source/Cinematics/SceneNode.cpp @@ -697,7 +697,6 @@ void CAnimSceneNode::InterpolateCameras(SCameraParams& retInterpolatedCameraPara return; } - static const float EPSILON_TIME = 0.01f; // consider times within EPSILON_TIME of beginning of blend time to be at the beginning of blend time float interpolatedFoV; ISceneCamera* secondCamera = static_cast(new CComponentEntitySceneCamera(secondKey.cameraAzEntityId)); diff --git a/Gems/Maestro/Code/Source/Cinematics/Tests/EntityNodeTest.cpp b/Gems/Maestro/Code/Source/Cinematics/Tests/EntityNodeTest.cpp index 064f1ba6a7..595a5aac3c 100644 --- a/Gems/Maestro/Code/Source/Cinematics/Tests/EntityNodeTest.cpp +++ b/Gems/Maestro/Code/Source/Cinematics/Tests/EntityNodeTest.cpp @@ -113,7 +113,6 @@ namespace EntityNodeTest TEST_F(CryMovie_CharacterTrackAnimator_Test, CryMovieUnitTest_CharacterTrackAnimator_ComputeAnimKeyNormalizedTime_Loop) { const float NORMALIZED_CLIP_START = .0f; - const float NORMALIZED_CLIP_END = 1.0f; const float ERROR_TOLERANCE = 0.0001f; ICharacterKey key; m_dummyTrack.GetKey(EntityNodeTest::KEY_IDX, &key); diff --git a/Gems/Multiplayer/Code/Source/Components/LocalPredictionPlayerInputComponent.cpp b/Gems/Multiplayer/Code/Source/Components/LocalPredictionPlayerInputComponent.cpp index 936f2ea92c..452cb31a7a 100644 --- a/Gems/Multiplayer/Code/Source/Components/LocalPredictionPlayerInputComponent.cpp +++ b/Gems/Multiplayer/Code/Source/Components/LocalPredictionPlayerInputComponent.cpp @@ -40,7 +40,6 @@ namespace Multiplayer AzNetworking::StringifySerializer::ValueMap differences = clientMap; for (auto iter = server.GetValueMap().begin(); iter != server.GetValueMap().end(); ++iter) { - auto serverValueIter = clientMap.find(iter->first); if (iter->second == differences[iter->first]) { differences.erase(iter->first); @@ -492,7 +491,6 @@ namespace Multiplayer { const double deltaTime = static_cast(deltaTimeMs) / 1000.0; const double clientInputRateSec = static_cast(static_cast(cl_InputRateMs)) / 1000.0; - const double maxRewindHistory = static_cast(static_cast(cl_MaxRewindHistoryMs)) / 1000.0; // Update banked time accumulator m_clientBankedTime -= deltaTime; diff --git a/Gems/Multiplayer/Code/Source/Debug/MultiplayerDebugSystemComponent.cpp b/Gems/Multiplayer/Code/Source/Debug/MultiplayerDebugSystemComponent.cpp index 27a4dff485..422b2f0cae 100644 --- a/Gems/Multiplayer/Code/Source/Debug/MultiplayerDebugSystemComponent.cpp +++ b/Gems/Multiplayer/Code/Source/Debug/MultiplayerDebugSystemComponent.cpp @@ -230,7 +230,6 @@ namespace Multiplayer void DrawNetworkingStats() { const float TEXT_BASE_WIDTH = ImGui::CalcTextSize("A").x; - const float TEXT_BASE_HEIGHT = ImGui::GetTextLineHeightWithSpacing(); const ImGuiTableFlags flags = ImGuiTableFlags_BordersV | ImGuiTableFlags_BordersOuterH @@ -383,7 +382,6 @@ namespace Multiplayer void DrawMultiplayerStats() { const float TEXT_BASE_WIDTH = ImGui::CalcTextSize("A").x; - const float TEXT_BASE_HEIGHT = ImGui::GetTextLineHeightWithSpacing(); IMultiplayer* multiplayer = AZ::Interface::Get(); MultiplayerComponentRegistry* componentRegistry = GetMultiplayerComponentRegistry(); diff --git a/Gems/Multiplayer/Code/Source/MultiplayerSystemComponent.cpp b/Gems/Multiplayer/Code/Source/MultiplayerSystemComponent.cpp index 497d35db7e..1be68ad6d8 100644 --- a/Gems/Multiplayer/Code/Source/MultiplayerSystemComponent.cpp +++ b/Gems/Multiplayer/Code/Source/MultiplayerSystemComponent.cpp @@ -747,7 +747,6 @@ namespace Multiplayer { m_initEvent.Signal(m_networkInterface); - const AZ::Aabb worldBounds = AZ::Aabb::CreateFromMinMax(AZ::Vector3(-16384.0f), AZ::Vector3(16384.0f)); //const AZ::Aabb worldBounds = AZ::Interface.Get()->GetWorldBounds(); AZStd::unique_ptr newDomain = AZStd::make_unique(); m_networkEntityManager.Initialize(InvalidHostId, AZStd::move(newDomain)); @@ -892,9 +891,8 @@ namespace Multiplayer // Unfortunately necessary, as NotifyPreRender can update transforms and thus cause a deadlock inside the vis system AZStd::vector gatheredEntities; - AzFramework::IEntityBoundsUnion* entityBoundsUnion = AZ::Interface::Get(); AZ::Interface::Get()->GetDefaultVisibilityScene()->Enumerate(viewFrustum, - [&gatheredEntities, entityBoundsUnion](const AzFramework::IVisibilityScene::NodeData& nodeData) + [&gatheredEntities](const AzFramework::IVisibilityScene::NodeData& nodeData) { gatheredEntities.reserve(gatheredEntities.size() + nodeData.m_entries.size()); for (AzFramework::VisibilityEntry* visEntry : nodeData.m_entries) diff --git a/Gems/Multiplayer/Code/Source/NetworkEntity/EntityReplication/PropertySubscriber.h b/Gems/Multiplayer/Code/Source/NetworkEntity/EntityReplication/PropertySubscriber.h index f5615f3d52..286509b798 100644 --- a/Gems/Multiplayer/Code/Source/NetworkEntity/EntityReplication/PropertySubscriber.h +++ b/Gems/Multiplayer/Code/Source/NetworkEntity/EntityReplication/PropertySubscriber.h @@ -40,7 +40,6 @@ namespace Multiplayer // The last packet to have been received about this entity AzNetworking::PacketId m_lastReceivedPacketId = AzNetworking::InvalidPacketId; - AZ::TimeMs m_lastRecievedTimeMs = AZ::TimeMs{ 0 }; AZ::TimeMs m_markForRemovalTimeMs = AZ::TimeMs{ 0 }; }; } diff --git a/Gems/Multiplayer/Code/Source/ReplicationWindows/ServerToClientReplicationWindow.cpp b/Gems/Multiplayer/Code/Source/ReplicationWindows/ServerToClientReplicationWindow.cpp index ba9740f8db..3677eb8b5c 100644 --- a/Gems/Multiplayer/Code/Source/ReplicationWindows/ServerToClientReplicationWindow.cpp +++ b/Gems/Multiplayer/Code/Source/ReplicationWindows/ServerToClientReplicationWindow.cpp @@ -181,9 +181,9 @@ namespace Multiplayer void ServerToClientReplicationWindow::DebugDraw() const { - static const float BoundaryStripeHeight = 1.0f; - static const float BoundaryStripeSpacing = 0.5f; - static const int32_t BoundaryStripeCount = 10; + //static const float BoundaryStripeHeight = 1.0f; + //static const float BoundaryStripeSpacing = 0.5f; + //static const int32_t BoundaryStripeCount = 10; //if (auto localEnt = m_ControlledEntity.lock()) //{ @@ -289,7 +289,6 @@ namespace Multiplayer } const bool isQueueFull = (m_candidateQueue.size() >= sv_MaxEntitiesToTrackReplication); // See if have the maximum number of entities in our set - const bool isBetterChoice = !m_candidateQueue.empty() && (priority > m_candidateQueue.top().m_priority); // Check if the new thing we are adding is better than the worst item in our set const bool isInReplicationSet = m_replicationSet.find(entityHandle) != m_replicationSet.end(); if (!isInReplicationSet) { diff --git a/Gems/Multiplayer/Code/Source/ReplicationWindows/ServerToClientReplicationWindow.h b/Gems/Multiplayer/Code/Source/ReplicationWindows/ServerToClientReplicationWindow.h index 391693812d..bfaa351095 100644 --- a/Gems/Multiplayer/Code/Source/ReplicationWindows/ServerToClientReplicationWindow.h +++ b/Gems/Multiplayer/Code/Source/ReplicationWindows/ServerToClientReplicationWindow.h @@ -76,7 +76,6 @@ namespace Multiplayer //NetBindComponent* m_controlledNetBindComponent = nullptr; const AzNetworking::IConnection* m_connection = nullptr; - float m_minPriorityReplicated = 0.0f; ///< Lowest replicated entity priority in last update // Cached values to detect a poor network connection uint32_t m_lastCheckedSentPackets = 0; diff --git a/Gems/NvCloth/Code/Tests/System/FabricCookerTest.cpp b/Gems/NvCloth/Code/Tests/System/FabricCookerTest.cpp index f6f9947223..c5a22d02d1 100644 --- a/Gems/NvCloth/Code/Tests/System/FabricCookerTest.cpp +++ b/Gems/NvCloth/Code/Tests/System/FabricCookerTest.cpp @@ -140,9 +140,6 @@ namespace UnitTest TEST(NvClothSystem, FactoryCooker_CopyInternalCookedData_CopiedDataMatchesSource) { - const AZ::u32 data[] = { 0, 2, 45, 64, 125 }; - const size_t numDataElements = sizeof(data) / sizeof(data[0]); - nv::cloth::CookedData nvCookedData; nvCookedData.mNumParticles = 0; diff --git a/Gems/PhysX/Code/Source/Utils.cpp b/Gems/PhysX/Code/Source/Utils.cpp index 0b7ab9436b..8a76d6d986 100644 --- a/Gems/PhysX/Code/Source/Utils.cpp +++ b/Gems/PhysX/Code/Source/Utils.cpp @@ -654,10 +654,6 @@ namespace PhysX const AZ::Quaternion& colliderRelativeRotation, const AZ::Vector3& nonUniformScale) { - AZ::Transform transform = GetColliderWorldTransform(worldTransform, - colliderRelativePosition, - colliderRelativeRotation); - for (AZ::Vector3& point : pointsInOut) { point = worldTransform.TransformPoint(nonUniformScale * diff --git a/Gems/PhysX/Code/Tests/Benchmarks/PhysXCharactersRagdollBenchmarks.cpp b/Gems/PhysX/Code/Tests/Benchmarks/PhysXCharactersRagdollBenchmarks.cpp index 575ff7b4b7..8febfcddfc 100644 --- a/Gems/PhysX/Code/Tests/Benchmarks/PhysXCharactersRagdollBenchmarks.cpp +++ b/Gems/PhysX/Code/Tests/Benchmarks/PhysXCharactersRagdollBenchmarks.cpp @@ -225,7 +225,6 @@ namespace PhysX::Benchmarks } //enable and position the ragdolls - const int ragdollsPerCol = static_cast(RagdollConstants::TerrainSize / 10.0f) - 1; int idx = 0; for (auto& ragdoll : ragdolls) { diff --git a/Gems/PhysX/Code/Tests/CharacterControllerTests.cpp b/Gems/PhysX/Code/Tests/CharacterControllerTests.cpp index 53a7e20be6..c4cb4cc4ad 100644 --- a/Gems/PhysX/Code/Tests/CharacterControllerTests.cpp +++ b/Gems/PhysX/Code/Tests/CharacterControllerTests.cpp @@ -247,7 +247,6 @@ namespace PhysX for (int i = 0; i < 50; i++) { basis.Update(desiredVelocity); - AZ::Vector3 velocity = basis.m_controller->GetVelocity(); EXPECT_TRUE(basis.m_controller->GetVelocity().IsClose(AZ::Vector3::CreateZero())); } @@ -260,7 +259,6 @@ namespace PhysX for (int i = 0; i < 50; i++) { basis.Update(desiredVelocity); - AZ::Vector3 velocity = basis.m_controller->GetVelocity(); EXPECT_TRUE(basis.m_controller->GetVelocity().IsClose(desiredVelocity)); } } diff --git a/Gems/PhysX/Code/Tests/PhysXMultithreadingTest.cpp b/Gems/PhysX/Code/Tests/PhysXMultithreadingTest.cpp index cb200113bb..a0013402b1 100644 --- a/Gems/PhysX/Code/Tests/PhysXMultithreadingTest.cpp +++ b/Gems/PhysX/Code/Tests/PhysXMultithreadingTest.cpp @@ -140,11 +140,9 @@ namespace PhysX Log_Help(m_threadDesc.m_name, "Thread %d - sleeping for %dms\n", AZStd::this_thread::get_id(), m_waitTimeMilliseconds); AZStd::this_thread::sleep_for(AZStd::chrono::milliseconds(m_waitTimeMilliseconds)); Log_Help(m_threadDesc.m_name, "Thread %d - running cast\n", AZStd::this_thread::get_id()); - AZStd::chrono::system_clock::time_point startTime = AZStd::chrono::system_clock::now(); RunRequest(); - AZStd::chrono::microseconds exeTimeUS = AZStd::chrono::system_clock::now() - startTime; Log_Help(m_threadDesc.m_name, "Thread %d - complete - time %dus\n", AZStd::this_thread::get_id(), exeTimeUS.count()); } diff --git a/Gems/PhysX/Code/Tests/PhysXSceneQueryTests.cpp b/Gems/PhysX/Code/Tests/PhysXSceneQueryTests.cpp index caacf5dce2..48ae2e37d7 100644 --- a/Gems/PhysX/Code/Tests/PhysXSceneQueryTests.cpp +++ b/Gems/PhysX/Code/Tests/PhysXSceneQueryTests.cpp @@ -737,11 +737,11 @@ namespace PhysX auto* sceneInterface = AZ::Interface::Get(); //setup bodies - AzPhysics::SimulatedBodyHandle sphereHandle = TestUtils::AddSphereToScene(m_testSceneHandle, + TestUtils::AddSphereToScene(m_testSceneHandle, AZ::Vector3(10.0f, 0.0f, 0.0f), 3.0f); AzPhysics::SimulatedBodyHandle boxHandle = TestUtils::AddBoxToScene(m_testSceneHandle, AZ::Vector3(7.0f, 4.0f, 0.0f), AZ::Vector3(1.0f)); - AzPhysics::SimulatedBodyHandle capsuleHandle = TestUtils::AddCapsuleToScene(m_testSceneHandle, + TestUtils::AddCapsuleToScene(m_testSceneHandle, AZ::Vector3(15.0f, 0.0f, 0.0f), 3.0f, 1.0f); //Create request @@ -769,11 +769,11 @@ namespace PhysX auto* sceneInterface = AZ::Interface::Get(); //setup bodies - AzPhysics::SimulatedBodyHandle sphereHandle = TestUtils::AddSphereToScene(m_testSceneHandle, + TestUtils::AddSphereToScene(m_testSceneHandle, AZ::Vector3(10.0f, 0.0f, 0.0f), 3.0f); AzPhysics::SimulatedBodyHandle boxHandle = TestUtils::AddBoxToScene(m_testSceneHandle, AZ::Vector3(7.0f, 4.0f, 0.0f), AZ::Vector3(1.0f)); - AzPhysics::SimulatedBodyHandle capsuleHandle = TestUtils::AddCapsuleToScene(m_testSceneHandle, + TestUtils::AddCapsuleToScene(m_testSceneHandle, AZ::Vector3(15.0f, 0.0f, 0.0f), 3.0f, 1.0f); //Box Overlap Request @@ -824,9 +824,9 @@ namespace PhysX auto* sceneInterface = AZ::Interface::Get(); //setup bodies - AzPhysics::SimulatedBodyHandle sphereHandle = TestUtils::AddSphereToScene(m_testSceneHandle, + TestUtils::AddSphereToScene(m_testSceneHandle, AZ::Vector3(10.0f, 0.0f, 0.0f), 3.0f); - AzPhysics::SimulatedBodyHandle boxHandle = TestUtils::AddBoxToScene(m_testSceneHandle, + TestUtils::AddBoxToScene(m_testSceneHandle, AZ::Vector3(7.0f, 4.0f, 0.0f), AZ::Vector3(1.0f)); AzPhysics::SimulatedBodyHandle capsuleHandle = TestUtils::AddCapsuleToScene(m_testSceneHandle, AZ::Vector3(15.0f, 0.0f, 0.0f), 3.0f, 1.0f); @@ -863,9 +863,9 @@ namespace PhysX //setup bodies AzPhysics::SimulatedBodyHandle sphereHandle = TestUtils::AddSphereToScene(m_testSceneHandle, AZ::Vector3(10.0f, 0.0f, 0.0f), 3.0f, AzPhysics::CollisionLayer(0)); - AzPhysics::SimulatedBodyHandle boxHandle = TestUtils::AddBoxToScene(m_testSceneHandle, + TestUtils::AddBoxToScene(m_testSceneHandle, AZ::Vector3(12.0f, 0.0f, 0.0f), AZ::Vector3(1.0f), AzPhysics::CollisionLayer(1)); - AzPhysics::SimulatedBodyHandle capsuleHandle = TestUtils::AddCapsuleToScene(m_testSceneHandle, + TestUtils::AddCapsuleToScene(m_testSceneHandle, AZ::Vector3(14.0f, 0.0f, 0.0f), 3.0f, 1.0f, AzPhysics::CollisionLayer(2)); //Create Request diff --git a/Gems/PhysX/Code/Tests/PhysXSceneTests.cpp b/Gems/PhysX/Code/Tests/PhysXSceneTests.cpp index 5b90ef0004..7baaa34ab5 100644 --- a/Gems/PhysX/Code/Tests/PhysXSceneTests.cpp +++ b/Gems/PhysX/Code/Tests/PhysXSceneTests.cpp @@ -558,7 +558,7 @@ namespace PhysX // add a static simulated body - this is not expected to be reported as an active actor AzPhysics::StaticRigidBodyConfiguration staticConfig; staticConfig.m_colliderAndShapeData = shapeColliderData; - AzPhysics::SimulatedBodyHandle staticSphereHandle = sceneInterface->AddSimulatedBody(m_testSceneHandle, &staticConfig); + sceneInterface->AddSimulatedBody(m_testSceneHandle, &staticConfig); // add a rigid body - this is expect to be reported as an active actor AzPhysics::RigidBodyConfiguration rigidConfig; diff --git a/Gems/PhysX/Code/Tests/PhysXSpecificTest.cpp b/Gems/PhysX/Code/Tests/PhysXSpecificTest.cpp index 6e96db4db2..0c0eee3eb0 100644 --- a/Gems/PhysX/Code/Tests/PhysXSpecificTest.cpp +++ b/Gems/PhysX/Code/Tests/PhysXSpecificTest.cpp @@ -1126,7 +1126,7 @@ namespace PhysX return nullptr; }; - auto RemoveRigidBody = [this](AzPhysics::RigidBody*& rigidBody) + auto RemoveRigidBody = [](AzPhysics::RigidBody*& rigidBody) { auto* sceneInterface = AZ::Interface::Get(); if (rigidBody && sceneInterface) diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/NodeFunctionGeneric.h b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/NodeFunctionGeneric.h index e9586ac83a..9906c73cf5 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/NodeFunctionGeneric.h +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/NodeFunctionGeneric.h @@ -148,7 +148,7 @@ namespace ScriptCanvas { static int indices[] = { inputDatumIndices... }; static_assert(sizeof...(Is) == AZ_ARRAY_SIZE(indices), "size of default values doesn't match input datum indices for them"); - std::initializer_list { (MoreHelp(node, indices[Is], AZStd::forward(args)), 0)... }; + [[maybe_unused]] std::initializer_list dummy = { (MoreHelp(node, indices[Is], AZStd::forward(args)), 0)... }; } template diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Operators/Containers/OperatorErase.cpp b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Operators/Containers/OperatorErase.cpp index adcf8c4ff8..ebb7a8233a 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Operators/Containers/OperatorErase.cpp +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Operators/Containers/OperatorErase.cpp @@ -59,7 +59,7 @@ namespace ScriptCanvas if (sourceType == SourceType::SourceInput) { ContractDescriptor supportsMethodContract; - supportsMethodContract.m_createFunc = [this]() -> SupportsMethodContract* { return aznew SupportsMethodContract("Erase"); }; + supportsMethodContract.m_createFunc = []() -> SupportsMethodContract* { return aznew SupportsMethodContract("Erase"); }; contractDescs.push_back(AZStd::move(supportsMethodContract)); } } diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Operators/Containers/OperatorFront.cpp b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Operators/Containers/OperatorFront.cpp index 15f80896cd..d83711adbe 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Operators/Containers/OperatorFront.cpp +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Operators/Containers/OperatorFront.cpp @@ -23,7 +23,7 @@ namespace ScriptCanvas if (sourceType == SourceType::SourceInput) { ContractDescriptor supportsMethodContract; - supportsMethodContract.m_createFunc = [this]() -> SupportsMethodContract* { return aznew SupportsMethodContract("Front"); }; + supportsMethodContract.m_createFunc = []() -> SupportsMethodContract* { return aznew SupportsMethodContract("Front"); }; contractDescs.push_back(AZStd::move(supportsMethodContract)); } } diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Operators/Containers/OperatorInsert.cpp b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Operators/Containers/OperatorInsert.cpp index 30efece944..7374b3442f 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Operators/Containers/OperatorInsert.cpp +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Operators/Containers/OperatorInsert.cpp @@ -21,7 +21,7 @@ namespace ScriptCanvas if (sourceType == SourceType::SourceInput) { ContractDescriptor supportsMethodContract; - supportsMethodContract.m_createFunc = [this]() -> SupportsMethodContract* { return aznew SupportsMethodContract("Insert"); }; + supportsMethodContract.m_createFunc = []() -> SupportsMethodContract* { return aznew SupportsMethodContract("Insert"); }; contractDescs.push_back(AZStd::move(supportsMethodContract)); } } diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Operators/Containers/OperatorPushBack.cpp b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Operators/Containers/OperatorPushBack.cpp index 04f6b0756e..5793d06aec 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Operators/Containers/OperatorPushBack.cpp +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Operators/Containers/OperatorPushBack.cpp @@ -21,7 +21,7 @@ namespace ScriptCanvas if (sourceType == SourceType::SourceInput) { ContractDescriptor supportsMethodContract; - supportsMethodContract.m_createFunc = [this]() -> SupportsMethodContract* { return aznew SupportsMethodContract("PushBack"); }; + supportsMethodContract.m_createFunc = []() -> SupportsMethodContract* { return aznew SupportsMethodContract("PushBack"); }; contractDescs.push_back(AZStd::move(supportsMethodContract)); } } diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Spawning/SpawnNodeable.cpp b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Spawning/SpawnNodeable.cpp index d11e916d42..e28ed9dce8 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Spawning/SpawnNodeable.cpp +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Spawning/SpawnNodeable.cpp @@ -101,7 +101,7 @@ namespace ScriptCanvas::Nodeables::Spawning return; } - auto preSpawnCB = [this, translation, rotation, scale]([[maybe_unused]] AzFramework::EntitySpawnTicket::Id ticketId, + auto preSpawnCB = [translation, rotation, scale]([[maybe_unused]] AzFramework::EntitySpawnTicket::Id ticketId, AzFramework::SpawnableEntityContainerView view) { AZ::Entity* rootEntity = *view.begin(); diff --git a/Gems/ScriptEvents/Code/Include/ScriptEvents/ScriptEventsAssetRef.h b/Gems/ScriptEvents/Code/Include/ScriptEvents/ScriptEventsAssetRef.h index 506e1611bd..619dd42483 100644 --- a/Gems/ScriptEvents/Code/Include/ScriptEvents/ScriptEventsAssetRef.h +++ b/Gems/ScriptEvents/Code/Include/ScriptEvents/ScriptEventsAssetRef.h @@ -135,7 +135,6 @@ namespace ScriptEvents AZ::Data::AssetCatalogRequestBus::BroadcastResult(assetInfo, &AZ::Data::AssetCatalogRequests::GetAssetInfoById, m_asset.GetId()); if (assetInfo.m_assetId.IsValid()) { - const AZ::Data::AssetType assetTypeId = azrtti_typeid(); auto& assetManager = AZ::Data::AssetManager::Instance(); m_asset = assetManager.GetAsset(m_asset.GetId(), azrtti_typeid(), m_asset.GetAutoLoadBehavior()); diff --git a/Gems/ScriptEvents/Code/Tests/Tests/ScriptEventsTest_Core.cpp b/Gems/ScriptEvents/Code/Tests/Tests/ScriptEventsTest_Core.cpp index 7ae39db846..6da11deb95 100644 --- a/Gems/ScriptEvents/Code/Tests/Tests/ScriptEventsTest_Core.cpp +++ b/Gems/ScriptEvents/Code/Tests/Tests/ScriptEventsTest_Core.cpp @@ -406,26 +406,6 @@ namespace ScriptEventsTests EXPECT_TRUE(behaviorEbus->m_destroyHandler->Invoke(handler)); - auto onReady = [&assetData, &scriptEventName]() { - const char* renamedMethod = "__METHOD__1__"; - - ScriptEvents::ScriptEventsAsset* loadedScriptAsset = assetData.GetAs(); - EXPECT_TRUE(loadedScriptAsset); - - const ScriptEvents::ScriptEvent& loadedDefinition = loadedScriptAsset->m_definition; - - EXPECT_EQ(loadedDefinition.GetVersion(), 0); - EXPECT_STREQ(loadedDefinition.GetName().data(), scriptEventName.c_str()); - - - ScriptEvents::Method method; - bool foundMethod = loadedDefinition.FindMethod(renamedMethod, method); - EXPECT_TRUE(foundMethod); - EXPECT_EQ(method.GetNameProperty().GetVersion(), 1); - - assetData = {}; - }; - AssetEventHandler assetHandler2(assetId, []() {}, []() {}); assetHandler2.BusConnect(assetId); diff --git a/Gems/SurfaceData/Code/Include/SurfaceData/Tests/SurfaceDataTestMocks.h b/Gems/SurfaceData/Code/Include/SurfaceData/Tests/SurfaceDataTestMocks.h index 2f45d22748..11171215f7 100644 --- a/Gems/SurfaceData/Code/Include/SurfaceData/Tests/SurfaceDataTestMocks.h +++ b/Gems/SurfaceData/Code/Include/SurfaceData/Tests/SurfaceDataTestMocks.h @@ -293,7 +293,7 @@ namespace UnitTest SurfaceData::SurfaceDataRegistryHandle GetEntryHandle(AZ::EntityId id, const AZStd::vector& entryList) { // Look up the requested entity Id and see if we have a registered surface entry with that handle. If so, return the handle. - auto result = AZStd::find_if(entryList.begin(), entryList.end(), [this, id](const SurfaceData::SurfaceDataRegistryEntry& entry) { return entry.m_entityId == id; }); + auto result = AZStd::find_if(entryList.begin(), entryList.end(), [id](const SurfaceData::SurfaceDataRegistryEntry& entry) { return entry.m_entityId == id; }); if (result == entryList.end()) { return SurfaceData::InvalidSurfaceDataRegistryHandle; diff --git a/Gems/Twitch/Code/Source/TwitchREST.cpp b/Gems/Twitch/Code/Source/TwitchREST.cpp index 7403e927ca..a8aaa83fa0 100644 --- a/Gems/Twitch/Code/Source/TwitchREST.cpp +++ b/Gems/Twitch/Code/Source/TwitchREST.cpp @@ -69,7 +69,7 @@ namespace Twitch { AZStd::string url( BuildBaseURL("users", friendID) + "/friends/notifications"); - AddHTTPRequest(url, Aws::Http::HttpMethod::HTTP_DELETE, GetDefaultHeaders(), [receipt, this](const Aws::Utils::Json::JsonView& /*json*/, Aws::Http::HttpResponseCode httpCode) + AddHTTPRequest(url, Aws::Http::HttpMethod::HTTP_DELETE, GetDefaultHeaders(), [receipt](const Aws::Utils::Json::JsonView& /*json*/, Aws::Http::HttpResponseCode httpCode) { ResultCode rc(ResultCode::TwitchRESTError); @@ -87,7 +87,7 @@ namespace Twitch { AZStd::string url(BuildBaseURL("users", friendID) + "/friends/notifications"); - AddHTTPRequest(url, Aws::Http::HttpMethod::HTTP_GET, GetDefaultHeaders(), [receipt, this](const Aws::Utils::Json::JsonView& json, Aws::Http::HttpResponseCode httpCode) + AddHTTPRequest(url, Aws::Http::HttpMethod::HTTP_GET, GetDefaultHeaders(), [receipt](const Aws::Utils::Json::JsonView& json, Aws::Http::HttpResponseCode httpCode) { ResultCode rc(ResultCode::TwitchRESTError); AZ::s64 count = 0; @@ -203,7 +203,7 @@ namespace Twitch { AZStd::string url(BuildBaseURL("users") + "/friends/relationships/" + friendID); - AddHTTPRequest(url, Aws::Http::HttpMethod::HTTP_PUT, GetDefaultHeaders(), [receipt, this]([[maybe_unused]] const Aws::Utils::Json::JsonView& jsonDoc, Aws::Http::HttpResponseCode httpCode) + AddHTTPRequest(url, Aws::Http::HttpMethod::HTTP_PUT, GetDefaultHeaders(), [receipt]([[maybe_unused]] const Aws::Utils::Json::JsonView& jsonDoc, Aws::Http::HttpResponseCode httpCode) { ResultCode rc(ResultCode::TwitchRESTError); @@ -265,7 +265,7 @@ namespace Twitch { AZStd::string url(BuildBaseURL("users") + "/friends/requests/" + friendID); - AddHTTPRequest(url, Aws::Http::HttpMethod::HTTP_PUT, GetDefaultHeaders(), [receipt, this]([[maybe_unused]] const Aws::Utils::Json::JsonView& jsonDoc, Aws::Http::HttpResponseCode httpCode) + AddHTTPRequest(url, Aws::Http::HttpMethod::HTTP_PUT, GetDefaultHeaders(), [receipt]([[maybe_unused]] const Aws::Utils::Json::JsonView& jsonDoc, Aws::Http::HttpResponseCode httpCode) { ResultCode rc(ResultCode::TwitchRESTError); @@ -282,7 +282,7 @@ namespace Twitch { AZStd::string url(BuildBaseURL("users") + "/friends/requests/" + friendID); - AddHTTPRequest(url, Aws::Http::HttpMethod::HTTP_DELETE, GetDefaultHeaders(), [receipt, this]([[maybe_unused]] const Aws::Utils::Json::JsonView& jsonDoc, Aws::Http::HttpResponseCode httpCode) + AddHTTPRequest(url, Aws::Http::HttpMethod::HTTP_DELETE, GetDefaultHeaders(), [receipt]([[maybe_unused]] const Aws::Utils::Json::JsonView& jsonDoc, Aws::Http::HttpResponseCode httpCode) { ResultCode rc(ResultCode::TwitchRESTError); diff --git a/Gems/Vegetation/Code/Source/Components/BlockerComponent.cpp b/Gems/Vegetation/Code/Source/Components/BlockerComponent.cpp index e26f1aee47..0f45e532d9 100644 --- a/Gems/Vegetation/Code/Source/Components/BlockerComponent.cpp +++ b/Gems/Vegetation/Code/Source/Components/BlockerComponent.cpp @@ -222,7 +222,7 @@ namespace Vegetation for (const auto& id : processedIds) { bool accepted = true; - FilterRequestBus::EnumerateHandlersId(id, [this, &instanceData, &accepted](FilterRequestBus::Events* handler) { + FilterRequestBus::EnumerateHandlersId(id, [&instanceData, &accepted](FilterRequestBus::Events* handler) { accepted = handler->Evaluate(instanceData); return accepted; }); diff --git a/Gems/Vegetation/Code/Source/Components/MeshBlockerComponent.cpp b/Gems/Vegetation/Code/Source/Components/MeshBlockerComponent.cpp index 52461e691c..dc205079fd 100644 --- a/Gems/Vegetation/Code/Source/Components/MeshBlockerComponent.cpp +++ b/Gems/Vegetation/Code/Source/Components/MeshBlockerComponent.cpp @@ -259,7 +259,7 @@ namespace Vegetation for (const auto& id : processedIds) { bool accepted = true; - FilterRequestBus::EnumerateHandlersId(id, [this, &instanceData, &accepted](FilterRequestBus::Events* handler) { + FilterRequestBus::EnumerateHandlersId(id, [&instanceData, &accepted](FilterRequestBus::Events* handler) { accepted = handler->Evaluate(instanceData); return accepted; }); diff --git a/Gems/Vegetation/Code/Source/PrefabInstanceSpawner.cpp b/Gems/Vegetation/Code/Source/PrefabInstanceSpawner.cpp index 2189929fa3..efeb60d598 100644 --- a/Gems/Vegetation/Code/Source/PrefabInstanceSpawner.cpp +++ b/Gems/Vegetation/Code/Source/PrefabInstanceSpawner.cpp @@ -325,7 +325,7 @@ namespace Vegetation // Create a callback for SpawnAllEntities that will set the transform of the root entity to the correct position / rotation / scale // for our spawned instance. - auto preSpawnCB = [this, world]( + auto preSpawnCB = [world]( [[maybe_unused]] AzFramework::EntitySpawnTicket::Id ticketId, AzFramework::SpawnableEntityContainerView view) { AZ::Entity* rootEntity = *view.begin(); diff --git a/Gems/Vegetation/Code/Tests/VegetationTest.h b/Gems/Vegetation/Code/Tests/VegetationTest.h index 6638b54a40..cf7c9b70a1 100644 --- a/Gems/Vegetation/Code/Tests/VegetationTest.h +++ b/Gems/Vegetation/Code/Tests/VegetationTest.h @@ -77,7 +77,6 @@ namespace UnitTest claimContext.m_existedCallback = [this](const Vegetation::ClaimPoint&, const Vegetation::InstanceData&) { - m_existedCallbackCount; return m_existedCallbackOutput; }; From fb75e3570094fde403ddc557c238523acbccf1f2 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Fri, 20 Aug 2021 17:52:36 -0700 Subject: [PATCH 010/131] enabling MSVC warning to match clang warnings Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- cmake/Platform/Common/MSVC/Configurations_msvc.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmake/Platform/Common/MSVC/Configurations_msvc.cmake b/cmake/Platform/Common/MSVC/Configurations_msvc.cmake index 9353e4eb1c..7a66f397c5 100644 --- a/cmake/Platform/Common/MSVC/Configurations_msvc.cmake +++ b/cmake/Platform/Common/MSVC/Configurations_msvc.cmake @@ -40,6 +40,8 @@ ly_append_configurations_options( # Enabling warnings that are disabled by default from /W4 # https://docs.microsoft.com/en-us/cpp/preprocessor/compiler-warnings-that-are-off-by-default?view=vs-2019 /we4296 # 'operator': expression is always false + /we5233 # explicit lambda capture 'identifier' is not used + # /we4426 # optimization flags changed after including header, may be due to #pragma optimize() # /we4464 # relative include path contains '..' # /we4619 # #pragma warning: there is no warning number 'number' From eaefc580d68020bbad949125ea75d26ba90cd804 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Fri, 20 Aug 2021 17:53:14 -0700 Subject: [PATCH 011/131] Code/Editor Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../AzAssetBrowserRequestHandler.cpp | 2 +- Code/Editor/Controls/ColorGradientCtrl.h | 1 - Code/Editor/Controls/ConsoleSCB.cpp | 1 - Code/Editor/Controls/ConsoleSCB.h | 1 - Code/Editor/Controls/SplineCtrl.cpp | 2 - Code/Editor/Controls/SplineCtrlEx.cpp | 2 - Code/Editor/Controls/TimelineCtrl.h | 1 - Code/Editor/Controls/WndGridHelper.h | 2 - Code/Editor/Core/LevelEditorMenuHandler.cpp | 6 +- Code/Editor/Core/LevelEditorMenuHandler.h | 2 - Code/Editor/CryEditDoc.cpp | 8 --- Code/Editor/CryEditPy.cpp | 5 -- ...bjectSelectionReferenceFrameCalculator.cpp | 3 +- ...bObjectSelectionReferenceFrameCalculator.h | 1 - Code/Editor/GameExporter.h | 1 - Code/Editor/LayoutWnd.cpp | 1 - Code/Editor/LevelFileDialog.h | 1 - Code/Editor/LogFile.cpp | 4 +- Code/Editor/Objects/ObjectManager.cpp | 16 +---- Code/Editor/Objects/SelectionGroup.cpp | 2 - Code/Editor/Objects/TrackGizmo.cpp | 1 - .../SandboxIntegration.cpp | 5 +- .../SandboxIntegration.h | 3 - .../UI/Outliner/OutlinerListModel.cpp | 6 +- Code/Editor/PythonEditorFuncs.cpp | 58 ------------------- Code/Editor/QtViewPaneManager.cpp | 3 +- Code/Editor/QtViewPaneManager.h | 1 - .../Editor/RenderHelpers/AxisHelperShared.inl | 2 - Code/Editor/StartupTraceHandler.cpp | 2 +- Code/Editor/ToolbarManager.cpp | 1 - .../Editor/TrackView/DirectorNodeAnimator.cpp | 4 +- Code/Editor/TrackView/DirectorNodeAnimator.h | 2 - Code/Editor/TrackView/TrackViewAnimNode.cpp | 1 - .../TrackView/TrackViewDopeSheetBase.cpp | 7 --- Code/Editor/TrackView/TrackViewNode.h | 7 +-- Code/Editor/TrackView/TrackViewNodes.h | 1 - Code/Editor/TrackView/TrackViewSequence.cpp | 4 +- Code/Editor/TrackView/TrackViewSplineCtrl.cpp | 1 - Code/Editor/Util/ColumnGroupTreeView.h | 1 - Code/Editor/Util/Image.h | 1 - Code/Editor/Util/ImageASC.cpp | 2 +- Code/Editor/Util/ImageGif.cpp | 2 - Code/Editor/Util/ImageUtil.cpp | 2 +- Code/Editor/ViewPane.h | 1 - 44 files changed, 17 insertions(+), 163 deletions(-) diff --git a/Code/Editor/AzAssetBrowser/AzAssetBrowserRequestHandler.cpp b/Code/Editor/AzAssetBrowser/AzAssetBrowserRequestHandler.cpp index b164323238..1c2be16a3d 100644 --- a/Code/Editor/AzAssetBrowser/AzAssetBrowserRequestHandler.cpp +++ b/Code/Editor/AzAssetBrowser/AzAssetBrowserRequestHandler.cpp @@ -327,7 +327,7 @@ void AzAssetBrowserRequestHandler::AddContextMenuActions(QWidget* caller, QMenu* if (!vetoOpenerFound) { // if we found no valid openers and no veto openers then just allow it to be opened with the operating system itself. - menu->addAction(QObject::tr("Open with associated application..."), [this, fullFilePath]() + menu->addAction(QObject::tr("Open with associated application..."), [fullFilePath]() { OpenWithOS(fullFilePath); }); diff --git a/Code/Editor/Controls/ColorGradientCtrl.h b/Code/Editor/Controls/ColorGradientCtrl.h index 80d8b966f4..a3f95fcd8c 100644 --- a/Code/Editor/Controls/ColorGradientCtrl.h +++ b/Code/Editor/Controls/ColorGradientCtrl.h @@ -130,7 +130,6 @@ private: private: ISplineInterpolator* m_pSpline; - bool m_bAutoDelete; bool m_bNoZoom; QRect m_rcClipRect; diff --git a/Code/Editor/Controls/ConsoleSCB.cpp b/Code/Editor/Controls/ConsoleSCB.cpp index dbe7ba3472..aed148976f 100644 --- a/Code/Editor/Controls/ConsoleSCB.cpp +++ b/Code/Editor/Controls/ConsoleSCB.cpp @@ -298,7 +298,6 @@ Lines CConsoleSCB::s_pendingLines; CConsoleSCB::CConsoleSCB(QWidget* parent) : QWidget(parent) , ui(new Ui::Console()) - , m_richEditTextLength(0) , m_backgroundTheme(gSettings.consoleBackgroundColorTheme) { m_lines = s_pendingLines; diff --git a/Code/Editor/Controls/ConsoleSCB.h b/Code/Editor/Controls/ConsoleSCB.h index f51786e2a5..051f3ea4e7 100644 --- a/Code/Editor/Controls/ConsoleSCB.h +++ b/Code/Editor/Controls/ConsoleSCB.h @@ -191,7 +191,6 @@ private: void OnEditorNotifyEvent(EEditorNotifyEvent event) override; QScopedPointer ui; - int m_richEditTextLength; Lines m_lines; static Lines s_pendingLines; diff --git a/Code/Editor/Controls/SplineCtrl.cpp b/Code/Editor/Controls/SplineCtrl.cpp index 80d30b37ad..8ccf103c25 100644 --- a/Code/Editor/Controls/SplineCtrl.cpp +++ b/Code/Editor/Controls/SplineCtrl.cpp @@ -123,8 +123,6 @@ void CSplineCtrl::paintEvent(QPaintEvent* event) { QPainter painter(this); - QRect rcClient = rect(); - if (m_pSpline) { m_bSelectedKeys.resize(m_pSpline->GetKeyCount()); diff --git a/Code/Editor/Controls/SplineCtrlEx.cpp b/Code/Editor/Controls/SplineCtrlEx.cpp index f299ce185d..9e0a954c79 100644 --- a/Code/Editor/Controls/SplineCtrlEx.cpp +++ b/Code/Editor/Controls/SplineCtrlEx.cpp @@ -819,8 +819,6 @@ void SplineWidget::DrawSpline(QPainter* painter, SSplineInfo& splineInfo, float { const QPen pOldPen = painter->pen(); - const QRect rcClip = painter->clipBoundingRect().intersected(m_rcSpline).toRect(); - ////////////////////////////////////////////////////////////////////////// ISplineInterpolator* pSpline = splineInfo.pSpline; ISplineInterpolator* pDetailSpline = splineInfo.pDetailSpline; diff --git a/Code/Editor/Controls/TimelineCtrl.h b/Code/Editor/Controls/TimelineCtrl.h index 015704460a..f87bdf3410 100644 --- a/Code/Editor/Controls/TimelineCtrl.h +++ b/Code/Editor/Controls/TimelineCtrl.h @@ -136,7 +136,6 @@ protected: void DrawFrameTicks(QPainter* dc); private: - bool m_bAutoDelete; QRect m_rcClient; QRect m_rcTimeline; float m_fTimeMarker; diff --git a/Code/Editor/Controls/WndGridHelper.h b/Code/Editor/Controls/WndGridHelper.h index 158ffca508..d5d90b3a92 100644 --- a/Code/Editor/Controls/WndGridHelper.h +++ b/Code/Editor/Controls/WndGridHelper.h @@ -81,8 +81,6 @@ public: newzoom.y = 0.01f; } - Vec2 prevz = zoom; - // Zoom to mouse position. float ofsx = origin.x; float ofsy = origin.y; diff --git a/Code/Editor/Core/LevelEditorMenuHandler.cpp b/Code/Editor/Core/LevelEditorMenuHandler.cpp index 3724993604..8c757a361e 100644 --- a/Code/Editor/Core/LevelEditorMenuHandler.cpp +++ b/Code/Editor/Core/LevelEditorMenuHandler.cpp @@ -41,8 +41,6 @@ using namespace AZ; using namespace AzToolsFramework; static const char* const s_LUAEditorName = "Lua Editor"; -static const char* const s_shortTimeInterval = "debug"; -static const char* const s_assetImporterMetricsIdentifier = "AssetImporter"; // top level menu ids static const char* const s_fileMenuId = "FileMenu"; @@ -50,7 +48,6 @@ static const char* const s_editMenuId = "EditMenu"; static const char* const s_gameMenuId = "GameMenu"; static const char* const s_toolMenuId = "ToolMenu"; static const char* const s_viewMenuId = "ViewMenu"; -static const char* const s_awsMenuId = "AwsMenu"; static const char* const s_helpMenuId = "HelpMenu"; static bool CompareLayoutNames(const QString& name1, const QString& name2) @@ -158,12 +155,11 @@ namespace } LevelEditorMenuHandler::LevelEditorMenuHandler( - MainWindow* mainWindow, QtViewPaneManager* const viewPaneManager, QSettings& settings) + MainWindow* mainWindow, QtViewPaneManager* const viewPaneManager, [[maybe_unused]] QSettings& settings) : QObject(mainWindow) , m_mainWindow(mainWindow) , m_viewPaneManager(viewPaneManager) , m_actionManager(mainWindow->GetActionManager()) - , m_settings(settings) { #if defined(AZ_PLATFORM_MAC) // Hide the non-native toolbar, then setNativeMenuBar to ensure it is always visible on macOS. diff --git a/Code/Editor/Core/LevelEditorMenuHandler.h b/Code/Editor/Core/LevelEditorMenuHandler.h index 4cf1569c59..95f2f70703 100644 --- a/Code/Editor/Core/LevelEditorMenuHandler.h +++ b/Code/Editor/Core/LevelEditorMenuHandler.h @@ -106,7 +106,6 @@ private: ActionManager::MenuWrapper m_toolsMenu; QMenu* m_mostRecentLevelsMenu = nullptr; - QMenu* m_mostRecentProjectsMenu = nullptr; QMenu* m_editmenu = nullptr; ActionManager::MenuWrapper m_viewPanesMenu; @@ -117,7 +116,6 @@ private: int m_viewPaneVersion = 0; QList m_topLevelMenus; - QSettings& m_settings; }; #endif // LEVELEDITORMENUHANDLER_H diff --git a/Code/Editor/CryEditDoc.cpp b/Code/Editor/CryEditDoc.cpp index cb920da2de..c6de10c0cb 100644 --- a/Code/Editor/CryEditDoc.cpp +++ b/Code/Editor/CryEditDoc.cpp @@ -1018,14 +1018,6 @@ bool CCryEditDoc::AfterSaveDocument([[maybe_unused]] const QString& lpszPathName return bSaved; } - -static void GetUserSettingsFile(const QString& levelFolder, QString& userSettings) -{ - const char* pUserName = GetISystem()->GetUserName(); - QString fileName = QStringLiteral("%1_usersettings.editor_xml").arg(pUserName); - userSettings = Path::Make(levelFolder, fileName); -} - static bool TryRenameFile(const QString& oldPath, const QString& newPath, int retryAttempts=10) { QFile(newPath).setPermissions(QFile::ReadOther | QFile::WriteOther); diff --git a/Code/Editor/CryEditPy.cpp b/Code/Editor/CryEditPy.cpp index 2477cd2f35..10fd56c134 100644 --- a/Code/Editor/CryEditPy.cpp +++ b/Code/Editor/CryEditPy.cpp @@ -97,11 +97,6 @@ namespace } } - const char* PyGetGameFolder() - { - return Path::GetEditingGameDataFolder().c_str(); - } - AZStd::string PyGetGameFolderAsString() { return Path::GetEditingGameDataFolder(); diff --git a/Code/Editor/EditMode/SubObjectSelectionReferenceFrameCalculator.cpp b/Code/Editor/EditMode/SubObjectSelectionReferenceFrameCalculator.cpp index 80368d3ec1..99f4ab1ca6 100644 --- a/Code/Editor/EditMode/SubObjectSelectionReferenceFrameCalculator.cpp +++ b/Code/Editor/EditMode/SubObjectSelectionReferenceFrameCalculator.cpp @@ -13,12 +13,11 @@ #include "SubObjectSelectionReferenceFrameCalculator.h" -SubObjectSelectionReferenceFrameCalculator::SubObjectSelectionReferenceFrameCalculator(ESubObjElementType selectionType) +SubObjectSelectionReferenceFrameCalculator::SubObjectSelectionReferenceFrameCalculator([[maybe_unused]] ESubObjElementType selectionType) : m_anySelected(false) , pos(0.0f, 0.0f, 0.0f) , normal(0.0f, 0.0f, 0.0f) , nNormals(0) - , selectionType(selectionType) , bUseExplicitFrame(false) , bExplicitAnySelected(false) { diff --git a/Code/Editor/EditMode/SubObjectSelectionReferenceFrameCalculator.h b/Code/Editor/EditMode/SubObjectSelectionReferenceFrameCalculator.h index 7c0d6f40c6..dd33342feb 100644 --- a/Code/Editor/EditMode/SubObjectSelectionReferenceFrameCalculator.h +++ b/Code/Editor/EditMode/SubObjectSelectionReferenceFrameCalculator.h @@ -32,7 +32,6 @@ private: Vec3 pos; Vec3 normal; int nNormals; - ESubObjElementType selectionType; std::vector positions; Matrix34 m_refFrame; bool bUseExplicitFrame; diff --git a/Code/Editor/GameExporter.h b/Code/Editor/GameExporter.h index 3e3c57fb4c..19ec601ff7 100644 --- a/Code/Editor/GameExporter.h +++ b/Code/Editor/GameExporter.h @@ -102,7 +102,6 @@ private: AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING bool m_bAutoExportMode; - int m_numExportedMaterials; static CGameExporter* m_pCurrentExporter; }; diff --git a/Code/Editor/LayoutWnd.cpp b/Code/Editor/LayoutWnd.cpp index 7f73c313d9..aa2a008844 100644 --- a/Code/Editor/LayoutWnd.cpp +++ b/Code/Editor/LayoutWnd.cpp @@ -183,7 +183,6 @@ void CLayoutWnd::MaximizeViewport(int paneId) QString viewClass = m_viewType[paneId]; - const QRect rc = rect(); if (!m_bMaximized) { CLayoutViewPane* pViewPane = GetViewPane(paneId); diff --git a/Code/Editor/LevelFileDialog.h b/Code/Editor/LevelFileDialog.h index 93d8e4eb9b..6347eb946a 100644 --- a/Code/Editor/LevelFileDialog.h +++ b/Code/Editor/LevelFileDialog.h @@ -64,7 +64,6 @@ private: QString m_fileName; QString m_filter; const bool m_bOpenDialog; - bool m_initialized = false; LevelTreeModel* const m_model; LevelTreeModelFilter* const m_filterModel; }; diff --git a/Code/Editor/LogFile.cpp b/Code/Editor/LogFile.cpp index 5978356781..2ebb353915 100644 --- a/Code/Editor/LogFile.cpp +++ b/Code/Editor/LogFile.cpp @@ -180,18 +180,17 @@ void CLogFile::FormatLineV(const char * format, va_list argList) void CLogFile::AboutSystem() { char szBuffer[MAX_LOGBUFFER_SIZE]; - wchar_t szBufferW[MAX_LOGBUFFER_SIZE]; #if defined(AZ_PLATFORM_WINDOWS) || defined(AZ_PLATFORM_LINUX) ////////////////////////////////////////////////////////////////////// // Write the system informations to the log ////////////////////////////////////////////////////////////////////// - wchar_t szLanguageBufferW[64]; //wchar_t szCPUModel[64]; MEMORYSTATUS MemoryStatus; #endif // defined(AZ_PLATFORM_WINDOWS) || defined(AZ_PLATFORM_LINUX) #if defined(AZ_PLATFORM_WINDOWS) + wchar_t szLanguageBufferW[64]; DEVMODE DisplayConfig; OSVERSIONINFO OSVerInfo; OSVerInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); @@ -296,6 +295,7 @@ AZ_POP_DISABLE_WARNING ////////////////////////////////////////////////////////////////////// str += " ("; + wchar_t szBufferW[MAX_LOGBUFFER_SIZE]; GetWindowsDirectoryW(szBufferW, sizeof(szBufferW)); AZStd::to_string(szBuffer, MAX_LOGBUFFER_SIZE, szBufferW); str += szBuffer; diff --git a/Code/Editor/Objects/ObjectManager.cpp b/Code/Editor/Objects/ObjectManager.cpp index 940ef5b551..22d1d8bb17 100644 --- a/Code/Editor/Objects/ObjectManager.cpp +++ b/Code/Editor/Objects/ObjectManager.cpp @@ -1556,11 +1556,8 @@ void CObjectManager::DeleteSelection() // Make sure to unlock selection. GetIEditor()->LockSelection(false); - GUID bID = GUID_NULL; - - int i; CSelectionGroup objects; - for (i = 0; i < m_currSelection->GetCount(); i++) + for (int i = 0; i < m_currSelection->GetCount(); i++) { // Check condition(s) if object could be deleted if (!IsObjectDeletionAllowed(m_currSelection->GetObject(i))) @@ -2900,17 +2897,6 @@ namespace return AZ::Vector3(position.x, position.y, position.z); } - AZ::Vector3 PyGetWorldObjectPosition(const char* pName) - { - CBaseObject* pObject = GetIEditor()->GetObjectManager()->FindObject(pName); - if (!pObject) - { - throw std::logic_error((QString("\"") + pName + "\" is an invalid object.").toUtf8().data()); - } - Vec3 position = pObject->GetWorldPos(); - return AZ::Vector3(position.x, position.y, position.z); - } - void PySetObjectPosition(const char* pName, float fValueX, float fValueY, float fValueZ) { CBaseObject* pObject = GetIEditor()->GetObjectManager()->FindObject(pName); diff --git a/Code/Editor/Objects/SelectionGroup.cpp b/Code/Editor/Objects/SelectionGroup.cpp index f2b7b9ddaf..06d881d607 100644 --- a/Code/Editor/Objects/SelectionGroup.cpp +++ b/Code/Editor/Objects/SelectionGroup.cpp @@ -316,8 +316,6 @@ void CSelectionGroup::Rotate(const Ang3& angles, int referenceCoordSys) // return; // Rotate selection about selection center. - Vec3 center = GetCenter(); - Matrix34 rotateTM = Matrix34::CreateRotationXYZ(DEG2RAD(angles)); Rotate(rotateTM, referenceCoordSys); } diff --git a/Code/Editor/Objects/TrackGizmo.cpp b/Code/Editor/Objects/TrackGizmo.cpp index 8cbd7df2e5..59163c1e3d 100644 --- a/Code/Editor/Objects/TrackGizmo.cpp +++ b/Code/Editor/Objects/TrackGizmo.cpp @@ -176,7 +176,6 @@ void CTrackGizmo::DrawAxis(DisplayContext& dc, const Vec3& org) z = z * fScreenScale; float col[4] = { 1, 1, 1, 1 }; - float hcol[4] = { 1, 0, 0, 1 }; dc.renderer->DrawLabelEx(org + x, 1.2f, col, true, true, "X"); dc.renderer->DrawLabelEx(org + y, 1.2f, col, true, true, "Y"); dc.renderer->DrawLabelEx(org + z, 1.2f, col, true, true, "Z"); diff --git a/Code/Editor/Plugins/ComponentEntityEditorPlugin/SandboxIntegration.cpp b/Code/Editor/Plugins/ComponentEntityEditorPlugin/SandboxIntegration.cpp index 429fbd923c..47bd214b8d 100644 --- a/Code/Editor/Plugins/ComponentEntityEditorPlugin/SandboxIntegration.cpp +++ b/Code/Editor/Plugins/ComponentEntityEditorPlugin/SandboxIntegration.cpp @@ -528,7 +528,6 @@ void SandboxIntegrationManager::EntityParentChanged( oldAncestor = nextParentId; } while (oldAncestor.IsValid()); - AZ::EntityId newAncestors = newParentId; AZ::EntityId newAncestor = newParentId; bool isGoingToRootScene = false; @@ -721,7 +720,7 @@ void SandboxIntegrationManager::PopulateEditorGlobalContextMenu(QMenu* menu, con if (selected.size() > 0) { action = menu->addAction(QObject::tr("Find in Entity Outliner")); - QObject::connect(action, &QAction::triggered, [this, selected] + QObject::connect(action, &QAction::triggered, [selected] { AzToolsFramework::EditorEntityContextNotificationBus::Broadcast(&EditorEntityContextNotification::OnFocusInEntityOutliner, selected); }); @@ -842,7 +841,7 @@ void SandboxIntegrationManager::SetupLayerContextMenu(QMenu* menu) QAction* findLayerAssetAction = menu->addAction(QObject::tr("Find layer in Asset Browser")); findLayerAssetAction->setToolTip(QObject::tr("Selects this layer in the Asset Browser")); - QObject::connect(findLayerAssetAction, &QAction::triggered, [this, fullFilePath] { + QObject::connect(findLayerAssetAction, &QAction::triggered, [fullFilePath] { QtViewPaneManager::instance()->OpenPane(LyViewPane::AssetBrowser); AzToolsFramework::AssetBrowser::AssetBrowserViewRequestBus::Broadcast( diff --git a/Code/Editor/Plugins/ComponentEntityEditorPlugin/SandboxIntegration.h b/Code/Editor/Plugins/ComponentEntityEditorPlugin/SandboxIntegration.h index d14ba80bce..f2764681b2 100644 --- a/Code/Editor/Plugins/ComponentEntityEditorPlugin/SandboxIntegration.h +++ b/Code/Editor/Plugins/ComponentEntityEditorPlugin/SandboxIntegration.h @@ -280,7 +280,6 @@ private: private: AZ::Vector2 m_contextMenuViewPoint; - AZ::Vector3 m_sliceWorldPos; int m_inObjectPickMode; short m_startedUndoRecordingNestingLevel; // used in OnBegin/EndUndo to ensure we only accept undo's we started recording @@ -298,8 +297,6 @@ private: const AZStd::string m_defaultComponentViewportIconLocation = "Icons/Components/Viewport/Component_Placeholder.svg"; const AZStd::string m_defaultEntityIconLocation = "Icons/Components/Viewport/Transform.svg"; - bool m_debugDisplayBusImplementationActive = false; - AzToolsFramework::Prefab::PrefabIntegrationManager* m_prefabIntegrationManager = nullptr; AzToolsFramework::EditorEntityUiInterface* m_editorEntityUiInterface = nullptr; diff --git a/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/Outliner/OutlinerListModel.cpp b/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/Outliner/OutlinerListModel.cpp index 9ec81cdb3b..c25248d4f6 100644 --- a/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/Outliner/OutlinerListModel.cpp +++ b/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/Outliner/OutlinerListModel.cpp @@ -1234,8 +1234,6 @@ bool OutlinerListModel::ReparentEntities(const AZ::EntityId& newParentId, const QMimeData* OutlinerListModel::mimeData(const QModelIndexList& indexes) const { AZ_PROFILE_FUNCTION(AzToolsFramework); - AZ::TypeId uuid1 = AZ::AzTypeInfo::Uuid(); - AZ::TypeId uuid2 = AZ::AzTypeInfo::Uuid(); AzToolsFramework::EditorEntityIdContainer entityIdList; for (const QModelIndex& index : indexes) @@ -1462,13 +1460,11 @@ void OutlinerListModel::OnEntityRuntimeActivationChanged(AZ::EntityId entityId, QueueEntityUpdate(entityId); } -void OutlinerListModel::OnEntityInfoUpdatedRemoveChildBegin(AZ::EntityId parentId, AZ::EntityId childId) +void OutlinerListModel::OnEntityInfoUpdatedRemoveChildBegin([[maybe_unused]] AZ::EntityId parentId, [[maybe_unused]] AZ::EntityId childId) { //add/remove operations trigger selection change signals which assert and break undo/redo operations in progress in inspector etc. //so disallow selection updates until change is complete emit EnableSelectionUpdates(false); - auto parentIndex = GetIndexFromEntity(parentId); - auto childIndex = GetIndexFromEntity(childId); beginResetModel(); } diff --git a/Code/Editor/PythonEditorFuncs.cpp b/Code/Editor/PythonEditorFuncs.cpp index dff41c0a86..342cc607d7 100644 --- a/Code/Editor/PythonEditorFuncs.cpp +++ b/Code/Editor/PythonEditorFuncs.cpp @@ -33,18 +33,6 @@ namespace { - ////////////////////////////////////////////////////////////////////////// - const char* PyGetCVar(const char* pName) - { - ICVar* pCVar = GetIEditor()->GetSystem()->GetIConsole()->GetCVar(pName); - if (!pCVar) - { - Warning("PyGetCVar: Attempt to access non-existent CVar '%s'", pName ? pName : "(null)"); - throw std::logic_error((QString("\"") + pName + "\" is an invalid cvar.").toUtf8().data()); - } - return pCVar->GetString(); - } - ////////////////////////////////////////////////////////////////////////// const char* PyGetCVarAsString(const char* pName) { @@ -212,52 +200,6 @@ namespace return GetIEditor()->IsInSimulationMode(); } - ////////////////////////////////////////////////////////////////////////// - QString PyNewObject(const char* typeName, const char* fileName, const char* name, float x, float y, float z) - { - CBaseObject* object = GetIEditor()->NewObject(typeName, fileName, name, x, y, z); - if (object) - { - return object->GetName(); - } - else - { - return ""; - } - } - - ////////////////////////////////////////////////////////////////////////// - QString PyNewObjectAtCursor(const char* typeName, const char* fileName, const char* name) - { - CUndo undo("Create new object"); - - Vec3 pos(0, 0, 0); - - QPoint p = QCursor::pos(); - CViewport* viewport = GetIEditor()->GetViewManager()->GetViewportAtPoint(p); - if (viewport) - { - viewport->ScreenToClient(p); - if (GetIEditor()->GetAxisConstrains() != AXIS_TERRAIN) - { - pos = viewport->MapViewToCP(p); - } - else - { - // Snap to terrain. - bool hitTerrain; - pos = viewport->ViewToWorld(p, &hitTerrain); - if (hitTerrain) - { - pos.z = GetIEditor()->GetTerrainElevation(pos.x, pos.y) + 1.0f; - } - pos = viewport->SnapToGrid(pos); - } - } - - return PyNewObject(typeName, fileName, name, pos.x, pos.y, pos.z); - } - ////////////////////////////////////////////////////////////////////////// void PyRunConsole(const char* text) { diff --git a/Code/Editor/QtViewPaneManager.cpp b/Code/Editor/QtViewPaneManager.cpp index 022bb6ecd9..eff3a7331e 100644 --- a/Code/Editor/QtViewPaneManager.cpp +++ b/Code/Editor/QtViewPaneManager.cpp @@ -240,14 +240,13 @@ static bool SkipTitleBarOverdraw(QtViewPane* pane) return !pane->m_options.isDockable; } -DockWidget::DockWidget(QWidget* widget, QtViewPane* pane, QSettings* settings, QMainWindow* parent, AzQtComponents::FancyDocking* advancedDockManager) +DockWidget::DockWidget(QWidget* widget, QtViewPane* pane, [[maybe_unused]] QSettings* settings, QMainWindow* parent, AzQtComponents::FancyDocking* advancedDockManager) : AzQtComponents::StyledDockWidget(pane->m_name, SkipTitleBarOverdraw(pane), #if AZ_TRAIT_OS_PLATFORM_APPLE pane->m_options.detachedWindow ? nullptr : parent) #else parent) #endif - , m_settings(settings) , m_mainWindow(parent) , m_pane(pane) , m_advancedDockManager(advancedDockManager) diff --git a/Code/Editor/QtViewPaneManager.h b/Code/Editor/QtViewPaneManager.h index 49440068a0..3ad1cc9cf7 100644 --- a/Code/Editor/QtViewPaneManager.h +++ b/Code/Editor/QtViewPaneManager.h @@ -67,7 +67,6 @@ private: void reparentToMainWindowFix(); QRect ProperGeometry() const; QString settingsKey() const; - QSettings* const m_settings; QMainWindow* const m_mainWindow; QtViewPane* const m_pane; AzQtComponents::FancyDocking* m_advancedDockManager; diff --git a/Code/Editor/RenderHelpers/AxisHelperShared.inl b/Code/Editor/RenderHelpers/AxisHelperShared.inl index 2ceac98eae..24cd2ef9f5 100644 --- a/Code/Editor/RenderHelpers/AxisHelperShared.inl +++ b/Code/Editor/RenderHelpers/AxisHelperShared.inl @@ -191,7 +191,6 @@ void CAxisHelper::DrawAxis(const Matrix34& worldTM, const SGizmoParameters& setu { if (axis) { - float col[4] = { 1, 0, 0, 1 }; if (axis == AXIS_X || axis == AXIS_XY || axis == AXIS_XZ || axis == AXIS_XYZ) { colX = colSelected; @@ -436,7 +435,6 @@ void CAxisHelper::DrawAxis(const Matrix34& worldTM, const SGizmoParameters& setu { dc.SetColor(QColor(128, 32, 32), 0.4f); } - Vec3 org = worldTM.GetTranslation(); dc.DrawBall(Vec3(0.0f), m_size * kSelectionBallScale); } diff --git a/Code/Editor/StartupTraceHandler.cpp b/Code/Editor/StartupTraceHandler.cpp index ae525eb4e3..498bf10e31 100644 --- a/Code/Editor/StartupTraceHandler.cpp +++ b/Code/Editor/StartupTraceHandler.cpp @@ -168,7 +168,7 @@ namespace SandboxEditor void StartupTraceHandler::ShowMessageBox(const QString& message) { - AZ::SystemTickBus::QueueFunction([this, message]() + AZ::SystemTickBus::QueueFunction([message]() { // Parent to the main window, so that the error dialog doesn't // show up as a separate window when alt-tabbing. diff --git a/Code/Editor/ToolbarManager.cpp b/Code/Editor/ToolbarManager.cpp index 1831fe6a55..00b7992ef0 100644 --- a/Code/Editor/ToolbarManager.cpp +++ b/Code/Editor/ToolbarManager.cpp @@ -1217,7 +1217,6 @@ void EditableQToolBar::dropEvent(QDropEvent* ev) return; } - const int actionId = action->data().toInt(); QWidget* beforeWidget = insertPositionForDrop(ev->pos()); QAction* beforeAction = beforeWidget ? ActionForWidget(beforeWidget) : nullptr; diff --git a/Code/Editor/TrackView/DirectorNodeAnimator.cpp b/Code/Editor/TrackView/DirectorNodeAnimator.cpp index 3e2a1d5626..d9736075ce 100644 --- a/Code/Editor/TrackView/DirectorNodeAnimator.cpp +++ b/Code/Editor/TrackView/DirectorNodeAnimator.cpp @@ -19,8 +19,7 @@ //////////////////////////////////////////////////////////////////////////// -CDirectorNodeAnimator::CDirectorNodeAnimator(CTrackViewAnimNode* pDirectorNode) - : m_pDirectorNode(pDirectorNode) +CDirectorNodeAnimator::CDirectorNodeAnimator([[maybe_unused]] CTrackViewAnimNode* pDirectorNode) { assert(m_pDirectorNode != nullptr); } @@ -139,7 +138,6 @@ void CDirectorNodeAnimator::ForEachActiveSequence(const SAnimContext& ac, CTrack const bool bHandleOtherKeys, std::function animateFunction, std::function resetFunction) { - const float time = ac.time; const unsigned int numKeys = pSequenceTrack->GetKeyCount(); if (bHandleOtherKeys) diff --git a/Code/Editor/TrackView/DirectorNodeAnimator.h b/Code/Editor/TrackView/DirectorNodeAnimator.h index d2bde01c54..87d72bf5c8 100644 --- a/Code/Editor/TrackView/DirectorNodeAnimator.h +++ b/Code/Editor/TrackView/DirectorNodeAnimator.h @@ -34,7 +34,5 @@ private: void ForEachActiveSequence(const SAnimContext& ac, CTrackViewTrack* pSequenceTrack, const bool bHandleOtherKeys, std::function animateFunction, std::function resetFunction); - - CTrackViewAnimNode* m_pDirectorNode; }; #endif // CRYINCLUDE_EDITOR_TRACKVIEW_DIRECTORNODEANIMATOR_H diff --git a/Code/Editor/TrackView/TrackViewAnimNode.cpp b/Code/Editor/TrackView/TrackViewAnimNode.cpp index 4b599859e9..4b1ea688ee 100644 --- a/Code/Editor/TrackView/TrackViewAnimNode.cpp +++ b/Code/Editor/TrackView/TrackViewAnimNode.cpp @@ -1820,7 +1820,6 @@ bool CTrackViewAnimNode::IsDisabled() const ////////////////////////////////////////////////////////////////////////// void CTrackViewAnimNode::SetPos(const Vec3& position) { - const float time = GetSequence()->GetTime(); CTrackViewTrack* track = GetTrackForParameter(AnimParamType::Position); if (track) diff --git a/Code/Editor/TrackView/TrackViewDopeSheetBase.cpp b/Code/Editor/TrackView/TrackViewDopeSheetBase.cpp index d0034b2da4..12af760e95 100644 --- a/Code/Editor/TrackView/TrackViewDopeSheetBase.cpp +++ b/Code/Editor/TrackView/TrackViewDopeSheetBase.cpp @@ -199,7 +199,6 @@ void CTrackViewDopeSheetBase::SetTimeRange(float start, float end) void CTrackViewDopeSheetBase::SetTimeScale(float timeScale, float fAnchorTime) { const double fOldOffset = -fAnchorTime * m_timeScale; - const double fOldScale = m_timeScale; timeScale = std::max(timeScale, 0.001f); timeScale = std::min(timeScale, 100000.0f); @@ -1426,8 +1425,6 @@ void CTrackViewDopeSheetBase::OnCaptureChanged() ////////////////////////////////////////////////////////////////////////// bool CTrackViewDopeSheetBase::IsOkToAddKeyHere(const CTrackViewTrack* pTrack, float time) const { - const float timeEpsilon = 0.05f; - for (unsigned int i = 0; i < pTrack->GetKeyCount(); ++i) { const CTrackViewKeyConstHandle& keyHandle = pTrack->GetKey(i); @@ -2152,8 +2149,6 @@ void CTrackViewDopeSheetBase::AcceptUndo() { if (CUndo::IsRecording()) { - const QPoint mousePos = mapFromGlobal(QCursor::pos()); - CTrackViewSequence* sequence = GetIEditor()->GetAnimation()->GetSequence(); if (m_mouseMode == eTVMouseMode_Paste) @@ -2623,7 +2618,6 @@ void CTrackViewDopeSheetBase::DrawBoolTrack(const Range& timeRange, QPainter* pa { int x0 = TimeToClient(timeRange.start); float t0 = timeRange.start; - QRect trackRect; const QBrush prevBrush = painter->brush(); painter->setBrush(m_visibilityBrush); @@ -2752,7 +2746,6 @@ void CTrackViewDopeSheetBase::DrawKeys(CTrackViewTrack* pTrack, QPainter* painte } int x1 = x + kDefaultWidthForDescription; - CTrackViewKeyHandle nextKey = keyHandle.GetNextKey(); int nextKeyIndex = i + 1; diff --git a/Code/Editor/TrackView/TrackViewNode.h b/Code/Editor/TrackView/TrackViewNode.h index 2c289049e9..3c005b7fd9 100644 --- a/Code/Editor/TrackView/TrackViewNode.h +++ b/Code/Editor/TrackView/TrackViewNode.h @@ -22,13 +22,11 @@ class CTrackViewKeyConstHandle { public: CTrackViewKeyConstHandle() - : m_bIsValid(false) - , m_keyIndex(0) + : m_keyIndex(0) , m_pTrack(nullptr) {} CTrackViewKeyConstHandle(const CTrackViewTrack* pTrack, unsigned int keyIndex) - : m_bIsValid(true) - , m_keyIndex(keyIndex) + : m_keyIndex(keyIndex) , m_pTrack(pTrack) {} void GetKey(IKey* pKey) const; @@ -36,7 +34,6 @@ public: const CTrackViewTrack* GetTrack() const { return m_pTrack; } private: - bool m_bIsValid; unsigned int m_keyIndex; const CTrackViewTrack* m_pTrack; }; diff --git a/Code/Editor/TrackView/TrackViewNodes.h b/Code/Editor/TrackView/TrackViewNodes.h index d6ed95b88d..fc9804b4e4 100644 --- a/Code/Editor/TrackView/TrackViewNodes.h +++ b/Code/Editor/TrackView/TrackViewNodes.h @@ -202,7 +202,6 @@ private: // Drag and drop CTrackViewAnimNodeBundle m_draggedNodes; - CTrackViewAnimNode* m_pDragTarget; std::unordered_map m_menuParamTypeMap; std::unordered_map m_nodeToRecordMap; diff --git a/Code/Editor/TrackView/TrackViewSequence.cpp b/Code/Editor/TrackView/TrackViewSequence.cpp index f66e5276cd..76609ac947 100644 --- a/Code/Editor/TrackView/TrackViewSequence.cpp +++ b/Code/Editor/TrackView/TrackViewSequence.cpp @@ -135,9 +135,7 @@ CTrackViewKeyHandle CTrackViewSequence::FindSingleSelectedKey() ////////////////////////////////////////////////////////////////////////// void CTrackViewSequence::OnEntityComponentPropertyChanged(AZ::ComponentId changedComponentId) -{ - const AZ::EntityId entityId = *AzToolsFramework::PropertyEditorEntityChangeNotificationBus::GetCurrentBusId(); - +{ // find the component node for this changeComponentId if it exists for (int i = m_pAnimSequence->GetNodeCount(); --i >= 0;) { diff --git a/Code/Editor/TrackView/TrackViewSplineCtrl.cpp b/Code/Editor/TrackView/TrackViewSplineCtrl.cpp index 4911297985..352f2f3699 100644 --- a/Code/Editor/TrackView/TrackViewSplineCtrl.cpp +++ b/Code/Editor/TrackView/TrackViewSplineCtrl.cpp @@ -611,7 +611,6 @@ void CTrackViewSplineCtrl::mouseMoveEvent(QMouseEvent* event) CTrackViewSequenceNotificationContext context(pSequence); - QPoint cMousePosPrev = m_cMousePos; m_cMousePos = point; if (m_editMode == NothingMode) diff --git a/Code/Editor/Util/ColumnGroupTreeView.h b/Code/Editor/Util/ColumnGroupTreeView.h index c9226df8d0..3c7dea91c3 100644 --- a/Code/Editor/Util/ColumnGroupTreeView.h +++ b/Code/Editor/Util/ColumnGroupTreeView.h @@ -71,7 +71,6 @@ private: ColumnGroupHeaderView* m_header; ColumnGroupProxyModel* m_groupModel; QSet m_openNodes; - bool m_showGroups; }; #endif // COLUMNGROUPTREEVIEW_H diff --git a/Code/Editor/Util/Image.h b/Code/Editor/Util/Image.h index 8886598c43..a6d36673cb 100644 --- a/Code/Editor/Util/Image.h +++ b/Code/Editor/Util/Image.h @@ -178,7 +178,6 @@ public: ////////////////////////////////////////////////////////////////////////// void GetSubImage(int x1, int y1, int width, int height, TImage& img) const { - int size = width * height; img.Allocate(width, height); for (int y = 0; y < height; y++) { diff --git a/Code/Editor/Util/ImageASC.cpp b/Code/Editor/Util/ImageASC.cpp index c166917a68..a72ea8b9fd 100644 --- a/Code/Editor/Util/ImageASC.cpp +++ b/Code/Editor/Util/ImageASC.cpp @@ -99,7 +99,7 @@ bool CImageASC::Load(const QString& fileName, CFloatImage& image) // Break all of the values in the file apart into tokens. - char* nextToken = nullptr; + [[maybe_unused]] char* nextToken = nullptr; token = azstrtok(str, 0, seps, &nextToken); // ncols = grid width diff --git a/Code/Editor/Util/ImageGif.cpp b/Code/Editor/Util/ImageGif.cpp index a9ab4efdaf..67c5911344 100644 --- a/Code/Editor/Util/ImageGif.cpp +++ b/Code/Editor/Util/ImageGif.cpp @@ -76,8 +76,6 @@ static int numused; const char* id87 = "GIF87a"; const char* id89 = "GIF89a"; -static int log2 (int); - /* Fetch the next code from the raster data stream. The codes can be * any length from 3 to 12 bits, packed into 8-bit bytes, so we have to * maintain our location in the Raster array as a BIT Offset. We compute diff --git a/Code/Editor/Util/ImageUtil.cpp b/Code/Editor/Util/ImageUtil.cpp index 00e33162cf..c8432a3d1a 100644 --- a/Code/Editor/Util/ImageUtil.cpp +++ b/Code/Editor/Util/ImageUtil.cpp @@ -145,7 +145,7 @@ bool CImageUtil::LoadPGM(const QString& fileName, CImageEx& image) char* str = new char[fileSize]; fread(str, fileSize, 1, file); - char* nextToken = nullptr; + [[maybe_unused]] char* nextToken = nullptr; token = azstrtok(str, 0, seps, &nextToken); while (token != nullptr && token[0] == '#') diff --git a/Code/Editor/ViewPane.h b/Code/Editor/ViewPane.h index 5771a687c0..8cc9170e5f 100644 --- a/Code/Editor/ViewPane.h +++ b/Code/Editor/ViewPane.h @@ -118,7 +118,6 @@ private: int m_id; int m_nBorder; - int m_titleHeight; QWidget* m_viewport; QScrollArea* m_viewportScrollArea = nullptr; From 588d702e435a20afe4e099d8cfca6f438f409bf4 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Fri, 20 Aug 2021 17:53:31 -0700 Subject: [PATCH 012/131] Code/Framework/AzToolsFramework Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../AzToolsFramework/UI/Slice/SliceRelationshipWidget.hxx | 1 - .../Tests/EditorTransformComponentSelectionTests.cpp | 2 +- .../AzToolsFramework/Tests/Prefab/PrefabEntityAliasTests.cpp | 3 --- .../AzToolsFramework/Tests/Prefab/PrefabTestDomUtils.cpp | 2 +- .../AzToolsFramework/Tests/Prefab/PrefabUndoTests.cpp | 1 - Code/Framework/AzToolsFramework/Tests/Slice.cpp | 2 +- .../Tests/ToolsComponents/EditorLayerComponentTests.cpp | 4 ++-- Code/Framework/AzToolsFramework/Tests/TransformComponent.cpp | 1 - .../Tests/Viewport/ViewportUiManagerTests.cpp | 2 +- 9 files changed, 6 insertions(+), 12 deletions(-) diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Slice/SliceRelationshipWidget.hxx b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Slice/SliceRelationshipWidget.hxx index 64debe12bb..496f8b439f 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Slice/SliceRelationshipWidget.hxx +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Slice/SliceRelationshipWidget.hxx @@ -111,7 +111,6 @@ namespace AzToolsFramework QTreeWidget* m_sliceDependentsTree; ///< Tree widget for fields (left side) QTreeWidget* m_sliceDependencyTree; ///< Tree widget for slice targets (right side) - QLabel* m_infoLabel; ///< Label above slice tree describing selection QVBoxLayout* m_bottomLayout; ///< Bottom layout containing optional status messages, legend and buttons }; diff --git a/Code/Framework/AzToolsFramework/Tests/EditorTransformComponentSelectionTests.cpp b/Code/Framework/AzToolsFramework/Tests/EditorTransformComponentSelectionTests.cpp index e95f7aa271..c1c158d0f9 100644 --- a/Code/Framework/AzToolsFramework/Tests/EditorTransformComponentSelectionTests.cpp +++ b/Code/Framework/AzToolsFramework/Tests/EditorTransformComponentSelectionTests.cpp @@ -1579,7 +1579,7 @@ namespace UnitTest /////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Given AZ::Entity* entity = nullptr; - const AZ::EntityId entityId = CreateDefaultEditorEntity("Entity", &entity); + CreateDefaultEditorEntity("Entity", &entity); entity->Deactivate(); const auto* entityInfoComponent = entity->CreateComponent(); diff --git a/Code/Framework/AzToolsFramework/Tests/Prefab/PrefabEntityAliasTests.cpp b/Code/Framework/AzToolsFramework/Tests/Prefab/PrefabEntityAliasTests.cpp index 78be56e6ba..6158394f20 100644 --- a/Code/Framework/AzToolsFramework/Tests/Prefab/PrefabEntityAliasTests.cpp +++ b/Code/Framework/AzToolsFramework/Tests/Prefab/PrefabEntityAliasTests.cpp @@ -160,9 +160,6 @@ namespace UnitTest ASSERT_TRUE(secondRootInstance); - // Find the new instances versions of the new and referenced entities using the aliases we saved - AZ::EntityId secondNewEntityId = secondRootInstance->GetEntityId(newEntityAlias); - InstanceOptionalReference secondNestedInstance = secondRootInstance->FindNestedInstance(nestedAlias); ASSERT_TRUE(secondNestedInstance); AZ::EntityId secondReferencedEntityId = secondNestedInstance->get().GetEntityId(referencedEntityAlias); diff --git a/Code/Framework/AzToolsFramework/Tests/Prefab/PrefabTestDomUtils.cpp b/Code/Framework/AzToolsFramework/Tests/Prefab/PrefabTestDomUtils.cpp index b8d2ce63f5..334f01fc3a 100644 --- a/Code/Framework/AzToolsFramework/Tests/Prefab/PrefabTestDomUtils.cpp +++ b/Code/Framework/AzToolsFramework/Tests/Prefab/PrefabTestDomUtils.cpp @@ -132,7 +132,7 @@ namespace UnitTest PrefabDomUtils::FindPrefabDomValue(valueADom, PrefabDomUtils::LinkIdName); PrefabDomValueConstReference expectedNestedInstanceDomLinkId = PrefabDomUtils::FindPrefabDomValue(valueBDom, PrefabDomUtils::LinkIdName); - ComparePrefabDomValues(actualNestedInstanceDomLinkId, actualNestedInstanceDomLinkId); + ComparePrefabDomValues(actualNestedInstanceDomLinkId, expectedNestedInstanceDomLinkId); } if (shouldCompareContainerEntities) diff --git a/Code/Framework/AzToolsFramework/Tests/Prefab/PrefabUndoTests.cpp b/Code/Framework/AzToolsFramework/Tests/Prefab/PrefabUndoTests.cpp index 912f642118..5c68b30e8f 100644 --- a/Code/Framework/AzToolsFramework/Tests/Prefab/PrefabUndoTests.cpp +++ b/Code/Framework/AzToolsFramework/Tests/Prefab/PrefabUndoTests.cpp @@ -99,7 +99,6 @@ namespace UnitTest //create single entity AZ::Entity* newEntity = CreateEntity("New Entity", false); ASSERT_TRUE(newEntity); - AZ::EntityId entityId = newEntity->GetId(); //create a first instance where the entity will be added AZStd::unique_ptr testInstance = m_prefabSystemComponent->CreatePrefab({}, {}, "test/path"); diff --git a/Code/Framework/AzToolsFramework/Tests/Slice.cpp b/Code/Framework/AzToolsFramework/Tests/Slice.cpp index dd374826a5..1723fbed8b 100644 --- a/Code/Framework/AzToolsFramework/Tests/Slice.cpp +++ b/Code/Framework/AzToolsFramework/Tests/Slice.cpp @@ -225,7 +225,7 @@ namespace UnitTest tempAssetEntity = aznew AZ::Entity("TestEntity1"); tempAssetEntity->CreateComponent(); - AZ::Data::AssetId sliceAssetId1 = SaveAsSlice(tempAssetEntity); + SaveAsSlice(tempAssetEntity); tempAssetEntity = nullptr; AZ::SliceComponent::EntityList slice1EntitiesA = InstantiateSlice(sliceAssetId0); diff --git a/Code/Framework/AzToolsFramework/Tests/ToolsComponents/EditorLayerComponentTests.cpp b/Code/Framework/AzToolsFramework/Tests/ToolsComponents/EditorLayerComponentTests.cpp index 19cf1ad325..2f1d93c109 100644 --- a/Code/Framework/AzToolsFramework/Tests/ToolsComponents/EditorLayerComponentTests.cpp +++ b/Code/Framework/AzToolsFramework/Tests/ToolsComponents/EditorLayerComponentTests.cpp @@ -401,7 +401,7 @@ namespace AzToolsFramework TEST_F(EditorLayerComponentTest, LayerTests_TwoLayersUniqueNames_LayerNameIsValid) { - EntityAndLayerComponent secondLayer = CreateEntityWithLayer("UniqueLayerName"); + CreateEntityWithLayer("UniqueLayerName"); bool isLayerNameValid = true; AzToolsFramework::Layers::EditorLayerComponentRequestBus::EventResult( isLayerNameValid, @@ -412,7 +412,7 @@ namespace AzToolsFramework TEST_F(EditorLayerComponentTest, LayerTests_TwoLayersConflictingNames_LayerNameIsNotValid) { - EntityAndLayerComponent secondLayer = CreateEntityWithLayer(m_entityName); + CreateEntityWithLayer(m_entityName); bool isLayerNameValid = true; AzToolsFramework::Layers::EditorLayerComponentRequestBus::EventResult( isLayerNameValid, diff --git a/Code/Framework/AzToolsFramework/Tests/TransformComponent.cpp b/Code/Framework/AzToolsFramework/Tests/TransformComponent.cpp index 57ba0f998b..4fbebc8526 100644 --- a/Code/Framework/AzToolsFramework/Tests/TransformComponent.cpp +++ b/Code/Framework/AzToolsFramework/Tests/TransformComponent.cpp @@ -713,7 +713,6 @@ namespace UnitTest TransformBus::Event(m_childId, &TransformBus::Events::SetParentRelative, AZ::EntityId()); - childLocalPos; TransformBus::EventResult(childLocalPos, m_childId, &TransformBus::Events::GetLocalTranslation); EXPECT_TRUE(childLocalPos == expectedChildLocalPos); diff --git a/Code/Framework/AzToolsFramework/Tests/Viewport/ViewportUiManagerTests.cpp b/Code/Framework/AzToolsFramework/Tests/Viewport/ViewportUiManagerTests.cpp index 16a49577d1..91100b18c5 100644 --- a/Code/Framework/AzToolsFramework/Tests/Viewport/ViewportUiManagerTests.cpp +++ b/Code/Framework/AzToolsFramework/Tests/Viewport/ViewportUiManagerTests.cpp @@ -168,7 +168,7 @@ namespace UnitTest m_viewportManagerWrapper.GetMockRenderOverlay()->setVisible(true); auto clusterId = m_viewportManagerWrapper.GetViewportManager()->CreateCluster(AzToolsFramework::ViewportUi::Alignment::TopLeft); - auto buttonId = m_viewportManagerWrapper.GetViewportManager()->CreateClusterButton(clusterId, ""); + m_viewportManagerWrapper.GetViewportManager()->CreateClusterButton(clusterId, ""); m_viewportManagerWrapper.GetViewportManager()->Update(); m_viewportManagerWrapper.GetViewportManager()->SetClusterVisible(clusterId, false); From 9d5e7abfb151f26bae71a972d4cd1812c70feb8f Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Fri, 20 Aug 2021 17:53:48 -0700 Subject: [PATCH 013/131] Code/Framework/GridMate Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Code/Framework/GridMate/Tests/ReplicaSmall.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Code/Framework/GridMate/Tests/ReplicaSmall.cpp b/Code/Framework/GridMate/Tests/ReplicaSmall.cpp index ede2a9a195..3b3942e8f3 100644 --- a/Code/Framework/GridMate/Tests/ReplicaSmall.cpp +++ b/Code/Framework/GridMate/Tests/ReplicaSmall.cpp @@ -388,7 +388,7 @@ public: // If data set was not changed it should remain as non-dirty even after several PrepareData calls for (auto i = 0; i < 10; ++i) { - auto pdr = chunk->Data1.PrepareData(EndianType::BigEndian, 0); + [[maybe_unused]] auto pdr = chunk->Data1.PrepareData(EndianType::BigEndian, 0); AZ_TEST_ASSERT(chunk->Data1.IsDefaultValue() == true); } From ca03f65a5d7e752849f3282fbba9a3c3b0b12477 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Fri, 20 Aug 2021 17:54:03 -0700 Subject: [PATCH 014/131] Code/Legacy/CryCommon Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Code/Legacy/CryCommon/CryLibrary.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Code/Legacy/CryCommon/CryLibrary.h b/Code/Legacy/CryCommon/CryLibrary.h index 31cc91cbe7..b7e1c0f359 100644 --- a/Code/Legacy/CryCommon/CryLibrary.h +++ b/Code/Legacy/CryCommon/CryLibrary.h @@ -161,7 +161,7 @@ inline static HMODULE CryLoadLibrary(const char* libName, bool bLazy = false, bo return module; } -bool CryFreeLibrary(void* lib) +inline static bool CryFreeLibrary(void* lib) { if (lib) { From a2ab05a2622b21fc905b2c5522e5da1cb42673a6 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Fri, 20 Aug 2021 17:54:20 -0700 Subject: [PATCH 015/131] Code/Tools Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../AssetBundler/source/ui/AddSeedDialog.h | 1 - .../SerializationDependencies.cpp | 1 - .../native/FileWatcher/FileWatcher_linux.cpp | 1 - .../native/AssetManager/AssetRequestHandler.h | 2 +- .../SettingsRegistryBuilder.cpp | 2 +- .../assetmanager/AssetProcessorManagerTest.cpp | 1 - .../tests/resourcecompiler/RCBuilderTest.cpp | 5 ----- .../native/ui/SourceAssetTreeModel.cpp | 2 -- .../native/unittests/RCcontrollerUnitTests.cpp | 6 +++--- .../native/unittests/UtilitiesUnitTests.cpp | 7 ------- .../utilities/ApplicationManagerBase.cpp | 2 +- .../native/utilities/assetUtils.cpp | 1 - .../ProjectManager/Source/ProjectsScreen.cpp | 2 +- .../Importers/AssImpAnimationImporter.cpp | 1 - .../SceneAPI/SceneBuilder/SceneSystem.cpp | 1 - .../Tests/Containers/SceneGraphTests.cpp | 10 +++++----- .../Views/SceneGraphDownwardsIteratorTests.cpp | 1 - .../SceneUI/RowWidgets/TransformRowWidget.cpp | 2 +- .../Standalone/Source/Driller/AreaChart.cpp | 5 ++--- .../Standalone/Source/Driller/AreaChart.hxx | 2 -- .../Source/Driller/ChannelDataView.cpp | 1 - .../Source/Driller/DrillerCaptureWindow.cpp | 1 - .../Driller/Profiler/ProfilerDataView.cpp | 1 - .../LUA/CodeCompletion/LUACompletionModel.cpp | 6 +----- .../Source/LUA/LUAEditorBreakpointWidget.cpp | 4 +--- .../Standalone/Source/LUA/LUAEditorContext.cpp | 3 +-- .../Source/LUA/LUAEditorFindDialog.cpp | 5 +---- .../Source/LUA/LUAEditorFoldingWidget.cpp | 4 +--- .../Source/LUA/LUAEditorMainWindow.cpp | 3 +-- .../Source/LUA/LUAEditorSyntaxHighlighter.cpp | 18 +++++++----------- .../Standalone/Source/LUA/LUAEditorView.cpp | 2 -- 31 files changed, 28 insertions(+), 75 deletions(-) diff --git a/Code/Tools/AssetBundler/source/ui/AddSeedDialog.h b/Code/Tools/AssetBundler/source/ui/AddSeedDialog.h index 436db64693..c24e724994 100644 --- a/Code/Tools/AssetBundler/source/ui/AddSeedDialog.h +++ b/Code/Tools/AssetBundler/source/ui/AddSeedDialog.h @@ -47,7 +47,6 @@ namespace AssetBundler QSharedPointer m_ui; QString m_platformSpecificCachePath; - bool m_isAddSeedDialog = false; AZStd::string m_fileName; diff --git a/Code/Tools/AssetProcessor/AssetBuilderSDK/AssetBuilderSDK/SerializationDependencies.cpp b/Code/Tools/AssetProcessor/AssetBuilderSDK/AssetBuilderSDK/SerializationDependencies.cpp index 06d076dcfe..9e826faabb 100644 --- a/Code/Tools/AssetProcessor/AssetBuilderSDK/AssetBuilderSDK/SerializationDependencies.cpp +++ b/Code/Tools/AssetProcessor/AssetBuilderSDK/AssetBuilderSDK/SerializationDependencies.cpp @@ -101,7 +101,6 @@ namespace AssetBuilderSDK for (const auto& thisEntry : productDependencySet) { - constexpr int flags = 0; productDependencies.emplace_back(thisEntry.first, thisEntry.second); } } diff --git a/Code/Tools/AssetProcessor/Platform/Linux/native/FileWatcher/FileWatcher_linux.cpp b/Code/Tools/AssetProcessor/Platform/Linux/native/FileWatcher/FileWatcher_linux.cpp index 96f3dfb5e6..ea458ba826 100644 --- a/Code/Tools/AssetProcessor/Platform/Linux/native/FileWatcher/FileWatcher_linux.cpp +++ b/Code/Tools/AssetProcessor/Platform/Linux/native/FileWatcher/FileWatcher_linux.cpp @@ -192,7 +192,6 @@ void FolderRootWatch::WatchFolderLoop() for (size_t index=0; indexname; if (event->mask & (IN_CREATE | IN_DELETE | IN_MODIFY | IN_MOVE )) { diff --git a/Code/Tools/AssetProcessor/native/AssetManager/AssetRequestHandler.h b/Code/Tools/AssetProcessor/native/AssetManager/AssetRequestHandler.h index 5ebd507685..5fcb2ca730 100644 --- a/Code/Tools/AssetProcessor/native/AssetManager/AssetRequestHandler.h +++ b/Code/Tools/AssetProcessor/native/AssetManager/AssetRequestHandler.h @@ -115,7 +115,7 @@ namespace AssetProcessor { static constexpr unsigned int MessageType = TRequest::MessageType; - m_messageHandlers[MessageType] = [this, handler = AZStd::move(handler)](MessageData messageData) + m_messageHandlers[MessageType] = [handler = AZStd::move(handler)](MessageData messageData) { MessageData downcastData = messageData; diff --git a/Code/Tools/AssetProcessor/native/InternalBuilders/SettingsRegistryBuilder.cpp b/Code/Tools/AssetProcessor/native/InternalBuilders/SettingsRegistryBuilder.cpp index 9781c200fd..7c88c4324c 100644 --- a/Code/Tools/AssetProcessor/native/InternalBuilders/SettingsRegistryBuilder.cpp +++ b/Code/Tools/AssetProcessor/native/InternalBuilders/SettingsRegistryBuilder.cpp @@ -337,7 +337,7 @@ namespace AssetProcessor // Merge the Project User and User home settings registry only in non-release builds constexpr bool executeRegDumpCommands = false; AZ::CommandLine* commandLine{}; - AZ::ComponentApplicationBus::Broadcast([®istry, &commandLine](AZ::ComponentApplicationRequests* appRequests) + AZ::ComponentApplicationBus::Broadcast([&commandLine](AZ::ComponentApplicationRequests* appRequests) { commandLine = appRequests->GetAzCommandLine(); }); diff --git a/Code/Tools/AssetProcessor/native/tests/assetmanager/AssetProcessorManagerTest.cpp b/Code/Tools/AssetProcessor/native/tests/assetmanager/AssetProcessorManagerTest.cpp index 10ecc411ab..48a86dc5f6 100644 --- a/Code/Tools/AssetProcessor/native/tests/assetmanager/AssetProcessorManagerTest.cpp +++ b/Code/Tools/AssetProcessor/native/tests/assetmanager/AssetProcessorManagerTest.cpp @@ -3500,7 +3500,6 @@ TEST_F(AssetProcessorManagerTest, JobDependencyOrderOnce_MultipleJobs_EmitOK) using namespace AssetProcessor; using namespace AssetBuilderSDK; - AZ::Uuid dummyBuilderUUID = AZ::Uuid::CreateRandom(); QDir tempPath(m_tempDir.path()); QString watchFolderPath = tempPath.absoluteFilePath("subfolder1"); const ScanFolderInfo* scanFolder = m_config->GetScanFolderByPath(watchFolderPath); diff --git a/Code/Tools/AssetProcessor/native/tests/resourcecompiler/RCBuilderTest.cpp b/Code/Tools/AssetProcessor/native/tests/resourcecompiler/RCBuilderTest.cpp index 2465be2b33..9b2a12ecad 100644 --- a/Code/Tools/AssetProcessor/native/tests/resourcecompiler/RCBuilderTest.cpp +++ b/Code/Tools/AssetProcessor/native/tests/resourcecompiler/RCBuilderTest.cpp @@ -447,7 +447,6 @@ TEST_F(RCBuilderTest, ProcessLegacyRCJob_ProcessStandardSingleJob_Valid) TEST_F(RCBuilderTest, ProcessLegacyRCJob_ProcessCopySingleJob_Valid) { AZStd::string name = "test"; - AZ::Uuid builderUuid = AZ::Uuid::CreateRandom(); AZ::Uuid assetTypeUUid = AZ::Uuid::CreateRandom(); MockRCCompiler* mockRC = new MockRCCompiler(); TestInternalRecognizerBasedBuilder test(mockRC); @@ -506,7 +505,6 @@ TEST_F(RCBuilderTest, MatchTempFileToSkip_SkipRCFiles_false) TEST_F(RCBuilderTest, ProcessJob_ProcessStandardRCSingleJob_Valid) { - AZ::Uuid assetTypeUUid = AZ::Uuid::CreateRandom(); MockRCCompiler* mockRC = new MockRCCompiler(); TestInternalRecognizerBasedBuilder test(mockRC); MockRecognizerConfiguration configuration; @@ -536,7 +534,6 @@ TEST_F(RCBuilderTest, ProcessJob_ProcessStandardRCSingleJob_Valid) TEST_F(RCBuilderTest, ProcessJob_ProcessStandardRCSingleJob_Failed) { - AZ::Uuid assetTypeUUid = AZ::Uuid::CreateRandom(); MockRCCompiler* mockRC = new MockRCCompiler(); TestInternalRecognizerBasedBuilder test(mockRC); MockRecognizerConfiguration configuration; @@ -564,7 +561,6 @@ TEST_F(RCBuilderTest, ProcessJob_ProcessStandardRCSingleJob_Failed) TEST_F(RCBuilderTest, ProcessJob_ProcessStandardCopySingleJob_Valid) { - AZ::Uuid assetTypeUUid = AZ::Uuid::CreateRandom(); MockRCCompiler* mockRC = new MockRCCompiler(); TestInternalRecognizerBasedBuilder test(mockRC); MockRecognizerConfiguration configuration; @@ -590,7 +586,6 @@ TEST_F(RCBuilderTest, ProcessJob_ProcessStandardCopySingleJob_Valid) TEST_F(RCBuilderTest, ProcessJob_ProcessStandardSkippedSingleJob_Invalid) { - AZ::Uuid assetTypeUUid = AZ::Uuid::CreateRandom(); MockRCCompiler* mockRC = new MockRCCompiler(); TestInternalRecognizerBasedBuilder test(mockRC); MockRecognizerConfiguration configuration; diff --git a/Code/Tools/AssetProcessor/native/ui/SourceAssetTreeModel.cpp b/Code/Tools/AssetProcessor/native/ui/SourceAssetTreeModel.cpp index 1fcdd62cf7..88fbe5a204 100644 --- a/Code/Tools/AssetProcessor/native/ui/SourceAssetTreeModel.cpp +++ b/Code/Tools/AssetProcessor/native/ui/SourceAssetTreeModel.cpp @@ -87,8 +87,6 @@ namespace AssetProcessor return; } - QModelIndex newIndicesStart; - AssetTreeItem* parentItem = m_root.get(); // Use posix path separator for each child item AZ::IO::Path currentFullFolderPath(AZ::IO::PosixPathSeparator); diff --git a/Code/Tools/AssetProcessor/native/unittests/RCcontrollerUnitTests.cpp b/Code/Tools/AssetProcessor/native/unittests/RCcontrollerUnitTests.cpp index 0f5fea5eb9..5b15a6a552 100644 --- a/Code/Tools/AssetProcessor/native/unittests/RCcontrollerUnitTests.cpp +++ b/Code/Tools/AssetProcessor/native/unittests/RCcontrollerUnitTests.cpp @@ -604,14 +604,14 @@ void RCcontrollerUnitTests::RunRCControllerTests() m_rcController.m_RCJobListModel.addNewJob(jobA); bool beginWorkA = false; - QObject::connect(jobA, &RCJob::BeginWork, this, [this, &beginWorkA]() + QObject::connect(jobA, &RCJob::BeginWork, this, [&beginWorkA]() { beginWorkA = true; } ); bool jobFinishedA = false; - QObject::connect(jobA, &RCJob::JobFinished, this, [this, &jobFinishedA](AssetBuilderSDK::ProcessJobResponse /*result*/) + QObject::connect(jobA, &RCJob::JobFinished, this, [&jobFinishedA](AssetBuilderSDK::ProcessJobResponse /*result*/) { jobFinishedA = true; } @@ -655,7 +655,7 @@ void RCcontrollerUnitTests::RunRCControllerTests() ); bool jobFinishedB = false; - QObject::connect(jobB, &RCJob::JobFinished, this, [this, &jobFinishedB](AssetBuilderSDK::ProcessJobResponse /*result*/) + QObject::connect(jobB, &RCJob::JobFinished, this, [&jobFinishedB](AssetBuilderSDK::ProcessJobResponse /*result*/) { jobFinishedB = true; } diff --git a/Code/Tools/AssetProcessor/native/unittests/UtilitiesUnitTests.cpp b/Code/Tools/AssetProcessor/native/unittests/UtilitiesUnitTests.cpp index ed6fa4b8b4..b34f79142c 100644 --- a/Code/Tools/AssetProcessor/native/unittests/UtilitiesUnitTests.cpp +++ b/Code/Tools/AssetProcessor/native/unittests/UtilitiesUnitTests.cpp @@ -319,13 +319,6 @@ void UtilitiesUnitTests::StartTest() // --------------- TEST FilePatternMatcher { - const char* wildcardMatch[] = { - "*.cfg", - "*.txt", - "abf*.llm" - "sdf.c*", - "a.bcd" - }; { AssetBuilderSDK::FilePatternMatcher extensionWildcardTest(AssetBuilderSDK::AssetBuilderPattern("*.cfg", AssetBuilderSDK::AssetBuilderPattern::Wildcard)); UNIT_TEST_EXPECT_TRUE(extensionWildcardTest.MatchesPath(AZStd::string("foo.cfg"))); diff --git a/Code/Tools/AssetProcessor/native/utilities/ApplicationManagerBase.cpp b/Code/Tools/AssetProcessor/native/utilities/ApplicationManagerBase.cpp index b90364e1c5..4e0bc7e434 100644 --- a/Code/Tools/AssetProcessor/native/utilities/ApplicationManagerBase.cpp +++ b/Code/Tools/AssetProcessor/native/utilities/ApplicationManagerBase.cpp @@ -1209,7 +1209,7 @@ void ApplicationManagerBase::InitFileProcessor() AssetProcessor::ThreadController* fileProcessorHelper = new AssetProcessor::ThreadController(); addRunningThread(fileProcessorHelper); - m_fileProcessor.reset(fileProcessorHelper->initialize([this, &fileProcessorHelper]() + m_fileProcessor.reset(fileProcessorHelper->initialize([this]() { return new AssetProcessor::FileProcessor(m_platformConfiguration); })); diff --git a/Code/Tools/AssetProcessor/native/utilities/assetUtils.cpp b/Code/Tools/AssetProcessor/native/utilities/assetUtils.cpp index 72a036bdaa..7292990a72 100644 --- a/Code/Tools/AssetProcessor/native/utilities/assetUtils.cpp +++ b/Code/Tools/AssetProcessor/native/utilities/assetUtils.cpp @@ -1399,7 +1399,6 @@ namespace AssetUtilities QString inputName; QString platformName; QString jobDescription; - AZ::Uuid guid = AZ::Uuid::CreateNull(); using namespace AzToolsFramework::AssetDatabase; diff --git a/Code/Tools/ProjectManager/Source/ProjectsScreen.cpp b/Code/Tools/ProjectManager/Source/ProjectsScreen.cpp index e27eedd122..4c763fb501 100644 --- a/Code/Tools/ProjectManager/Source/ProjectsScreen.cpp +++ b/Code/Tools/ProjectManager/Source/ProjectsScreen.cpp @@ -360,7 +360,7 @@ namespace O3DE::ProjectManager constexpr int waitTimeInMs = 3000; QTimer::singleShot( waitTimeInMs, this, - [this, button] + [button] { if (button) { diff --git a/Code/Tools/SceneAPI/SceneBuilder/Importers/AssImpAnimationImporter.cpp b/Code/Tools/SceneAPI/SceneBuilder/Importers/AssImpAnimationImporter.cpp index 16f8d85509..a5b286bbc6 100644 --- a/Code/Tools/SceneAPI/SceneBuilder/Importers/AssImpAnimationImporter.cpp +++ b/Code/Tools/SceneAPI/SceneBuilder/Importers/AssImpAnimationImporter.cpp @@ -652,7 +652,6 @@ namespace AZ aiAnimMesh* aiAnimMesh = mesh->mAnimMeshes[meshIdx]; AZStd::string_view nodeName(aiAnimMesh->mName.C_Str()); - const AZ::u32 maxKeys = static_cast(keys.size()); AZ::u32 keyIdx = 0; for (AZ::u32 frame = 0; frame < numKeyFrames; ++frame) { diff --git a/Code/Tools/SceneAPI/SceneBuilder/SceneSystem.cpp b/Code/Tools/SceneAPI/SceneBuilder/SceneSystem.cpp index e9117b780a..ebe907706d 100644 --- a/Code/Tools/SceneAPI/SceneBuilder/SceneSystem.cpp +++ b/Code/Tools/SceneAPI/SceneBuilder/SceneSystem.cpp @@ -105,7 +105,6 @@ namespace AZ } break; } - AZ::Matrix4x4 inverse = currentCoordMatrix.GetInverseTransform(); AZ::Matrix4x4 adjustmatrix = targetCoordMatrix * currentCoordMatrix.GetInverseTransform(); m_adjustTransform.reset(new DataTypes::MatrixType(AssImpSDKWrapper::AssImpTypeConverter::ToTransform(adjustmatrix))); m_adjustTransformInverse.reset(new DataTypes::MatrixType(m_adjustTransform->GetInverseFull())); diff --git a/Code/Tools/SceneAPI/SceneCore/Tests/Containers/SceneGraphTests.cpp b/Code/Tools/SceneAPI/SceneCore/Tests/Containers/SceneGraphTests.cpp index b57f284003..87e2cbdbde 100644 --- a/Code/Tools/SceneAPI/SceneCore/Tests/Containers/SceneGraphTests.cpp +++ b/Code/Tools/SceneAPI/SceneCore/Tests/Containers/SceneGraphTests.cpp @@ -332,7 +332,7 @@ namespace AZ { SceneGraph testSceneGraph; AZStd::shared_ptr testDataObject = AZStd::make_shared(); - SceneGraph::NodeIndex firstChildNodeIndex = testSceneGraph.AddChild(testSceneGraph.GetRoot(), "FirstChild", AZStd::move(testDataObject)); + testSceneGraph.AddChild(testSceneGraph.GetRoot(), "FirstChild", AZStd::move(testDataObject)); testDataObject = AZStd::make_shared(); SceneGraph::NodeIndex testNodeIndex = testSceneGraph.AddChild(testSceneGraph.GetRoot(), "SecondChild", AZStd::move(testDataObject)); @@ -350,7 +350,7 @@ namespace AZ SceneGraph::NodeIndex testRootNodeIndex = testSceneGraph.AddChild(testSceneGraph.GetRoot(), "testRoot", AZStd::move(testDataObject)); testDataObject = AZStd::make_shared(); - SceneGraph::NodeIndex firstChildNodeIndex = testSceneGraph.AddChild(testRootNodeIndex, "FirstChild", AZStd::move(testDataObject)); + testSceneGraph.AddChild(testRootNodeIndex, "FirstChild", AZStd::move(testDataObject)); testDataObject = AZStd::make_shared(); SceneGraph::NodeIndex testNodeIndex = testSceneGraph.AddChild(testRootNodeIndex, "SecondChild", AZStd::move(testDataObject)); @@ -371,10 +371,10 @@ namespace AZ SceneGraph::NodeIndex testRootNodeSiblingIndex = testSceneGraph.AddChild(testSceneGraph.GetRoot(), "testRootSibling", AZStd::move(testDataObject)); testDataObject = AZStd::make_shared(); - SceneGraph::NodeIndex firstChildNodeIndex = testSceneGraph.AddChild(testRootNodeIndex, "FirstChild", AZStd::move(testDataObject)); + testSceneGraph.AddChild(testRootNodeIndex, "FirstChild", AZStd::move(testDataObject)); testDataObject = AZStd::make_shared(); - SceneGraph::NodeIndex testNodeIndex = testSceneGraph.AddChild(testRootNodeIndex, "SecondChild", AZStd::move(testDataObject)); + testSceneGraph.AddChild(testRootNodeIndex, "SecondChild", AZStd::move(testDataObject)); SceneGraph::NodeIndex foundIndex = testSceneGraph.Find(testRootNodeSiblingIndex, "SecondChild"); EXPECT_FALSE(foundIndex.IsValid()); @@ -475,7 +475,7 @@ namespace AZ AZStd::string expectedNodeName("TestNode"); - SceneGraph::NodeIndex testNodeIndex = testSceneGraph.AddChild(testSceneGraph.GetRoot(), expectedNodeName.c_str()); + testSceneGraph.AddChild(testSceneGraph.GetRoot(), expectedNodeName.c_str()); SceneGraph::NodeIndex foundIndex = testSceneGraph.Find(expectedNodeName); ASSERT_TRUE(foundIndex.IsValid()); const SceneGraph::Name& nodeName = testSceneGraph.GetNodeName(foundIndex); diff --git a/Code/Tools/SceneAPI/SceneCore/Tests/Containers/Views/SceneGraphDownwardsIteratorTests.cpp b/Code/Tools/SceneAPI/SceneCore/Tests/Containers/Views/SceneGraphDownwardsIteratorTests.cpp index fbecbe635c..84892373bf 100644 --- a/Code/Tools/SceneAPI/SceneCore/Tests/Containers/Views/SceneGraphDownwardsIteratorTests.cpp +++ b/Code/Tools/SceneAPI/SceneCore/Tests/Containers/Views/SceneGraphDownwardsIteratorTests.cpp @@ -303,7 +303,6 @@ namespace AZ TYPED_TEST_P(SceneGraphDownwardsIteratorContext, Algorithms_FindIf_FindsValue3InNodeAdotC) { using Traversal = typename SceneGraphDownwardsIteratorContext::Traversal; - SceneGraph::NodeIndex index = this->m_graph.Find("A.C"); auto sceneView = MakeSceneGraphDownwardsView(this->m_graph, this->m_graph.GetContentStorage().begin()); auto result = AZStd::find_if(sceneView.begin(), sceneView.end(), [](const AZStd::shared_ptr& object) -> bool diff --git a/Code/Tools/SceneAPI/SceneUI/RowWidgets/TransformRowWidget.cpp b/Code/Tools/SceneAPI/SceneUI/RowWidgets/TransformRowWidget.cpp index e9d83002e9..2672555850 100644 --- a/Code/Tools/SceneAPI/SceneUI/RowWidgets/TransformRowWidget.cpp +++ b/Code/Tools/SceneAPI/SceneUI/RowWidgets/TransformRowWidget.cpp @@ -149,7 +149,7 @@ namespace AZ hider->setLayout(layout2); layoutOriginal->addWidget(hider); - connect(toolButton, &QToolButton::clicked, this, [this, hider, parentWidget, toolButton] + connect(toolButton, &QToolButton::clicked, this, [this, hider, toolButton] { m_expanded = !m_expanded; if (m_expanded) diff --git a/Code/Tools/Standalone/Source/Driller/AreaChart.cpp b/Code/Tools/Standalone/Source/Driller/AreaChart.cpp index a0eccc7d45..3416975be8 100644 --- a/Code/Tools/Standalone/Source/Driller/AreaChart.cpp +++ b/Code/Tools/Standalone/Source/Driller/AreaChart.cpp @@ -23,9 +23,8 @@ namespace AreaChart // LineSeries /////////////// - LineSeries::LineSeries(AreaChart* owner, size_t seriesId, const QString& name, const QColor& color, size_t seriesSize) - : m_owner(owner) - , m_seriesId(seriesId) + LineSeries::LineSeries([[maybe_unused]] AreaChart* owner, size_t seriesId, const QString& name, const QColor& color, size_t seriesSize) + : m_seriesId(seriesId) , m_name(name) , m_color(color) , m_highlighted(false) diff --git a/Code/Tools/Standalone/Source/Driller/AreaChart.hxx b/Code/Tools/Standalone/Source/Driller/AreaChart.hxx index 6e41734d07..35a279a1e4 100644 --- a/Code/Tools/Standalone/Source/Driller/AreaChart.hxx +++ b/Code/Tools/Standalone/Source/Driller/AreaChart.hxx @@ -69,7 +69,6 @@ namespace AreaChart private: - AreaChart* m_owner; LinePoints m_linePoints; size_t m_seriesId; @@ -182,7 +181,6 @@ namespace AreaChart size_t m_inspectionSeries; - size_t m_mouseOverArea; AZStd::vector< AZStd::vector > m_hitAreas; bool m_clicked; diff --git a/Code/Tools/Standalone/Source/Driller/ChannelDataView.cpp b/Code/Tools/Standalone/Source/Driller/ChannelDataView.cpp index 27922f47a3..0fd94476e3 100644 --- a/Code/Tools/Standalone/Source/Driller/ChannelDataView.cpp +++ b/Code/Tools/Standalone/Source/Driller/ChannelDataView.cpp @@ -439,7 +439,6 @@ namespace Driller QColor drawColor = budgetMarker.GetColor(); - QRect sizeRect = rect(); int x = rect().left(); float normalizedValue = ((budgetMarker.GetValue() + 1.0f) / 2.0f); int y = static_cast(rect().bottom() - (rect().height() * normalizedValue)); diff --git a/Code/Tools/Standalone/Source/Driller/DrillerCaptureWindow.cpp b/Code/Tools/Standalone/Source/Driller/DrillerCaptureWindow.cpp index 7f39136649..f5df4f1629 100644 --- a/Code/Tools/Standalone/Source/Driller/DrillerCaptureWindow.cpp +++ b/Code/Tools/Standalone/Source/Driller/DrillerCaptureWindow.cpp @@ -744,7 +744,6 @@ namespace Driller bool wascapturing = IsInCaptureMode(CaptureMode::Capturing); - CaptureMode::Inspecting; emit OnCaptureModeChange(m_captureMode); if (m_data) diff --git a/Code/Tools/Standalone/Source/Driller/Profiler/ProfilerDataView.cpp b/Code/Tools/Standalone/Source/Driller/Profiler/ProfilerDataView.cpp index 26bcb82fea..f8e2a9e5da 100644 --- a/Code/Tools/Standalone/Source/Driller/Profiler/ProfilerDataView.cpp +++ b/Code/Tools/Standalone/Source/Driller/Profiler/ProfilerDataView.cpp @@ -496,7 +496,6 @@ namespace Driller m_persistentState->m_treeExpansionData.clear(); QSet qSetQString; m_gui->widgetProfilerData->WriteTreeViewStateTo(qSetQString); - QSet::iterator iter = qSetQString.begin(); for (auto iterStrings = qSetQString.begin(); iterStrings != qSetQString.end(); ++iterStrings) { m_persistentState->m_treeExpansionData.push_back(iterStrings->toUtf8().data()); diff --git a/Code/Tools/Standalone/Source/LUA/CodeCompletion/LUACompletionModel.cpp b/Code/Tools/Standalone/Source/LUA/CodeCompletion/LUACompletionModel.cpp index 8fadc230cd..977b7a4d29 100644 --- a/Code/Tools/Standalone/Source/LUA/CodeCompletion/LUACompletionModel.cpp +++ b/Code/Tools/Standalone/Source/LUA/CodeCompletion/LUACompletionModel.cpp @@ -130,12 +130,8 @@ namespace LUAEditor return Qt::ItemIsEnabled | Qt::ItemIsSelectable; } - QVariant CompletionModel::headerData(int section, Qt::Orientation orientation, int role) const + QVariant CompletionModel::headerData([[maybe_unused]] int section, [[maybe_unused]] Qt::Orientation orientation, [[maybe_unused]] int role) const { - section; - orientation; - role; - return QVariant(); } diff --git a/Code/Tools/Standalone/Source/LUA/LUAEditorBreakpointWidget.cpp b/Code/Tools/Standalone/Source/LUA/LUAEditorBreakpointWidget.cpp index 8cce681a74..5b47ee136a 100644 --- a/Code/Tools/Standalone/Source/LUA/LUAEditorBreakpointWidget.cpp +++ b/Code/Tools/Standalone/Source/LUA/LUAEditorBreakpointWidget.cpp @@ -67,10 +67,8 @@ namespace LUAEditor OnBreakpointLineDeleted.clear(); } - void LUAEditorBreakpointWidget::paintEvent(QPaintEvent* paintEvent) + void LUAEditorBreakpointWidget::paintEvent([[maybe_unused]] QPaintEvent* paintEvent) { - paintEvent; - QPainter p(this); auto colors = AZ::UserSettings::CreateFind(AZ_CRC("LUA Editor Text Settings", 0xb6e15565), AZ::UserSettings::CT_GLOBAL); diff --git a/Code/Tools/Standalone/Source/LUA/LUAEditorContext.cpp b/Code/Tools/Standalone/Source/LUA/LUAEditorContext.cpp index 0c9b3a1d77..1fa127dd7d 100644 --- a/Code/Tools/Standalone/Source/LUA/LUAEditorContext.cpp +++ b/Code/Tools/Standalone/Source/LUA/LUAEditorContext.cpp @@ -950,7 +950,6 @@ namespace LUAEditor newAssetName += ".lua"; } - AZ::Data::AssetType assetType = AZ::AzTypeInfo::Uuid(); AZ::Data::AssetId catalogAssetId; EBUS_EVENT_RESULT(catalogAssetId, AZ::Data::AssetCatalogRequestBus, GetAssetIdByPath, newAssetName.c_str(), AZ::AzTypeInfo::Uuid(), false); @@ -2419,7 +2418,7 @@ namespace LUAEditor std::regex errorRegex(".+\\.lua:(\\d+):(.*)"); AzToolsFramework::Logging::LogLine::ParseLog(logResult.GetValue().c_str(), logResult.GetValue().size(), - [this, &msg, ¤tAsset, &errorRegex](AzToolsFramework::Logging::LogLine& logLine) + [this, ¤tAsset, &errorRegex](AzToolsFramework::Logging::LogLine& logLine) { if ((logLine.GetLogType() == AzToolsFramework::Logging::LogLine::TYPE_WARNING) || (logLine.GetLogType() == AzToolsFramework::Logging::LogLine::TYPE_ERROR)) { diff --git a/Code/Tools/Standalone/Source/LUA/LUAEditorFindDialog.cpp b/Code/Tools/Standalone/Source/LUA/LUAEditorFindDialog.cpp index 69108a1ad2..c775ddc0ba 100644 --- a/Code/Tools/Standalone/Source/LUA/LUAEditorFindDialog.cpp +++ b/Code/Tools/Standalone/Source/LUA/LUAEditorFindDialog.cpp @@ -80,7 +80,7 @@ namespace LUAEditor auto pState = AZ::UserSettings::CreateFind(AZ_CRC("FindInCurrent", 0xba0962af), AZ::UserSettings::CT_LOCAL); m_gui->wrapCheckBox->setChecked((pState ? pState->m_findWrap : true)); - connect(m_gui->wrapCheckBox, &QCheckBox::stateChanged, this, [this](int newState) + connect(m_gui->wrapCheckBox, &QCheckBox::stateChanged, this, [](int newState) { auto pState = AZ::UserSettings::CreateFind(AZ_CRC("FindInCurrent", 0xba0962af), AZ::UserSettings::CT_LOCAL); pState->m_findWrap = (newState == Qt::Checked); @@ -350,7 +350,6 @@ namespace LUAEditor void LUAEditorFindDialog::FindInView(LUAViewWidget* pLUAViewWidget, QListWidget* pCurrentFindListView) { - pCurrentFindListView; if (!pLUAViewWidget) { return; @@ -373,8 +372,6 @@ namespace LUAEditor void LUAEditorFindDialog::FindNextInView(LUAViewWidget::FindOperation* operation, LUAViewWidget* pLUAViewWidget, QListWidget* pCurrentFindListView) { - pLUAViewWidget; - pCurrentFindListView; int line = 0; int index = 0; pLUAViewWidget->GetCursorPosition(line, index); diff --git a/Code/Tools/Standalone/Source/LUA/LUAEditorFoldingWidget.cpp b/Code/Tools/Standalone/Source/LUA/LUAEditorFoldingWidget.cpp index 98bf18e7ca..43257f66f2 100644 --- a/Code/Tools/Standalone/Source/LUA/LUAEditorFoldingWidget.cpp +++ b/Code/Tools/Standalone/Source/LUA/LUAEditorFoldingWidget.cpp @@ -31,10 +31,8 @@ namespace LUAEditor { } - void FoldingWidget::paintEvent(QPaintEvent* paintEvent) + void FoldingWidget::paintEvent([[maybe_unused]] QPaintEvent* paintEvent) { - paintEvent; - auto colors = AZ::UserSettings::CreateFind(AZ_CRC("LUA Editor Text Settings", 0xb6e15565), AZ::UserSettings::CT_GLOBAL); auto cursor = m_textEdit->textCursor(); diff --git a/Code/Tools/Standalone/Source/LUA/LUAEditorMainWindow.cpp b/Code/Tools/Standalone/Source/LUA/LUAEditorMainWindow.cpp index 45484f2815..ffbc5a445c 100644 --- a/Code/Tools/Standalone/Source/LUA/LUAEditorMainWindow.cpp +++ b/Code/Tools/Standalone/Source/LUA/LUAEditorMainWindow.cpp @@ -213,7 +213,7 @@ namespace LUAEditor auto newState = AZ::UserSettings::CreateFind(AZ_CRC("LUA EDITOR MAIN WINDOW STATE", 0xa181bc4a), AZ::UserSettings::CT_LOCAL); m_gui->actionAutoReloadUnmodifiedFiles->setChecked(newState->m_bAutoReloadUnmodifiedFiles); - connect(m_gui->actionAutoReloadUnmodifiedFiles, &QAction::triggered, this, [this](bool newValue) + connect(m_gui->actionAutoReloadUnmodifiedFiles, &QAction::triggered, this, [](bool newValue) { auto newState = AZ::UserSettings::CreateFind(AZ_CRC("LUA EDITOR MAIN WINDOW STATE", 0xa181bc4a), AZ::UserSettings::CT_LOCAL); newState->m_bAutoReloadUnmodifiedFiles = newValue; @@ -2394,7 +2394,6 @@ namespace LUAEditor // if we have any elements, the last element is top right aligned: QLayoutItem* pItem = children[children.size() - 1]; QSize lastItemSize = pItem->minimumSize(); - QPoint topRight = effectiveRect.topRight(); const int magicalRightEdgeOffset = pItem->widget()->style()->pixelMetric(QStyle::PM_ScrollBarExtent); QRect topRightCorner(effectiveRect.topRight() - QPoint(lastItemSize.width() + magicalRightEdgeOffset, 0) + QPoint(-2, 2), lastItemSize); diff --git a/Code/Tools/Standalone/Source/LUA/LUAEditorSyntaxHighlighter.cpp b/Code/Tools/Standalone/Source/LUA/LUAEditorSyntaxHighlighter.cpp index a0c4d175a7..29229d36d0 100644 --- a/Code/Tools/Standalone/Source/LUA/LUAEditorSyntaxHighlighter.cpp +++ b/Code/Tools/Standalone/Source/LUA/LUAEditorSyntaxHighlighter.cpp @@ -16,9 +16,8 @@ namespace LUAEditor namespace { template - void CreateTypes(Container& container) + void CreateTypes([[maybe_unused]] Container& container) { - container; } template @@ -44,11 +43,11 @@ namespace LUAEditor { public: virtual ~BaseParserState() {} - virtual bool IsMultilineState(LUASyntaxHighlighter::StateMachine& machine) const { (void*)&machine; return false; } - virtual void StartState(LUASyntaxHighlighter::StateMachine& machine) { (void*)&machine; } + virtual bool IsMultilineState([[maybe_unused]] LUASyntaxHighlighter::StateMachine& machine) const { return false; } + virtual void StartState([[maybe_unused]] LUASyntaxHighlighter::StateMachine& machine) {} //note you only get 13 bits of usable space here. see QTBlockState m_syntaxHighlighterStateExtra virtual AZ::u16 GetSaveState() const { return 0; } - virtual void SetSaveState(AZ::u16 state) { state; } + virtual void SetSaveState([[maybe_unused]] AZ::u16 state) {} virtual void Parse(LUASyntaxHighlighter::StateMachine& machine, const QChar& nextChar) = 0; }; @@ -87,7 +86,7 @@ namespace LUAEditor class LongCommentParserState : public BaseParserState { - bool IsMultilineState(LUASyntaxHighlighter::StateMachine& machine) const override { (void*)&machine; return true; } + bool IsMultilineState([[maybe_unused]] LUASyntaxHighlighter::StateMachine& machine) const override { return true; } void StartState(LUASyntaxHighlighter::StateMachine& machine) override; AZ::u16 GetSaveState() const override { return m_bracketLevel; } void SetSaveState(AZ::u16 state) override; @@ -341,9 +340,8 @@ namespace LUAEditor } } - void ShortCommentParserState::StartState(LUASyntaxHighlighter::StateMachine& machine) + void ShortCommentParserState::StartState([[maybe_unused]] LUASyntaxHighlighter::StateMachine& machine) { - machine; m_mightBeLong = true; } @@ -365,10 +363,8 @@ namespace LUAEditor m_endNextChar = false; } - void LongCommentParserState::Parse(LUASyntaxHighlighter::StateMachine& machine, const QChar& nextChar) + void LongCommentParserState::Parse(LUASyntaxHighlighter::StateMachine& machine, [[maybe_unused]] const QChar& nextChar) { - nextChar; - if (m_endNextChar) { machine.SetState(ParserStates::Null); diff --git a/Code/Tools/Standalone/Source/LUA/LUAEditorView.cpp b/Code/Tools/Standalone/Source/LUA/LUAEditorView.cpp index 092d3f4b8c..18d12f292c 100644 --- a/Code/Tools/Standalone/Source/LUA/LUAEditorView.cpp +++ b/Code/Tools/Standalone/Source/LUA/LUAEditorView.cpp @@ -1200,8 +1200,6 @@ namespace LUAEditor void LUAViewWidget::focusInEvent(QFocusEvent* pEvent) { - pEvent; - QWidget::focusInEvent(pEvent); m_gui->m_luaTextEdit->setFocus(); } From d4ee5423a91d0694b5be86e5cfa0bd7178e2c4bc Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Fri, 20 Aug 2021 17:54:53 -0700 Subject: [PATCH 016/131] Code/Framework/AzCore Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Code/Framework/AzCore/Tests/AZStd/Algorithms.cpp | 3 +-- Code/Framework/AzCore/Tests/AZStd/FunctorsBind.cpp | 3 ++- Code/Framework/AzCore/Tests/AZStd/ListsIntrusive.cpp | 2 +- Code/Framework/AzCore/Tests/AZStd/SetsIntrusive.cpp | 2 +- Code/Framework/AzCore/Tests/AZStd/String.cpp | 8 ++++---- .../AzCore/Tests/Math/ShapeIntersectionTests.cpp | 3 --- Code/Framework/AzCore/Tests/Math/SimdMathTests.cpp | 2 -- Code/Framework/AzCore/Tests/Memory/LeakDetection.cpp | 1 - 8 files changed, 9 insertions(+), 15 deletions(-) diff --git a/Code/Framework/AzCore/Tests/AZStd/Algorithms.cpp b/Code/Framework/AzCore/Tests/AZStd/Algorithms.cpp index 2bb799e627..a1c9e5d79e 100644 --- a/Code/Framework/AzCore/Tests/AZStd/Algorithms.cpp +++ b/Code/Framework/AzCore/Tests/AZStd/Algorithms.cpp @@ -1032,7 +1032,7 @@ namespace UnitTest auto CreateArray = []() constexpr -> AZStd::array { AZStd::array localArray = { {1, 2, 3} }; - auto resultFunc = AZStd::for_each(localArray.begin(), localArray.end(), [](int& element) { ++element; }); + AZStd::for_each(localArray.begin(), localArray.end(), [](int& element) { ++element; }); return localArray; }; constexpr AZStd::array testArray = CreateArray(); @@ -1271,7 +1271,6 @@ namespace UnitTest TEST_F(Algorithms, Unique_Compile_WhenUsedInConstexpr) { - constexpr AZStd::array testList = { { 1, 2, 3 } }; auto TestUnique = []() constexpr { AZStd::array localArray{ { 1, 2, 2, 5, 5, 6} }; diff --git a/Code/Framework/AzCore/Tests/AZStd/FunctorsBind.cpp b/Code/Framework/AzCore/Tests/AZStd/FunctorsBind.cpp index b720257f18..58ab71096b 100644 --- a/Code/Framework/AzCore/Tests/AZStd/FunctorsBind.cpp +++ b/Code/Framework/AzCore/Tests/AZStd/FunctorsBind.cpp @@ -940,9 +940,10 @@ namespace UnitTest // 64 Byte buffer is used to prevent AZStd::function for storing the // lambda internal storage using the small buffer optimization // Therefore causing the supplied allocator to be used - AZStd::aligned_storage_t<64, 1> bufferToAvoidSmallBufferOptimization; + [[maybe_unused]] AZStd::aligned_storage_t<64, 1> bufferToAvoidSmallBufferOptimization; auto xValueAndConstXValueFunc = [bufferToAvoidSmallBufferOptimization](int lhs, int rhs) -> int { + AZ_UNUSED(bufferToAvoidSmallBufferOptimization); return lhs + rhs; }; diff --git a/Code/Framework/AzCore/Tests/AZStd/ListsIntrusive.cpp b/Code/Framework/AzCore/Tests/AZStd/ListsIntrusive.cpp index 511a4e479e..9e238b3d7d 100644 --- a/Code/Framework/AzCore/Tests/AZStd/ListsIntrusive.cpp +++ b/Code/Framework/AzCore/Tests/AZStd/ListsIntrusive.cpp @@ -997,7 +997,7 @@ namespace UnitTest myclass_base_list.clear(); auto reverseIterBegin = myclass_base_list.rbegin(); auto reverseIterEnd = myclass_base_list.rend(); - EXPECT_EQ(reverseIterEnd, reverseIterEnd); + EXPECT_EQ(reverseIterBegin, reverseIterEnd); } } } diff --git a/Code/Framework/AzCore/Tests/AZStd/SetsIntrusive.cpp b/Code/Framework/AzCore/Tests/AZStd/SetsIntrusive.cpp index 61f9144452..6cae83c3ad 100644 --- a/Code/Framework/AzCore/Tests/AZStd/SetsIntrusive.cpp +++ b/Code/Framework/AzCore/Tests/AZStd/SetsIntrusive.cpp @@ -287,7 +287,7 @@ namespace UnitTest myclass_base_set.clear(); auto reverseIterBegin = myclass_base_set.rbegin(); auto reverseIterEnd = myclass_base_set.rend(); - EXPECT_EQ(reverseIterEnd, reverseIterEnd); + EXPECT_EQ(reverseIterBegin, reverseIterEnd); } } } diff --git a/Code/Framework/AzCore/Tests/AZStd/String.cpp b/Code/Framework/AzCore/Tests/AZStd/String.cpp index 0ff12a352c..4c6687b00d 100644 --- a/Code/Framework/AzCore/Tests/AZStd/String.cpp +++ b/Code/Framework/AzCore/Tests/AZStd/String.cpp @@ -1229,7 +1229,7 @@ namespace UnitTest string_view subView2 = view2.substr(10); EXPECT_EQ("Haystack", subView2); AZ_TEST_START_TRACE_SUPPRESSION; - string_view assertSubView = view2.substr(view2.size() + 1); + [[maybe_unused]] string_view assertSubView = view2.substr(view2.size() + 1); AZ_TEST_STOP_TRACE_SUPPRESSION(1); // compare @@ -1472,7 +1472,7 @@ namespace UnitTest class WrappedInt { - int val; + [[maybe_unused]] int val; }; using ValidFormatArg = AZStd::string::_Format_Internal::ValidFormatArg; @@ -1751,6 +1751,7 @@ namespace UnitTest static constexpr basic_string_view elementView1(compileTimeString1); static constexpr basic_string_view elementView2(compileTimeString2); static_assert(elementView1.data(), "string_view.data() should be non-nullptr"); + static_assert(elementView2.data(), "string_view.data() should be non-nullptr"); } TYPED_TEST(BasicStringViewConstexprFixture, StringView_SizeOperatorsConstexpr) @@ -1779,7 +1780,7 @@ namespace UnitTest { using TypeParam = char; // null terminated compile time string - auto MakeCompileTimeString1 = []() constexpr -> const TypeParam* + [[maybe_unused]] auto MakeCompileTimeString1 = []() constexpr -> const TypeParam* { return "HelloWorld"; }; @@ -2131,7 +2132,6 @@ namespace UnitTest constexpr AZStd::fixed_string<128> test3{ AZStd::fixed_string<128>{}.insert(0, "Brown") }; constexpr AZStd::fixed_string<128> test4{ AZStd::fixed_string<128>{ "App" }.insert(0, AZStd::string_view("Blue")) }; constexpr AZStd::fixed_string<128> test5{ AZStd::fixed_string<128>{ "App" }.insert(0, test1, 2, 2) }; - constexpr AZStd::string_view redView("Red"); constexpr AZStd::fixed_string<128> test6{ AZStd::fixed_string<128>{ "App" }.insert(size_t(0), 5, 'X') }; constexpr AZStd::fixed_string<128> test7{ AZStd::fixed_string<128>{ "App" }.insert(0, "GreenTea", 5) }; auto MakeFixedStringWithInsertWithIteratorPos1 = []() constexpr diff --git a/Code/Framework/AzCore/Tests/Math/ShapeIntersectionTests.cpp b/Code/Framework/AzCore/Tests/Math/ShapeIntersectionTests.cpp index 659febf564..e7980af781 100644 --- a/Code/Framework/AzCore/Tests/Math/ShapeIntersectionTests.cpp +++ b/Code/Framework/AzCore/Tests/Math/ShapeIntersectionTests.cpp @@ -117,9 +117,6 @@ namespace UnitTest EXPECT_TRUE(AZ::ShapeIntersection::Classify(frustum, s2) == AZ::IntersectResult::Exterior); } - AZ::Vector3 axisX = AZ::Vector3::CreateAxisX(); - AZ::Vector3 axisY = AZ::Vector3::CreateAxisY(); - AZ::Vector3 axisZ = AZ::Vector3::CreateAxisZ(); { AZ::Obb obb = AZ::Obb::CreateFromPositionRotationAndHalfLengths( AZ::Vector3(0.0f, -3.9f, 0.0f), AZ::Quaternion::CreateIdentity(), AZ::Vector3::CreateOne()); diff --git a/Code/Framework/AzCore/Tests/Math/SimdMathTests.cpp b/Code/Framework/AzCore/Tests/Math/SimdMathTests.cpp index 4570d79b83..b7b3c9c952 100644 --- a/Code/Framework/AzCore/Tests/Math/SimdMathTests.cpp +++ b/Code/Framework/AzCore/Tests/Math/SimdMathTests.cpp @@ -1414,7 +1414,6 @@ namespace UnitTest typename VectorType::Int32Type testVector = VectorType::ConvertToInt(sourceVector); VectorType::StoreUnaligned(testStoreValues, testVector); - int32_t results[4] = { 0, 1, -1, 2 }; for (int32_t i = 0; i < VectorType::ElementCount; ++i) { EXPECT_THAT(testStoreValues[i], testWholeLoadValues[i]); @@ -1476,7 +1475,6 @@ namespace UnitTest typename VectorType::Int32Type testVector = VectorType::ConvertToIntNearest(sourceVector); VectorType::StoreUnaligned(testStoreValues, testVector); - int32_t results[4] = { 0, 1, -1, 2 }; for (int32_t i = 0; i < VectorType::ElementCount; ++i) { EXPECT_THAT(testStoreValues[i], testWholeLoadValues[i]); diff --git a/Code/Framework/AzCore/Tests/Memory/LeakDetection.cpp b/Code/Framework/AzCore/Tests/Memory/LeakDetection.cpp index ce94ce14f2..b4f129bb48 100644 --- a/Code/Framework/AzCore/Tests/Memory/LeakDetection.cpp +++ b/Code/Framework/AzCore/Tests/Memory/LeakDetection.cpp @@ -76,7 +76,6 @@ namespace UnitTest return true; } - AZ::Debug::DrillerManager* m_drillerManager = nullptr; bool m_leakDetected = false; bool m_leakExpected = false; }; From 847fe108b7769278ca5ac5762338598662eba0fc Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Fri, 20 Aug 2021 17:55:10 -0700 Subject: [PATCH 017/131] Code/Framework/AtomCore Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Code/Framework/AtomCore/Tests/InstanceDatabase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Code/Framework/AtomCore/Tests/InstanceDatabase.cpp b/Code/Framework/AtomCore/Tests/InstanceDatabase.cpp index 7b47a9b99e..5d1edc5a09 100644 --- a/Code/Framework/AtomCore/Tests/InstanceDatabase.cpp +++ b/Code/Framework/AtomCore/Tests/InstanceDatabase.cpp @@ -324,7 +324,7 @@ namespace UnitTest // Tests whether the deleter actually calls delete properly without // a parent database. - instance->m_onDeleteCallback = [this, &m_deleted]() + instance->m_onDeleteCallback = [&m_deleted]() { m_deleted = true; }; From 4efaafeb96bb837937456f67190def7cf0798a64 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Fri, 20 Aug 2021 17:55:28 -0700 Subject: [PATCH 018/131] Code/Framework/AzFramework Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Code/Framework/AzFramework/Tests/Scene.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Code/Framework/AzFramework/Tests/Scene.cpp b/Code/Framework/AzFramework/Tests/Scene.cpp index 0f701f3190..31df6e6774 100644 --- a/Code/Framework/AzFramework/Tests/Scene.cpp +++ b/Code/Framework/AzFramework/Tests/Scene.cpp @@ -230,7 +230,7 @@ namespace SceneUnitTest // Check to make sure there are no more active scenes. size_t index = 0; - m_sceneSystem->IterateActiveScenes([&index, &scenes](const AZStd::shared_ptr&) + m_sceneSystem->IterateActiveScenes([&index](const AZStd::shared_ptr&) { index++; return true; @@ -251,7 +251,7 @@ namespace SceneUnitTest scenes[i].reset(); } index = 0; - m_sceneSystem->IterateZombieScenes([&index, &scenes](Scene&) { + m_sceneSystem->IterateZombieScenes([&index](Scene&) { index++; return true; }); From ece541b79f1d9f9de56869d577d01df3f01fb143 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Fri, 20 Aug 2021 17:55:54 -0700 Subject: [PATCH 019/131] Code/Framework/AzManipulatorTestFramework Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../AzManipulatorTestFramework/Tests/GridSnappingTest.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Code/Framework/AzManipulatorTestFramework/Tests/GridSnappingTest.cpp b/Code/Framework/AzManipulatorTestFramework/Tests/GridSnappingTest.cpp index c824ddc766..12b2a6546c 100644 --- a/Code/Framework/AzManipulatorTestFramework/Tests/GridSnappingTest.cpp +++ b/Code/Framework/AzManipulatorTestFramework/Tests/GridSnappingTest.cpp @@ -71,7 +71,7 @@ namespace UnitTest // callback to update the manipulator's current position linearManipulator->InstallMouseMoveCallback( - [this, linearManipulator](const AzToolsFramework::LinearManipulator::Action& action) + [linearManipulator](const AzToolsFramework::LinearManipulator::Action& action) { linearManipulator->SetLocalPosition(action.LocalPosition()); }); From 657853c093bf63723c15e8463f8aaa1550702c33 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Fri, 20 Aug 2021 17:56:09 -0700 Subject: [PATCH 020/131] Code/Framework/AzNetworking Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Code/Framework/AzNetworking/AzNetworking/Utilities/Endian.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Code/Framework/AzNetworking/AzNetworking/Utilities/Endian.h b/Code/Framework/AzNetworking/AzNetworking/Utilities/Endian.h index 67165c380d..df6dd87494 100644 --- a/Code/Framework/AzNetworking/AzNetworking/Utilities/Endian.h +++ b/Code/Framework/AzNetworking/AzNetworking/Utilities/Endian.h @@ -14,14 +14,14 @@ #include #if AZ_TRAIT_NEEDS_HTONLL -const uint64_t htonll(uint64_t value) +inline static const uint64_t htonll(uint64_t value) { const uint32_t hiValue = htonl(static_cast(value >> 32)); const uint32_t loValue = htonl(static_cast(value & 0x00000000FFFFFFFF)); return static_cast(hiValue) << 32 | static_cast(loValue); } -const uint64_t ntohll(uint64_t value) +inline static const uint64_t ntohll(uint64_t value) { return htonll(value); } From fbbcdfd3cae605a7797c079b2d3453a309494008 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Fri, 20 Aug 2021 17:56:25 -0700 Subject: [PATCH 021/131] Code/Framework/AzQtComponents Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../AzQtComponents/AzQtComponents/Gallery/SpinBoxPage.cpp | 6 +++--- .../AzQtComponents/AzQtComponents/Gallery/TabWidgetPage.cpp | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Gallery/SpinBoxPage.cpp b/Code/Framework/AzQtComponents/AzQtComponents/Gallery/SpinBoxPage.cpp index 0ee5d90d38..1ee8daf786 100644 --- a/Code/Framework/AzQtComponents/AzQtComponents/Gallery/SpinBoxPage.cpp +++ b/Code/Framework/AzQtComponents/AzQtComponents/Gallery/SpinBoxPage.cpp @@ -146,7 +146,7 @@ AzQtComponents::SpinBox::setHasError(doubleSpinBox, true); { QAction* action = new QAction("Up", this); action->setShortcut(QKeySequence(Qt::Key_Up)); - connect(action, &QAction::triggered, [this]() + connect(action, &QAction::triggered, []() { qDebug() << "Up pressed"; }); @@ -155,7 +155,7 @@ AzQtComponents::SpinBox::setHasError(doubleSpinBox, true); { QAction* action = new QAction("Down", this); action->setShortcut(QKeySequence(Qt::Key_Down)); - connect(action, &QAction::triggered, [this]() + connect(action, &QAction::triggered, []() { qDebug() << "Down pressed"; }); @@ -171,7 +171,7 @@ template void SpinBoxPage::track(SpinBoxType* spinBox) { // connect to changes in the spinboxes and listen for the undo state - QObject::connect(spinBox, &SpinBoxType::valueChangeBegan, this, [this, spinBox]() { + QObject::connect(spinBox, &SpinBoxType::valueChangeBegan, this, [spinBox]() { ValueType oldValue = spinBox->value(); spinBox->setProperty("OldValue", oldValue); }); diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Gallery/TabWidgetPage.cpp b/Code/Framework/AzQtComponents/AzQtComponents/Gallery/TabWidgetPage.cpp index 9059e910a3..6e553e7436 100644 --- a/Code/Framework/AzQtComponents/AzQtComponents/Gallery/TabWidgetPage.cpp +++ b/Code/Framework/AzQtComponents/AzQtComponents/Gallery/TabWidgetPage.cpp @@ -36,17 +36,17 @@ TabWidgetPage::TabWidgetPage(QWidget* parent) menu->addAction("Action 4 (No-op)"); actionMenu->setMenu(menu); - connect(action1, &QAction::triggered, this, [this]() { + connect(action1, &QAction::triggered, this, []() { QMessageBox messageBox({}, "Action 1 triggered", "Action 1 has been triggered", QMessageBox::Ok); messageBox.exec(); }); - connect(action2, &QAction::triggered, this, [this]() { + connect(action2, &QAction::triggered, this, []() { QMessageBox messageBox({}, "Action 2 triggered", "Action 2 has been triggered", QMessageBox::Ok); messageBox.exec(); }); - connect(action3, &QAction::triggered, this, [this]() { + connect(action3, &QAction::triggered, this, []() { QMessageBox messageBox({}, "Action 3 triggered", "Action 3 has been triggered", QMessageBox::Ok); messageBox.exec(); }); From 257557c69291c2dfe9b3e537791576e520ab74dc Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Fri, 20 Aug 2021 17:56:42 -0700 Subject: [PATCH 022/131] Code/Framework/AzToolsFramework Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../Archive/ArchiveComponent.cpp | 2 +- .../Views/AssetBrowserFolderWidget.cpp | 2 +- .../AssetEditor/AssetEditorWidget.cpp | 6 +++--- .../UI/Logging/LogPanel_Panel.cpp | 1 - .../UI/PropertyEditor/ComponentEditor.cpp | 2 +- .../UI/PropertyEditor/ComponentEditor.hxx | 1 - .../PropertyEditor/PropertyBoolComboBoxCtrl.cpp | 16 ++++++++-------- .../UI/PropertyEditor/PropertyCRCCtrl.cpp | 8 ++++---- .../UI/PropertyEditor/PropertyColorCtrl.cpp | 16 ++++++++-------- .../PropertyEditor/PropertyDoubleSliderCtrl.cpp | 16 ++++++++-------- .../UI/PropertyEditor/PropertyDoubleSpinCtrl.cpp | 16 ++++++++-------- .../UI/PropertyEditor/PropertyEntityIdCtrl.cpp | 4 ++-- .../PropertyStringLineEditCtrl.cpp | 8 ++++---- 13 files changed, 48 insertions(+), 50 deletions(-) diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Archive/ArchiveComponent.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Archive/ArchiveComponent.cpp index 2a09ba0471..5004108132 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Archive/ArchiveComponent.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Archive/ArchiveComponent.cpp @@ -236,7 +236,7 @@ namespace AzToolsFramework { AZStd::string commandLineArgs = Platform::GetListFilesInArchiveCommand(archivePath); - auto parseOutput = [respCallback, taskHandle, &fileEntries](bool exitCode, AZStd::string consoleOutput) + auto parseOutput = [respCallback, &fileEntries](bool exitCode, AZStd::string consoleOutput) { Platform::ParseConsoleOutputFromListFilesInArchive(consoleOutput, fileEntries); AZ::TickBus::QueueFunction(respCallback, exitCode, AZStd::move(consoleOutput)); diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/Views/AssetBrowserFolderWidget.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/Views/AssetBrowserFolderWidget.cpp index 7e2b0859a6..d918cad2a2 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/Views/AssetBrowserFolderWidget.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/Views/AssetBrowserFolderWidget.cpp @@ -81,7 +81,7 @@ namespace AzToolsFramework mainLayout->addWidget(m_viewStack); - connect(actionGroup, &QActionGroup::triggered, this, [this, thumbnailViewAction, listViewAction, sizeComboBox](QAction* action) { + connect(actionGroup, &QActionGroup::triggered, this, [this, thumbnailViewAction, sizeComboBox](QAction* action) { if (action == thumbnailViewAction) { m_viewStack->setCurrentWidget(m_thumbnailView); diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/AssetEditor/AssetEditorWidget.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/AssetEditor/AssetEditorWidget.cpp index 744b87d753..7198ed1be8 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/AssetEditor/AssetEditorWidget.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/AssetEditor/AssetEditorWidget.cpp @@ -57,7 +57,7 @@ namespace AzToolsFramework { using AssetCheckoutCallback = AZStd::function; - void AssetCheckoutCommon(const AZ::Data::AssetId& id, AZ::Data::Asset asset, AZ::SerializeContext* serializeContext, AssetCheckoutCallback assetCheckoutAndSaveCallback) + void AssetCheckoutCommon(const AZ::Data::AssetId& id, AZ::Data::Asset asset, [[maybe_unused]] AZ::SerializeContext* serializeContext, AssetCheckoutCallback assetCheckoutAndSaveCallback) { AZStd::string assetPath; AZ::Data::AssetCatalogRequestBus::BroadcastResult(assetPath, &AZ::Data::AssetCatalogRequests::GetAssetPathById, id); @@ -74,7 +74,7 @@ namespace AzToolsFramework { using SCCommandBus = SourceControlCommandBus; SCCommandBus::Broadcast(&SCCommandBus::Events::RequestEdit, assetFullPath.c_str(), true, - [id, asset, assetFullPath, serializeContext, assetCheckoutAndSaveCallback](bool /*success*/, const SourceControlFileInfo& info) + [id, asset, assetFullPath, assetCheckoutAndSaveCallback](bool /*success*/, const SourceControlFileInfo& info) { if (!info.IsReadOnly()) { @@ -360,7 +360,7 @@ namespace AzToolsFramework if (savedCallback) { auto conn = AZStd::make_shared(); - *conn = connect(this, &AssetEditorWidget::OnAssetSavedSignal, this, [this, conn, savedCallback]() + *conn = connect(this, &AssetEditorWidget::OnAssetSavedSignal, this, [conn, savedCallback]() { disconnect(*conn); savedCallback(); diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Logging/LogPanel_Panel.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Logging/LogPanel_Panel.cpp index 55c42e2535..4fabdfad12 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Logging/LogPanel_Panel.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Logging/LogPanel_Panel.cpp @@ -657,7 +657,6 @@ namespace AzToolsFramework // if we have any elements, the last element is top right aligned: QLayoutItem* pItem = m_children[m_children.size() - 1]; QSize lastItemSize = pItem->minimumSize(); - QPoint topRight = effectiveRect.topRight(); QRect topRightCorner(effectiveRect.topRight() - QPoint(lastItemSize.width(), 0), lastItemSize); pItem->setGeometry(topRightCorner); } diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/ComponentEditor.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/ComponentEditor.cpp index fbbf55d0ad..85676df243 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/ComponentEditor.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/ComponentEditor.cpp @@ -397,7 +397,7 @@ namespace AzToolsFramework AzQtComponents::CardNotification * notification = CreateNotification(message); const QPushButton * featureButton = notification->addButtonFeature(tr("Continue")); - connect(featureButton, &QPushButton::clicked, this, [this, notification]() + connect(featureButton, &QPushButton::clicked, this, [notification]() { notification->close(); }); diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/ComponentEditor.hxx b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/ComponentEditor.hxx index bd44d513fd..b2140868da 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/ComponentEditor.hxx +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/ComponentEditor.hxx @@ -135,7 +135,6 @@ namespace AzToolsFramework QIcon m_warningIcon; ReflectedPropertyEditor* m_propertyEditor = nullptr; - QVBoxLayout* m_mainLayout = nullptr; AZ::SerializeContext* m_serializeContext; diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyBoolComboBoxCtrl.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyBoolComboBoxCtrl.cpp index 094204e5a6..4a1e969e41 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyBoolComboBoxCtrl.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyBoolComboBoxCtrl.cpp @@ -93,24 +93,24 @@ namespace AzToolsFramework void BoolPropertyComboBoxHandler::ConsumeAttribute(PropertyBoolComboBoxCtrl* GUI, AZ::u32 attrib, PropertyAttributeReader* attrValue, const char* debugName) { - (void)GUI; - (void)attrib; - (void)attrValue; - (void)debugName; + AZ_UNUSED(GUI); + AZ_UNUSED(attrib); + AZ_UNUSED(attrValue); + AZ_UNUSED(debugName); } void BoolPropertyComboBoxHandler::WriteGUIValuesIntoProperty(size_t index, PropertyBoolComboBoxCtrl* GUI, property_t& instance, InstanceDataNode* node) { - (int)index; - (void)node; + AZ_UNUSED(index); + AZ_UNUSED(node); bool val = GUI->value(); instance = static_cast(val); } bool BoolPropertyComboBoxHandler::ReadValuesIntoGUI(size_t index, PropertyBoolComboBoxCtrl* GUI, const property_t& instance, InstanceDataNode* node) { - (int)index; - (void)node; + AZ_UNUSED(index); + AZ_UNUSED(node); bool val = instance; GUI->setValue(val); return false; diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyCRCCtrl.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyCRCCtrl.cpp index 84d7d37585..6a1f1404a1 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyCRCCtrl.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyCRCCtrl.cpp @@ -173,16 +173,16 @@ namespace AzToolsFramework void U32CRCHandler::WriteGUIValuesIntoProperty(size_t index, PropertyCRCCtrl* GUI, AZ::u32& instance, InstanceDataNode* node) { - (int)index; - (void)node; + AZ_UNUSED(index); + AZ_UNUSED(node); AZ::u32 val = GUI->value(); instance = static_cast(val); } bool U32CRCHandler::ReadValuesIntoGUI(size_t index, PropertyCRCCtrl* GUI, const AZ::u32& instance, InstanceDataNode* node) { - (int)index; - (void)node; + AZ_UNUSED(index); + AZ_UNUSED(node); GUI->setValue(instance); return false; } diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyColorCtrl.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyColorCtrl.cpp index 2534df50b6..13c5c8bfac 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyColorCtrl.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyColorCtrl.cpp @@ -373,8 +373,8 @@ namespace AzToolsFramework void AZColorPropertyHandler::WriteGUIValuesIntoProperty(size_t index, PropertyColorCtrl* GUI, property_t& instance, InstanceDataNode* node) { - (int)index; - (void)node; + AZ_UNUSED(index); + AZ_UNUSED(node); QColor val = GUI->value(); AZ::Color asAZColor((float)val.redF(), (float)val.greenF(), (float)val.blueF(), (float)val.alphaF()); instance = static_cast(asAZColor); @@ -382,8 +382,8 @@ namespace AzToolsFramework bool AZColorPropertyHandler::ReadValuesIntoGUI(size_t index, PropertyColorCtrl* GUI, const property_t& instance, InstanceDataNode* node) { - (int)index; - (void)node; + AZ_UNUSED(index); + AZ_UNUSED(node); AZ::Vector4 asVector4 = static_cast(instance); QColor asQColor; asQColor.setRedF((qreal)asVector4.GetX()); @@ -410,8 +410,8 @@ namespace AzToolsFramework } void Vector3ColorPropertyHandler::WriteGUIValuesIntoProperty(size_t index, PropertyColorCtrl* GUI, property_t& instance, InstanceDataNode* node) { - (int)index; - (void)node; + AZ_UNUSED(index); + AZ_UNUSED(node); QColor val = GUI->value(); AZ::Vector3 asVector3((float)val.redF(), (float)val.greenF(), (float)val.blueF()); instance = static_cast(asVector3); @@ -419,8 +419,8 @@ namespace AzToolsFramework bool Vector3ColorPropertyHandler::ReadValuesIntoGUI(size_t index, PropertyColorCtrl* GUI, const property_t& instance, InstanceDataNode* node) { - (int)index; - (void)node; + AZ_UNUSED(index); + AZ_UNUSED(node); AZ::Vector3 asVector3 = static_cast(instance); QColor asQColor; asQColor.setRedF((qreal)asVector3.GetX()); diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyDoubleSliderCtrl.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyDoubleSliderCtrl.cpp index 0b9120bcce..64ba3b604b 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyDoubleSliderCtrl.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyDoubleSliderCtrl.cpp @@ -305,24 +305,24 @@ namespace AzToolsFramework void doublePropertySliderHandler::WriteGUIValuesIntoProperty(size_t index, PropertyDoubleSliderCtrl* GUI, property_t& instance, InstanceDataNode* node) { - (int)index; - (void)node; + AZ_UNUSED(index); + AZ_UNUSED(node); double val = GUI->value(); instance = static_cast(val); } void floatPropertySliderHandler::WriteGUIValuesIntoProperty(size_t index, PropertyDoubleSliderCtrl* GUI, property_t& instance, InstanceDataNode* node) { - (int)index; - (void)node; + AZ_UNUSED(index); + AZ_UNUSED(node); double val = GUI->value(); instance = static_cast(val); } bool doublePropertySliderHandler::ReadValuesIntoGUI(size_t index, PropertyDoubleSliderCtrl* GUI, const property_t& instance, InstanceDataNode* node) { - (int)index; - (void)node; + AZ_UNUSED(index); + AZ_UNUSED(node); GUI->blockSignals(true); GUI->setValue(instance); GUI->blockSignals(false); @@ -331,8 +331,8 @@ namespace AzToolsFramework bool floatPropertySliderHandler::ReadValuesIntoGUI(size_t index, PropertyDoubleSliderCtrl* GUI, const property_t& instance, InstanceDataNode* node) { - (int)index; - (void)node; + AZ_UNUSED(index); + AZ_UNUSED(node); GUI->blockSignals(true); GUI->setValue(instance); GUI->blockSignals(false); diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyDoubleSpinCtrl.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyDoubleSpinCtrl.cpp index 58f1192f7c..6842b50d80 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyDoubleSpinCtrl.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyDoubleSpinCtrl.cpp @@ -363,32 +363,32 @@ namespace AzToolsFramework void doublePropertySpinboxHandler::WriteGUIValuesIntoProperty(size_t index, PropertyDoubleSpinCtrl* GUI, property_t& instance, InstanceDataNode* node) { - (int)index; - (void)node; + AZ_UNUSED(index); + AZ_UNUSED(node); double val = GUI->value() / GUI->multiplier(); instance = static_cast(val); } void floatPropertySpinboxHandler::WriteGUIValuesIntoProperty(size_t index, PropertyDoubleSpinCtrl* GUI, property_t& instance, InstanceDataNode* node) { - (int)index; - (void)node; + AZ_UNUSED(index); + AZ_UNUSED(node); double val = GUI->value() / GUI->multiplier(); instance = static_cast(val); } bool doublePropertySpinboxHandler::ReadValuesIntoGUI(size_t index, PropertyDoubleSpinCtrl* GUI, const property_t& instance, InstanceDataNode* node) { - (int)index; - (void)node; + AZ_UNUSED(index); + AZ_UNUSED(node); GUI->setValue(instance * GUI->multiplier()); return false; } bool floatPropertySpinboxHandler::ReadValuesIntoGUI(size_t index, PropertyDoubleSpinCtrl* GUI, const property_t& instance, InstanceDataNode* node) { - (int)index; - (void)node; + AZ_UNUSED(index); + AZ_UNUSED(node); GUI->setValue(instance * GUI->multiplier()); return false; } diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyEntityIdCtrl.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyEntityIdCtrl.cpp index 424a110c49..f98638fd69 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyEntityIdCtrl.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyEntityIdCtrl.cpp @@ -518,8 +518,8 @@ namespace AzToolsFramework void EntityIdPropertyHandler::WriteGUIValuesIntoProperty(size_t index, PropertyEntityIdCtrl* GUI, property_t& instance, InstanceDataNode* node) { - (int)index; - (void)node; + AZ_UNUSED(index); + AZ_UNUSED(node); instance = GUI->GetEntityId(); } diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyStringLineEditCtrl.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyStringLineEditCtrl.cpp index ea02e93c96..feb2a9e2ad 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyStringLineEditCtrl.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyStringLineEditCtrl.cpp @@ -142,16 +142,16 @@ namespace AzToolsFramework void StringPropertyLineEditHandler::WriteGUIValuesIntoProperty(size_t index, PropertyStringLineEditCtrl* GUI, property_t& instance, InstanceDataNode* node) { - (int)index; - (void)node; + AZ_UNUSED(index); + AZ_UNUSED(node); AZStd::string val = GUI->value(); instance = static_cast(val); } bool StringPropertyLineEditHandler::ReadValuesIntoGUI(size_t index, PropertyStringLineEditCtrl* GUI, const property_t& instance, InstanceDataNode* node) { - (int)index; - (void)node; + AZ_UNUSED(index); + AZ_UNUSED(node); AZStd::string val = instance; GUI->setValue(val); return false; From c19c4af1e1b381b4945fed312e1a518acad8c8d0 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Fri, 20 Aug 2021 17:57:02 -0700 Subject: [PATCH 023/131] Gems/Atom Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../Code/Source/Compressors/ETC2.cpp | 2 -- .../Code/Source/Converters/ColorChart.cpp | 1 - .../Code/Source/Converters/FIR-Filter.cpp | 14 ++++++------- .../Code/Source/Converters/HighPass.cpp | 3 --- .../Code/Source/ImageLoader/DdsLoader.cpp | 4 ++-- .../Code/Source/Processing/ImageConvert.cpp | 2 -- .../Source/Processing/ImageObjectImpl.cpp | 2 -- .../ImageThumbnailSystemComponent.cpp | 2 +- .../Editor/CommonFiles/Preprocessor.cpp | 3 ++- .../Source/Editor/ShaderBuilderUtility.cpp | 2 +- .../Model/ModelAssetBuilderComponent.cpp | 1 - .../Model/MorphTargetExporter.cpp | 2 -- .../RPI/Code/Tests/Buffer/BufferTests.cpp | 1 - .../Code/Tests/Common/ErrorMessageFinder.cpp | 2 +- .../Code/Tests/Image/StreamingImageTests.cpp | 1 - .../Tests/Material/MaterialAssetTests.cpp | 18 ++++++++--------- .../Material/MaterialSourceDataTests.cpp | 4 ++-- .../Tests/Material/MaterialTypeAssetTests.cpp | 20 +++++++++---------- Gems/Atom/RPI/Code/Tests/Model/ModelTests.cpp | 1 - .../Viewport/RenderViewportWidget.h | 2 -- .../MaterialEditorBrowserInteractions.cpp | 6 +++--- .../Source/Window/MaterialEditorWindow.cpp | 8 ++++---- .../EditorMaterialComponentInspector.cpp | 4 ++-- 23 files changed, 44 insertions(+), 61 deletions(-) diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Compressors/ETC2.cpp b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Compressors/ETC2.cpp index 9c002952be..0c3d6dca3d 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Compressors/ETC2.cpp +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Compressors/ETC2.cpp @@ -115,8 +115,6 @@ namespace ImageProcessingAtom IImageObjectPtr ETC2Compressor::CompressImage(IImageObjectPtr srcImage, EPixelFormat fmtDst, const CompressOption* compressOption) const { - const size_t srcPixelSize = 4; - //validate input EPixelFormat fmtSrc = srcImage->GetPixelFormat(); diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Converters/ColorChart.cpp b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Converters/ColorChart.cpp index 0b06e00a9f..b6e9cf4c8c 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Converters/ColorChart.cpp +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Converters/ColorChart.cpp @@ -133,7 +133,6 @@ namespace ImageProcessingAtom IImageObjectPtr C3dLutColorChart::GenerateChartImage() { - const AZ::u32 mipCount = 1; IImageObjectPtr image(IImageObject::CreateImage(ePS_Red* ePS_Blue, ePS_Green, 1, ePixelFormat_R8G8B8A8)); { diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Converters/FIR-Filter.cpp b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Converters/FIR-Filter.cpp index 0bfdf6d672..0387ec5c7b 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Converters/FIR-Filter.cpp +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Converters/FIR-Filter.cpp @@ -209,18 +209,18 @@ namespace ImageProcessingAtom /* addition of c-pointers already takes care of datatype-sizes */ \ const signed long int dy = /*parm->mirror ? -1 :*/ 1; \ const unsigned int stridei = parm->incols * 1 * 1; \ - const unsigned int stridet = parm->subcols * 1 * 1; \ - const unsigned int strideo = parm->outcols * 1 * 1; \ + [[maybe_unused]] const unsigned int stridet = parm->subcols * 1 * 1; \ + [[maybe_unused]] const unsigned int strideo = parm->outcols * 1 * 1; \ /* offset and shift calculations still require the unmodified values */ \ const unsigned int strideiraw = parm->incols; \ - const unsigned int stridetraw = parm->subcols; \ + [[maybe_unused]] const unsigned int stridetraw = parm->subcols; \ const unsigned int strideoraw = parm->outcols; \ \ class Plane2D tmp(tmpcols, tmprows, 4); \ dtyp*** t = (dtyp***)tmp; \ int srcPos, dstPos; \ - bool plusminush = false; const bool of = true; \ - bool plusminusv = false; const bool nc = false; \ + bool plusminush = false; [[maybe_unused]] const bool of = true; \ + bool plusminusv = false; [[maybe_unused]] const bool nc = false; \ FilterWeights* fwh = calculateFilterWeights(parm->resample.colrem, parm->caged ? 0 : 0 - parm->region.subtop, parm->caged ? srccols : parm->subrows - parm->region.subtop, \ parm->resample.colquo, 0, dstcols, reps, parm->resample.colblur, parm->resample.wf, parm->resample.operation != eWindowEvaluation_Sum, plusminush); \ FilterWeights* fwv = calculateFilterWeights(parm->resample.rowrem, parm->caged ? 0 : 0 - parm->region.intop, parm->caged ? srcrows : parm->inrows - parm->region.intop, \ @@ -833,7 +833,7 @@ namespace ImageProcessingAtom #define filterRowFetch(srcOffs, srcSize, srcSkip, dstOffs, dstSize, dstSkip) \ /* vertical stride, horizontal fetch */ \ - getCxNFromStreamSwapped(srcSkip, i); \ + /* getCxNFromStreamSwapped(srcSkip, i); Expands to nothing */ \ getCxNFromStream(srcSkip, i); \ getCxNFromPlane(1); \ \ @@ -935,7 +935,7 @@ namespace ImageProcessingAtom comcpyCHistogram(); \ \ /* horizontal stride, vertical store */ \ - putCxNToStreamSwapped(dstSkip, o); \ + /* putCxNToStreamSwapped(dstSkip, o); Expands to nothing */ \ putCxNToStream(dstSkip, o); \ putCxNToPlane(1); \ \ diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Converters/HighPass.cpp b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Converters/HighPass.cpp index eefd5332be..e2071fb586 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Converters/HighPass.cpp +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Converters/HighPass.cpp @@ -58,9 +58,6 @@ namespace ImageProcessingAtom // linear interpolation FilterImage(MipGenType::triangle, MipGenEvalType::sum, 0.0f, 0.0f, m_img, dwMipDown, newImage, dstMip, NULL, NULL); - const AZ::u32 pixelCountIn = m_img->GetWidth(dstMip) * m_img->GetHeight(dstMip); - const AZ::u32 pixelCountOut = newImage->GetWidth(dstMip) * newImage->GetHeight(dstMip); - //substraction AZ::u8* srcPixelBuf; AZ::u32 srcPitch; diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/ImageLoader/DdsLoader.cpp b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/ImageLoader/DdsLoader.cpp index b9054a9911..20367227bd 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/ImageLoader/DdsLoader.cpp +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/ImageLoader/DdsLoader.cpp @@ -87,7 +87,7 @@ namespace ImageProcessingAtom if (dxgiFormat != DXGI_FORMAT_UNKNOWN) { int i = 0; - for (i; i < ePixelFormat_Count; i++) + for (; i < ePixelFormat_Count; i++) { const PixelFormatInfo* info = CPixelFormats::GetInstance().GetPixelFormatInfo((EPixelFormat)i); if (static_cast(info->d3d10Format) == dxgiFormat) @@ -506,7 +506,7 @@ namespace ImageProcessingAtom if (dxgiFormat != DXGI_FORMAT_UNKNOWN) { uint32_t i = 0; - for (i; i < ePixelFormat_Count; i++) + for (; i < ePixelFormat_Count; i++) { const PixelFormatInfo* info = CPixelFormats::GetInstance().GetPixelFormatInfo((EPixelFormat)i); if (static_cast(info->d3d10Format) == dxgiFormat) diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Processing/ImageConvert.cpp b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Processing/ImageConvert.cpp index 9abb6de300..3f28e89334 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Processing/ImageConvert.cpp +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Processing/ImageConvert.cpp @@ -603,8 +603,6 @@ namespace ImageProcessingAtom const bool isCompressing = isSourceFormatUncompressed ? true : false; const EPixelFormat outputFormat = isCompressing ? destinationFormat : sourceFormat; - const uint32_t imageWidth = m_image->Get()->GetWidth(0); - const uint32_t imageHeight = m_image->Get()->GetHeight(0); ICompressorPtr compressor = ICompressor::FindCompressor(outputFormat, m_input->m_presetSetting.m_destColorSpace, isCompressing); // find out if the compressor has a preference to any specific colorspace diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Processing/ImageObjectImpl.cpp b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Processing/ImageObjectImpl.cpp index fd3923d7bf..8504f5e074 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Processing/ImageObjectImpl.cpp +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Processing/ImageObjectImpl.cpp @@ -241,8 +241,6 @@ namespace ImageProcessingAtom // clone this image-object's contents IImageObject* CImageObject::Clone(uint32_t maxMipCount) const { - const EPixelFormat srcPixelformat = GetPixelFormat(); - IImageObject* outImage = AllocateImage(maxMipCount); AZ::u32 mips = outImage->GetMipCount(); diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Thumbnail/ImageThumbnailSystemComponent.cpp b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Thumbnail/ImageThumbnailSystemComponent.cpp index 7e4d29e23c..5a41411d86 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Thumbnail/ImageThumbnailSystemComponent.cpp +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Thumbnail/ImageThumbnailSystemComponent.cpp @@ -180,7 +180,7 @@ namespace ImageProcessingAtom // Dispatch event on main thread AZ::SystemTickBus::QueueFunction( [ - thumbnailKey, thumbnailSize, + thumbnailKey, pixmap = QPixmap::fromImage(image.scaled(QSize(thumbnailSize, thumbnailSize), Qt::KeepAspectRatio, Qt::SmoothTransformation)) ]() mutable { diff --git a/Gems/Atom/Asset/Shader/Code/Source/Editor/CommonFiles/Preprocessor.cpp b/Gems/Atom/Asset/Shader/Code/Source/Editor/CommonFiles/Preprocessor.cpp index 9c77ae6b35..9c1b3a78ca 100644 --- a/Gems/Atom/Asset/Shader/Code/Source/Editor/CommonFiles/Preprocessor.cpp +++ b/Gems/Atom/Asset/Shader/Code/Source/Editor/CommonFiles/Preprocessor.cpp @@ -154,7 +154,8 @@ namespace AZ // Remark: for MacOS & Linux it is important to call va_start again before // each call to azvsnprintf. Not required for Windows. va_start(args, format); - count = azvscprintf(format, args) + 1; // vscprintf returns a size that doesn't include the null character. + count = azvscprintf(format, args); + count += 1; // vscprintf returns a size that doesn't include the null character. va_end(args); biggerData.reset(new char[count]); diff --git a/Gems/Atom/Asset/Shader/Code/Source/Editor/ShaderBuilderUtility.cpp b/Gems/Atom/Asset/Shader/Code/Source/Editor/ShaderBuilderUtility.cpp index 0018f2ead8..450631eaae 100644 --- a/Gems/Atom/Asset/Shader/Code/Source/Editor/ShaderBuilderUtility.cpp +++ b/Gems/Atom/Asset/Shader/Code/Source/Editor/ShaderBuilderUtility.cpp @@ -517,7 +517,7 @@ namespace AZ { // Search the function name into the list of valid entry points into the shader. auto findId = - AZStd::find_if(shaderEntryPoints.begin(), shaderEntryPoints.end(), [&functionName, &mask](const auto& item) { + AZStd::find_if(shaderEntryPoints.begin(), shaderEntryPoints.end(), [&functionName](const auto& item) { return item.first == functionName; }); diff --git a/Gems/Atom/RPI/Code/Source/RPI.Builders/Model/ModelAssetBuilderComponent.cpp b/Gems/Atom/RPI/Code/Source/RPI.Builders/Model/ModelAssetBuilderComponent.cpp index 13e5714b52..5fcbcd7180 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Builders/Model/ModelAssetBuilderComponent.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Builders/Model/ModelAssetBuilderComponent.cpp @@ -959,7 +959,6 @@ namespace AZ size_t numInfluencesAdded = 0; for (const auto& skinData : sourceMesh.m_skinData) { - const size_t numJoints = skinData->GetBoneCount(); const AZ::u32 controlPointIndex = sourceMeshData->GetControlPointIndex(static_cast(vertexIndex)); const size_t numSkinInfluences = skinData->GetLinkCount(controlPointIndex); diff --git a/Gems/Atom/RPI/Code/Source/RPI.Builders/Model/MorphTargetExporter.cpp b/Gems/Atom/RPI/Code/Source/RPI.Builders/Model/MorphTargetExporter.cpp index fa437c002f..44141f3ae3 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Builders/Model/MorphTargetExporter.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Builders/Model/MorphTargetExporter.cpp @@ -149,8 +149,6 @@ namespace AZ::RPI const float tolerance = CalcPositionDeltaTolerance(sourceMesh); AZ::Aabb deltaPositionAabb = AZ::Aabb::CreateNull(); - const uint32_t numFaces = blendShapeData->GetFaceCount(); - AZStd::vector& packedCompressedMorphTargetVertexData = productMesh.m_morphTargetVertexData; MorphTargetMetaAsset::MorphTarget metaData; diff --git a/Gems/Atom/RPI/Code/Tests/Buffer/BufferTests.cpp b/Gems/Atom/RPI/Code/Tests/Buffer/BufferTests.cpp index f648de6997..a2f478901c 100644 --- a/Gems/Atom/RPI/Code/Tests/Buffer/BufferTests.cpp +++ b/Gems/Atom/RPI/Code/Tests/Buffer/BufferTests.cpp @@ -616,7 +616,6 @@ namespace UnitTest Data::Asset asset; creator.End(asset); - bufferInfo.m_bufferDescriptor.m_byteCount; Data::Instance bufferInst = RPI::Buffer::FindOrCreate(asset); ASSERT_NE(bufferInst.get(), nullptr); diff --git a/Gems/Atom/RPI/Code/Tests/Common/ErrorMessageFinder.cpp b/Gems/Atom/RPI/Code/Tests/Common/ErrorMessageFinder.cpp index 7ffdffbb14..fa88f145a6 100644 --- a/Gems/Atom/RPI/Code/Tests/Common/ErrorMessageFinder.cpp +++ b/Gems/Atom/RPI/Code/Tests/Common/ErrorMessageFinder.cpp @@ -105,7 +105,7 @@ namespace UnitTest { EXPECT_FALSE(m_disabled); - AZStd::for_each(m_expectedErrors.begin(), m_expectedErrors.end(), [this](ExpectedError& expectedError) { expectedError.m_gotCount = 0; }); + AZStd::for_each(m_expectedErrors.begin(), m_expectedErrors.end(), [](ExpectedError& expectedError) { expectedError.m_gotCount = 0; }); m_checked = false; } diff --git a/Gems/Atom/RPI/Code/Tests/Image/StreamingImageTests.cpp b/Gems/Atom/RPI/Code/Tests/Image/StreamingImageTests.cpp index 3836f5c8f5..345637bfe5 100644 --- a/Gems/Atom/RPI/Code/Tests/Image/StreamingImageTests.cpp +++ b/Gems/Atom/RPI/Code/Tests/Image/StreamingImageTests.cpp @@ -490,7 +490,6 @@ namespace UnitTest const uint16_t mipLevels = 1; const uint16_t arraySize = 1; - const uint16_t pixelSize = 4; Data::Asset mipChain; diff --git a/Gems/Atom/RPI/Code/Tests/Material/MaterialAssetTests.cpp b/Gems/Atom/RPI/Code/Tests/Material/MaterialAssetTests.cpp index 0b30b723d6..ce223ceb35 100644 --- a/Gems/Atom/RPI/Code/Tests/Material/MaterialAssetTests.cpp +++ b/Gems/Atom/RPI/Code/Tests/Material/MaterialAssetTests.cpp @@ -267,47 +267,47 @@ namespace UnitTest creator.SetPropertyValue(Name{ "MyBool" }, m_testImageAsset); }); - expectCreatorError([this](MaterialAssetCreator& creator) + expectCreatorError([](MaterialAssetCreator& creator) { creator.SetPropertyValue(Name{ "MyInt" }, 0.0f); }); - expectCreatorError([this](MaterialAssetCreator& creator) + expectCreatorError([](MaterialAssetCreator& creator) { creator.SetPropertyValue(Name{ "MyUInt" }, -1); }); - expectCreatorError([this](MaterialAssetCreator& creator) + expectCreatorError([](MaterialAssetCreator& creator) { creator.SetPropertyValue(Name{ "MyFloat" }, 10u); }); - expectCreatorError([this](MaterialAssetCreator& creator) + expectCreatorError([](MaterialAssetCreator& creator) { creator.SetPropertyValue(Name{ "MyFloat2" }, 1.0f); }); - expectCreatorError([this](MaterialAssetCreator& creator) + expectCreatorError([](MaterialAssetCreator& creator) { creator.SetPropertyValue(Name{ "MyFloat3" }, AZ::Vector4{}); }); - expectCreatorError([this](MaterialAssetCreator& creator) + expectCreatorError([](MaterialAssetCreator& creator) { creator.SetPropertyValue(Name{ "MyFloat4" }, AZ::Vector3{}); }); - expectCreatorError([this](MaterialAssetCreator& creator) + expectCreatorError([](MaterialAssetCreator& creator) { creator.SetPropertyValue(Name{ "MyColor" }, MaterialPropertyValue(false)); }); - expectCreatorError([this](MaterialAssetCreator& creator) + expectCreatorError([](MaterialAssetCreator& creator) { creator.SetPropertyValue(Name{ "MyImage" }, true); }); - expectCreatorError([this](MaterialAssetCreator& creator) + expectCreatorError([](MaterialAssetCreator& creator) { creator.SetPropertyValue(Name{ "MyEnum" }, -1); }); diff --git a/Gems/Atom/RPI/Code/Tests/Material/MaterialSourceDataTests.cpp b/Gems/Atom/RPI/Code/Tests/Material/MaterialSourceDataTests.cpp index a20d16b0d6..553c3243e1 100644 --- a/Gems/Atom/RPI/Code/Tests/Material/MaterialSourceDataTests.cpp +++ b/Gems/Atom/RPI/Code/Tests/Material/MaterialSourceDataTests.cpp @@ -566,7 +566,7 @@ namespace UnitTest // We use local functions to easily start a new MaterialAssetCreator for each test case because // the AssetCreator would just skip subsequent operations after the first failure is detected. - auto expectError = [this](AZStd::function setOneBadInput, [[maybe_unused]] uint32_t expectedAsserts = 2) + auto expectError = [](AZStd::function setOneBadInput, [[maybe_unused]] uint32_t expectedAsserts = 2) { MaterialSourceData sourceData; @@ -583,7 +583,7 @@ namespace UnitTest EXPECT_FALSE(materialAssetOutcome.IsSuccess()); }; - auto expectWarning = [this](AZStd::function setOneBadInput, [[maybe_unused]] uint32_t expectedAsserts = 1) + auto expectWarning = [](AZStd::function setOneBadInput, [[maybe_unused]] uint32_t expectedAsserts = 1) { MaterialSourceData sourceData; diff --git a/Gems/Atom/RPI/Code/Tests/Material/MaterialTypeAssetTests.cpp b/Gems/Atom/RPI/Code/Tests/Material/MaterialTypeAssetTests.cpp index 6b788addc7..e11a049af2 100644 --- a/Gems/Atom/RPI/Code/Tests/Material/MaterialTypeAssetTests.cpp +++ b/Gems/Atom/RPI/Code/Tests/Material/MaterialTypeAssetTests.cpp @@ -413,7 +413,7 @@ namespace UnitTest EXPECT_EQ(1, creator.GetErrorCount()); }; - auto expectCreatorWarning = [this](AZStd::function passBadInput) + auto expectCreatorWarning = [](AZStd::function passBadInput) { MaterialTypeAssetCreator creator; creator.Begin(Uuid::CreateRandom()); @@ -442,47 +442,47 @@ namespace UnitTest creator.SetPropertyValue(Name{ "MyBool" }, m_testImageAsset); }); - expectCreatorError([this](MaterialTypeAssetCreator& creator) + expectCreatorError([](MaterialTypeAssetCreator& creator) { creator.SetPropertyValue(Name{ "MyInt" }, 0.0f); }); - expectCreatorError([this](MaterialTypeAssetCreator& creator) + expectCreatorError([](MaterialTypeAssetCreator& creator) { creator.SetPropertyValue(Name{ "MyUInt" }, -1); }); - expectCreatorError([this](MaterialTypeAssetCreator& creator) + expectCreatorError([](MaterialTypeAssetCreator& creator) { creator.SetPropertyValue(Name{ "MyFloat" }, 10u); }); - expectCreatorError([this](MaterialTypeAssetCreator& creator) + expectCreatorError([](MaterialTypeAssetCreator& creator) { creator.SetPropertyValue(Name{ "MyFloat2" }, 1.0f); }); - expectCreatorError([this](MaterialTypeAssetCreator& creator) + expectCreatorError([](MaterialTypeAssetCreator& creator) { creator.SetPropertyValue(Name{ "MyFloat3" }, AZ::Vector4{}); }); - expectCreatorError([this](MaterialTypeAssetCreator& creator) + expectCreatorError([](MaterialTypeAssetCreator& creator) { creator.SetPropertyValue(Name{ "MyFloat4" }, AZ::Vector3{}); }); - expectCreatorError([this](MaterialTypeAssetCreator& creator) + expectCreatorError([](MaterialTypeAssetCreator& creator) { creator.SetPropertyValue(Name{ "MyColor" }, MaterialPropertyValue(false)); }); - expectCreatorError([this](MaterialTypeAssetCreator& creator) + expectCreatorError([](MaterialTypeAssetCreator& creator) { creator.SetPropertyValue(Name{ "MyImage" }, true); }); - expectCreatorError([this](MaterialTypeAssetCreator& creator) + expectCreatorError([](MaterialTypeAssetCreator& creator) { creator.SetPropertyValue(Name{ "MyEnum" }, -1); }); diff --git a/Gems/Atom/RPI/Code/Tests/Model/ModelTests.cpp b/Gems/Atom/RPI/Code/Tests/Model/ModelTests.cpp index ff998ad4d3..7b07e14de0 100644 --- a/Gems/Atom/RPI/Code/Tests/Model/ModelTests.cpp +++ b/Gems/Atom/RPI/Code/Tests/Model/ModelTests.cpp @@ -783,7 +783,6 @@ namespace UnitTest const uint32_t vertexCount = 36; const uint32_t vertexSize = sizeof(float) * 3; - const uint32_t vertexBufferSize = vertexCount * vertexSize; RHI::BufferViewDescriptor validStreamBufferViewDescriptor = RHI::BufferViewDescriptor::CreateStructured(0, vertexCount, vertexSize); diff --git a/Gems/Atom/Tools/AtomToolsFramework/Code/Include/AtomToolsFramework/Viewport/RenderViewportWidget.h b/Gems/Atom/Tools/AtomToolsFramework/Code/Include/AtomToolsFramework/Viewport/RenderViewportWidget.h index bb26e116af..1dad34cdb5 100644 --- a/Gems/Atom/Tools/AtomToolsFramework/Code/Include/AtomToolsFramework/Viewport/RenderViewportWidget.h +++ b/Gems/Atom/Tools/AtomToolsFramework/Code/Include/AtomToolsFramework/Viewport/RenderViewportWidget.h @@ -160,8 +160,6 @@ namespace AtomToolsFramework QElapsedTimer m_renderTimer; // The time of the last recorded tick event from the system tick bus. AZ::ScriptTimePoint m_time; - // Whether the Viewport is currently hiding and capturing the cursor position. - bool m_capturingCursor = false; // The viewport settings (e.g. grid snapping, grid size) for this viewport. const AzToolsFramework::ViewportInteraction::ViewportSettings* m_viewportSettings = nullptr; // Maps our internal Qt events into AzFramework InputChannels for our ViewportControllerList. diff --git a/Gems/Atom/Tools/MaterialEditor/Code/Source/Window/MaterialEditorBrowserInteractions.cpp b/Gems/Atom/Tools/MaterialEditor/Code/Source/Window/MaterialEditorBrowserInteractions.cpp index 3440d9c316..e6ffd2842f 100644 --- a/Gems/Atom/Tools/MaterialEditor/Code/Source/Window/MaterialEditorBrowserInteractions.cpp +++ b/Gems/Atom/Tools/MaterialEditor/Code/Source/Window/MaterialEditorBrowserInteractions.cpp @@ -125,7 +125,7 @@ namespace MaterialEditor QDesktopServices::openUrl(QUrl::fromLocalFile(entry->GetFullPath().c_str())); }); - menu->addAction("Duplicate...", [entry, caller]() + menu->addAction("Duplicate...", [entry]() { const QFileInfo duplicateFileInfo(AtomToolsFramework::GetDuplicationFileInfo(entry->GetFullPath().c_str())); if (!duplicateFileInfo.absoluteFilePath().isEmpty()) @@ -156,7 +156,7 @@ namespace MaterialEditor AtomToolsFramework::AtomToolsDocumentSystemRequestBus::Broadcast(&AtomToolsFramework::AtomToolsDocumentSystemRequestBus::Events::OpenDocument, entry->GetFullPath()); }); - menu->addAction("Duplicate...", [entry, caller]() + menu->addAction("Duplicate...", [entry]() { const QFileInfo duplicateFileInfo(AtomToolsFramework::GetDuplicationFileInfo(entry->GetFullPath().c_str())); if (!duplicateFileInfo.absoluteFilePath().isEmpty()) @@ -285,7 +285,7 @@ namespace MaterialEditor }); // add get latest action - m_getLatestAction = sourceControlMenu->addAction("Get Latest", [path, this]() + m_getLatestAction = sourceControlMenu->addAction("Get Latest", [path]() { SourceControlCommandBus::Broadcast(&SourceControlCommandBus::Events::RequestLatest, path.c_str(), [](bool, const SourceControlFileInfo&) {}); diff --git a/Gems/Atom/Tools/MaterialEditor/Code/Source/Window/MaterialEditorWindow.cpp b/Gems/Atom/Tools/MaterialEditor/Code/Source/Window/MaterialEditorWindow.cpp index 8922591580..4c742d4ee1 100644 --- a/Gems/Atom/Tools/MaterialEditor/Code/Source/Window/MaterialEditorWindow.cpp +++ b/Gems/Atom/Tools/MaterialEditor/Code/Source/Window/MaterialEditorWindow.cpp @@ -304,7 +304,7 @@ namespace MaterialEditor } }, QKeySequence::New); - m_actionOpen = m_menuFile->addAction("&Open...", [this]() { + m_actionOpen = m_menuFile->addAction("&Open...", []() { const AZStd::vector assetTypes = { azrtti_typeid() }; const AZStd::string filePath = AtomToolsFramework::GetOpenFileInfo(assetTypes).absoluteFilePath().toUtf8().constData(); if (!filePath.empty()) @@ -369,7 +369,7 @@ namespace MaterialEditor AtomToolsFramework::AtomToolsDocumentSystemRequestBus::Broadcast(&AtomToolsFramework::AtomToolsDocumentSystemRequestBus::Events::CloseDocument, documentId); }, QKeySequence::Close); - m_actionCloseAll = m_menuFile->addAction("Close All", [this]() { + m_actionCloseAll = m_menuFile->addAction("Close All", []() { AtomToolsFramework::AtomToolsDocumentSystemRequestBus::Broadcast(&AtomToolsFramework::AtomToolsDocumentSystemRequestBus::Events::CloseAllDocuments); }); @@ -436,7 +436,7 @@ namespace MaterialEditor SetDockWidgetVisible(label, !IsDockWidgetVisible(label)); }); - m_actionConsole = m_menuView->addAction("&Console", [this]() { + m_actionConsole = m_menuView->addAction("&Console", []() { }); m_actionPythonTerminal = m_menuView->addAction("Python &Terminal", [this]() { @@ -471,7 +471,7 @@ namespace MaterialEditor dialog.exec(); }); - m_actionAbout = m_menuHelp->addAction("&About...", [this]() { + m_actionAbout = m_menuHelp->addAction("&About...", []() { }); } diff --git a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Material/EditorMaterialComponentInspector.cpp b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Material/EditorMaterialComponentInspector.cpp index f4c255d774..b9a4adc068 100644 --- a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Material/EditorMaterialComponentInspector.cpp +++ b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Material/EditorMaterialComponentInspector.cpp @@ -214,7 +214,7 @@ namespace AZ groupNameId.c_str())); auto propertyGroupWidget = new AtomToolsFramework::InspectorPropertyGroupWidget( &group, &group, group.TYPEINFO_Uuid(), this, this, saveStateKey, - [this](const AzToolsFramework::InstanceDataNode* source, const AzToolsFramework::InstanceDataNode* target) { + [](const AzToolsFramework::InstanceDataNode* source, const AzToolsFramework::InstanceDataNode* target) { AZ_UNUSED(source); const AtomToolsFramework::DynamicProperty* property = AtomToolsFramework::FindDynamicPropertyForInstanceDataNode(target); return property && AtomToolsFramework::ArePropertyValuesEqual(property->GetValue(), property->GetConfig().m_parentValue); @@ -267,7 +267,7 @@ namespace AZ groupNameId.c_str())); auto propertyGroupWidget = new AtomToolsFramework::InspectorPropertyGroupWidget( &group, &group, group.TYPEINFO_Uuid(), this, this, saveStateKey, - [this](const AzToolsFramework::InstanceDataNode* source, const AzToolsFramework::InstanceDataNode* target) { + [](const AzToolsFramework::InstanceDataNode* source, const AzToolsFramework::InstanceDataNode* target) { AZ_UNUSED(source); const AtomToolsFramework::DynamicProperty* property = AtomToolsFramework::FindDynamicPropertyForInstanceDataNode(target); return property && AtomToolsFramework::ArePropertyValuesEqual(property->GetValue(), property->GetConfig().m_parentValue); From ff0f85e031e5660259d8925817e45694b59ca9ab Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Fri, 20 Aug 2021 17:57:35 -0700 Subject: [PATCH 024/131] Gems/AWS Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../Source/Editor/Attribution/AWSCoreAttributionManager.cpp | 4 ++-- .../AWSGameLiftServer/Tests/AWSGameLiftServerManagerTest.cpp | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Gems/AWSCore/Code/Source/Editor/Attribution/AWSCoreAttributionManager.cpp b/Gems/AWSCore/Code/Source/Editor/Attribution/AWSCoreAttributionManager.cpp index 85dd1469cb..712c083e7a 100644 --- a/Gems/AWSCore/Code/Source/Editor/Attribution/AWSCoreAttributionManager.cpp +++ b/Gems/AWSCore/Code/Source/Editor/Attribution/AWSCoreAttributionManager.cpp @@ -298,7 +298,7 @@ namespace AWSCore { AZ::ModuleManagerRequestBus::Broadcast( &AZ::ModuleManagerRequestBus::Events::EnumerateModules, - [this, &gems](const AZ::ModuleData& moduleData) + [&gems](const AZ::ModuleData& moduleData) { AZ::Entity* moduleEntity = moduleData.GetEntity(); auto moduleEntityName = moduleEntity->GetName(); @@ -338,7 +338,7 @@ namespace AWSCore AZ_Printf("AWSAttributionManager", "AWSAttribution metric submit success"); }, - [this]([[maybe_unused]] ServiceAPI::AWSAttributionRequestJob* failJob) + []([[maybe_unused]] ServiceAPI::AWSAttributionRequestJob* failJob) { AZ_Error("AWSAttributionManager", false, "Metrics send error: %s", failJob->error.message.c_str()); }, diff --git a/Gems/AWSGameLift/Code/AWSGameLiftServer/Tests/AWSGameLiftServerManagerTest.cpp b/Gems/AWSGameLift/Code/AWSGameLiftServer/Tests/AWSGameLiftServerManagerTest.cpp index a0b8f2e495..e0a7caba24 100644 --- a/Gems/AWSGameLift/Code/AWSGameLiftServer/Tests/AWSGameLiftServerManagerTest.cpp +++ b/Gems/AWSGameLift/Code/AWSGameLiftServer/Tests/AWSGameLiftServerManagerTest.cpp @@ -398,7 +398,6 @@ namespace UnitTest .WillOnce(Return(successOutcome)); AZStd::vector testThreadPool; - AZStd::atomic trueCount = 0; AZ_TEST_START_TRACE_SUPPRESSION; for (int index = 0; index < testThreadNumber; index++) { From 303be51957d4b65e334938c663dcdf5d1fdcec2b Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Fri, 20 Aug 2021 17:58:13 -0700 Subject: [PATCH 025/131] Gems/Camera Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Gems/Camera/Code/Source/ViewportCameraSelectorWindow_Internals.h | 1 - 1 file changed, 1 deletion(-) diff --git a/Gems/Camera/Code/Source/ViewportCameraSelectorWindow_Internals.h b/Gems/Camera/Code/Source/ViewportCameraSelectorWindow_Internals.h index 2c3d114908..b07ae7789f 100644 --- a/Gems/Camera/Code/Source/ViewportCameraSelectorWindow_Internals.h +++ b/Gems/Camera/Code/Source/ViewportCameraSelectorWindow_Internals.h @@ -58,7 +58,6 @@ namespace Camera private: AZStd::vector m_cameraItems; AZ::EntityId m_sequenceCameraEntityId; - bool m_sequenceCameraSelected; }; struct ViewportCameraSelectorWindow From 62439e03fb90e919687b2a05d89d617ef14b7e77 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Fri, 20 Aug 2021 17:58:32 -0700 Subject: [PATCH 026/131] Gems/EditorPythonBindings Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../Code/Source/PythonMarshalComponent.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Gems/EditorPythonBindings/Code/Source/PythonMarshalComponent.cpp b/Gems/EditorPythonBindings/Code/Source/PythonMarshalComponent.cpp index 257df31778..fd12635325 100644 --- a/Gems/EditorPythonBindings/Code/Source/PythonMarshalComponent.cpp +++ b/Gems/EditorPythonBindings/Code/Source/PythonMarshalComponent.cpp @@ -697,14 +697,12 @@ namespace EditorPythonBindings class TypeConverterDictionary final : public PythonMarshalComponent::TypeConverter { - AZ::GenericClassInfo* m_genericClassInfo = nullptr; const AZ::SerializeContext::ClassData* m_classData = nullptr; const AZ::TypeId m_typeId = {}; public: - TypeConverterDictionary(AZ::GenericClassInfo* genericClassInfo, const AZ::SerializeContext::ClassData* classData, const AZ::TypeId& typeId) - : m_genericClassInfo(genericClassInfo) - , m_classData(classData) + TypeConverterDictionary([[maybe_unused]] AZ::GenericClassInfo* genericClassInfo, const AZ::SerializeContext::ClassData* classData, const AZ::TypeId& typeId) + : m_classData(classData) , m_typeId(typeId) { } From 794d656c662b2f5146a9a2b2491eb43f8027e12e Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Fri, 20 Aug 2021 17:58:50 -0700 Subject: [PATCH 027/131] Gems/EMotionFX Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../EMotionFX/Pipeline/RCExt/Actor/ActorGroupExporter.cpp | 1 - Gems/EMotionFX/Code/EMotionFX/Rendering/Common/RenderUtil.cpp | 2 -- .../Tools/EMotionStudio/EMStudioSDK/Source/FileManager.h | 2 -- .../Tools/EMotionStudio/EMStudioSDK/Source/MainWindow.h | 3 --- .../EMotionStudio/EMStudioSDK/Source/MainWindowEventFilter.h | 2 +- .../Plugins/StandardPlugins/Source/AnimGraph/AnimGraphModel.h | 2 +- .../Source/AnimGraph/BlendSpace1DNodeWidget.cpp | 2 -- .../StandardPlugins/Source/AnimGraph/ParameterWindow.cpp | 1 - .../StandardPlugins/Source/AnimGraph/ParameterWindow.h | 1 - .../StandardPlugins/Source/Attachments/AttachmentsPlugin.h | 1 - .../Source/MorphTargetsWindow/MorphTargetsWindowPlugin.h | 1 - .../Source/MotionEvents/MotionEventsPlugin.cpp | 1 - .../StandardPlugins/Source/MotionEvents/MotionEventsPlugin.h | 1 - .../Source/MotionSetsWindow/MotionSetWindow.cpp | 2 -- .../StandardPlugins/Source/MotionSetsWindow/MotionSetWindow.h | 1 - .../Source/MotionWindow/MotionExtractionWindow.h | 1 - .../Source/MotionWindow/MotionRetargetingWindow.h | 2 -- .../StandardPlugins/Source/NodeGroups/NodeGroupWidget.h | 1 - .../StandardPlugins/Source/TimeView/TimeViewToolBar.cpp | 2 +- .../StandardPlugins/Source/TimeView/TrackDataHeaderWidget.cpp | 4 ---- .../Editor/Plugins/SimulatedObject/SimulatedObjectWidget.cpp | 1 - .../Editor/PropertyWidgets/AnimGraphTransitionHandler.cpp | 2 +- .../Integration/Editor/Components/EditorActorComponent.cpp | 1 - .../ProvidesUI/AnimGraph/Transitions/RemoveTransition.cpp | 1 - .../AnimGraph/Transitions/RemoveTransitionCondition.cpp | 1 - 25 files changed, 4 insertions(+), 35 deletions(-) diff --git a/Gems/EMotionFX/Code/EMotionFX/Pipeline/RCExt/Actor/ActorGroupExporter.cpp b/Gems/EMotionFX/Code/EMotionFX/Pipeline/RCExt/Actor/ActorGroupExporter.cpp index efd3d84aa0..4cba50138a 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Pipeline/RCExt/Actor/ActorGroupExporter.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Pipeline/RCExt/Actor/ActorGroupExporter.cpp @@ -163,7 +163,6 @@ namespace EMotionFX } // Default to the first mesh group until we get a way to choose it via the scene settings (ATOM-13590). - AZStd::optional meshAssetId = AZStd::nullopt; AZ_Error("EMotionFX", atomModelAssets.size() <= 1, "Ambigious mesh for actor asset. More than one mesh group found. Defaulting to the first one."); if (!atomModelAssets.empty()) { diff --git a/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/RenderUtil.cpp b/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/RenderUtil.cpp index 183d56a07f..6fd28ee72f 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/RenderUtil.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/RenderUtil.cpp @@ -519,7 +519,6 @@ namespace MCommon EMotionFX::SubMesh* subMesh = mesh->GetSubMesh(subMeshIndex); const uint32 numVertices = subMesh->GetNumVertices(); const uint32 startVertex = subMesh->GetStartVertex(); - const uint32 startIndex = subMesh->GetStartIndex(); for (uint32 j = 0; j < numVertices; ++j) { @@ -1332,7 +1331,6 @@ namespace MCommon // render mesh based axis void RenderUtil::RenderAxis(float size, const AZ::Vector3& position, const AZ::Vector3& right, const AZ::Vector3& up, const AZ::Vector3& forward) { - const float zeroSphereRadius = size * 0.075f; static const MCore::RGBAColor xAxisColor(1.0f, 0.0f, 0.0f); static const MCore::RGBAColor yAxisColor(0.0f, 1.0f, 0.0f); static const MCore::RGBAColor zAxisColor(0.0f, 0.0f, 1.0f); diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/FileManager.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/FileManager.h index 98d7de188d..9e2b4001b5 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/FileManager.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/FileManager.h @@ -112,8 +112,6 @@ namespace EMStudio QString m_lastWorkspaceFolder; QString m_lastNodeMapFolder; - bool m_skipFileChangedCheck; - void UpdateLastUsedFolder(const char* filename, QString& outLastFolder) const; QString GetLastUsedFolder(const QString& lastUsedFolder) const; }; diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/MainWindow.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/MainWindow.h index 734dd7840d..318838b2b1 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/MainWindow.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/MainWindow.h @@ -203,9 +203,6 @@ namespace EMStudio QAction* m_saveAllAction; QAction* m_mergeActorAction; QAction* m_saveSelectedActorsAction; -#ifdef EMFX_DEVELOPMENT_BUILD - QAction* m_saveSelectedActorAsAttachmentsAction; -#endif // application mode QComboBox* m_applicationMode; diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/MainWindowEventFilter.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/MainWindowEventFilter.h index c7e82b13e9..144fac4eed 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/MainWindowEventFilter.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/MainWindowEventFilter.h @@ -27,6 +27,6 @@ namespace EMStudio virtual bool nativeEventFilter(const QByteArray& /*eventType*/, void* message, long* /*result*/) Q_DECL_OVERRIDE; private: - MainWindow* m_mainWindow; + [[maybe_unused]] MainWindow* m_mainWindow; }; } diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/AnimGraphModel.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/AnimGraphModel.h index 7ff61123cb..46ab632ce2 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/AnimGraphModel.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/AnimGraphModel.h @@ -313,7 +313,7 @@ namespace EMStudio bool Execute(MCore::Command * command, const MCore::CommandLine& commandLine) override; \ bool Undo(MCore::Command* command, const MCore::CommandLine& commandLine) override; \ private: \ - AnimGraphModel& m_animGraphModel; \ + [[maybe_unused]] AnimGraphModel& m_animGraphModel; \ }; \ friend class CLASSNAME; diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/BlendSpace1DNodeWidget.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/BlendSpace1DNodeWidget.cpp index bd8b94f361..e4990d658b 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/BlendSpace1DNodeWidget.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/BlendSpace1DNodeWidget.cpp @@ -364,8 +364,6 @@ namespace EMStudio const int rectLeft = m_drawRect.left(); const int rectRight = m_drawRect.right(); - const int rectBottom = m_drawRect.bottom(); - const int xValueTop = rectBottom + 4; const int xAxisLabelTop = m_drawCenterY + 15; const char numFormat = 'g'; const int numPrecision = 4; diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/ParameterWindow.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/ParameterWindow.cpp index c93d358c07..3f3c7c1c7d 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/ParameterWindow.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/ParameterWindow.cpp @@ -651,7 +651,6 @@ namespace EMStudio // enable/disable recording/playback mode void ParameterWindow::OnRecorderStateChanged() { - const bool readOnly = (EMotionFX::GetRecorder().GetIsInPlayMode()); // disable when in playback mode, enable otherwise if (m_animGraph) { // update parameter values diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/ParameterWindow.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/ParameterWindow.h index 66cb62f0a5..f3b1702751 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/ParameterWindow.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/ParameterWindow.h @@ -205,7 +205,6 @@ namespace EMStudio ParameterWindowTreeWidget* m_treeWidget; AzQtComponents::FilteredSearchWidget* m_searchWidget; QVBoxLayout* m_verticalLayout; - QScrollArea* m_scrollArea; AZStd::string m_nameString; struct ParameterWidget { diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/Attachments/AttachmentsPlugin.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/Attachments/AttachmentsPlugin.h index d59d0d1b93..edab3a9580 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/Attachments/AttachmentsPlugin.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/Attachments/AttachmentsPlugin.h @@ -85,7 +85,6 @@ namespace EMStudio CommandAdjustActorCallback* m_adjustActorCallback; CommandRemoveActorInstanceCallback* m_removeActorInstanceCallback; - QWidget* m_noSelectionWidget; MysticQt::DialogStack* m_dialogStack; AttachmentsWindow* m_attachmentsWindow; AttachmentsHierarchyWindow* m_attachmentsHierarchyWindow; diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MorphTargetsWindow/MorphTargetsWindowPlugin.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MorphTargetsWindow/MorphTargetsWindowPlugin.h index d2295fcd9c..26503bfbc6 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MorphTargetsWindow/MorphTargetsWindowPlugin.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MorphTargetsWindow/MorphTargetsWindowPlugin.h @@ -91,6 +91,5 @@ namespace EMStudio QVBoxLayout* m_staticTextLayout; QWidget* m_staticTextWidget; MysticQt::DialogStack* m_dialogStack; - QLabel* m_infoText; }; } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionEvents/MotionEventsPlugin.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionEvents/MotionEventsPlugin.cpp index 316b2017cc..8d77bd5e04 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionEvents/MotionEventsPlugin.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionEvents/MotionEventsPlugin.cpp @@ -32,7 +32,6 @@ namespace EMStudio , m_dialogStack(nullptr) , m_motionEventPresetsWidget(nullptr) , m_motionEventWidget(nullptr) - , m_motionTable(nullptr) , m_timeViewPlugin(nullptr) , m_trackHeaderWidget(nullptr) , m_trackDataWidget(nullptr) diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionEvents/MotionEventsPlugin.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionEvents/MotionEventsPlugin.h index 7cd34e4bca..f2c0f43b9b 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionEvents/MotionEventsPlugin.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionEvents/MotionEventsPlugin.h @@ -87,7 +87,6 @@ namespace EMStudio MotionEventPresetsWidget* m_motionEventPresetsWidget; MotionEventWidget* m_motionEventWidget; - QTableWidget* m_motionTable; TimeViewPlugin* m_timeViewPlugin; TrackHeaderWidget* m_trackHeaderWidget; TrackDataWidget* m_trackDataWidget; diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionSetsWindow/MotionSetWindow.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionSetsWindow/MotionSetWindow.cpp index 6d16ea19b1..393e26790b 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionSetsWindow/MotionSetWindow.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionSetsWindow/MotionSetWindow.cpp @@ -819,7 +819,6 @@ namespace EMStudio } const QList selectedItems = m_tableWidget->selectedItems(); - const size_t numSelectedItems = selectedItems.count(); // Get the row indices from the selected items. AZStd::vector rowIndices; @@ -1079,7 +1078,6 @@ namespace EMStudio // Get the row indices from the selected items. AZStd::vector rowIndices; GetRowIndices(selectedItems, rowIndices); - const size_t numRowIndices = rowIndices.size(); // remove motion from motion window, too? bool removeMotion = false; diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionSetsWindow/MotionSetWindow.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionSetsWindow/MotionSetWindow.h index 8c1fe04662..a1cab4e89f 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionSetsWindow/MotionSetWindow.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionSetsWindow/MotionSetWindow.h @@ -187,7 +187,6 @@ namespace EMStudio size_t CalcNumMotionEntriesUsingMotionExcluding(const AZStd::string& motionFilename, EMotionFX::MotionSet* excludedMotionSet); private: - QVBoxLayout* m_vLayout = nullptr; MotionSetTableWidget* m_tableWidget = nullptr; QAction* m_addAction = nullptr; diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionWindow/MotionExtractionWindow.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionWindow/MotionExtractionWindow.h index 5e314df323..2f0bf63685 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionWindow/MotionExtractionWindow.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionWindow/MotionExtractionWindow.h @@ -68,7 +68,6 @@ namespace EMStudio // general MotionWindowPlugin* m_motionWindowPlugin; - QCheckBox* m_autoMode; // flags widget QWidget* m_flagsWidget; diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionWindow/MotionRetargetingWindow.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionWindow/MotionRetargetingWindow.h index a846982eca..3090a1f8bd 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionWindow/MotionRetargetingWindow.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionWindow/MotionRetargetingWindow.h @@ -49,8 +49,6 @@ namespace EMStudio private: MotionWindowPlugin* m_motionWindowPlugin; QCheckBox* m_motionRetargetingButton; - EMotionFX::ActorInstance* m_selectedActorInstance; - EMotionFX::Actor* m_actor; CommandSystem::SelectionList m_selectionList; }; } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/NodeGroups/NodeGroupWidget.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/NodeGroups/NodeGroupWidget.h index c96b972085..e1530ebd3b 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/NodeGroups/NodeGroupWidget.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/NodeGroups/NodeGroupWidget.h @@ -58,7 +58,6 @@ namespace EMStudio NodeSelectionWindow* m_nodeSelectionWindow; CommandSystem::SelectionList m_nodeSelectionList; EMotionFX::NodeGroup* m_nodeGroup; - uint16 m_nodeGroupIndex; CommandSystem::CommandAdjustNodeGroup::NodeAction m_nodeAction; // widgets diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TimeViewToolBar.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TimeViewToolBar.cpp index d95b606b3f..14a27eec49 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TimeViewToolBar.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TimeViewToolBar.cpp @@ -441,7 +441,7 @@ namespace EMStudio const bool playbackOptionsVisible = m_playbackOptions->UpdateInterface(mode, /*showRightSeparator=*/false); const bool playbackControlsVisible = m_playbackControls->UpdateInterface(mode, /*showRightSeparator=*/playbackOptionsVisible); - const bool recorderGroupVisible = m_recorderGroup->UpdateInterface(mode, /*showRightSeparator=*/playbackControlsVisible); + m_recorderGroup->UpdateInterface(mode, /*showRightSeparator=*/playbackControlsVisible); } void TimeViewToolBar::OnDetailedNodes() diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TrackDataHeaderWidget.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TrackDataHeaderWidget.cpp index 0d1f55c172..9524d6f57d 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TrackDataHeaderWidget.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TrackDataHeaderWidget.cpp @@ -284,8 +284,6 @@ namespace EMStudio { m_plugin->SetRedrawFlag(); - const bool ctrlPressed = event->modifiers() & Qt::ControlModifier; - const bool shiftPressed = event->modifiers() & Qt::ShiftModifier; const bool altPressed = event->modifiers() & Qt::AltModifier; // store the last clicked position @@ -370,8 +368,6 @@ namespace EMStudio m_plugin->GetTimeInfoWidget()->SetIsOverwriteMode(false); } - const bool ctrlPressed = event->modifiers() & Qt::ControlModifier; - if (event->button() == Qt::RightButton) { m_mouseRightClicked = false; diff --git a/Gems/EMotionFX/Code/Source/Editor/Plugins/SimulatedObject/SimulatedObjectWidget.cpp b/Gems/EMotionFX/Code/Source/Editor/Plugins/SimulatedObject/SimulatedObjectWidget.cpp index a2b23e3268..48104707de 100644 --- a/Gems/EMotionFX/Code/Source/Editor/Plugins/SimulatedObject/SimulatedObjectWidget.cpp +++ b/Gems/EMotionFX/Code/Source/Editor/Plugins/SimulatedObject/SimulatedObjectWidget.cpp @@ -495,7 +495,6 @@ namespace EMotionFX if (renderSimulatedJoints && !selectedJointIndices.empty()) { // Render the joint radius. - const MCore::RGBAColor defaultColor = renderPlugin->GetRenderOptions()->GetSelectedSimulatedObjectColliderColor(); const size_t actorInstanceCount = GetActorManager().GetNumActorInstances(); for (size_t actorInstanceIndex = 0; actorInstanceIndex < actorInstanceCount; ++actorInstanceIndex) { diff --git a/Gems/EMotionFX/Code/Source/Editor/PropertyWidgets/AnimGraphTransitionHandler.cpp b/Gems/EMotionFX/Code/Source/Editor/PropertyWidgets/AnimGraphTransitionHandler.cpp index 4bc4da1030..ce114a498e 100644 --- a/Gems/EMotionFX/Code/Source/Editor/PropertyWidgets/AnimGraphTransitionHandler.cpp +++ b/Gems/EMotionFX/Code/Source/Editor/PropertyWidgets/AnimGraphTransitionHandler.cpp @@ -206,7 +206,7 @@ namespace EMotionFX QPushButton* removeTransitionButton = new QPushButton(); EMStudio::EMStudioManager::MakeTransparentButton(removeTransitionButton, "Images/Icons/Trash.svg", "Remove transition from list"); - connect(removeTransitionButton, &QPushButton::clicked, this, [this, removeTransitionButton, id]() + connect(removeTransitionButton, &QPushButton::clicked, this, [this, id]() { m_transitionIds.erase(AZStd::remove(m_transitionIds.begin(), m_transitionIds.end(), id), m_transitionIds.end()); Reinit(); diff --git a/Gems/EMotionFX/Code/Source/Integration/Editor/Components/EditorActorComponent.cpp b/Gems/EMotionFX/Code/Source/Integration/Editor/Components/EditorActorComponent.cpp index 485b56c077..ed4edda891 100644 --- a/Gems/EMotionFX/Code/Source/Integration/Editor/Components/EditorActorComponent.cpp +++ b/Gems/EMotionFX/Code/Source/Integration/Editor/Components/EditorActorComponent.cpp @@ -683,7 +683,6 @@ namespace EMotionFX const size_t lodLevel = m_actorInstance->GetLODLevel(); Actor* actor = m_actorAsset.Get()->GetActor(); const size_t numNodes = actor->GetNumNodes(); - const size_t numLods = actor->GetNumLODLevels(); for (size_t nodeIndex = 0; nodeIndex < numNodes; ++nodeIndex) { Mesh* mesh = actor->GetMesh(lodLevel, nodeIndex); diff --git a/Gems/EMotionFX/Code/Tests/ProvidesUI/AnimGraph/Transitions/RemoveTransition.cpp b/Gems/EMotionFX/Code/Tests/ProvidesUI/AnimGraph/Transitions/RemoveTransition.cpp index c4d4504335..db4ca21fe5 100644 --- a/Gems/EMotionFX/Code/Tests/ProvidesUI/AnimGraph/Transitions/RemoveTransition.cpp +++ b/Gems/EMotionFX/Code/Tests/ProvidesUI/AnimGraph/Transitions/RemoveTransition.cpp @@ -73,7 +73,6 @@ namespace EMotionFX // Select the transition in the anim graph model. const QModelIndex& modelIndex = animGraphModel.FindFirstModelIndex(transition); - const EMStudio::AnimGraphModel::ModelItemType itemType = modelIndex.data(EMStudio::AnimGraphModel::ROLE_MODEL_ITEM_TYPE).value(); ASSERT_TRUE(modelIndex.isValid()) << "Anim graph transition has an invalid model index."; animGraphModel.GetSelectionModel().select(QItemSelection(modelIndex, modelIndex), QItemSelectionModel::Current | QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows); diff --git a/Gems/EMotionFX/Code/Tests/ProvidesUI/AnimGraph/Transitions/RemoveTransitionCondition.cpp b/Gems/EMotionFX/Code/Tests/ProvidesUI/AnimGraph/Transitions/RemoveTransitionCondition.cpp index 5dbe52c2c4..c07a2f9611 100644 --- a/Gems/EMotionFX/Code/Tests/ProvidesUI/AnimGraph/Transitions/RemoveTransitionCondition.cpp +++ b/Gems/EMotionFX/Code/Tests/ProvidesUI/AnimGraph/Transitions/RemoveTransitionCondition.cpp @@ -76,7 +76,6 @@ namespace EMotionFX // Select the transition in the anim graph model. const QModelIndex& modelIndex = animGraphModel.FindFirstModelIndex(transition); - const EMStudio::AnimGraphModel::ModelItemType itemType = modelIndex.data(EMStudio::AnimGraphModel::ROLE_MODEL_ITEM_TYPE).value(); ASSERT_TRUE(modelIndex.isValid()) << "Anim graph transition has an invalid model index."; animGraphModel.GetSelectionModel().select(QItemSelection(modelIndex, modelIndex), QItemSelectionModel::Current | QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows); From 3c56faceb4bc8425d83a849b2d6b188ddfdba3bc Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Fri, 20 Aug 2021 17:59:06 -0700 Subject: [PATCH 028/131] Gems/LyShine Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../Code/Editor/Animation/Controls/UiSplineCtrlEx.cpp | 2 -- .../Code/Editor/Animation/Controls/UiTimelineCtrl.h | 1 - Gems/LyShine/Code/Editor/Animation/UiAnimViewAnimNode.cpp | 7 +------ .../Code/Editor/Animation/UiAnimViewDopeSheetBase.cpp | 6 ------ Gems/LyShine/Code/Editor/Animation/UiAnimViewNode.h | 7 ++----- Gems/LyShine/Code/Editor/Animation/UiAnimViewNodes.cpp | 3 --- Gems/LyShine/Code/Editor/Animation/UiAnimViewNodes.h | 1 - Gems/LyShine/Code/Editor/Animation/UiAnimViewSequence.cpp | 3 ++- .../LyShine/Code/Editor/Animation/UiAnimViewSplineCtrl.cpp | 1 - Gems/LyShine/Code/Editor/EditorMenu.cpp | 2 +- Gems/LyShine/Code/Editor/HierarchyMenu.cpp | 2 +- Gems/LyShine/Code/Editor/MainToolbar.cpp | 2 +- Gems/LyShine/Code/Editor/PropertiesContainer.h | 1 - Gems/LyShine/Code/Editor/PropertyHandlerAnchor.cpp | 4 +--- Gems/LyShine/Code/Editor/PropertyHandlerChar.cpp | 7 ++----- Gems/LyShine/Code/Editor/PropertyHandlerDirectory.cpp | 2 +- Gems/LyShine/Code/Editor/PropertyHandlerOffset.cpp | 4 +--- Gems/LyShine/Code/Editor/PropertyHandlerPivot.cpp | 4 +--- Gems/LyShine/Code/Editor/SpriteBorderEditor.cpp | 1 - Gems/LyShine/Code/Editor/ViewportInteraction.h | 1 - 20 files changed, 14 insertions(+), 47 deletions(-) diff --git a/Gems/LyShine/Code/Editor/Animation/Controls/UiSplineCtrlEx.cpp b/Gems/LyShine/Code/Editor/Animation/Controls/UiSplineCtrlEx.cpp index cf5c1b2d8f..94a4c77593 100644 --- a/Gems/LyShine/Code/Editor/Animation/Controls/UiSplineCtrlEx.cpp +++ b/Gems/LyShine/Code/Editor/Animation/Controls/UiSplineCtrlEx.cpp @@ -824,8 +824,6 @@ void SplineWidget::DrawSpline(QPainter* painter, SSplineInfo& splineInfo, float { const QPen pOldPen = painter->pen(); - const QRect rcClip = painter->clipBoundingRect().intersected(m_rcSpline).toRect(); - ////////////////////////////////////////////////////////////////////////// ISplineInterpolator* pSpline = splineInfo.pSpline; ISplineInterpolator* pDetailSpline = splineInfo.pDetailSpline; diff --git a/Gems/LyShine/Code/Editor/Animation/Controls/UiTimelineCtrl.h b/Gems/LyShine/Code/Editor/Animation/Controls/UiTimelineCtrl.h index d1aeaacb00..701d187ddc 100644 --- a/Gems/LyShine/Code/Editor/Animation/Controls/UiTimelineCtrl.h +++ b/Gems/LyShine/Code/Editor/Animation/Controls/UiTimelineCtrl.h @@ -134,7 +134,6 @@ protected: void DrawFrameTicks(QPainter* dc); private: - bool m_bAutoDelete; QRect m_rcClient; QRect m_rcTimeline; float m_fTimeMarker; diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewAnimNode.cpp b/Gems/LyShine/Code/Editor/Animation/UiAnimViewAnimNode.cpp index 3646e5a413..54ea410349 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewAnimNode.cpp +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewAnimNode.cpp @@ -149,8 +149,6 @@ void CUiAnimViewAnimNode::UiElementPropertyChanged() bool valueChanged = false; - const float time = GetSequence()->GetTime(); - if (m_nodeEntityId.IsValid() && !m_azEntityDataCache.empty()) { AZ::Entity* pNodeEntity = nullptr; @@ -537,9 +535,6 @@ void CUiAnimViewAnimNode::BindToEditorObjects() CUiAnimViewSequenceNotificationContext context(GetSequence()); - CUiAnimViewAnimNode* pDirector = GetDirector(); - const bool bBelongsToActiveDirector = pDirector ? pDirector->IsActiveDirector() : true; - // if this node represents an AZ entity then register for updates if (m_nodeEntityId.IsValid()) { @@ -1632,7 +1627,7 @@ void CUiAnimViewAnimNode::OnSelectionChanged(const bool bSelected) { if (m_pAnimNode) { - const EUiAnimNodeType animNodeType = GetType(); + [[maybe_unused]] const EUiAnimNodeType animNodeType = GetType(); assert(animNodeType == eUiAnimNodeType_Camera || animNodeType == eUiAnimNodeType_Entity || animNodeType == eUiAnimNodeType_GeomCache); const EUiAnimNodeFlags flags = (EUiAnimNodeFlags)m_pAnimNode->GetFlags(); diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewDopeSheetBase.cpp b/Gems/LyShine/Code/Editor/Animation/UiAnimViewDopeSheetBase.cpp index 4e67fb520e..443480ab0d 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewDopeSheetBase.cpp +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewDopeSheetBase.cpp @@ -192,7 +192,6 @@ void CUiAnimViewDopeSheetBase::SetTimeRange(float start, float end) void CUiAnimViewDopeSheetBase::SetTimeScale(float timeScale, float fAnchorTime) { const double fOldOffset = -fAnchorTime * m_timeScale; - const double fOldScale = m_timeScale; timeScale = std::max(timeScale, 0.001f); timeScale = std::min(timeScale, 100000.0f); @@ -1308,8 +1307,6 @@ void CUiAnimViewDopeSheetBase::OnCaptureChanged() ////////////////////////////////////////////////////////////////////////// bool CUiAnimViewDopeSheetBase::IsOkToAddKeyHere(const CUiAnimViewTrack* pTrack, float time) const { - const float timeEpsilon = 0.05f; - for (unsigned int i = 0; i < pTrack->GetKeyCount(); ++i) { CUiAnimViewKeyHandle keyHandle = const_cast(pTrack)->GetKey(i); @@ -1795,8 +1792,6 @@ void CUiAnimViewDopeSheetBase::AcceptUndo() { if (UiAnimUndo::IsRecording()) { - const QPoint mousePos = mapFromGlobal(QCursor::pos()); - if (m_mouseMode == eUiAVMouseMode_Paste) { UiAnimUndoManager::Get()->Cancel(); @@ -2242,7 +2237,6 @@ void CUiAnimViewDopeSheetBase::DrawBoolTrack(const Range& timeRange, QPainter* p { int x0 = TimeToClient(timeRange.start); float t0 = timeRange.start; - QRect trackRect; const QBrush prevBrush = painter->brush(); painter->setBrush(m_visibilityBrush); diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewNode.h b/Gems/LyShine/Code/Editor/Animation/UiAnimViewNode.h index 5a82d1be7f..0213cbb410 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewNode.h +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewNode.h @@ -19,13 +19,11 @@ class CUiAnimViewKeyConstHandle { public: CUiAnimViewKeyConstHandle() - : m_bIsValid(false) - , m_keyIndex(0) + : m_keyIndex(0) , m_pTrack(nullptr) {} CUiAnimViewKeyConstHandle(const CUiAnimViewTrack* pTrack, unsigned int keyIndex) - : m_bIsValid(true) - , m_keyIndex(keyIndex) + : m_keyIndex(keyIndex) , m_pTrack(pTrack) {} void GetKey(IKey* pKey) const; @@ -33,7 +31,6 @@ public: const CUiAnimViewTrack* GetTrack() const { return m_pTrack; } private: - bool m_bIsValid; unsigned int m_keyIndex; const CUiAnimViewTrack* m_pTrack; }; diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewNodes.cpp b/Gems/LyShine/Code/Editor/Animation/UiAnimViewNodes.cpp index 74d2c7d4fb..a6c4e2424b 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewNodes.cpp +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewNodes.cpp @@ -1096,9 +1096,6 @@ void CUiAnimViewNodesCtrl::AddGroupNodeAddItems(UiAnimContextMenu& contextMenu, contextMenu.main.addAction("Add Event Node")->setData(eMI_AddEvent); } - const bool bIsDirectorOrSequence = (pAnimNode->GetType() == eUiAnimNodeType_Director || pAnimNode->GetNodeType() == eUiAVNT_Sequence); - - #if UI_ANIMATION_REMOVED contextMenu.main.addAction("Add Comment Node")->setData(eMI_AddCommentNode); contextMenu.main.addAction("Add Console Variable")->setData(eMI_AddConsoleVariable); diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewNodes.h b/Gems/LyShine/Code/Editor/Animation/UiAnimViewNodes.h index a5cce764e3..c7226da23f 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewNodes.h +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewNodes.h @@ -182,7 +182,6 @@ private: // Drag and drop CUiAnimViewAnimNodeBundle m_draggedNodes; - CUiAnimViewAnimNode* m_pDragTarget; std::unordered_map m_nodeToRecordMap; diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewSequence.cpp b/Gems/LyShine/Code/Editor/Animation/UiAnimViewSequence.cpp index d8888124a4..9c26100bad 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewSequence.cpp +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewSequence.cpp @@ -488,11 +488,12 @@ void CUiAnimViewSequence::SelectSelectedNodesInViewport() assert(UiAnimUndo::IsRecording()); CUiAnimViewAnimNodeBundle selectedNodes = GetSelectedAnimNodes(); - const unsigned int numSelectedNodes = selectedNodes.GetCount(); std::vector entitiesToBeSelected; #if UI_ANIMATION_REMOVED // lights + const unsigned int numSelectedNodes = selectedNodes.GetCount(); + // Also select objects that refer to light animation const bool bLightAnimationSetActive = GetFlags() & IUiAnimSequence::eSeqFlags_LightAnimationSet; if (bLightAnimationSetActive) diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewSplineCtrl.cpp b/Gems/LyShine/Code/Editor/Animation/UiAnimViewSplineCtrl.cpp index 8edd13f8cc..382b589ac3 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewSplineCtrl.cpp +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewSplineCtrl.cpp @@ -589,7 +589,6 @@ void CUiAnimViewSplineCtrl::mouseMoveEvent(QMouseEvent* event) CUiAnimViewSequenceNotificationContext context(pSequence); - QPoint cMousePosPrev = m_cMousePos; m_cMousePos = point; if (m_editMode == SelectMode) diff --git a/Gems/LyShine/Code/Editor/EditorMenu.cpp b/Gems/LyShine/Code/Editor/EditorMenu.cpp index 840bd206ab..8a6c93de6b 100644 --- a/Gems/LyShine/Code/Editor/EditorMenu.cpp +++ b/Gems/LyShine/Code/Editor/EditorMenu.cpp @@ -704,7 +704,7 @@ void EditorWindow::AddMenu_View() action->setEnabled(canvasLoaded); QObject::connect(action, &QAction::triggered, - [this]([[maybe_unused]] bool checked) + []([[maybe_unused]] bool checked) { gEnv->pCryFont->ReloadAllFonts(); }); diff --git a/Gems/LyShine/Code/Editor/HierarchyMenu.cpp b/Gems/LyShine/Code/Editor/HierarchyMenu.cpp index ab0c250434..31c5255538 100644 --- a/Gems/LyShine/Code/Editor/HierarchyMenu.cpp +++ b/Gems/LyShine/Code/Editor/HierarchyMenu.cpp @@ -330,7 +330,7 @@ void HierarchyMenu::SliceMenuItems(HierarchyWidget* hierarchy, slicesAddedToMenu.push_back(sliceAsset.GetId()); QAction* action = menu->addAction(assetPath.c_str()); - QObject::connect(action, &QAction::triggered, [this, hierarchy, sliceAsset] + QObject::connect(action, &QAction::triggered, [hierarchy, sliceAsset] { hierarchy->GetEditorWindow()->EditSliceInNewTab(sliceAsset.GetId()); } diff --git a/Gems/LyShine/Code/Editor/MainToolbar.cpp b/Gems/LyShine/Code/Editor/MainToolbar.cpp index ee2d3db7b5..dd0ab39f89 100644 --- a/Gems/LyShine/Code/Editor/MainToolbar.cpp +++ b/Gems/LyShine/Code/Editor/MainToolbar.cpp @@ -32,7 +32,7 @@ MainToolbar::MainToolbar(EditorWindow* parent) QObject::connect(m_zoomFactorSpinBox, QOverload::of(&AzQtComponents::DoubleSpinBox::valueChanged), - [this, parent](double value) + [parent](double value) { parent->GetViewport()->GetViewportInteraction()->SetCanvasZoomPercent(static_cast(value)); }); diff --git a/Gems/LyShine/Code/Editor/PropertiesContainer.h b/Gems/LyShine/Code/Editor/PropertiesContainer.h index 0d47444281..209a2354ad 100644 --- a/Gems/LyShine/Code/Editor/PropertiesContainer.h +++ b/Gems/LyShine/Code/Editor/PropertiesContainer.h @@ -119,7 +119,6 @@ private: PropertiesWidget* m_propertiesWidget; EditorWindow* m_editorWindow; - QWidget* m_containerWidget; QWidget* m_componentListContents; QVBoxLayout* m_rowLayout; QLineEdit* m_selectedEntityDisplayNameWidget; diff --git a/Gems/LyShine/Code/Editor/PropertyHandlerAnchor.cpp b/Gems/LyShine/Code/Editor/PropertyHandlerAnchor.cpp index 8e00b6f277..5ffba22df6 100644 --- a/Gems/LyShine/Code/Editor/PropertyHandlerAnchor.cpp +++ b/Gems/LyShine/Code/Editor/PropertyHandlerAnchor.cpp @@ -350,10 +350,8 @@ void PropertyHandlerAnchor::WriteGUIValuesIntoProperty(size_t index, PropertyAnc } } -bool PropertyHandlerAnchor::ReadValuesIntoGUI(size_t index, PropertyAnchorCtrl* GUI, const property_t& instance, [[maybe_unused]] AzToolsFramework::InstanceDataNode* node) +bool PropertyHandlerAnchor::ReadValuesIntoGUI([[maybe_unused]] size_t index, PropertyAnchorCtrl* GUI, const property_t& instance, [[maybe_unused]] AzToolsFramework::InstanceDataNode* node) { - (int)index; - AzQtComponents::VectorInput* ctrl = GUI->GetPropertyVectorCtrl(); ctrl->blockSignals(true); diff --git a/Gems/LyShine/Code/Editor/PropertyHandlerChar.cpp b/Gems/LyShine/Code/Editor/PropertyHandlerChar.cpp index b3cacec065..d99cd9bf20 100644 --- a/Gems/LyShine/Code/Editor/PropertyHandlerChar.cpp +++ b/Gems/LyShine/Code/Editor/PropertyHandlerChar.cpp @@ -27,19 +27,16 @@ void PropertyHandlerChar::ConsumeAttribute(AzToolsFramework::PropertyStringLineE { } -void PropertyHandlerChar::WriteGUIValuesIntoProperty(size_t index, AzToolsFramework::PropertyStringLineEditCtrl* GUI, property_t& instance, [[maybe_unused]] AzToolsFramework::InstanceDataNode* node) +void PropertyHandlerChar::WriteGUIValuesIntoProperty([[maybe_unused]] size_t index, AzToolsFramework::PropertyStringLineEditCtrl* GUI, property_t& instance, [[maybe_unused]] AzToolsFramework::InstanceDataNode* node) { - (int)index; AZStd::string str = GUI->value(); wchar_t character = '\0'; AZStd::to_wstring(&character, 1, str.c_str()); instance = character; } -bool PropertyHandlerChar::ReadValuesIntoGUI(size_t index, AzToolsFramework::PropertyStringLineEditCtrl* GUI, const property_t& instance, [[maybe_unused]] AzToolsFramework::InstanceDataNode* node) +bool PropertyHandlerChar::ReadValuesIntoGUI([[maybe_unused]] size_t index, AzToolsFramework::PropertyStringLineEditCtrl* GUI, const property_t& instance, [[maybe_unused]] AzToolsFramework::InstanceDataNode* node) { - (int)index; - GUI->blockSignals(true); { // NOTE: this assumes the uint32_t can be interpreted as a wchar_t, it seems to diff --git a/Gems/LyShine/Code/Editor/PropertyHandlerDirectory.cpp b/Gems/LyShine/Code/Editor/PropertyHandlerDirectory.cpp index 1f3e28b077..5a464b2210 100644 --- a/Gems/LyShine/Code/Editor/PropertyHandlerDirectory.cpp +++ b/Gems/LyShine/Code/Editor/PropertyHandlerDirectory.cpp @@ -53,7 +53,7 @@ PropertyDirectoryCtrl::PropertyDirectoryCtrl(QWidget* parent) QObject::connect(refreshButton, &QPushButton::clicked, - [this]([[maybe_unused]] bool checked) + []([[maybe_unused]] bool checked) { UiEditorRefreshDirectoryNotificationBus::Broadcast(&UiEditorRefreshDirectoryNotificationInterface::OnRefreshDirectory); }); diff --git a/Gems/LyShine/Code/Editor/PropertyHandlerOffset.cpp b/Gems/LyShine/Code/Editor/PropertyHandlerOffset.cpp index 22f87b5b53..b8a34ae314 100644 --- a/Gems/LyShine/Code/Editor/PropertyHandlerOffset.cpp +++ b/Gems/LyShine/Code/Editor/PropertyHandlerOffset.cpp @@ -106,10 +106,8 @@ void PropertyHandlerOffset::WriteGUIValuesIntoProperty(size_t index, AzQtCompone EBUS_EVENT_ID(id, UiTransform2dBus, SetOffsets, newInternalOffset); } -bool PropertyHandlerOffset::ReadValuesIntoGUI(size_t index, AzQtComponents::VectorInput* GUI, const UiTransform2dInterface::Offsets& instance, AzToolsFramework::InstanceDataNode* node) +bool PropertyHandlerOffset::ReadValuesIntoGUI([[maybe_unused]] size_t index, AzQtComponents::VectorInput* GUI, const UiTransform2dInterface::Offsets& instance, AzToolsFramework::InstanceDataNode* node) { - (int)index; - // IMPORTANT: We DON'T need to do validation of data here because that's // done for us BEFORE we get here. We DO need to set the labels here. diff --git a/Gems/LyShine/Code/Editor/PropertyHandlerPivot.cpp b/Gems/LyShine/Code/Editor/PropertyHandlerPivot.cpp index 47d98cf68a..3f89b2fe74 100644 --- a/Gems/LyShine/Code/Editor/PropertyHandlerPivot.cpp +++ b/Gems/LyShine/Code/Editor/PropertyHandlerPivot.cpp @@ -143,10 +143,8 @@ void PropertyHandlerPivot::WriteGUIValuesIntoProperty(size_t index, PropertyPivo } } -bool PropertyHandlerPivot::ReadValuesIntoGUI(size_t index, PropertyPivotCtrl* GUI, const property_t& instance, [[maybe_unused]] AzToolsFramework::InstanceDataNode* node) +bool PropertyHandlerPivot::ReadValuesIntoGUI([[maybe_unused]] size_t index, PropertyPivotCtrl* GUI, const property_t& instance, [[maybe_unused]] AzToolsFramework::InstanceDataNode* node) { - (int)index; - AzQtComponents::VectorInput* ctrl = GUI->GetPropertyVectorCtrl(); ctrl->blockSignals(true); diff --git a/Gems/LyShine/Code/Editor/SpriteBorderEditor.cpp b/Gems/LyShine/Code/Editor/SpriteBorderEditor.cpp index 04f655123c..93d77bd174 100644 --- a/Gems/LyShine/Code/Editor/SpriteBorderEditor.cpp +++ b/Gems/LyShine/Code/Editor/SpriteBorderEditor.cpp @@ -227,7 +227,6 @@ void SpriteBorderEditor::DisplaySelectedCell(AZ::u32 cellIndex) // Determine how much we need to scale the view to fit the cell // contents to the displayed properties image. const AZ::Vector2 cellSize = m_sprite->GetCellSize(cellIndex); - const AZ::Vector2 cellScale = AZ::Vector2(m_unscaledSpriteSheet.size().width() / cellSize.GetX(), m_unscaledSpriteSheet.size().height() / cellSize.GetY()); // Scale-to-fit, while preserving aspect ratio. QRect croppedRect = m_unscaledSpriteSheet.rect(); diff --git a/Gems/LyShine/Code/Editor/ViewportInteraction.h b/Gems/LyShine/Code/Editor/ViewportInteraction.h index 100d1fdb1e..a104d87634 100644 --- a/Gems/LyShine/Code/Editor/ViewportInteraction.h +++ b/Gems/LyShine/Code/Editor/ViewportInteraction.h @@ -261,7 +261,6 @@ private: // data AZStd::string m_cursorStr; QCursor m_cursorRotate; - bool m_inObjectPickMode = false; ViewportInteraction::InteractionMode m_interactionModeBeforePickMode; AZ::EntityId m_hoverElement; bool m_entityPickedOnMousePress; // used to ignore mouse move/release events if element was picked on the mouse press From 52569adedabf2e56ee7308ade60a7076c939c2cb Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Fri, 20 Aug 2021 17:59:22 -0700 Subject: [PATCH 029/131] Gems/MultiplayerCompression Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../Code/Tests/MultiplayerCompressionTest.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/Gems/MultiplayerCompression/Code/Tests/MultiplayerCompressionTest.cpp b/Gems/MultiplayerCompression/Code/Tests/MultiplayerCompressionTest.cpp index 1c3eda6709..572dffbe60 100644 --- a/Gems/MultiplayerCompression/Code/Tests/MultiplayerCompressionTest.cpp +++ b/Gems/MultiplayerCompression/Code/Tests/MultiplayerCompressionTest.cpp @@ -67,8 +67,6 @@ TEST_F(MultiplayerCompressionTest, MultiplayerCompression_CompressTest) EXPECT_TRUE(uncompressedSize = buffer.GetSize()); EXPECT_TRUE(memcmp(pDecompressedBuffer, buffer.GetBuffer(), uncompressedSize) == 0); - const AZ::u64 unmarshalTime = (AZStd::chrono::system_clock::now() - startTime).count(); - delete [] pCompressedBuffer; delete [] pDecompressedBuffer; From 4ae74c913f63e6c9e9868aed6b4483bfec1762a4 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Fri, 20 Aug 2021 17:59:49 -0700 Subject: [PATCH 030/131] Gems/PhysX Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Gems/PhysX/Code/Editor/ConfigStringLineEditCtrl.cpp | 8 ++++---- Gems/PhysX/Code/Editor/EditorClassConverters.cpp | 1 - .../PhysX/Code/Editor/EditorSubComponentModeAngleCone.cpp | 4 +--- Gems/PhysX/Code/Editor/EditorSubComponentModeSnap.cpp | 1 - Gems/PhysX/Code/Source/EditorBallJointComponent.cpp | 1 - Gems/PhysX/Code/Source/EditorShapeColliderComponent.cpp | 4 ++-- .../Code/Tests/Benchmarks/PhysXRigidBodyBenchmarks.cpp | 3 +-- Gems/PhysX/Code/Tests/ShapeColliderComponentTests.cpp | 1 - Gems/PhysX/Code/Tests/SystemComponentTest.cpp | 2 -- 9 files changed, 8 insertions(+), 17 deletions(-) diff --git a/Gems/PhysX/Code/Editor/ConfigStringLineEditCtrl.cpp b/Gems/PhysX/Code/Editor/ConfigStringLineEditCtrl.cpp index 1e506263be..4cf5204917 100644 --- a/Gems/PhysX/Code/Editor/ConfigStringLineEditCtrl.cpp +++ b/Gems/PhysX/Code/Editor/ConfigStringLineEditCtrl.cpp @@ -257,16 +257,16 @@ namespace PhysX void ConfigStringLineEditHandler::WriteGUIValuesIntoProperty(size_t index, ConfigStringLineEditCtrl* GUI, property_t& instance, AzToolsFramework::InstanceDataNode* node) { - (int)index; - (void)node; + AZ_UNUSED(index); + AZ_UNUSED(node); AZStd::string val = GUI->Value(); instance = static_cast(val); } bool ConfigStringLineEditHandler::ReadValuesIntoGUI(size_t index, ConfigStringLineEditCtrl* GUI, const property_t& instance, AzToolsFramework::InstanceDataNode* node) { - (int)index; - (void)node; + AZ_UNUSED(index); + AZ_UNUSED(node); AZStd::string val = instance; GUI->setValue(val); return false; diff --git a/Gems/PhysX/Code/Editor/EditorClassConverters.cpp b/Gems/PhysX/Code/Editor/EditorClassConverters.cpp index dfa30dc0b4..e55ac6bbda 100644 --- a/Gems/PhysX/Code/Editor/EditorClassConverters.cpp +++ b/Gems/PhysX/Code/Editor/EditorClassConverters.cpp @@ -65,7 +65,6 @@ namespace PhysX { // collision group id AzPhysics::CollisionGroups::Id collisionGroupId; - const int baseColliderComponentIndex = classElement.FindElement(AZ_CRC("BaseClass1", 0xd4925735)); FindElementRecursiveAndGetData(classElement, AZ_CRC("CollisionGroupId", 0x84fe4bbe), collisionGroupId); // collider config diff --git a/Gems/PhysX/Code/Editor/EditorSubComponentModeAngleCone.cpp b/Gems/PhysX/Code/Editor/EditorSubComponentModeAngleCone.cpp index 7e9a59093f..778fce1546 100644 --- a/Gems/PhysX/Code/Editor/EditorSubComponentModeAngleCone.cpp +++ b/Gems/PhysX/Code/Editor/EditorSubComponentModeAngleCone.cpp @@ -334,15 +334,13 @@ namespace PhysX } void EditorSubComponentModeAngleCone::ConfigureLinearView( - float axisLength, const AZ::Color& axis1Color, const AZ::Color& axis2Color, + float axisLength, [[maybe_unused]] const AZ::Color& axis1Color, const AZ::Color& axis2Color, const AZ::Color& axis3Color) { const float coneLength = 0.28f; const float coneRadius = 0.07f; const float lineWidth = 0.05f; - const AZ::Color axesColor[] = { axis1Color, axis2Color, axis3Color }; - const auto configureLinearView = [lineWidth, coneLength, axisLength, coneRadius]( AzToolsFramework::LinearManipulator* linearManipulator, const AZ::Color& color) { diff --git a/Gems/PhysX/Code/Editor/EditorSubComponentModeSnap.cpp b/Gems/PhysX/Code/Editor/EditorSubComponentModeSnap.cpp index cef48a7cf5..5220b2e274 100644 --- a/Gems/PhysX/Code/Editor/EditorSubComponentModeSnap.cpp +++ b/Gems/PhysX/Code/Editor/EditorSubComponentModeSnap.cpp @@ -99,7 +99,6 @@ namespace PhysX debugDisplay.PushMatrix(localTransform); const float xAxisLineLength = 15.0f; - const float yzAxisArrowLength = 1.0f; debugDisplay.SetColor(AZ::Color(1.0f, 0.0f, 0.0f, 1.0f)); debugDisplay.DrawLine(AZ::Vector3(0.0f, 0.0f, 0.0f), AZ::Vector3(xAxisLineLength, 0.0f, 0.0f)); diff --git a/Gems/PhysX/Code/Source/EditorBallJointComponent.cpp b/Gems/PhysX/Code/Source/EditorBallJointComponent.cpp index d196b4644d..da000baeed 100644 --- a/Gems/PhysX/Code/Source/EditorBallJointComponent.cpp +++ b/Gems/PhysX/Code/Source/EditorBallJointComponent.cpp @@ -237,7 +237,6 @@ namespace PhysX debugDisplay.PushMatrix(localTransform); const float xAxisArrowLength = 2.0f; - const float yzAxisArrowLength = 1.0f; debugDisplay.SetColor(AZ::Color(1.0f, 0.0f, 0.0f, 1.0f)); debugDisplay.DrawArrow(AZ::Vector3(0.0f, 0.0f, 0.0f), AZ::Vector3(xAxisArrowLength, 0.0f, 0.0f)); diff --git a/Gems/PhysX/Code/Source/EditorShapeColliderComponent.cpp b/Gems/PhysX/Code/Source/EditorShapeColliderComponent.cpp index 7ff62e0fc6..57bfe17a30 100644 --- a/Gems/PhysX/Code/Source/EditorShapeColliderComponent.cpp +++ b/Gems/PhysX/Code/Source/EditorShapeColliderComponent.cpp @@ -58,10 +58,10 @@ namespace PhysX { if (m_shapeType == ShapeType::Cylinder) { - return AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::Show; + return AZ::Edit::PropertyVisibility::Show; } - return AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::Hide; + return AZ::Edit::PropertyVisibility::Hide; } void EditorShapeColliderComponent::Reflect(AZ::ReflectContext* context) diff --git a/Gems/PhysX/Code/Tests/Benchmarks/PhysXRigidBodyBenchmarks.cpp b/Gems/PhysX/Code/Tests/Benchmarks/PhysXRigidBodyBenchmarks.cpp index b02a3962cc..0117e9737b 100644 --- a/Gems/PhysX/Code/Tests/Benchmarks/PhysXRigidBodyBenchmarks.cpp +++ b/Gems/PhysX/Code/Tests/Benchmarks/PhysXRigidBodyBenchmarks.cpp @@ -175,7 +175,6 @@ namespace PhysX::Benchmarks const int numRigidBodies = static_cast(state.range(0)); //common settings for each rigid body - const float boxSize = 5.0f; const float boxSizeWithSpacing = RigidBodyConstants::RigidBodys::BoxSize + 2.0f; const int boxesPerCol = static_cast(RigidBodyConstants::TerrainSize / boxSizeWithSpacing) - 1; int spawnColIdx = 0; @@ -399,7 +398,7 @@ namespace PhysX::Benchmarks return rand.GetRandomFloat() * 25.0f + 5.0f; }; - Utils::GenerateEntityIdFuncPtr entityIdGenerator = [&rand](int idx) -> AZ::EntityId { + Utils::GenerateEntityIdFuncPtr entityIdGenerator = [](int idx) -> AZ::EntityId { return AZ::EntityId(static_cast(idx) + RigidBodyConstants::RigidBodys::RigidBodyEntityIdStart); }; auto boxShapeConfiguration = AZStd::make_shared(AZ::Vector3(RigidBodyConstants::RigidBodys::BoxSize)); diff --git a/Gems/PhysX/Code/Tests/ShapeColliderComponentTests.cpp b/Gems/PhysX/Code/Tests/ShapeColliderComponentTests.cpp index e3c7d9acfb..cbaf4b4625 100644 --- a/Gems/PhysX/Code/Tests/ShapeColliderComponentTests.cpp +++ b/Gems/PhysX/Code/Tests/ShapeColliderComponentTests.cpp @@ -299,7 +299,6 @@ namespace PhysXEditorTests // the bounding box of the rigid body should reflect the dimensions of the cylinder set above AZ::Aabb aabb = staticBody->GetAabb(); - const float validDiameter = validRadius * 2.0f; // Check that the z positions of the bounding box match that of the cylinder EXPECT_NEAR(aabb.GetMin().GetZ(), -0.5f * validHeight, AZ::Constants::Tolerance); diff --git a/Gems/PhysX/Code/Tests/SystemComponentTest.cpp b/Gems/PhysX/Code/Tests/SystemComponentTest.cpp index cf9bbe3567..11c5e0a115 100644 --- a/Gems/PhysX/Code/Tests/SystemComponentTest.cpp +++ b/Gems/PhysX/Code/Tests/SystemComponentTest.cpp @@ -21,8 +21,6 @@ namespace PhysXEditorTests // Initialize new configs with some non-default values. const AZ::Vector3 newGravity(2.f, 5.f, 7.f); - const float newFixedTimeStep = 0.008f; - const float newMaxTimeStep = 0.034f; AzPhysics::SceneConfiguration newConfiguration; From 3ebf045cb57b025c74540d991aee11670da090e4 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Fri, 20 Aug 2021 18:01:03 -0700 Subject: [PATCH 031/131] Gems/GradientSignal Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../Source/Editor/EditorImageProcessingSystemComponent.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gems/GradientSignal/Code/Source/Editor/EditorImageProcessingSystemComponent.cpp b/Gems/GradientSignal/Code/Source/Editor/EditorImageProcessingSystemComponent.cpp index 52c96c143c..e665d46468 100644 --- a/Gems/GradientSignal/Code/Source/Editor/EditorImageProcessingSystemComponent.cpp +++ b/Gems/GradientSignal/Code/Source/Editor/EditorImageProcessingSystemComponent.cpp @@ -108,7 +108,7 @@ namespace GradientSignal if(settingsExist) { - menu->addAction("Edit Gradient Image Settings...", [this, source, settingsPath]() + menu->addAction("Edit Gradient Image Settings...", [settingsPath]() { bool result = false; AZ::Data::AssetInfo assetInfo; @@ -123,7 +123,7 @@ namespace GradientSignal } else { - menu->addAction("Enable Gradient Image Settings", [this, source, settingsPath]() + menu->addAction("Enable Gradient Image Settings", [settingsPath]() { GradientSignal::ImageSettings imageSettings; AZ::Utils::SaveObjectToFile(settingsPath, AZ::DataStream::ST_XML, &imageSettings); From 2f5a39176d46448438460bbd2cfbd64a9d615f04 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Fri, 20 Aug 2021 18:01:28 -0700 Subject: [PATCH 032/131] Gems/GraphCanvas Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../Nodes/Group/NodeGroupFrameComponent.cpp | 2 - .../Code/Source/Components/SceneComponent.cpp | 4 -- .../Translation/TranslationDatabase.cpp | 4 +- .../GraphicsItems/ParticleGraphicsItem.cpp | 1 - .../StaticLib/GraphCanvas/Styling/Parser.cpp | 40 ------------------- .../GraphCanvas/Utils/GraphUtils.cpp | 11 ----- .../GraphCanvas/Utils/QtVectorMath.h | 10 ----- .../ConstructPresetDialog.cpp | 1 - .../GraphCanvasGraphicsView.cpp | 1 - .../Model/NodePaletteSortFilterProxyModel.cpp | 2 - 10 files changed, 2 insertions(+), 74 deletions(-) diff --git a/Gems/GraphCanvas/Code/Source/Components/Nodes/Group/NodeGroupFrameComponent.cpp b/Gems/GraphCanvas/Code/Source/Components/Nodes/Group/NodeGroupFrameComponent.cpp index c317e8044a..f6a7efd7fb 100644 --- a/Gems/GraphCanvas/Code/Source/Components/Nodes/Group/NodeGroupFrameComponent.cpp +++ b/Gems/GraphCanvas/Code/Source/Components/Nodes/Group/NodeGroupFrameComponent.cpp @@ -2295,8 +2295,6 @@ namespace GraphCanvas { QScopedValueRollback allowMovement(m_allowMovement, false); - QRectF rect = boundingRect(); - qreal originalHeight = boundingRect().height(); qreal newHeight = boundingRect().height() + (newSize.height() - oldSize.height()); diff --git a/Gems/GraphCanvas/Code/Source/Components/SceneComponent.cpp b/Gems/GraphCanvas/Code/Source/Components/SceneComponent.cpp index eefde088bb..f236b6b1e1 100644 --- a/Gems/GraphCanvas/Code/Source/Components/SceneComponent.cpp +++ b/Gems/GraphCanvas/Code/Source/Components/SceneComponent.cpp @@ -3262,8 +3262,6 @@ namespace GraphCanvas { for (const auto& sceneMember : sceneMemberList) { - QRectF boundingArea; - QGraphicsItem* sceneItem = nullptr; VisualRequestBus::EventResult(sceneItem, sceneMember->GetId(), &VisualRequests::AsGraphicsItem); @@ -3292,8 +3290,6 @@ namespace GraphCanvas { for (const auto& sceneMember : sceneMemberList) { - QRectF boundingArea; - QGraphicsItem* sceneItem = nullptr; VisualRequestBus::EventResult(sceneItem, sceneMember->GetId(), &VisualRequests::AsGraphicsItem); diff --git a/Gems/GraphCanvas/Code/Source/Translation/TranslationDatabase.cpp b/Gems/GraphCanvas/Code/Source/Translation/TranslationDatabase.cpp index 158b310d7c..17c59d17bc 100644 --- a/Gems/GraphCanvas/Code/Source/Translation/TranslationDatabase.cpp +++ b/Gems/GraphCanvas/Code/Source/Translation/TranslationDatabase.cpp @@ -33,10 +33,10 @@ namespace GraphCanvas m_database.clear(); - AZStd::function reloadFn = [this]() + AZStd::function reloadFn = []() { // Collects all script assets for reloading - AZ::Data::AssetCatalogRequests::AssetEnumerationCB collectAssetsCb = [this](const AZ::Data::AssetId, const AZ::Data::AssetInfo& info) + AZ::Data::AssetCatalogRequests::AssetEnumerationCB collectAssetsCb = [](const AZ::Data::AssetId, const AZ::Data::AssetInfo& info) { // Check asset type if (info.m_assetType == azrtti_typeid()) diff --git a/Gems/GraphCanvas/Code/StaticLib/GraphCanvas/GraphicsItems/ParticleGraphicsItem.cpp b/Gems/GraphCanvas/Code/StaticLib/GraphCanvas/GraphicsItems/ParticleGraphicsItem.cpp index 26ee857cd8..a6ec4484cf 100644 --- a/Gems/GraphCanvas/Code/StaticLib/GraphCanvas/GraphicsItems/ParticleGraphicsItem.cpp +++ b/Gems/GraphCanvas/Code/StaticLib/GraphCanvas/GraphicsItems/ParticleGraphicsItem.cpp @@ -117,7 +117,6 @@ namespace GraphCanvas void ParticleGraphicsItem::paint([[maybe_unused]] QPainter* painter, [[maybe_unused]] const QStyleOptionGraphicsItem* option, [[maybe_unused]] QWidget* widget) { - static const float k_pulseWidth = 60.0f; painter->save(); float alpha = m_configuration.m_alphaStart; diff --git a/Gems/GraphCanvas/Code/StaticLib/GraphCanvas/Styling/Parser.cpp b/Gems/GraphCanvas/Code/StaticLib/GraphCanvas/Styling/Parser.cpp index d391ecf418..5d15c9fcd0 100644 --- a/Gems/GraphCanvas/Code/StaticLib/GraphCanvas/Styling/Parser.cpp +++ b/Gems/GraphCanvas/Code/StaticLib/GraphCanvas/Styling/Parser.cpp @@ -291,8 +291,6 @@ namespace QColor ParseColor(const QString& color) { - QColor result; - QRegularExpressionMatch match; if ((match = hexColor.match(color)).hasMatch()) { @@ -520,34 +518,6 @@ namespace } } - QFont::Capitalization ParseFontVariant(const QString& value) - { - if (QString::compare(value, QLatin1String("normal"), Qt::CaseInsensitive) == 0) - { - return QFont::MixedCase; - } - else if (QString::compare(value, QLatin1String("all-uppercase"), Qt::CaseInsensitive) == 0) - { - return QFont::AllUppercase; - } - else if (QString::compare(value, QLatin1String("all-lowercase"), Qt::CaseInsensitive) == 0) - { - return QFont::AllLowercase; - } - else if (QString::compare(value, QLatin1String("small-caps"), Qt::CaseInsensitive) == 0) - { - return QFont::SmallCaps; - } - else if (QString::compare(value, QLatin1String("capitalize"), Qt::CaseInsensitive) == 0) - { - return QFont::Capitalize; - } - else - { - return{}; - } - } - bool IsFontStyleValid(const QString& value) { if (QString::compare(value, QLatin1String("normal"), Qt::CaseInsensitive) == 0 || @@ -640,16 +610,6 @@ namespace return{}; } - AZStd::string CreateStyleName(const Styling::Style& style) - { - const Styling::SelectorVector selectors = style.GetSelectors(); - return std::accumulate(selectors.cbegin(), selectors.cend(), AZStd::string(), [](const AZStd::string& a, const Styling::Selector& s) { - return a + (a.empty() ? "" : ", ") + s.ToString(); - }); - } - - - } // namespace diff --git a/Gems/GraphCanvas/Code/StaticLib/GraphCanvas/Utils/GraphUtils.cpp b/Gems/GraphCanvas/Code/StaticLib/GraphCanvas/Utils/GraphUtils.cpp index 93ee795ec6..40284efcdf 100644 --- a/Gems/GraphCanvas/Code/StaticLib/GraphCanvas/Utils/GraphUtils.cpp +++ b/Gems/GraphCanvas/Code/StaticLib/GraphCanvas/Utils/GraphUtils.cpp @@ -1898,8 +1898,6 @@ namespace GraphCanvas targetConnectionType = ConnectionType::CT_Invalid; } - NodeId nodeId = initializingEndpoint.GetNodeId(); - AZStd::vector< SlotId > slotIds; NodeRequestBus::EventResult(slotIds, initializingEndpoint.GetNodeId(), &NodeRequests::GetSlotIds); @@ -2307,7 +2305,6 @@ namespace GraphCanvas AZ::EntityId anchorEntity; float minDistance = -1; - QPointF offset; AZStd::vector nearbyEntities; FloatingElementAnchor floatingAnchor; @@ -2425,10 +2422,6 @@ namespace GraphCanvas // - Overall Alignment is a bit...non-deterministic right now, and can change for some reason. AZStd::queue< OrganizationHelper* > termimnalOrganizationHelpers; - QPointF minTerminalPointSpot(0,0); - - AZ::Vector2 anchorPoint = CalculateAlignmentAnchorPoint(alignConfig); - // Tail recursed loop. while (!nextLayer.empty()) { @@ -2487,10 +2480,6 @@ namespace GraphCanvas OrganizationHelper* helper = termimnalOrganizationHelpers.front(); termimnalOrganizationHelpers.pop(); - NodeId nodeId = helper->m_nodeId; - - QRectF totalBoundingRect = helper->m_boundingArea; - OrganizationSpaceAllocationHelper leftAllocation; OrganizationSpaceAllocationHelper rightAllocation; diff --git a/Gems/GraphCanvas/Code/StaticLib/GraphCanvas/Utils/QtVectorMath.h b/Gems/GraphCanvas/Code/StaticLib/GraphCanvas/Utils/QtVectorMath.h index 8361d57e9a..5b572714f2 100644 --- a/Gems/GraphCanvas/Code/StaticLib/GraphCanvas/Utils/QtVectorMath.h +++ b/Gems/GraphCanvas/Code/StaticLib/GraphCanvas/Utils/QtVectorMath.h @@ -58,18 +58,8 @@ namespace GraphCanvas } // Find the line between the two rectangles. - QPointF direction = rectA.center() - rectB.center(); QLineF directionLine(rectA.center(), rectB.center()); - QLineF aLine1; - QLineF aLine2; - QLineF aFinalLine; - - QLineF bLine1; - QLineF bLine2; - QLineF bFinalLine; - - // Not strictly correct, but correct enough. // // Finds the two points on the line from center to center, and returns the distance between them. diff --git a/Gems/GraphCanvas/Code/StaticLib/GraphCanvas/Widgets/ConstructPresetDialog/ConstructPresetDialog.cpp b/Gems/GraphCanvas/Code/StaticLib/GraphCanvas/Widgets/ConstructPresetDialog/ConstructPresetDialog.cpp index 73655cf41d..bde2135b9e 100644 --- a/Gems/GraphCanvas/Code/StaticLib/GraphCanvas/Widgets/ConstructPresetDialog/ConstructPresetDialog.cpp +++ b/Gems/GraphCanvas/Code/StaticLib/GraphCanvas/Widgets/ConstructPresetDialog/ConstructPresetDialog.cpp @@ -445,7 +445,6 @@ namespace GraphCanvas if (newIndex >= 0) { - QModelIndex index = m_presetsModel->index(newIndex, 0); m_ui->constructTypes->setCurrentIndex(newIndex); } } diff --git a/Gems/GraphCanvas/Code/StaticLib/GraphCanvas/Widgets/GraphCanvasGraphicsView/GraphCanvasGraphicsView.cpp b/Gems/GraphCanvas/Code/StaticLib/GraphCanvas/Widgets/GraphCanvasGraphicsView/GraphCanvasGraphicsView.cpp index f0b4d264ca..fa7e051035 100644 --- a/Gems/GraphCanvas/Code/StaticLib/GraphCanvas/Widgets/GraphCanvasGraphicsView/GraphCanvasGraphicsView.cpp +++ b/Gems/GraphCanvas/Code/StaticLib/GraphCanvas/Widgets/GraphCanvasGraphicsView/GraphCanvasGraphicsView.cpp @@ -1488,7 +1488,6 @@ namespace GraphCanvas void GraphCanvasGraphicsView::SaveViewParams() { - QPointF centerPoint = mapToScene(rect().center()); QPointF anchorPoint = mapToScene(rect().topLeft()); m_viewParams.m_anchorPointX = aznumeric_cast(anchorPoint.x()); diff --git a/Gems/GraphCanvas/Code/StaticLib/GraphCanvas/Widgets/NodePalette/Model/NodePaletteSortFilterProxyModel.cpp b/Gems/GraphCanvas/Code/StaticLib/GraphCanvas/Widgets/NodePalette/Model/NodePaletteSortFilterProxyModel.cpp index 89e0ef3aac..33d11f998e 100644 --- a/Gems/GraphCanvas/Code/StaticLib/GraphCanvas/Widgets/NodePalette/Model/NodePaletteSortFilterProxyModel.cpp +++ b/Gems/GraphCanvas/Code/StaticLib/GraphCanvas/Widgets/NodePalette/Model/NodePaletteSortFilterProxyModel.cpp @@ -202,8 +202,6 @@ namespace GraphCanvas AZStd::list exploreItems; exploreItems.push_back(treeItem); - const QModelIndex k_flagIndex; - while (!exploreItems.empty()) { const GraphCanvas::GraphCanvasTreeItem* currentItem = exploreItems.front(); From 323d642e658b4d431929befed4884677d4c65304 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Fri, 20 Aug 2021 18:01:54 -0700 Subject: [PATCH 033/131] Gems/ScriptCanvas Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../ScriptCanvasBuilderWorkerUtility.cpp | 6 ------ .../Assets/ScriptCanvasAssetHelpers.cpp | 1 - .../Editor/Assets/ScriptCanvasAssetHolder.cpp | 2 +- .../Editor/Assets/ScriptCanvasMemoryAsset.cpp | 4 +--- .../Code/Editor/Components/EditorGraph.cpp | 9 -------- .../Code/Editor/Nodes/NodeDisplayUtils.cpp | 1 - .../Code/Editor/Nodes/NodeUtils.cpp | 21 ------------------- .../Code/Editor/SystemComponent.cpp | 2 +- .../Widgets/NodePalette/NodePaletteModel.cpp | 10 --------- .../StatisticsDialog/NodeUsageTreeItem.cpp | 2 -- .../GraphValidationDockWidget.cpp | 1 - .../VariablePanel/VariableDockWidget.cpp | 2 +- .../Code/Editor/View/Windows/MainWindow.cpp | 8 +++---- .../Windows/Tools/UpgradeTool/UpgradeTool.cpp | 2 +- .../Tools/UpgradeTool/VersionExplorer.cpp | 3 +-- .../Code/Include/ScriptCanvas/Core/Core.cpp | 2 -- .../Code/Include/ScriptCanvas/Core/Node.cpp | 2 -- .../ScriptCanvas/Grammar/ParsingUtilities.cpp | 2 -- .../ScriptCanvas/Grammar/Primitives.cpp | 1 - .../Libraries/Core/FunctionDefinitionNode.cpp | 2 +- .../Libraries/Core/ReceiveScriptEvent.cpp | 1 - .../Operators/Containers/OperatorAt.cpp | 2 +- .../Operators/Containers/OperatorBack.cpp | 2 +- .../ScriptCanvas/Variable/VariableData.cpp | 1 - .../Code/Source/PerformanceStatistician.cpp | 1 - .../EditorAutomationStates/UtilityStates.h | 1 - .../NodePaletteFullCreation.cpp | 2 -- .../EditorMouseActions.cpp | 2 +- .../ScriptCanvasActions/VariableActions.cpp | 1 - .../EditorAutomationStates/UtilityStates.cpp | 1 - .../Source/EditorAutomationTestDialog.h | 2 -- .../EditorAutomationTests/VariableTests.cpp | 1 - .../EditorAutomationTests/VariableTests.h | 3 --- .../Code/Editor/Source/WrapperMock.cpp | 1 - .../Code/Tests/ScriptCanvasPhysicsTest.cpp | 3 --- .../Code/Tests/ScriptCanvas_Core.cpp | 6 +++--- .../Code/Tests/ScriptCanvas_Variables.cpp | 4 ---- 37 files changed, 16 insertions(+), 101 deletions(-) diff --git a/Gems/ScriptCanvas/Code/Builder/ScriptCanvasBuilderWorkerUtility.cpp b/Gems/ScriptCanvas/Code/Builder/ScriptCanvasBuilderWorkerUtility.cpp index af5e49bdeb..0853789b19 100644 --- a/Gems/ScriptCanvas/Code/Builder/ScriptCanvasBuilderWorkerUtility.cpp +++ b/Gems/ScriptCanvas/Code/Builder/ScriptCanvasBuilderWorkerUtility.cpp @@ -486,7 +486,6 @@ namespace ScriptCanvasBuilder AZ::Outcome ProcessTranslationJob(ProcessTranslationJobInput& input) { - const bool saveRawLua{ true }; auto sourceGraph = PrepareSourceGraph(input.buildEntity); auto version = sourceGraph->GetVersion(); @@ -651,11 +650,6 @@ namespace ScriptCanvasBuilder for (const auto& assetDependency : runtimeData.m_requiredAssets) { - auto filterScripts = [](const AZ::Data::Asset& asset) - { - return asset.GetType() != azrtti_typeid(); - }; - if (AZ::Data::AssetManager::Instance().GetAsset(assetDependency.GetId(), assetDependency.GetType(), AZ::Data::AssetLoadBehavior::PreLoad)) { jobProduct.m_dependencies.push_back({ assetDependency.GetId(), {} }); diff --git a/Gems/ScriptCanvas/Code/Editor/Assets/ScriptCanvasAssetHelpers.cpp b/Gems/ScriptCanvas/Code/Editor/Assets/ScriptCanvasAssetHelpers.cpp index 554bb31b25..884fa2d5c9 100644 --- a/Gems/ScriptCanvas/Code/Editor/Assets/ScriptCanvasAssetHelpers.cpp +++ b/Gems/ScriptCanvas/Code/Editor/Assets/ScriptCanvasAssetHelpers.cpp @@ -41,7 +41,6 @@ namespace ScriptCanvasEditor bool sourceInfoFound{}; AzToolsFramework::AssetSystemRequestBus::BroadcastResult(sourceInfoFound, &AzToolsFramework::AssetSystemRequestBus::Events::GetSourceInfoBySourcePath, fullPath.data(), catalogAssetInfo, watchFolder); - auto saveAssetId = sourceInfoFound ? catalogAssetInfo.m_assetId : AZ::Data::AssetId(AZ::Uuid::CreateRandom()); if (sourceInfoFound) { outAssetInfo = catalogAssetInfo; diff --git a/Gems/ScriptCanvas/Code/Editor/Assets/ScriptCanvasAssetHolder.cpp b/Gems/ScriptCanvas/Code/Editor/Assets/ScriptCanvasAssetHolder.cpp index 5c62844e9f..a42a9bad48 100644 --- a/Gems/ScriptCanvas/Code/Editor/Assets/ScriptCanvasAssetHolder.cpp +++ b/Gems/ScriptCanvas/Code/Editor/Assets/ScriptCanvasAssetHolder.cpp @@ -67,7 +67,7 @@ namespace ScriptCanvasEditor { AssetTrackerNotificationBus::Handler::BusConnect(m_scriptCanvasAsset.GetId()); - Callbacks::OnAssetReadyCallback onAssetReady = [this](ScriptCanvasMemoryAsset& asset) + Callbacks::OnAssetReadyCallback onAssetReady = [](ScriptCanvasMemoryAsset& asset) { AssetHelpers::DumpAssetInfo(asset.GetFileAssetId(), "ScriptCanvasAssetHolder::Init"); }; diff --git a/Gems/ScriptCanvas/Code/Editor/Assets/ScriptCanvasMemoryAsset.cpp b/Gems/ScriptCanvas/Code/Editor/Assets/ScriptCanvasMemoryAsset.cpp index e7dc2343f2..dbb95828f7 100644 --- a/Gems/ScriptCanvas/Code/Editor/Assets/ScriptCanvasMemoryAsset.cpp +++ b/Gems/ScriptCanvas/Code/Editor/Assets/ScriptCanvasMemoryAsset.cpp @@ -374,7 +374,6 @@ namespace ScriptCanvasEditor } else { - AZ::Data::AssetId assetId = asset.GetId(); Internal::MemoryAssetSystemNotificationBus::Broadcast(&Internal::MemoryAssetSystemNotifications::OnAssetReloaded, this); } } @@ -392,7 +391,6 @@ namespace ScriptCanvasEditor } else { - AZ::Data::AssetId assetId = asset.GetId(); Internal::MemoryAssetSystemNotificationBus::Broadcast(&Internal::MemoryAssetSystemNotifications::OnAssetError, this); } } @@ -505,7 +503,7 @@ namespace ScriptCanvasEditor m_pendingSave.emplace_back(normPath); m_assetSaveFinalizer.Reset(); - m_assetSaveFinalizer.Start(this, fileInfo, saveInfo, onSaveCallback, AssetSaveFinalizer::OnCompleteHandler([this, saveInfo](AZ::Data::AssetId /*assetId*/) + m_assetSaveFinalizer.Start(this, fileInfo, saveInfo, onSaveCallback, AssetSaveFinalizer::OnCompleteHandler([saveInfo](AZ::Data::AssetId /*assetId*/) { })); } diff --git a/Gems/ScriptCanvas/Code/Editor/Components/EditorGraph.cpp b/Gems/ScriptCanvas/Code/Editor/Components/EditorGraph.cpp index 325c348d9c..1899951638 100644 --- a/Gems/ScriptCanvas/Code/Editor/Components/EditorGraph.cpp +++ b/Gems/ScriptCanvas/Code/Editor/Components/EditorGraph.cpp @@ -1034,16 +1034,9 @@ namespace ScriptCanvasEditor if (connection) { - ScriptCanvas::Endpoint scSourceEndpoint = connection->GetSourceEndpoint(); - GraphCanvas::Endpoint sourceEndpoint = ConvertToGraphCanvasEndpoint(scSourceEndpoint); - - ScriptCanvas::Endpoint scTargetEndpoint = connection->GetTargetEndpoint(); - GraphCanvas::Endpoint targetEndpoint = ConvertToGraphCanvasEndpoint(scTargetEndpoint); - ScriptCanvas::GraphNotificationBus::Event(GetScriptCanvasId(), &ScriptCanvas::GraphNotifications::OnDisonnectionComplete, connectionId); DisconnectById(scConnectionId); - } } @@ -2666,8 +2659,6 @@ namespace ScriptCanvasEditor AZStd::vector< GraphCanvas::SlotId > slotIds; GraphCanvas::NodeRequestBus::EventResult(slotIds, nodeId, &GraphCanvas::NodeRequests::GetSlotIds); - GraphCanvas::GraphId graphCanvasGraphId = GetGraphCanvasGraphId(); - for (const GraphCanvas::SlotId& slotId : slotIds) { GraphCanvas::SlotType slotType = GraphCanvas::SlotTypes::Invalid; diff --git a/Gems/ScriptCanvas/Code/Editor/Nodes/NodeDisplayUtils.cpp b/Gems/ScriptCanvas/Code/Editor/Nodes/NodeDisplayUtils.cpp index b9e96938af..8d616f0a68 100644 --- a/Gems/ScriptCanvas/Code/Editor/Nodes/NodeDisplayUtils.cpp +++ b/Gems/ScriptCanvas/Code/Editor/Nodes/NodeDisplayUtils.cpp @@ -744,7 +744,6 @@ namespace ScriptCanvasEditor::Nodes return graphCanvasNodeId; } - auto busId = senderNode->GetBusSlotId(); for (const auto& slot : senderNode->GetSlots()) { if (slot.IsVisible()) diff --git a/Gems/ScriptCanvas/Code/Editor/Nodes/NodeUtils.cpp b/Gems/ScriptCanvas/Code/Editor/Nodes/NodeUtils.cpp index 000dafed88..3c5e74cbeb 100644 --- a/Gems/ScriptCanvas/Code/Editor/Nodes/NodeUtils.cpp +++ b/Gems/ScriptCanvas/Code/Editor/Nodes/NodeUtils.cpp @@ -14,27 +14,6 @@ #include -namespace -{ - ScriptCanvas::ConnectionType ToScriptCanvasConnectionType(GraphCanvas::ConnectionType connectionType) - { - ScriptCanvas::ConnectionType scriptCanvasConnectionType = ScriptCanvas::ConnectionType::Unknown; - switch (connectionType) - { - case GraphCanvas::CT_Input: - scriptCanvasConnectionType = ScriptCanvas::ConnectionType::Input; - break; - case GraphCanvas::CT_Output: - scriptCanvasConnectionType = ScriptCanvas::ConnectionType::Output; - break; - default: - break; - } - - return scriptCanvasConnectionType; - } -} - namespace ScriptCanvasEditor::Nodes { void CopyTranslationKeyedNameToDatumLabel(const AZ::EntityId& graphCanvasNodeId, diff --git a/Gems/ScriptCanvas/Code/Editor/SystemComponent.cpp b/Gems/ScriptCanvas/Code/Editor/SystemComponent.cpp index b80bba75c2..4b60fd357c 100644 --- a/Gems/ScriptCanvas/Code/Editor/SystemComponent.cpp +++ b/Gems/ScriptCanvas/Code/Editor/SystemComponent.cpp @@ -332,7 +332,7 @@ namespace ScriptCanvasEditor if (isScriptCanvasAsset) { - auto scriptCanvasEditorCallback = [this]([[maybe_unused]] const char* fullSourceFileNameInCall, const AZ::Uuid& sourceUUIDInCall) + auto scriptCanvasEditorCallback = []([[maybe_unused]] const char* fullSourceFileNameInCall, const AZ::Uuid& sourceUUIDInCall) { AZ::Outcome openOutcome = AZ::Failure(AZStd::string()); const SourceAssetBrowserEntry* fullDetails = SourceAssetBrowserEntry::GetSourceByUuid(sourceUUIDInCall); diff --git a/Gems/ScriptCanvas/Code/Editor/View/Widgets/NodePalette/NodePaletteModel.cpp b/Gems/ScriptCanvas/Code/Editor/View/Widgets/NodePalette/NodePaletteModel.cpp index 0949daa458..38def487e6 100644 --- a/Gems/ScriptCanvas/Code/Editor/View/Widgets/NodePalette/NodePaletteModel.cpp +++ b/Gems/ScriptCanvas/Code/Editor/View/Widgets/NodePalette/NodePaletteModel.cpp @@ -87,16 +87,6 @@ namespace return AZ::FindAttribute(attribute, method->m_attributes) != nullptr; // warning C4800: 'AZ::Attribute *': forcing value to bool 'true' or 'false' (performance warning) } - bool HasAttribute(const AZ::BehaviorClass* behaviorClass, AZ::Crc32 attributeCrc) - { - AZ::Attribute* attribute = AZ::FindAttribute(attributeCrc, behaviorClass->m_attributes); - if (attribute) - { - return true; - } - return false; - } - // Checks for and returns the Category attribute from an AZ::AttributeArray AZStd::string GetCategoryPath(const AZ::AttributeArray& attributes, const AZ::BehaviorContext& behaviorContext) { diff --git a/Gems/ScriptCanvas/Code/Editor/View/Widgets/StatisticsDialog/NodeUsageTreeItem.cpp b/Gems/ScriptCanvas/Code/Editor/View/Widgets/StatisticsDialog/NodeUsageTreeItem.cpp index ddcdaad161..4dce7ce384 100644 --- a/Gems/ScriptCanvas/Code/Editor/View/Widgets/StatisticsDialog/NodeUsageTreeItem.cpp +++ b/Gems/ScriptCanvas/Code/Editor/View/Widgets/StatisticsDialog/NodeUsageTreeItem.cpp @@ -152,8 +152,6 @@ namespace ScriptCanvasEditor m_assetType = assetType; - const bool loadBlocking = false; - auto onAssetReady = [](ScriptCanvasMemoryAsset&) {}; AssetTrackerRequestBus::Broadcast(&AssetTrackerRequests::Load, m_assetId, m_assetType, onAssetReady); } diff --git a/Gems/ScriptCanvas/Code/Editor/View/Widgets/ValidationPanel/GraphValidationDockWidget.cpp b/Gems/ScriptCanvas/Code/Editor/View/Widgets/ValidationPanel/GraphValidationDockWidget.cpp index 6d29c01ff4..da7fab5405 100644 --- a/Gems/ScriptCanvas/Code/Editor/View/Widgets/ValidationPanel/GraphValidationDockWidget.cpp +++ b/Gems/ScriptCanvas/Code/Editor/View/Widgets/ValidationPanel/GraphValidationDockWidget.cpp @@ -810,7 +810,6 @@ namespace ScriptCanvasEditor const ScriptCanvas::ValidationEvent* validationEvent = model->FindItemForIndex(m_proxyModel->mapToSource(modelIndex)); AZ::EntityId graphCanvasMemberId; - QRectF focusArea; if (const ScriptCanvas::FocusOnEntityEffect* focusOnEntityEffect = azrtti_cast(validationEvent)) { diff --git a/Gems/ScriptCanvas/Code/Editor/View/Widgets/VariablePanel/VariableDockWidget.cpp b/Gems/ScriptCanvas/Code/Editor/View/Widgets/VariablePanel/VariableDockWidget.cpp index 60bc7ba0d2..eb2f92f42c 100644 --- a/Gems/ScriptCanvas/Code/Editor/View/Widgets/VariablePanel/VariableDockWidget.cpp +++ b/Gems/ScriptCanvas/Code/Editor/View/Widgets/VariablePanel/VariableDockWidget.cpp @@ -258,7 +258,7 @@ namespace ScriptCanvasEditor QObject::connect(pasteAction, &QAction::triggered, - [dockWidget, varId](bool) + [dockWidget](bool) { GraphVariablesTableView::HandleVariablePaste(dockWidget->GetActiveScriptCanvasId()); }); diff --git a/Gems/ScriptCanvas/Code/Editor/View/Windows/MainWindow.cpp b/Gems/ScriptCanvas/Code/Editor/View/Windows/MainWindow.cpp index 87bf4cf23c..f4241e3545 100644 --- a/Gems/ScriptCanvas/Code/Editor/View/Windows/MainWindow.cpp +++ b/Gems/ScriptCanvas/Code/Editor/View/Windows/MainWindow.cpp @@ -323,14 +323,13 @@ namespace ScriptCanvasEditor m_mainWindow->OnWorkspaceRestoreStart(); } - AZ::Data::AssetId focusedAsset = workspace->GetFocusedAssetId(); m_queuedAssetFocus = workspace->GetFocusedAssetId(); for (const auto& assetSaveData : workspace->GetActiveAssetData()) { AssetTrackerNotificationBus::MultiHandler::BusConnect(assetSaveData.m_assetId); - Callbacks::OnAssetReadyCallback onAssetReady = [this, focusedAsset, assetSaveData](ScriptCanvasMemoryAsset& asset) + Callbacks::OnAssetReadyCallback onAssetReady = [this, assetSaveData](ScriptCanvasMemoryAsset& asset) { // If we get an error callback. Just remove it from out active lists. if (asset.IsSourceInError()) @@ -1020,7 +1019,7 @@ namespace ScriptCanvasEditor if (shouldSaveResults == UnsavedChangesOptions::SAVE) { - Callbacks::OnSave saveCB = [this, assetId](bool isSuccessful, AZ::Data::AssetPtr, AZ::Data::AssetId) + Callbacks::OnSave saveCB = [this](bool isSuccessful, AZ::Data::AssetPtr, AZ::Data::AssetId) { if (isSuccessful) { @@ -1610,7 +1609,7 @@ namespace ScriptCanvasEditor return; } - Callbacks::OnAssetReadyCallback onAssetReady = [this, fullPath, assetInfo](ScriptCanvasMemoryAsset&) + Callbacks::OnAssetReadyCallback onAssetReady = [this, assetInfo](ScriptCanvasMemoryAsset&) { ScriptCanvasMemoryAsset::pointer memoryAsset; AssetTrackerRequestBus::BroadcastResult(memoryAsset, &AssetTrackerRequests::GetAsset, assetInfo.m_assetId); @@ -2527,7 +2526,6 @@ namespace ScriptCanvasEditor void MainWindow::UpdateWorkspaceStatus(const ScriptCanvasMemoryAsset& memoryAsset) { AZ::Data::AssetId fileAssetId = memoryAsset.GetFileAssetId(); - AZ::Data::AssetId memoryAssetId = memoryAsset.GetId(); size_t eraseCount = m_loadingAssets.erase(fileAssetId); diff --git a/Gems/ScriptCanvas/Code/Editor/View/Windows/Tools/UpgradeTool/UpgradeTool.cpp b/Gems/ScriptCanvas/Code/Editor/View/Windows/Tools/UpgradeTool/UpgradeTool.cpp index e069c509ce..3d42fdad42 100644 --- a/Gems/ScriptCanvas/Code/Editor/View/Windows/Tools/UpgradeTool/UpgradeTool.cpp +++ b/Gems/ScriptCanvas/Code/Editor/View/Windows/Tools/UpgradeTool/UpgradeTool.cpp @@ -437,7 +437,7 @@ namespace ScriptCanvasEditor auto streamer = AZ::Interface::Get(); AZ::IO::FileRequestPtr flushRequest = streamer->FlushCache(assetToUpgrade.m_relativePath); - streamer->SetRequestCompleteCallback(flushRequest, [this]([[maybe_unused]] AZ::IO::FileRequestHandle request) + streamer->SetRequestCompleteCallback(flushRequest, []([[maybe_unused]] AZ::IO::FileRequestHandle request) { }); streamer->QueueRequest(flushRequest); diff --git a/Gems/ScriptCanvas/Code/Editor/View/Windows/Tools/UpgradeTool/VersionExplorer.cpp b/Gems/ScriptCanvas/Code/Editor/View/Windows/Tools/UpgradeTool/VersionExplorer.cpp index b9aff660f2..c04bea9698 100644 --- a/Gems/ScriptCanvas/Code/Editor/View/Windows/Tools/UpgradeTool/VersionExplorer.cpp +++ b/Gems/ScriptCanvas/Code/Editor/View/Windows/Tools/UpgradeTool/VersionExplorer.cpp @@ -725,7 +725,7 @@ namespace ScriptCanvasEditor spinner->SetIsBusy(true); rowGoToButton->setEnabled(false); - m_inProgressAsset = AZStd::find_if(m_assetsToUpgrade.begin(), m_assetsToUpgrade.end(), [this, asset](const UpgradeAssets::value_type& assetToUpgrade) + m_inProgressAsset = AZStd::find_if(m_assetsToUpgrade.begin(), m_assetsToUpgrade.end(), [asset](const UpgradeAssets::value_type& assetToUpgrade) { return assetToUpgrade.GetId() == asset.GetId(); }); @@ -807,7 +807,6 @@ namespace ScriptCanvasEditor const QTextCursor oldCursor = m_ui->textEdit->textCursor(); QScrollBar* scrollBar = m_ui->textEdit->verticalScrollBar(); - const int oldScrollValue = scrollBar->value(); m_ui->textEdit->moveCursor(QTextCursor::End); QTextCursor textCursor = m_ui->textEdit->textCursor(); diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/Core.cpp b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/Core.cpp index a5e73005c1..c45dc01c35 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/Core.cpp +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/Core.cpp @@ -54,8 +54,6 @@ namespace ScriptCanvas auto lhsIter = lhs.begin(); auto rhsIter = rhs.begin(); - const bool isCaseSensitive = false; - for (; lhsIter != lhs.end(); ++lhsIter, ++rhsIter) { if (!AZ::StringFunc::Equal(lhsIter->c_str(), rhsIter->c_str())) diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/Node.cpp b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/Node.cpp index 28f0519552..7dda4d4609 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/Node.cpp +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/Node.cpp @@ -1461,8 +1461,6 @@ namespace ScriptCanvas return slot.GetDataType(); } - Endpoint endpoint = slot.GetEndpoint(); - auto connectedNodes = GetConnectedNodes(slot); for (auto endpointPair : connectedNodes) diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Grammar/ParsingUtilities.cpp b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Grammar/ParsingUtilities.cpp index caae465964..dc33e6bae6 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Grammar/ParsingUtilities.cpp +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Grammar/ParsingUtilities.cpp @@ -707,8 +707,6 @@ namespace ScriptCanvas return false; } - auto id = execution->GetId(); - if (ActivatesSelf(execution)) { return true; diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Grammar/Primitives.cpp b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Grammar/Primitives.cpp index ee7c1ee2d2..59f12481e7 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Grammar/Primitives.cpp +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Grammar/Primitives.cpp @@ -55,7 +55,6 @@ namespace ScriptCanvas AZStd::vector tokens; AzFramework::StringFunc::Tokenize(name, tokens, Grammar::k_luaSpecialCharacters); AZStd::string joinResult; - const size_t length = tokens.size(); for (auto& token : tokens) { joinResult.append(token); diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Core/FunctionDefinitionNode.cpp b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Core/FunctionDefinitionNode.cpp index 071528d5b4..6cda0b75dd 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Core/FunctionDefinitionNode.cpp +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Core/FunctionDefinitionNode.cpp @@ -166,7 +166,7 @@ namespace ScriptCanvas } }, { - [this]() + []() { DisallowReentrantExecutionContract* reentrantContract = aznew DisallowReentrantExecutionContract(); return reentrantContract; diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Core/ReceiveScriptEvent.cpp b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Core/ReceiveScriptEvent.cpp index 8a86347aa3..b874077834 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Core/ReceiveScriptEvent.cpp +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Core/ReceiveScriptEvent.cpp @@ -86,7 +86,6 @@ namespace ScriptCanvas if (!wasConfigured) { - AZ::Uuid addressTypeId = m_definition.GetAddressType(); AZ::Uuid addressId = m_definition.GetAddressTypeProperty().GetId(); if (m_definition.IsAddressRequired()) diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Operators/Containers/OperatorAt.cpp b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Operators/Containers/OperatorAt.cpp index 868ad34650..e44fd0b1f1 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Operators/Containers/OperatorAt.cpp +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Operators/Containers/OperatorAt.cpp @@ -23,7 +23,7 @@ namespace ScriptCanvas if (sourceType == SourceType::SourceInput) { ContractDescriptor supportsMethodContract; - supportsMethodContract.m_createFunc = [this]() -> SupportsMethodContract* { return aznew SupportsMethodContract("At"); }; + supportsMethodContract.m_createFunc = []() -> SupportsMethodContract* { return aznew SupportsMethodContract("At"); }; contractDescs.push_back(AZStd::move(supportsMethodContract)); } } diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Operators/Containers/OperatorBack.cpp b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Operators/Containers/OperatorBack.cpp index e665d145e9..66d33d4c8f 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Operators/Containers/OperatorBack.cpp +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Operators/Containers/OperatorBack.cpp @@ -23,7 +23,7 @@ namespace ScriptCanvas if (sourceType == SourceType::SourceInput) { ContractDescriptor supportsMethodContract; - supportsMethodContract.m_createFunc = [this]() -> SupportsMethodContract* { return aznew SupportsMethodContract("Back"); }; + supportsMethodContract.m_createFunc = []() -> SupportsMethodContract* { return aznew SupportsMethodContract("Back"); }; contractDescs.push_back(AZStd::move(supportsMethodContract)); } } diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Variable/VariableData.cpp b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Variable/VariableData.cpp index 7474ebbf35..9869602c84 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Variable/VariableData.cpp +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Variable/VariableData.cpp @@ -144,7 +144,6 @@ namespace ScriptCanvas GraphVariable* VariableData::FindVariable(VariableId variableId) { - AZStd::pair resultPair; auto foundIt = m_variableMap.find(variableId); return foundIt != m_variableMap.end() ? &foundIt->second : nullptr; } diff --git a/Gems/ScriptCanvas/Code/Source/PerformanceStatistician.cpp b/Gems/ScriptCanvas/Code/Source/PerformanceStatistician.cpp index e5a5b3cd19..826490e487 100644 --- a/Gems/ScriptCanvas/Code/Source/PerformanceStatistician.cpp +++ b/Gems/ScriptCanvas/Code/Source/PerformanceStatistician.cpp @@ -104,7 +104,6 @@ namespace ScriptCanvas void PerformanceStatistician::OnStartTrackingRequested() { m_accumulatedStats.tickCount = 0; - m_accumulatedTickCountRemaining; m_accumulatedStartTime = AZStd::chrono::system_clock::now(); } diff --git a/Gems/ScriptCanvasDeveloper/Code/Editor/Include/ScriptCanvasDeveloperEditor/EditorAutomation/EditorAutomationStates/UtilityStates.h b/Gems/ScriptCanvasDeveloper/Code/Editor/Include/ScriptCanvasDeveloperEditor/EditorAutomation/EditorAutomationStates/UtilityStates.h index e6cdf0e390..429331e054 100644 --- a/Gems/ScriptCanvasDeveloper/Code/Editor/Include/ScriptCanvasDeveloperEditor/EditorAutomation/EditorAutomationStates/UtilityStates.h +++ b/Gems/ScriptCanvasDeveloper/Code/Editor/Include/ScriptCanvasDeveloperEditor/EditorAutomation/EditorAutomationStates/UtilityStates.h @@ -139,7 +139,6 @@ namespace ScriptCanvasDeveloper void OnStateActionsComplete() override; private: - int m_row = 0; int m_rowCount = 0; MoveMouseToViewRowAction* m_mouseToRow = nullptr; diff --git a/Gems/ScriptCanvasDeveloper/Code/Editor/Source/AutomationActions/NodePaletteFullCreation.cpp b/Gems/ScriptCanvasDeveloper/Code/Editor/Source/AutomationActions/NodePaletteFullCreation.cpp index 35dc250a33..3a66aefe6b 100644 --- a/Gems/ScriptCanvasDeveloper/Code/Editor/Source/AutomationActions/NodePaletteFullCreation.cpp +++ b/Gems/ScriptCanvasDeveloper/Code/Editor/Source/AutomationActions/NodePaletteFullCreation.cpp @@ -92,8 +92,6 @@ namespace ScriptCanvasDeveloperEditor int m_heightOffset = 0; int m_maxRowHeight = 0; - - int creationCounter = 100; }; void NodePaletteFullCreationAction() diff --git a/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomation/EditorAutomationActions/EditorMouseActions.cpp b/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomation/EditorAutomationActions/EditorMouseActions.cpp index cf757af1ec..0ef306f638 100644 --- a/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomation/EditorAutomationActions/EditorMouseActions.cpp +++ b/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomation/EditorAutomationActions/EditorMouseActions.cpp @@ -155,7 +155,6 @@ namespace ScriptCanvasDeveloper m_startPosition = QCursor::pos(); } - QPointF currentPosition = QCursor::pos(); QPointF targetPoint = m_targetPosition; float percentage = aznumeric_cast(m_tickCount)/aznumeric_cast(m_tickDuration); @@ -170,6 +169,7 @@ namespace ScriptCanvasDeveloper #if defined(AZ_COMPILER_MSVC) INPUT osInput = { 0 }; + QPointF currentPosition = QCursor::pos(); osInput.type = INPUT_MOUSE; osInput.mi.mouseData = 0; diff --git a/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomation/EditorAutomationActions/ScriptCanvasActions/VariableActions.cpp b/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomation/EditorAutomationActions/ScriptCanvasActions/VariableActions.cpp index d46f52bfdf..72203f6710 100644 --- a/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomation/EditorAutomationActions/ScriptCanvasActions/VariableActions.cpp +++ b/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomation/EditorAutomationActions/ScriptCanvasActions/VariableActions.cpp @@ -275,7 +275,6 @@ namespace ScriptCanvasDeveloper } QRegion region = m_graphPalette->visibleRegion(); - QRect boundingRegion = region.boundingRect(); m_indexIsVisible = region.contains(m_graphPalette->visualRect(m_displayIndex).center()); } diff --git a/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomation/EditorAutomationStates/UtilityStates.cpp b/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomation/EditorAutomationStates/UtilityStates.cpp index 459dc82542..6b0636fbdd 100644 --- a/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomation/EditorAutomationStates/UtilityStates.cpp +++ b/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomation/EditorAutomationStates/UtilityStates.cpp @@ -187,7 +187,6 @@ namespace ScriptCanvasDeveloper DeleteVariableRowFromPaletteState::DeleteVariableRowFromPaletteState(int row) : NamedAutomationState("DeleteVariableRowFromPaletteState") - , m_row(row) , m_clickAction(Qt::MouseButton::LeftButton) , m_deleteAction(VK_DELETE) { diff --git a/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomationTestDialog.h b/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomationTestDialog.h index 0284e2588e..84597a991c 100644 --- a/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomationTestDialog.h +++ b/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomationTestDialog.h @@ -133,7 +133,5 @@ namespace ScriptCanvasDeveloper QLabel* m_errorTestLabel = nullptr; QLabel* m_runLabel = nullptr; QMainWindow* m_scriptCanvasWindow = nullptr; - - QWindow* m_canvasWindow = nullptr; }; } diff --git a/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomationTests/VariableTests.cpp b/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomationTests/VariableTests.cpp index 860d9af27a..c259a626ee 100644 --- a/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomationTests/VariableTests.cpp +++ b/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomationTests/VariableTests.cpp @@ -669,7 +669,6 @@ namespace ScriptCanvasDeveloper VariableLifeCycleTest::VariableLifeCycleTest(AZStd::string name, AZStd::vector dataTypes, CreateVariableAction::CreationType creationType) : EditorAutomationTest(name.c_str()) - , m_creationType(creationType) , m_typesToMake(dataTypes) { m_variableTypeId = "ActiveVariableTypeId"; diff --git a/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomationTests/VariableTests.h b/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomationTests/VariableTests.h index d4438d222a..252227cf17 100644 --- a/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomationTests/VariableTests.h +++ b/Gems/ScriptCanvasDeveloper/Code/Editor/Source/EditorAutomationTests/VariableTests.h @@ -256,14 +256,11 @@ namespace ScriptCanvasDeveloper int SetupNextVariable(); - CreateVariableAction::CreationType m_creationType = CreateVariableAction::CreationType::AutoComplete; - ScriptCanvas::VariableId m_activeVariableId; AZStd::vector m_createVariables; AZStd::vector m_typesToMake; bool m_createVariablesNodesViaContextMenu = true; - bool m_closedGraph = false; int m_activeIndex = 0; GraphCanvas::ViewId m_viewId; diff --git a/Gems/ScriptCanvasDeveloper/Code/Editor/Source/WrapperMock.cpp b/Gems/ScriptCanvasDeveloper/Code/Editor/Source/WrapperMock.cpp index f26c36573c..6663a7a5cd 100644 --- a/Gems/ScriptCanvasDeveloper/Code/Editor/Source/WrapperMock.cpp +++ b/Gems/ScriptCanvasDeveloper/Code/Editor/Source/WrapperMock.cpp @@ -67,7 +67,6 @@ namespace ScriptCanvasDeveloper ScriptCanvasEditor::NodeIdPair nodePair; - const AZ::Vector2 scenePointVec2 = AZ::Vector2(aznumeric_cast(scenePoint.x()), aznumeric_cast(scenePoint.y())); if (result == addMock) { ScriptCanvasEditor::EditorGraphRequestBus::EventResult(nodePair, scriptCanvasId, &ScriptCanvasEditor::EditorGraphRequests::CreateCustomNode, azrtti_typeid(), AZ::Vector2(aznumeric_cast(scenePoint.x()), aznumeric_cast(scenePoint.y()))); diff --git a/Gems/ScriptCanvasPhysics/Code/Tests/ScriptCanvasPhysicsTest.cpp b/Gems/ScriptCanvasPhysics/Code/Tests/ScriptCanvasPhysicsTest.cpp index 14eb69d669..ac6109ce30 100644 --- a/Gems/ScriptCanvasPhysics/Code/Tests/ScriptCanvasPhysicsTest.cpp +++ b/Gems/ScriptCanvasPhysics/Code/Tests/ScriptCanvasPhysicsTest.cpp @@ -313,7 +313,6 @@ namespace ScriptCanvasPhysicsTests .WillByDefault(Return(m_hitResult)); // given raycast data - const AZ::Vector3 start = AZ::Vector3::CreateZero(); const AZ::Vector3 direction = AZ::Vector3(0.f,1.f,0.f); const float distance = 1.f; const AZStd::string collisionGroup = "default"; @@ -346,7 +345,6 @@ namespace ScriptCanvasPhysicsTests .WillByDefault(Return(m_hitResult)); // given raycast data - const AZ::Vector3 start = AZ::Vector3::CreateZero(); const AZ::Vector3 direction = AZ::Vector3(0.f,1.f,0.f); const float distance = 1.f; const AZStd::string collisionGroup = "default"; @@ -385,7 +383,6 @@ namespace ScriptCanvasPhysicsTests .WillByDefault(Return(m_hitResult)); // given shapecast data - const AZ::Vector3 start = AZ::Vector3::CreateZero(); const AZ::Vector3 direction = AZ::Vector3(0.f,1.f,0.f); const float distance = 1.f; const AZStd::string collisionGroup = "default"; diff --git a/Gems/ScriptCanvasTesting/Code/Tests/ScriptCanvas_Core.cpp b/Gems/ScriptCanvasTesting/Code/Tests/ScriptCanvas_Core.cpp index 406163108d..f6fce5ddb5 100644 --- a/Gems/ScriptCanvasTesting/Code/Tests/ScriptCanvas_Core.cpp +++ b/Gems/ScriptCanvasTesting/Code/Tests/ScriptCanvas_Core.cpp @@ -360,16 +360,16 @@ TEST_F(ScriptCanvasTestFixture, ValueTypes) double numberDoubleValue = *numberDouble.GetAs(); Datum numberHex(Datum(0xff)); - /*int numberHexValue =*/ *numberHex.GetAs(); + [[maybe_unused]] int numberHexValue = *numberHex.GetAs(); Datum numberPi(Datum(3.14f)); float numberPiValue = *numberPi.GetAs(); Datum numberSigned(Datum(-100)); - /*int numberSignedValue =*/ *numberSigned.GetAs(); + [[maybe_unused]] int numberSignedValue = *numberSigned.GetAs(); Datum numberUnsigned(Datum(100u)); - /*unsigned int numberUnsignedValue =*/ *numberUnsigned.GetAs(); + [[maybe_unused]] unsigned int numberUnsignedValue = *numberUnsigned.GetAs(); Datum numberDoublePi(Datum(6.28)); double numberDoublePiValue = *numberDoublePi.GetAs(); diff --git a/Gems/ScriptCanvasTesting/Code/Tests/ScriptCanvas_Variables.cpp b/Gems/ScriptCanvasTesting/Code/Tests/ScriptCanvas_Variables.cpp index 7b91768d84..01472f2e88 100644 --- a/Gems/ScriptCanvasTesting/Code/Tests/ScriptCanvas_Variables.cpp +++ b/Gems/ScriptCanvasTesting/Code/Tests/ScriptCanvas_Variables.cpp @@ -207,28 +207,24 @@ TEST_F(ScriptCanvasTestFixture, RemoveVariableTest) GraphVariableManagerRequestBus::EventResult(addPropertyOutcome, scriptCanvasId, &GraphVariableManagerRequests::AddVariable, "FirstVector3", vector3Datum1, false); EXPECT_TRUE(addPropertyOutcome); EXPECT_TRUE(addPropertyOutcome.GetValue().IsValid()); - const VariableId firstVector3Id = addPropertyOutcome.GetValue(); ++numVariablesAdded; addPropertyOutcome = AZ::Failure(AZStd::string("Uninitialized")); GraphVariableManagerRequestBus::EventResult(addPropertyOutcome, scriptCanvasId, &GraphVariableManagerRequests::AddVariable, "SecondVector3", vector3Datum2, false); EXPECT_TRUE(addPropertyOutcome); EXPECT_TRUE(addPropertyOutcome.GetValue().IsValid()); - const VariableId secondVector3Id = addPropertyOutcome.GetValue(); ++numVariablesAdded; addPropertyOutcome = AZ::Failure(AZStd::string("Uninitialized")); GraphVariableManagerRequestBus::EventResult(addPropertyOutcome, scriptCanvasId, &GraphVariableManagerRequests::AddVariable, "FirstVector4", vector4Datum, false); EXPECT_TRUE(addPropertyOutcome); EXPECT_TRUE(addPropertyOutcome.GetValue().IsValid()); - const VariableId firstVector4Id = addPropertyOutcome.GetValue(); ++numVariablesAdded; addPropertyOutcome = AZ::Failure(AZStd::string("Uninitialized")); GraphVariableManagerRequestBus::EventResult(addPropertyOutcome, scriptCanvasId, &GraphVariableManagerRequests::AddVariable, "ProjectionMatrix", behaviorMatrix4x4Datum, false); EXPECT_TRUE(addPropertyOutcome); EXPECT_TRUE(addPropertyOutcome.GetValue().IsValid()); - const VariableId projectionMatrixId = addPropertyOutcome.GetValue(); ++numVariablesAdded; addPropertyOutcome = AZ::Failure(AZStd::string("Uninitialized")); From 5e9872f7ce9a122f447ba9b6c3bf0986666436ac Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Fri, 20 Aug 2021 18:02:08 -0700 Subject: [PATCH 034/131] other gems Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Gems/LandscapeCanvas/Code/Source/Editor/MainWindow.cpp | 8 ++++---- .../DependencyBuilder/DependencyBuilderWorker.cpp | 3 +-- .../Builders/DependencyBuilder/DependencyBuilderWorker.h | 1 - Gems/LyShine/Code/Editor/ComponentHelpers.cpp | 2 +- Gems/SliceFavorites/Code/Source/FavoriteDataModel.cpp | 2 +- 5 files changed, 7 insertions(+), 9 deletions(-) diff --git a/Gems/LandscapeCanvas/Code/Source/Editor/MainWindow.cpp b/Gems/LandscapeCanvas/Code/Source/Editor/MainWindow.cpp index 2204034185..836eec682e 100644 --- a/Gems/LandscapeCanvas/Code/Source/Editor/MainWindow.cpp +++ b/Gems/LandscapeCanvas/Code/Source/Editor/MainWindow.cpp @@ -955,14 +955,14 @@ namespace LandscapeCanvasEditor auto redoAction = new QAction(QObject::tr("&Redo"), this); redoAction->setShortcut(AzQtComponents::RedoKeySequence); - QObject::connect(redoAction, &QAction::triggered, [this] { + QObject::connect(redoAction, &QAction::triggered, [] { GetLegacyEditor()->Redo(); }); menu->insertAction(separatorAction, redoAction); auto undoAction = new QAction(QObject::tr("&Undo"), this); undoAction->setShortcut(QKeySequence::Undo); - QObject::connect(undoAction, &QAction::triggered, [this] { + QObject::connect(undoAction, &QAction::triggered, [] { GetLegacyEditor()->Undo(); }); menu->insertAction(redoAction, undoAction); @@ -2852,7 +2852,7 @@ namespace LandscapeCanvasEditor // For any node with an Entity Name slot, we need to replace the string property display with a read-only version // instead until we have support for listening for GraphModel slot value changes. We need to delay this because // when the node is added, the slots haven't been added to the element map yet. - QTimer::singleShot(0, [this, node, graphId]() { + QTimer::singleShot(0, [node, graphId]() { GraphModel::SlotPtr slot = node->GetSlot(LandscapeCanvas::ENTITY_NAME_SLOT_ID); if (slot) { @@ -2976,7 +2976,7 @@ namespace LandscapeCanvasEditor AzToolsFramework::EntityIdList vegetationAreaIds; m_serializeContext->EnumerateObject(component, // beginElemCB - [this, &previewEntityId, &inboundShapeEntityId, &gradientSamplerIds, &vegetationAreaIds](void *instance, [[maybe_unused]] const AZ::SerializeContext::ClassData *classData, const AZ::SerializeContext::ClassElement *classElement) -> bool + [&previewEntityId, &inboundShapeEntityId, &gradientSamplerIds, &vegetationAreaIds](void *instance, [[maybe_unused]] const AZ::SerializeContext::ClassData *classData, const AZ::SerializeContext::ClassElement *classElement) -> bool { if (classElement && (classElement->m_typeId == azrtti_typeid())) { diff --git a/Gems/LmbrCentral/Code/Source/Builders/DependencyBuilder/DependencyBuilderWorker.cpp b/Gems/LmbrCentral/Code/Source/Builders/DependencyBuilder/DependencyBuilderWorker.cpp index c67dad89b3..dc060ee7cf 100644 --- a/Gems/LmbrCentral/Code/Source/Builders/DependencyBuilder/DependencyBuilderWorker.cpp +++ b/Gems/LmbrCentral/Code/Source/Builders/DependencyBuilder/DependencyBuilderWorker.cpp @@ -12,9 +12,8 @@ namespace DependencyBuilder { - DependencyBuilderWorker::DependencyBuilderWorker(AZStd::string jobKey, bool critical) + DependencyBuilderWorker::DependencyBuilderWorker(AZStd::string jobKey, [[maybe_unused]] bool critical) : m_jobKey(jobKey) - , m_critical(critical) { } diff --git a/Gems/LmbrCentral/Code/Source/Builders/DependencyBuilder/DependencyBuilderWorker.h b/Gems/LmbrCentral/Code/Source/Builders/DependencyBuilder/DependencyBuilderWorker.h index 91e657dc2d..76c46fde35 100644 --- a/Gems/LmbrCentral/Code/Source/Builders/DependencyBuilder/DependencyBuilderWorker.h +++ b/Gems/LmbrCentral/Code/Source/Builders/DependencyBuilder/DependencyBuilderWorker.h @@ -38,7 +38,6 @@ namespace DependencyBuilder private: AZStd::string m_jobKey; - bool m_critical = false; bool m_isShuttingDown = false; }; } diff --git a/Gems/LyShine/Code/Editor/ComponentHelpers.cpp b/Gems/LyShine/Code/Editor/ComponentHelpers.cpp index b2c3d20025..d7ba13cb7c 100644 --- a/Gems/LyShine/Code/Editor/ComponentHelpers.cpp +++ b/Gems/LyShine/Code/Editor/ComponentHelpers.cpp @@ -764,7 +764,7 @@ namespace ComponentHelpers QObject::connect(action, &QAction::triggered, hierarchy, - [serializeContext, hierarchy, componentClass, items]([[maybe_unused]] bool checked) + [hierarchy, componentClass, items]([[maybe_unused]] bool checked) { EBUS_EVENT(UiEditorInternalNotificationBus, OnBeginUndoableEntitiesChange); diff --git a/Gems/SliceFavorites/Code/Source/FavoriteDataModel.cpp b/Gems/SliceFavorites/Code/Source/FavoriteDataModel.cpp index 94b9d78247..6ef49f4a1b 100644 --- a/Gems/SliceFavorites/Code/Source/FavoriteDataModel.cpp +++ b/Gems/SliceFavorites/Code/Source/FavoriteDataModel.cpp @@ -562,7 +562,7 @@ namespace SliceFavorites // Rebuild the menu from the current tree m_favoritesMenu->clear(); - m_favoritesMenu->addAction(QIcon(":/Icons/SliceFavorite_Icon_Manage"), "Manage favorites...", m_favoritesMenu.get(), [this]() + m_favoritesMenu->addAction(QIcon(":/Icons/SliceFavorite_Icon_Manage"), "Manage favorites...", m_favoritesMenu.get(), []() { AzToolsFramework::OpenViewPane(SliceFavorites::ManageSliceFavorites); }); From 45dcbb96bacf219a16d91cf184d19be11bcdd429 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Fri, 20 Aug 2021 18:38:03 -0700 Subject: [PATCH 035/131] enable more warnings for MSVC Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- cmake/Platform/Common/MSVC/Configurations_msvc.cmake | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/cmake/Platform/Common/MSVC/Configurations_msvc.cmake b/cmake/Platform/Common/MSVC/Configurations_msvc.cmake index 9353e4eb1c..7b5646cb9e 100644 --- a/cmake/Platform/Common/MSVC/Configurations_msvc.cmake +++ b/cmake/Platform/Common/MSVC/Configurations_msvc.cmake @@ -40,12 +40,11 @@ ly_append_configurations_options( # Enabling warnings that are disabled by default from /W4 # https://docs.microsoft.com/en-us/cpp/preprocessor/compiler-warnings-that-are-off-by-default?view=vs-2019 /we4296 # 'operator': expression is always false - # /we4426 # optimization flags changed after including header, may be due to #pragma optimize() - # /we4464 # relative include path contains '..' - # /we4619 # #pragma warning: there is no warning number 'number' - # /we4777 # 'function' : format string 'string' requires an argument of type 'type1', but variadic argument number has type 'type2' - # /we5031 # #pragma warning(pop): likely mismatch, popping warning state pushed in different file - # /WE5032 # detected #pragma warning(push) with no corresponding #pragma warning(pop) + /we4426 # optimization flags changed after including header, may be due to #pragma optimize() + /we4619 # #pragma warning: there is no warning number 'number' + /we4777 # 'function' : format string 'string' requires an argument of type 'type1', but variadic argument number has type 'type2' looks useful + /we5031 # #pragma warning(pop): likely mismatch, popping warning state pushed in different file + /we5032 # detected #pragma warning(push) with no corresponding #pragma warning(pop) /Zc:forScope # Force Conformance in for Loop Scope /diagnostics:caret # Compiler diagnostic options: includes the column where the issue was found and places a caret (^) under the location in the line of code where the issue was detected. From e98bab8a75c563b2e4790c1e8f37a4bd2d4c9b42 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Fri, 20 Aug 2021 18:39:00 -0700 Subject: [PATCH 036/131] fixing format strings Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Code/Editor/LogFile.cpp | 4 ++-- Code/Editor/Util/GuidUtil.h | 4 ++-- .../Platform/Common/WinAPI/AzCore/Debug/Trace_WinAPI.cpp | 2 +- .../Platform/Windows/AzCore/Debug/StackTracer_Windows.cpp | 2 +- Code/Framework/GridMate/Tests/Carrier.cpp | 2 +- Code/Legacy/CrySystem/DebugCallStack.cpp | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Code/Editor/LogFile.cpp b/Code/Editor/LogFile.cpp index 5978356781..0a375882f6 100644 --- a/Code/Editor/LogFile.cpp +++ b/Code/Editor/LogFile.cpp @@ -288,7 +288,7 @@ AZ_POP_DISABLE_WARNING str += "Version Unknown"; } } - azsnprintf(szBuffer, MAX_LOGBUFFER_SIZE, " %d.%d", OSVerInfo.dwMajorVersion, OSVerInfo.dwMinorVersion); + azsnprintf(szBuffer, MAX_LOGBUFFER_SIZE, " %ld.%ld", OSVerInfo.dwMajorVersion, OSVerInfo.dwMinorVersion); str += szBuffer; ////////////////////////////////////////////////////////////////////// @@ -338,7 +338,7 @@ AZ_POP_DISABLE_WARNING str += " "; azstrdate(szBuffer); str += szBuffer; - azsnprintf(szBuffer, MAX_LOGBUFFER_SIZE, ", system running for %d minutes", GetTickCount() / 60000); + azsnprintf(szBuffer, MAX_LOGBUFFER_SIZE, ", system running for %ld minutes", GetTickCount() / 60000); str += szBuffer; CryLog("%s", str.toUtf8().data()); #else diff --git a/Code/Editor/Util/GuidUtil.h b/Code/Editor/Util/GuidUtil.h index 9952d6b4ed..c53589b6ca 100644 --- a/Code/Editor/Util/GuidUtil.h +++ b/Code/Editor/Util/GuidUtil.h @@ -48,7 +48,7 @@ inline bool GuidUtil::IsEmpty(REFGUID guid) inline const char* GuidUtil::ToString(REFGUID guid) { static char guidString[64]; - sprintf_s(guidString, "{%.8X-%.4X-%.4X-%.2X%.2X-%.2X%.2X%.2X%.2X%.2X%.2X}", guid.Data1, guid.Data2, guid.Data3, guid.Data4[0], guid.Data4[1], + sprintf_s(guidString, "{%.8lX-%.4X-%.4X-%.2X%.2X-%.2X%.2X%.2X%.2X%.2X%.2X}", guid.Data1, guid.Data2, guid.Data3, guid.Data4[0], guid.Data4[1], guid.Data4[2], guid.Data4[3], guid.Data4[4], guid.Data4[5], guid.Data4[6], guid.Data4[7]); return guidString; } @@ -62,7 +62,7 @@ inline GUID GuidUtil::FromString(const char* guidString) guid.Data1 = 0; guid.Data2 = 0; guid.Data3 = 0; - azsscanf(guidString, "{%8" SCNx32 "-%4hX-%4hX-%2X%2X-%2X%2X%2X%2X%2X%2X}", + azsscanf(guidString, "{%8lX-%4hX-%4hX-%2X%2X-%2X%2X%2X%2X%2X%2X}", &guid.Data1, &guid.Data2, &guid.Data3, &d[0], &d[1], &d[2], &d[3], &d[4], &d[5], &d[6], &d[7]); guid.Data4[0] = static_cast(d[0]); guid.Data4[1] = static_cast(d[1]); diff --git a/Code/Framework/AzCore/Platform/Common/WinAPI/AzCore/Debug/Trace_WinAPI.cpp b/Code/Framework/AzCore/Platform/Common/WinAPI/AzCore/Debug/Trace_WinAPI.cpp index 99ea10e4bc..02c1988215 100644 --- a/Code/Framework/AzCore/Platform/Common/WinAPI/AzCore/Debug/Trace_WinAPI.cpp +++ b/Code/Framework/AzCore/Platform/Common/WinAPI/AzCore/Debug/Trace_WinAPI.cpp @@ -145,7 +145,7 @@ namespace AZ char message[g_maxMessageLength]; Debug::Trace::Instance().Output(nullptr, "==================================================================\n"); - azsnprintf(message, g_maxMessageLength, "Exception : 0x%X - '%s' [%p]\n", ExceptionInfo->ExceptionRecord->ExceptionCode, GetExeptionName(ExceptionInfo->ExceptionRecord->ExceptionCode), ExceptionInfo->ExceptionRecord->ExceptionAddress); + azsnprintf(message, g_maxMessageLength, "Exception : 0x%lX - '%s' [%p]\n", ExceptionInfo->ExceptionRecord->ExceptionCode, GetExeptionName(ExceptionInfo->ExceptionRecord->ExceptionCode), ExceptionInfo->ExceptionRecord->ExceptionAddress); Debug::Trace::Instance().Output(nullptr, message); EBUS_EVENT(Debug::TraceMessageDrillerBus, OnException, message); diff --git a/Code/Framework/AzCore/Platform/Windows/AzCore/Debug/StackTracer_Windows.cpp b/Code/Framework/AzCore/Platform/Windows/AzCore/Debug/StackTracer_Windows.cpp index c4a12730ad..4558a6a3aa 100644 --- a/Code/Framework/AzCore/Platform/Windows/AzCore/Debug/StackTracer_Windows.cpp +++ b/Code/Framework/AzCore/Platform/Windows/AzCore/Debug/StackTracer_Windows.cpp @@ -478,7 +478,7 @@ namespace AZ { DWORD displacement; if (g_SymGetLineFromAddr64(g_currentProcess, pc, &displacement, &line) && line.FileName[0] != 0) { - azsnprintf(textLine, textLineSize, "%s (%d) : ", line.FileName, line.LineNumber); + azsnprintf(textLine, textLineSize, "%s (%ld) : ", line.FileName, line.LineNumber); } else { diff --git a/Code/Framework/GridMate/Tests/Carrier.cpp b/Code/Framework/GridMate/Tests/Carrier.cpp index 8d3ec4eef6..9a18eb9a2c 100644 --- a/Code/Framework/GridMate/Tests/Carrier.cpp +++ b/Code/Framework/GridMate/Tests/Carrier.cpp @@ -1707,7 +1707,7 @@ TEST_F(GridMateCarrierTestFixture, Test_GetSocketErrorString) static constexpr char posixErrorWouldBlockPosixErrStr[] = "Resource temporarily unavailable"; azsnprintf(expectedBuffer.data(), expectedBuffer.size()-1 , "%s", posixErrorWouldBlockPosixErrStr); #else - azsnprintf(expectedBuffer.data(), expectedBuffer.size()-1 , "%d", AZ_EWOULDBLOCK); + azsnprintf(expectedBuffer.data(), expectedBuffer.size()-1 , "%ld", AZ_EWOULDBLOCK); #endif // !AZ_TRAIT_USE_POSIX_STRERROR_R EXPECT_STREQ(expectedBuffer.data(), socketErrorString); EXPECT_STREQ(expectedBuffer.data(), buffer.data()); diff --git a/Code/Legacy/CrySystem/DebugCallStack.cpp b/Code/Legacy/CrySystem/DebugCallStack.cpp index cdfc5de21e..bea6c8c035 100644 --- a/Code/Legacy/CrySystem/DebugCallStack.cpp +++ b/Code/Legacy/CrySystem/DebugCallStack.cpp @@ -284,7 +284,7 @@ int DebugCallStack::handleException(EXCEPTION_POINTERS* exception_pointer) char excAddr[80]; WriteLineToLog(""); sprintf_s(excAddr, "0x%04X:0x%p", exception_pointer->ContextRecord->SegCs, exception_pointer->ExceptionRecord->ExceptionAddress); - sprintf_s(excCode, "0x%08X", exception_pointer->ExceptionRecord->ExceptionCode); + sprintf_s(excCode, "0x%08lX", exception_pointer->ExceptionRecord->ExceptionCode); WriteLineToLog("Exception: %s, at Address: %s", excCode, excAddr); } @@ -445,7 +445,7 @@ void DebugCallStack::LogExceptionInfo(EXCEPTION_POINTERS* pex) else { sprintf_s(excAddr, "0x%04X:0x%p", pex->ContextRecord->SegCs, pex->ExceptionRecord->ExceptionAddress); - sprintf_s(excCode, "0x%08X", pex->ExceptionRecord->ExceptionCode); + sprintf_s(excCode, "0x%08lX", pex->ExceptionRecord->ExceptionCode); excName = TranslateExceptionCode(pex->ExceptionRecord->ExceptionCode); azstrcpy(desc, AZ_ARRAY_SIZE(desc), ""); sprintf_s(excDesc, "%s\r\n%s", excName, desc); From 2e228d94f09c4e5f50e58300146aebf0304d776a Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Fri, 20 Aug 2021 18:39:40 -0700 Subject: [PATCH 037/131] push/pop mismatch Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Code/Editor/TrackView/TrackViewPythonFuncs.h | 2 +- .../AzToolsFramework/Application/ToolsApplication.cpp | 2 +- .../UI/LegacyFramework/Core/EditorFrameworkApplication.cpp | 2 +- Code/Tools/SceneAPI/SceneCore/Containers/Scene.h | 2 +- Code/Tools/SceneAPI/SceneCore/Containers/SceneManifest.h | 2 +- .../SceneAPI/SceneCore/Utilities/CoordinateSystemConverter.h | 2 +- .../View/Widgets/LoggingPanel/PivotTree/PivotTreeWidget.cpp | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Code/Editor/TrackView/TrackViewPythonFuncs.h b/Code/Editor/TrackView/TrackViewPythonFuncs.h index 8be1bd140c..6442145ee3 100644 --- a/Code/Editor/TrackView/TrackViewPythonFuncs.h +++ b/Code/Editor/TrackView/TrackViewPythonFuncs.h @@ -35,7 +35,7 @@ namespace AzToolsFramework : public AZ::Component , public EditorLayerTrackViewRequestBus::Handler { - AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING + AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING AZ_POP_DISABLE_DLL_EXPORT_BASECLASS_WARNING public: AZ_COMPONENT(TrackViewComponent, "{3CF943CC-6F10-4B19-88FC-CFB697558FFD}") diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Application/ToolsApplication.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Application/ToolsApplication.cpp index 3e895465e5..90897090cc 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Application/ToolsApplication.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Application/ToolsApplication.cpp @@ -70,7 +70,7 @@ #include AZ_PUSH_DISABLE_WARNING(4251, "-Wunknown-warning-option") // 4251: 'QFileInfo::d_ptr': class 'QSharedDataPointer' needs to have dll-interface to be used by clients of class 'QFileInfo' #include -AZ_POP_DISABLE_OVERRIDE_WARNING +AZ_POP_DISABLE_WARNING #include #include #include diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/LegacyFramework/Core/EditorFrameworkApplication.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/LegacyFramework/Core/EditorFrameworkApplication.cpp index 503cbc1d65..58dba5d1dd 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/LegacyFramework/Core/EditorFrameworkApplication.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/LegacyFramework/Core/EditorFrameworkApplication.cpp @@ -50,7 +50,7 @@ AZ_PUSH_DISABLE_WARNING(4251, "-Wunknown-warning-option") // 'QFileInfo::d_ptr': class 'QSharedDataPointer' needs to have dll-interface to be used by clients of class 'QFileInfo' #include -AZ_POP_DISABLE_OVERRIDE_WARNING +AZ_POP_DISABLE_WARNING #include #include #include diff --git a/Code/Tools/SceneAPI/SceneCore/Containers/Scene.h b/Code/Tools/SceneAPI/SceneCore/Containers/Scene.h index c96ebd25e1..49320c4592 100644 --- a/Code/Tools/SceneAPI/SceneCore/Containers/Scene.h +++ b/Code/Tools/SceneAPI/SceneCore/Containers/Scene.h @@ -63,7 +63,7 @@ namespace AZ SceneGraph m_graph; SceneManifest m_manifest; SceneOrientation m_originalOrientation = SceneOrientation::YUp; - AZ_POP_DISABLE_OVERRIDE_WARNING + AZ_POP_DISABLE_WARNING }; } // Containers } // SceneAPI diff --git a/Code/Tools/SceneAPI/SceneCore/Containers/SceneManifest.h b/Code/Tools/SceneAPI/SceneCore/Containers/SceneManifest.h index 00df1bca21..4386d4fd8c 100644 --- a/Code/Tools/SceneAPI/SceneCore/Containers/SceneManifest.h +++ b/Code/Tools/SceneAPI/SceneCore/Containers/SceneManifest.h @@ -106,7 +106,7 @@ namespace AZ AZ_PUSH_DISABLE_WARNING(4251, "-Wunknown-warning-option") StorageLookup m_storageLookup; ValueStorage m_values; - AZ_POP_DISABLE_OVERRIDE_WARNING + AZ_POP_DISABLE_WARNING }; } // Containers } // SceneAPI diff --git a/Code/Tools/SceneAPI/SceneCore/Utilities/CoordinateSystemConverter.h b/Code/Tools/SceneAPI/SceneCore/Utilities/CoordinateSystemConverter.h index 24f7243b32..11ba8cd391 100644 --- a/Code/Tools/SceneAPI/SceneCore/Utilities/CoordinateSystemConverter.h +++ b/Code/Tools/SceneAPI/SceneCore/Utilities/CoordinateSystemConverter.h @@ -55,7 +55,7 @@ namespace AZ::SceneAPI AZ::Transform m_targetTransform; AZ::Transform m_conversionTransform; AZ::Transform m_conversionTransformInversed; - AZ_POP_DISABLE_OVERRIDE_WARNING + AZ_POP_DISABLE_WARNING AZ::u32 m_targetBasisIndices[3]; bool m_needsConversion; bool m_sourceRightHanded; diff --git a/Gems/ScriptCanvas/Code/Editor/View/Widgets/LoggingPanel/PivotTree/PivotTreeWidget.cpp b/Gems/ScriptCanvas/Code/Editor/View/Widgets/LoggingPanel/PivotTree/PivotTreeWidget.cpp index 7a84fc3965..a34b42bed8 100644 --- a/Gems/ScriptCanvas/Code/Editor/View/Widgets/LoggingPanel/PivotTree/PivotTreeWidget.cpp +++ b/Gems/ScriptCanvas/Code/Editor/View/Widgets/LoggingPanel/PivotTree/PivotTreeWidget.cpp @@ -14,7 +14,7 @@ // Disable warnings in moc code AZ_PUSH_DISABLE_WARNING(4251 4800, "-Wunknown-warning-option") #include -AZ_POP_DISABLE_OVERRIDE_WARNING +AZ_POP_DISABLE_WARNING namespace ScriptCanvasEditor { From 3eb795a305614d2b9544b31dea4eca31fa9801f4 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Fri, 20 Aug 2021 18:40:20 -0700 Subject: [PATCH 038/131] alignment mismatches Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Code/Legacy/CryCommon/Cry_Camera.h | 2 +- Code/Legacy/CryCommon/IShader.h | 2 +- Code/Legacy/CryCommon/platform_impl.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Code/Legacy/CryCommon/Cry_Camera.h b/Code/Legacy/CryCommon/Cry_Camera.h index 851611c8a6..9db4340fcb 100644 --- a/Code/Legacy/CryCommon/Cry_Camera.h +++ b/Code/Legacy/CryCommon/Cry_Camera.h @@ -2146,7 +2146,7 @@ inline uint8 CCamera::IsOBBVisible_EH(const Vec3& wpos, const OBB& obb, f32 usca //--- ADDITIONAL-TEST --- //------------------------------------------------------------------------------ -extern _MS_ALIGN(64) uint32 BoxSides[]; +extern _MS_ALIGN(64) uint32 BoxSides[] _ALIGN(64); // Description: // A box can easily straddle one of the view-frustum planes far diff --git a/Code/Legacy/CryCommon/IShader.h b/Code/Legacy/CryCommon/IShader.h index 6ae3bd73df..da7b64e96b 100644 --- a/Code/Legacy/CryCommon/IShader.h +++ b/Code/Legacy/CryCommon/IShader.h @@ -770,7 +770,7 @@ _MS_ALIGN(16) struct SSkinningData SSkinningData* pNextSkinningData; // List to the next element which needs SW-Skinning } _ALIGN(16); -struct SRenderObjData +struct _MS_ALIGN(16) SRenderObjData { uintptr_t m_uniqueObjectId; diff --git a/Code/Legacy/CryCommon/platform_impl.cpp b/Code/Legacy/CryCommon/platform_impl.cpp index ecc196a49f..a89df5471a 100644 --- a/Code/Legacy/CryCommon/platform_impl.cpp +++ b/Code/Legacy/CryCommon/platform_impl.cpp @@ -404,7 +404,7 @@ _MS_ALIGN(64) uint32 BoxSides[0x40 * 8] = { 0, 0, 0, 0, 0, 0, 0, 0, //3d 0, 0, 0, 0, 0, 0, 0, 0, //3e 0, 0, 0, 0, 0, 0, 0, 0, //3f -}; +} _ALIGN(64); //////////////////////////////////////////////////////////////////////////////////////////////////////////// #if defined(AZ_RESTRICTED_PLATFORM) From 72ff6080adfbc4da5242f44ec5ff24831d85b48b Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Fri, 20 Aug 2021 18:59:12 -0700 Subject: [PATCH 039/131] format fix Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Code/Editor/LogFile.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Code/Editor/LogFile.cpp b/Code/Editor/LogFile.cpp index 0a375882f6..a89251d52f 100644 --- a/Code/Editor/LogFile.cpp +++ b/Code/Editor/LogFile.cpp @@ -388,7 +388,7 @@ AZ_POP_DISABLE_WARNING L"(Unknown graphics card)", szLanguageBufferW, sizeof(szLanguageBufferW), L"system.ini"); AZStd::to_string(szLanguageBuffer, szLanguageBufferW); - azsnprintf(szBuffer, MAX_LOGBUFFER_SIZE, "Current display mode is %dx%dx%d, %s", + azsnprintf(szBuffer, MAX_LOGBUFFER_SIZE, "Current display mode is %ldx%ldx%ld, %s", DisplayConfig.dmPelsWidth, DisplayConfig.dmPelsHeight, DisplayConfig.dmBitsPerPel, szLanguageBuffer.c_str()); CryLog("%s", szBuffer); From 2dbac8fe2577228596102dc44a2e7bfd2cd79d5e Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Fri, 20 Aug 2021 19:02:13 -0700 Subject: [PATCH 040/131] addressing comment Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- cmake/Platform/Common/MSVC/Configurations_msvc.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/Platform/Common/MSVC/Configurations_msvc.cmake b/cmake/Platform/Common/MSVC/Configurations_msvc.cmake index 7b5646cb9e..83ae51b408 100644 --- a/cmake/Platform/Common/MSVC/Configurations_msvc.cmake +++ b/cmake/Platform/Common/MSVC/Configurations_msvc.cmake @@ -42,7 +42,7 @@ ly_append_configurations_options( /we4296 # 'operator': expression is always false /we4426 # optimization flags changed after including header, may be due to #pragma optimize() /we4619 # #pragma warning: there is no warning number 'number' - /we4777 # 'function' : format string 'string' requires an argument of type 'type1', but variadic argument number has type 'type2' looks useful + /we4777 # 'function' : format string 'string' requires an argument of type 'type1', but variadic argument number has type 'type2 /we5031 # #pragma warning(pop): likely mismatch, popping warning state pushed in different file /we5032 # detected #pragma warning(push) with no corresponding #pragma warning(pop) From c07b9d31bf1c1aca107823b5ad91c3fb1b0641af Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Fri, 20 Aug 2021 19:21:50 -0700 Subject: [PATCH 041/131] PR comments/improvements Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Code/Framework/AzCore/AzCore/Math/Guid.h | 2 +- Code/Framework/AzNetworking/AzNetworking/Utilities/Endian.h | 4 ++-- Code/Legacy/CryCommon/CryLibrary.h | 6 +++--- Code/Legacy/CrySystem/XML/xml.cpp | 4 ++-- Gems/AtomLyIntegration/AtomFont/Code/Source/AtomFont.cpp | 1 - 5 files changed, 8 insertions(+), 9 deletions(-) diff --git a/Code/Framework/AzCore/AzCore/Math/Guid.h b/Code/Framework/AzCore/AzCore/Math/Guid.h index e2a56f86d8..9889092743 100644 --- a/Code/Framework/AzCore/AzCore/Math/Guid.h +++ b/Code/Framework/AzCore/AzCore/Math/Guid.h @@ -66,7 +66,7 @@ typedef const GUID& REFIID; const GUID name \ = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } } -inline static REFGUID GUID_NULL() +inline REFGUID GUID_NULL() { static GUID guid = { 0x00000000L, 0x0000, 0x0000, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} }; return guid; diff --git a/Code/Framework/AzNetworking/AzNetworking/Utilities/Endian.h b/Code/Framework/AzNetworking/AzNetworking/Utilities/Endian.h index df6dd87494..74bcd53877 100644 --- a/Code/Framework/AzNetworking/AzNetworking/Utilities/Endian.h +++ b/Code/Framework/AzNetworking/AzNetworking/Utilities/Endian.h @@ -14,14 +14,14 @@ #include #if AZ_TRAIT_NEEDS_HTONLL -inline static const uint64_t htonll(uint64_t value) +inline const uint64_t htonll(uint64_t value) { const uint32_t hiValue = htonl(static_cast(value >> 32)); const uint32_t loValue = htonl(static_cast(value & 0x00000000FFFFFFFF)); return static_cast(hiValue) << 32 | static_cast(loValue); } -inline static const uint64_t ntohll(uint64_t value) +inline const uint64_t ntohll(uint64_t value) { return htonll(value); } diff --git a/Code/Legacy/CryCommon/CryLibrary.h b/Code/Legacy/CryCommon/CryLibrary.h index b7e1c0f359..e12e7c6c36 100644 --- a/Code/Legacy/CryCommon/CryLibrary.h +++ b/Code/Legacy/CryCommon/CryLibrary.h @@ -97,14 +97,14 @@ static const char* GetModulePath() return getenv(gEnvName); } -inline static void SetModulePath(const char* pModulePath) +inline void SetModulePath(const char* pModulePath) { setenv(gEnvName, pModulePath ? pModulePath : "", true); } // bInModulePath is only ever set to false in RC, because rc needs to load dlls from a $PATH that // it has modified to include .. -inline static HMODULE CryLoadLibrary(const char* libName, bool bLazy = false, bool bInModulePath = true) +inline HMODULE CryLoadLibrary(const char* libName, bool bLazy = false, bool bInModulePath = true) { const char* libPath = nullptr; char pathBuffer[MAX_PATH] = {0}; @@ -161,7 +161,7 @@ inline static HMODULE CryLoadLibrary(const char* libName, bool bLazy = false, bo return module; } -inline static bool CryFreeLibrary(void* lib) +inline bool CryFreeLibrary(void* lib) { if (lib) { diff --git a/Code/Legacy/CrySystem/XML/xml.cpp b/Code/Legacy/CrySystem/XML/xml.cpp index ccc878b8f1..a6f3d5b564 100644 --- a/Code/Legacy/CrySystem/XML/xml.cpp +++ b/Code/Legacy/CrySystem/XML/xml.cpp @@ -1756,9 +1756,9 @@ XmlNodeRef XmlParserImp::ParseFile(const char* filename, XmlString& errorString, { // not binary XML - refuse to load if in scripts dir and not in bin xml to help reduce hacking // wish we could compile the text xml parser out, but too much work to get everything moved over - AZStd::fixed_string<32> strScripts = {"Scripts/"}; + constexpr AZStd::fixed_string<32> strScripts{"Scripts/"}; // exclude files and PAKs from Mods folder - AZStd::fixed_string<8> modsStr = {"Mods/"}; + constexpr AZStd::fixed_string<8> modsStr{"Mods/"}; if (_strnicmp(filename, strScripts.c_str(), strScripts.length()) == 0 && _strnicmp(adjustedFilename.c_str(), modsStr.c_str(), modsStr.length()) != 0 && _strnicmp(pakPath.c_str(), modsStr.c_str(), modsStr.length()) != 0) diff --git a/Gems/AtomLyIntegration/AtomFont/Code/Source/AtomFont.cpp b/Gems/AtomLyIntegration/AtomFont/Code/Source/AtomFont.cpp index 769c6fd51d..8c88a49b12 100644 --- a/Gems/AtomLyIntegration/AtomFont/Code/Source/AtomFont.cpp +++ b/Gems/AtomLyIntegration/AtomFont/Code/Source/AtomFont.cpp @@ -328,7 +328,6 @@ namespace } AZ::AtomFont::AtomFont([[maybe_unused]] ISystem* system) - : m_fonts() { CryLogAlways("Using FreeType %d.%d.%d", FREETYPE_MAJOR, FREETYPE_MINOR, FREETYPE_PATCH); From 7558a3d233f2eb37e9f10c3942c268542f5dbf9c Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Fri, 20 Aug 2021 19:40:13 -0700 Subject: [PATCH 042/131] fixes for Android Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../AtomCore/Serialization/Json/JsonUtils.cpp | 1 - .../Math/Internal/SimdMathVec4_scalar.inl | 1 - .../AzFramework/Application/Application.cpp | 6 +-- Code/Legacy/CryCommon/CryLibrary.h | 5 +- Code/Legacy/CryCommon/WinBase.cpp | 2 +- Code/Legacy/CrySystem/System.cpp | 54 ------------------- 6 files changed, 6 insertions(+), 63 deletions(-) diff --git a/Code/Framework/AtomCore/AtomCore/Serialization/Json/JsonUtils.cpp b/Code/Framework/AtomCore/AtomCore/Serialization/Json/JsonUtils.cpp index 1d3a9674a0..157a6c6074 100644 --- a/Code/Framework/AtomCore/AtomCore/Serialization/Json/JsonUtils.cpp +++ b/Code/Framework/AtomCore/AtomCore/Serialization/Json/JsonUtils.cpp @@ -31,7 +31,6 @@ namespace AZ static const char* FileType = "JsonSerialization"; static const char* VersionTag = "Version"; static const char* ClassNameTag = "ClassName"; - static const char* ClassIdTag = "ClassId"; static const char* ClassDataTag = "ClassData"; AZ::Outcome WriteJsonString(const rapidjson::Document& document, AZStd::string& jsonText, WriteJsonSettings settings) diff --git a/Code/Framework/AzCore/AzCore/Math/Internal/SimdMathVec4_scalar.inl b/Code/Framework/AzCore/AzCore/Math/Internal/SimdMathVec4_scalar.inl index 484351c799..68d4f103fe 100644 --- a/Code/Framework/AzCore/AzCore/Math/Internal/SimdMathVec4_scalar.inl +++ b/Code/Framework/AzCore/AzCore/Math/Internal/SimdMathVec4_scalar.inl @@ -867,7 +867,6 @@ namespace AZ const FloatType cols0 = {{ rows[0].v[0], rows[1].v[0], rows[2].v[0], 0.0f }}; const FloatType cols1 = {{ rows[0].v[1], rows[1].v[1], rows[2].v[1], 0.0f }}; const FloatType cols2 = {{ rows[0].v[2], rows[1].v[2], rows[2].v[2], 0.0f }}; - const FloatType cols3 = {{ rows[0].v[3], rows[1].v[3], rows[2].v[3], 1.0f }}; out[0] = cols0; out[1] = cols1; out[2] = cols2; diff --git a/Code/Framework/AzFramework/AzFramework/Application/Application.cpp b/Code/Framework/AzFramework/AzFramework/Application/Application.cpp index abd97aee0d..24c9d6045c 100644 --- a/Code/Framework/AzFramework/AzFramework/Application/Application.cpp +++ b/Code/Framework/AzFramework/AzFramework/Application/Application.cpp @@ -632,6 +632,9 @@ namespace AzFramework static void CreateUserCache(const AZ::IO::FixedMaxPath& cacheUserPath, AZ::IO::FileIOBase& fileIoBase) { + constexpr const char* userCachePathFilename{ "Cache" }; + AZ::IO::FixedMaxPath userCachePath = cacheUserPath / userCachePathFilename; +#if AZ_TRAIT_OS_IS_HOST_OS_PLATFORM // The number of max attempts ultimately dictates the number of Lumberyard instances that can run // simultaneously. This should be a reasonably high number so that it doesn't artificially limit // the number of instances (ex: parallel level exports via multiple Editor runs). It also shouldn't @@ -640,9 +643,6 @@ namespace AzFramework // 128 seems like a reasonable compromise. constexpr int maxAttempts = 128; - constexpr const char* userCachePathFilename{ "Cache" }; - AZ::IO::FixedMaxPath userCachePath = cacheUserPath / userCachePathFilename; -#if AZ_TRAIT_OS_IS_HOST_OS_PLATFORM int attemptNumber; for (attemptNumber = 0; attemptNumber < maxAttempts; ++attemptNumber) { diff --git a/Code/Legacy/CryCommon/CryLibrary.h b/Code/Legacy/CryCommon/CryLibrary.h index e12e7c6c36..995ba0abc5 100644 --- a/Code/Legacy/CryCommon/CryLibrary.h +++ b/Code/Legacy/CryCommon/CryLibrary.h @@ -92,7 +92,7 @@ using DetachEnvironmentFunction = void(*)(); #define HMODULE void* static const char* gEnvName("MODULE_PATH"); -static const char* GetModulePath() +inline const char* GetModulePath() { return getenv(gEnvName); } @@ -107,8 +107,6 @@ inline void SetModulePath(const char* pModulePath) inline HMODULE CryLoadLibrary(const char* libName, bool bLazy = false, bool bInModulePath = true) { const char* libPath = nullptr; - char pathBuffer[MAX_PATH] = {0}; - libPath = libName; #if !defined(AZ_PLATFORM_ANDROID) @@ -135,6 +133,7 @@ inline HMODULE CryLoadLibrary(const char* libName, bool bLazy = false, bool bInM } #endif } + char pathBuffer[MAX_PATH] = {0}; sprintf_s(pathBuffer, "%s/%s", modulePath, libName); libPath = pathBuffer; } diff --git a/Code/Legacy/CryCommon/WinBase.cpp b/Code/Legacy/CryCommon/WinBase.cpp index 99e01f7194..595e9091d6 100644 --- a/Code/Legacy/CryCommon/WinBase.cpp +++ b/Code/Legacy/CryCommon/WinBase.cpp @@ -829,7 +829,7 @@ const int comparePathNames(const char* cpFirst, const char* cpSecond, unsigned i return memicmp(first.c_str(), second.c_str(), length); } -#if defined(LINUX) || defined(APPLE) || defined(DEFINE_FIX_ONE_PATH_ELEMENT) +#if (defined(LINUX) || defined(APPLE)) && defined(DEFINE_FIX_ONE_PATH_ELEMENT) static bool FixOnePathElement(char* path) { if (*path == '\0') diff --git a/Code/Legacy/CrySystem/System.cpp b/Code/Legacy/CrySystem/System.cpp index 28940e32ac..97a2d07b3c 100644 --- a/Code/Legacy/CrySystem/System.cpp +++ b/Code/Legacy/CrySystem/System.cpp @@ -164,60 +164,6 @@ SSystemCVars g_cvars; #include #include "AZCoreLogSink.h" -#if defined(ANDROID) -namespace -{ - struct Callstack - { - Callstack() - : addrs(NULL) - , ignore(0) - , count(0) - { - } - Callstack(void** addrs, size_t ignore, size_t count) - { - this->addrs = addrs; - this->ignore = ignore; - this->count = count; - } - void** addrs; - size_t ignore; - size_t count; - }; - - static _Unwind_Reason_Code trace_func(struct _Unwind_Context* context, void* arg) - { - Callstack* cs = static_cast(arg); - if (cs->count) - { - void* ip = (void*) _Unwind_GetIP(context); - if (ip) - { - if (cs->ignore) - { - cs->ignore--; - } - else - { - cs->addrs[0] = ip; - cs->addrs++; - cs->count--; - } - } - } - return _URC_NO_REASON; - } - - static int Backtrace(void** addrs, size_t ignore, size_t size) - { - Callstack cs(addrs, ignore, size); - _Unwind_Backtrace(trace_func, (void*) &cs); - return size - cs.count; - } -} -#endif - ///////////////////////////////////////////////////////////////////////////////// // System Implementation. ////////////////////////////////////////////////////////////////////////// From 25284fb3a7e83616a0fa2c04d3eb3fc23dee3e9c Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Fri, 20 Aug 2021 19:40:25 -0700 Subject: [PATCH 043/131] fixes for Android Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../MicrophoneSystemComponent_Android.cpp | 74 +++++++++---------- 1 file changed, 36 insertions(+), 38 deletions(-) diff --git a/Gems/Microphone/Code/Source/Platform/Android/MicrophoneSystemComponent_Android.cpp b/Gems/Microphone/Code/Source/Platform/Android/MicrophoneSystemComponent_Android.cpp index f30bef03ae..1e696f7978 100644 --- a/Gems/Microphone/Code/Source/Platform/Android/MicrophoneSystemComponent_Android.cpp +++ b/Gems/Microphone/Code/Source/Platform/Android/MicrophoneSystemComponent_Android.cpp @@ -121,53 +121,51 @@ namespace Audio AZStd::size_t GetData(void** outputData, AZStd::size_t numFrames, const SAudioInputConfig& targetConfig, bool shouldDeinterleave) { - - bool changeSampleType = (targetConfig.m_sampleType != m_config.m_sampleType); - bool changeSampleRate = (targetConfig.m_sampleRate != m_config.m_sampleRate); - bool changeNumChannels = (targetConfig.m_numChannels != m_config.m_numChannels); - #if defined(USE_LIBSAMPLERATE) return {}; #else - if (changeSampleType || changeNumChannels) - { - // Without the SRC library, any change is unsupported! - return {}; - } - else if (changeSampleRate) - { - if(targetConfig.m_sampleRate > m_config.m_sampleRate) + bool changeSampleType = (targetConfig.m_sampleType != m_config.m_sampleType); + bool changeSampleRate = (targetConfig.m_sampleRate != m_config.m_sampleRate); + bool changeNumChannels = (targetConfig.m_numChannels != m_config.m_numChannels); + if (changeSampleType || changeNumChannels) { - AZ_Error("MacOSMicrophone", false, "Target sample rate is larger than source sample rate, this is not supported"); + // Without the SRC library, any change is unsupported! return {}; } - - auto sourceBuffer = new AZ::s16[numFrames]; - AZStd::size_t targetSize = GetDownsampleSize(numFrames, m_config.m_sampleRate, targetConfig.m_sampleRate); - auto targetBuffer = new AZ::s16[targetSize]; - - numFrames = m_captureData->ConsumeData(reinterpret_cast(&sourceBuffer), numFrames, m_config.m_numChannels, false); - - - if(numFrames > 0) + else if (changeSampleRate) { - Downsample(sourceBuffer, numFrames, m_config.m_sampleRate, targetBuffer, targetSize, targetConfig.m_sampleRate); + if(targetConfig.m_sampleRate > m_config.m_sampleRate) + { + AZ_Error("MacOSMicrophone", false, "Target sample rate is larger than source sample rate, this is not supported"); + return {}; + } - numFrames = targetSize; - // swap target data to output - ::memcpy(*outputData, targetBuffer, targetSize * 2); //*2 as two bytes per frame + auto sourceBuffer = new AZ::s16[numFrames]; + AZStd::size_t targetSize = GetDownsampleSize(numFrames, m_config.m_sampleRate, targetConfig.m_sampleRate); + auto targetBuffer = new AZ::s16[targetSize]; + + numFrames = m_captureData->ConsumeData(reinterpret_cast(&sourceBuffer), numFrames, m_config.m_numChannels, false); + + + if(numFrames > 0) + { + Downsample(sourceBuffer, numFrames, m_config.m_sampleRate, targetBuffer, targetSize, targetConfig.m_sampleRate); + + numFrames = targetSize; + // swap target data to output + ::memcpy(*outputData, targetBuffer, targetSize * 2); //*2 as two bytes per frame + } + + delete [] sourceBuffer; + delete [] targetBuffer; + + return numFrames; + } + else + { + // No change to the data from Input to Output + return m_captureData->ConsumeData(outputData, numFrames, m_config.m_numChannels, shouldDeinterleave); } - - delete [] sourceBuffer; - delete [] targetBuffer; - - return numFrames; - } - else - { - // No change to the data from Input to Output - return m_captureData->ConsumeData(outputData, numFrames, m_config.m_numChannels, shouldDeinterleave); - } #endif } From 7d71e3dc07d7515630cc3d62aa30847de09f4995 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Mon, 23 Aug 2021 13:00:27 -0700 Subject: [PATCH 044/131] Code/Editor Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Code/Editor/Controls/ImageHistogramCtrl.cpp | 6 ------ Code/Editor/Controls/TimelineCtrl.cpp | 5 ----- Code/Editor/FBXExporterDialog.cpp | 6 ------ Code/Editor/IconManager.cpp | 13 ------------ Code/Editor/LevelFileDialog.cpp | 16 -------------- Code/Editor/MainWindow.cpp | 6 ------ .../Objects/ComponentEntityObject.cpp | 5 ----- Code/Editor/ToolsConfigPage.cpp | 2 -- Code/Editor/TopRendererWnd.cpp | 21 ------------------- .../TrackView/TVCustomizeTrackColorsDlg.cpp | 1 - Code/Editor/TrackView/TVEventsDialog.cpp | 6 ------ Code/Editor/TrackView/TrackViewDialog.cpp | 3 --- 12 files changed, 90 deletions(-) diff --git a/Code/Editor/Controls/ImageHistogramCtrl.cpp b/Code/Editor/Controls/ImageHistogramCtrl.cpp index 252bf4f09b..48bc7a70d2 100644 --- a/Code/Editor/Controls/ImageHistogramCtrl.cpp +++ b/Code/Editor/Controls/ImageHistogramCtrl.cpp @@ -30,12 +30,6 @@ namespace ImageHistogram const QColor kGreenSectionColor = QColor(220, 255, 220); const QColor kBlueSectionColor = QColor(220, 220, 255); const QColor kSplitSeparatorColor = QColor(100, 100, 0); - const QColor kButtonBackColor = QColor(20, 20, 20); - const QColor kBtnLightColor(200, 200, 200); - const QColor kBtnShadowColor(50, 50, 50); - const int kButtonWidth = 40; - const QColor kButtonTextColor(255, 255, 0); - const int kTextLeftSpacing = 4; const int kTextFontSize = 70; const char* kTextFontFace = "Arial"; const QColor kTextColor(255, 255, 255); diff --git a/Code/Editor/Controls/TimelineCtrl.cpp b/Code/Editor/Controls/TimelineCtrl.cpp index 8159084784..aa30c326ac 100644 --- a/Code/Editor/Controls/TimelineCtrl.cpp +++ b/Code/Editor/Controls/TimelineCtrl.cpp @@ -18,11 +18,6 @@ #include "ScopedVariableSetter.h" #include "GridUtils.h" - -static const QColor timeMarkerCol = QColor(255, 0, 255); -static const QColor textCol = QColor(0, 0, 0); -static const QColor ltgrayCol = QColor(110, 110, 110); - QColor InterpolateColor(const QColor& c1, const QColor& c2, float fraction) { const int r = static_cast(static_cast(c2.red() - c1.red()) * fraction + c1.red()); diff --git a/Code/Editor/FBXExporterDialog.cpp b/Code/Editor/FBXExporterDialog.cpp index bae4b9bf7e..b080362b97 100644 --- a/Code/Editor/FBXExporterDialog.cpp +++ b/Code/Editor/FBXExporterDialog.cpp @@ -17,12 +17,6 @@ AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING #include AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING - -namespace -{ - const uint kDefaultFPS = 30u; -} - CFBXExporterDialog::CFBXExporterDialog(bool bDisplayOnlyFPSSetting, QWidget* pParent) : QDialog(pParent) , m_ui(new Ui::FBXExporterDialog) diff --git a/Code/Editor/IconManager.cpp b/Code/Editor/IconManager.cpp index dc9eb56b88..7732ae8155 100644 --- a/Code/Editor/IconManager.cpp +++ b/Code/Editor/IconManager.cpp @@ -27,19 +27,6 @@ namespace { - // Object names in this array must correspond to EObject enumeration. - const char* g_ObjectNames[eStatObject_COUNT] = - { - "Objects/Arrow.cgf", - "Objects/Axis.cgf", - "Objects/Sphere.cgf", - "Objects/Anchor.cgf", - "Objects/entrypoint.cgf", - "Objects/hidepoint.cgf", - "Objects/hidepoint_sec.cgf", - "Objects/reinforcement_point.cgf", - }; - const char* g_IconNames[eIcon_COUNT] = { "Icons/ScaleWarning.png", diff --git a/Code/Editor/LevelFileDialog.cpp b/Code/Editor/LevelFileDialog.cpp index c0c2b96c59..3f3077a2c4 100644 --- a/Code/Editor/LevelFileDialog.cpp +++ b/Code/Editor/LevelFileDialog.cpp @@ -32,22 +32,6 @@ static const char lastLoadPathFilename[] = "lastLoadPath.preset"; // Folder in which levels are stored static const char kLevelsFolder[] = "Levels"; -// List of folder names that are used to detect a level folder -static const char* kLevelFolderNames[] = -{ - "Layers", - "Minimap", - "LevelData" -}; - -// List of files that are used to detect a level folder -static const char* kLevelFileNames[] = -{ - "level.pak", - "filelist.xml", - "levelshadercache.pak", -}; - CLevelFileDialog::CLevelFileDialog(bool openDialog, QWidget* parent) : QDialog(parent) , m_bOpenDialog(openDialog) diff --git a/Code/Editor/MainWindow.cpp b/Code/Editor/MainWindow.cpp index fa2e792cc8..bec61df984 100644 --- a/Code/Editor/MainWindow.cpp +++ b/Code/Editor/MainWindow.cpp @@ -108,12 +108,6 @@ using namespace AzToolsFramework; #define LAYOUTS_WILDCARD "*.layout" #define DUMMY_LAYOUT_NAME "Dummy_Layout" -static const char* g_openViewPaneEventName = "OpenViewPaneEvent"; //Sent when users open view panes; -static const char* g_viewPaneAttributeName = "ViewPaneName"; //Name of the current view pane -static const char* g_openLocationAttributeName = "OpenLocation"; //Indicates where the current view pane is opened from - -static const char* g_assetImporterName = "AssetImporter"; - class CEditorOpenViewCommand : public _i_reference_target_t { diff --git a/Code/Editor/Plugins/ComponentEntityEditorPlugin/Objects/ComponentEntityObject.cpp b/Code/Editor/Plugins/ComponentEntityEditorPlugin/Objects/ComponentEntityObject.cpp index c91bf58074..36bdcf3a73 100644 --- a/Code/Editor/Plugins/ComponentEntityEditorPlugin/Objects/ComponentEntityObject.cpp +++ b/Code/Editor/Plugins/ComponentEntityEditorPlugin/Objects/ComponentEntityObject.cpp @@ -49,11 +49,6 @@ * Scalars for icon drawing behavior. */ static const int s_kIconSize = 36; /// Icon display size (in pixels) -static const float s_kIconMaxWorldDist = 200.f; /// Icons are culled past this range -static const float s_kIconMinScale = 0.1f; /// Minimum scale for icons in the distance -static const float s_kIconMaxScale = 1.0f; /// Maximum scale for icons near the camera -static const float s_kIconCloseDist = 3.f; /// Distance at which icons are at maximum scale -static const float s_kIconFarDist = 40.f; /// Distance at which icons are at minimum scale CComponentEntityObject::CComponentEntityObject() : m_hasIcon(false) diff --git a/Code/Editor/ToolsConfigPage.cpp b/Code/Editor/ToolsConfigPage.cpp index 1871dc763f..50001dc2f0 100644 --- a/Code/Editor/ToolsConfigPage.cpp +++ b/Code/Editor/ToolsConfigPage.cpp @@ -39,8 +39,6 @@ namespace QColor COLOR_FOR_CONSOLE_COMMAND = QColor(0, 0, 255); QColor COLOR_FOR_TOGGLE_COMMAND = QColor(128, 0, 255); QColor COLOR_FOR_INVALID_COMMAND = QColor(255, 0, 0); - - UINT CONSOLE_CMD_DROP_LIST_HEIGHT = 300; }; class IconListModel diff --git a/Code/Editor/TopRendererWnd.cpp b/Code/Editor/TopRendererWnd.cpp index 7bbefdd63f..3159301267 100644 --- a/Code/Editor/TopRendererWnd.cpp +++ b/Code/Editor/TopRendererWnd.cpp @@ -26,27 +26,6 @@ #define GL_RGBA 0x1908 #define GL_BGRA 0x80E1 -// Used to give each static object type a different color -static uint32 sVegetationColors[16] = -{ - 0xFFFF0000, - 0xFF00FF00, - 0xFF0000FF, - 0xFFFFFFFF, - 0xFFFF00FF, - 0xFFFFFF00, - 0xFF00FFFF, - 0xFF7F00FF, - 0xFF7FFF7F, - 0xFFFF7F00, - 0xFF00FF7F, - 0xFF7F7F7F, - 0xFFFF0000, - 0xFF00FF00, - 0xFF0000FF, - 0xFFFFFFFF, -}; - ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// diff --git a/Code/Editor/TrackView/TVCustomizeTrackColorsDlg.cpp b/Code/Editor/TrackView/TVCustomizeTrackColorsDlg.cpp index ae1080a9c1..b30f655b0b 100644 --- a/Code/Editor/TrackView/TVCustomizeTrackColorsDlg.cpp +++ b/Code/Editor/TrackView/TVCustomizeTrackColorsDlg.cpp @@ -106,7 +106,6 @@ namespace { AnimParamType::User, "Muted", QColor(255, 224, 224) }, }; - const int kButtonsIdBase = 0x7fff; const int kMaxRows = 20; const int kColumnWidth = 300; const int kRowHeight = 24; diff --git a/Code/Editor/TrackView/TVEventsDialog.cpp b/Code/Editor/TrackView/TVEventsDialog.cpp index 86b4c1f6bc..dbaaf4b530 100644 --- a/Code/Editor/TrackView/TVEventsDialog.cpp +++ b/Code/Editor/TrackView/TVEventsDialog.cpp @@ -29,12 +29,6 @@ AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING // CTVEventsDialog dialog -namespace -{ - const int kCountSubItemIndex = 1; - const int kTimeSubItemIndex = 2; -} - class TVEventsModel : public QAbstractTableModel { diff --git a/Code/Editor/TrackView/TrackViewDialog.cpp b/Code/Editor/TrackView/TrackViewDialog.cpp index f1701f9e20..d44d8535de 100644 --- a/Code/Editor/TrackView/TrackViewDialog.cpp +++ b/Code/Editor/TrackView/TrackViewDialog.cpp @@ -77,9 +77,6 @@ inline namespace TrackViewInternal const int s_kMinimumFrameSnappingFPS = 1; const int s_kMaximumFrameSnappingFPS = 120; - const int TRACKVIEW_LAYOUT_VERSION = 0x0001; // Bump this up on every substantial pane layout change - const int TRACKVIEW_REBAR_VERSION = 0x0002; // Bump this up on every substantial rebar change - CTrackViewSequence* GetSequenceByEntityIdOrName(const CTrackViewSequenceManager* pSequenceManager, const char* entityIdOrName) { // the "name" string will be an AZ::EntityId in string form if this was called from From 6bdef504446f39e73bbe558ebb4e086752271320 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Mon, 23 Aug 2021 13:00:45 -0700 Subject: [PATCH 045/131] Code/Framework Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Code/Framework/AzCore/AzCore/Debug/EventTraceDriller.cpp | 1 - Code/Framework/AzCore/AzCore/Debug/Trace.cpp | 1 - Code/Framework/AzCore/Tests/AZStd/Pair.cpp | 1 - .../Windows/Tests/IO/Streamer/StorageDriveTests_Windows.cpp | 2 +- .../Tests/Serialization/Json/MathMatrixSerializerTests.cpp | 2 +- Code/Framework/AzCore/Tests/TaskTests.cpp | 1 + .../AzFramework/AzFramework/Archive/ArchiveFileIO.cpp | 1 - Code/Framework/AzFramework/AzFramework/FileTag/FileTag.cpp | 2 +- Code/Framework/AzFramework/AzFramework/IO/RemoteFileIO.cpp | 2 ++ .../AzQtComponents/AzQtComponents/Components/DockTabBar.cpp | 2 -- .../AzQtComponents/Components/Widgets/Card.cpp | 5 ----- .../AzToolsFramework/Manipulators/EditorVertexSelection.cpp | 2 +- 12 files changed, 7 insertions(+), 15 deletions(-) diff --git a/Code/Framework/AzCore/AzCore/Debug/EventTraceDriller.cpp b/Code/Framework/AzCore/AzCore/Debug/EventTraceDriller.cpp index 1fdd249138..658021b018 100644 --- a/Code/Framework/AzCore/AzCore/Debug/EventTraceDriller.cpp +++ b/Code/Framework/AzCore/AzCore/Debug/EventTraceDriller.cpp @@ -26,7 +26,6 @@ namespace AZ const u32 Timestamp = AZ_CRC("Timestamp", 0xa5d6e63e); const u32 Duration = AZ_CRC("Duration", 0x865f80c0); const u32 Instant = AZ_CRC("Instant", 0x0e9047ad); - const u32 InstantScope = AZ_CRC("InstantScope", 0xed4bfb0e); } EventTraceDriller::EventTraceDriller() diff --git a/Code/Framework/AzCore/AzCore/Debug/Trace.cpp b/Code/Framework/AzCore/AzCore/Debug/Trace.cpp index bd3b12a3b8..74ecee40e5 100644 --- a/Code/Framework/AzCore/AzCore/Debug/Trace.cpp +++ b/Code/Framework/AzCore/AzCore/Debug/Trace.cpp @@ -66,7 +66,6 @@ namespace AZ static const int assertLevel_log = 1; static const int assertLevel_nativeUI = 2; static const int assertLevel_crash = 3; - static const int logLevel_errorWarning = 1; static const int logLevel_full = 2; static AZ::EnvironmentVariable> g_ignoredAsserts; static AZ::EnvironmentVariable g_assertVerbosityLevel; diff --git a/Code/Framework/AzCore/Tests/AZStd/Pair.cpp b/Code/Framework/AzCore/Tests/AZStd/Pair.cpp index 53786d20da..213cb8b17d 100644 --- a/Code/Framework/AzCore/Tests/AZStd/Pair.cpp +++ b/Code/Framework/AzCore/Tests/AZStd/Pair.cpp @@ -68,7 +68,6 @@ namespace UnitTest static constexpr size_t max_expected_size = MaxExpectedSize; }; - constexpr size_t pairSize = sizeof(AZStd::compressed_pair); using CompressedPairTestConfigs = ::testing::Types< CompressedPairTestConfig , CompressedPairTestConfig diff --git a/Code/Framework/AzCore/Tests/Platform/Windows/Tests/IO/Streamer/StorageDriveTests_Windows.cpp b/Code/Framework/AzCore/Tests/Platform/Windows/Tests/IO/Streamer/StorageDriveTests_Windows.cpp index a842626e18..6d572a02a3 100644 --- a/Code/Framework/AzCore/Tests/Platform/Windows/Tests/IO/Streamer/StorageDriveTests_Windows.cpp +++ b/Code/Framework/AzCore/Tests/Platform/Windows/Tests/IO/Streamer/StorageDriveTests_Windows.cpp @@ -639,7 +639,7 @@ namespace AZ::IO path.InitFromAbsolutePath(m_dummyFilepath); request->CreateRead(nullptr, buffer, unalignedSize + 4, path, unalignedOffset, unalignedSize); - auto callback = [&fileSize, unalignedOffset, unalignedSize, this](const FileRequest& request) + auto callback = [unalignedOffset, unalignedSize, this](const FileRequest& request) { EXPECT_EQ(request.GetStatus(), AZ::IO::IStreamerTypes::RequestStatus::Completed); auto& readRequest = AZStd::get(request.GetCommand()); diff --git a/Code/Framework/AzCore/Tests/Serialization/Json/MathMatrixSerializerTests.cpp b/Code/Framework/AzCore/Tests/Serialization/Json/MathMatrixSerializerTests.cpp index be51b3bf74..3cb316f472 100644 --- a/Code/Framework/AzCore/Tests/Serialization/Json/MathMatrixSerializerTests.cpp +++ b/Code/Framework/AzCore/Tests/Serialization/Json/MathMatrixSerializerTests.cpp @@ -469,7 +469,7 @@ namespace JsonSerializationTests *this->m_jsonDocument, *this->m_jsonDeserializationContext); - ASSERT_EQ(Outcomes::Success, result.GetOutcome()); + ASSERT_EQ(Outcomes::DefaultsUsed, result.GetOutcome()); EXPECT_TRUE(defaultValue == output); } diff --git a/Code/Framework/AzCore/Tests/TaskTests.cpp b/Code/Framework/AzCore/Tests/TaskTests.cpp index f2ca484df3..f65dffcd99 100644 --- a/Code/Framework/AzCore/Tests/TaskTests.cpp +++ b/Code/Framework/AzCore/Tests/TaskTests.cpp @@ -225,6 +225,7 @@ namespace UnitTest defaultTD, [td = AZStd::move(td)] { + AZ_UNUSED(td); }); task.Invoke(); // Destructor should not have run yet (except on moved-from instances) diff --git a/Code/Framework/AzFramework/AzFramework/Archive/ArchiveFileIO.cpp b/Code/Framework/AzFramework/AzFramework/Archive/ArchiveFileIO.cpp index c5e3bc9315..55f7640785 100644 --- a/Code/Framework/AzFramework/AzFramework/Archive/ArchiveFileIO.cpp +++ b/Code/Framework/AzFramework/AzFramework/Archive/ArchiveFileIO.cpp @@ -16,7 +16,6 @@ namespace AZ::IO { - constexpr size_t ArchiveFileiOMaxBuffersize = 16 * 1024; ArchiveFileIO::ArchiveFileIO(IArchive* archive) : m_archive(archive) { diff --git a/Code/Framework/AzFramework/AzFramework/FileTag/FileTag.cpp b/Code/Framework/AzFramework/AzFramework/FileTag/FileTag.cpp index c402e6c5bc..f820ee56ed 100644 --- a/Code/Framework/AzFramework/AzFramework/FileTag/FileTag.cpp +++ b/Code/Framework/AzFramework/AzFramework/FileTag/FileTag.cpp @@ -366,7 +366,7 @@ namespace AzFramework AZStd::set tags; AZStd::string resolvedFilePath = ResolveFilePath(filePath); - auto found = AZStd::find_if(m_fileTagsMap.begin(), m_fileTagsMap.end(), [filePath, resolvedFilePath](auto& entry) -> bool + auto found = AZStd::find_if(m_fileTagsMap.begin(), m_fileTagsMap.end(), [resolvedFilePath](auto& entry) -> bool { return resolvedFilePath == ResolveFilePath(entry.first); }); diff --git a/Code/Framework/AzFramework/AzFramework/IO/RemoteFileIO.cpp b/Code/Framework/AzFramework/AzFramework/IO/RemoteFileIO.cpp index 25bc31b760..3ac1b91144 100644 --- a/Code/Framework/AzFramework/AzFramework/IO/RemoteFileIO.cpp +++ b/Code/Framework/AzFramework/AzFramework/IO/RemoteFileIO.cpp @@ -27,7 +27,9 @@ namespace AZ const char* const NetworkFileIOChannel = "NetworkFileIO"; #ifndef REMOTEFILEIO_IS_NETWORKFILEIO const char* const RemoteFileIOChannel = "RemoteFileIO"; + #ifdef REMOTEFILEIO_SYNC_CHECK const char* const RemoteFileCacheChannel = "RemoteFileCache"; + #endif #endif const size_t READ_CHUNK_SIZE = 1024 * 256; diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Components/DockTabBar.cpp b/Code/Framework/AzQtComponents/AzQtComponents/Components/DockTabBar.cpp index 2574e1b05a..127163f056 100644 --- a/Code/Framework/AzQtComponents/AzQtComponents/Components/DockTabBar.cpp +++ b/Code/Framework/AzQtComponents/AzQtComponents/Components/DockTabBar.cpp @@ -31,8 +31,6 @@ static const int g_closeButtonOffset = g_closeButtonWidth + AzQtComponents::Dock static const QColor g_tabIndicatorUnderlayColor(Qt::black); // Constant for the opacity of our tab indicator underlay static const qreal g_tabIndicatorUnderlayOpacity = 0.75; -// Constant for the duration of our tab animations (in milliseconds) -static const int g_tabAnimationDurationMS = 250; namespace AzQtComponents diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/Card.cpp b/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/Card.cpp index a4ab3c5e5d..40c0a1d55a 100644 --- a/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/Card.cpp +++ b/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/Card.cpp @@ -25,11 +25,6 @@ namespace AzQtComponents { - namespace CardConstants - { - static const char* kPropertySelected = "selected"; - } - static QPixmap ApplyAlphaToPixmap(const QPixmap& pixmap, float alpha) { QImage image = pixmap.toImage().convertToFormat(QImage::Format_ARGB32); diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Manipulators/EditorVertexSelection.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Manipulators/EditorVertexSelection.cpp index 9bb452eb71..81f573672b 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Manipulators/EditorVertexSelection.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Manipulators/EditorVertexSelection.cpp @@ -1306,7 +1306,7 @@ namespace AzToolsFramework void EditorVertexSelectionVariable::PrepareActions() { ActionOverride deleteAction = CreateDeleteAction( - s_deleteVerticesTitle, s_duplicateVerticesDesc, + s_deleteVerticesTitle, s_deleteVerticesDesc, [this]() { DestroySelected(); From cb7b084e6bda3ef2c6e069730858657c187eb248 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Mon, 23 Aug 2021 13:01:03 -0700 Subject: [PATCH 046/131] Code/Legacy Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Code/Legacy/CryCommon/WinBase.cpp | 8 +------- Code/Legacy/CrySystem/Log.cpp | 2 +- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/Code/Legacy/CryCommon/WinBase.cpp b/Code/Legacy/CryCommon/WinBase.cpp index 595e9091d6..f9b1978e74 100644 --- a/Code/Legacy/CryCommon/WinBase.cpp +++ b/Code/Legacy/CryCommon/WinBase.cpp @@ -86,10 +86,6 @@ typedef struct stat FS_STAT_TYPE; #else typedef struct stat64 FS_STAT_TYPE; #endif -static const int FS_O_RDWR = O_RDWR; -static const int FS_O_RDONLY = O_RDONLY; -static const int FS_O_WRONLY = O_WRONLY; -static const FS_ERRNO_TYPE FS_EISDIR = EISDIR; #include @@ -829,7 +825,7 @@ const int comparePathNames(const char* cpFirst, const char* cpSecond, unsigned i return memicmp(first.c_str(), second.c_str(), length); } -#if (defined(LINUX) || defined(APPLE)) && defined(DEFINE_FIX_ONE_PATH_ELEMENT) +#if defined(FIX_FILENAME_CASE) static bool FixOnePathElement(char* path) { if (*path == '\0') @@ -1193,9 +1189,7 @@ DLL_EXPORT void OutputDebugString(const char* outputString) typedef DIR* FS_DIR_TYPE; typedef dirent FS_DIRENT_TYPE; static const FS_ERRNO_TYPE FS_ENOENT = ENOENT; -static const FS_ERRNO_TYPE FS_EINVAL = EINVAL; static const FS_DIR_TYPE FS_DIR_NULL = NULL; -static const unsigned char FS_TYPE_DIRECTORY = DT_DIR; typedef int FS_ERRNO_TYPE; diff --git a/Code/Legacy/CrySystem/Log.cpp b/Code/Legacy/CrySystem/Log.cpp index 27612bf786..193b53151c 100644 --- a/Code/Legacy/CrySystem/Log.cpp +++ b/Code/Legacy/CrySystem/Log.cpp @@ -44,7 +44,7 @@ namespace LogCVars int max_backup_directory_size_mb = 200; //200MB default }; -#ifndef _RELEASE +#if defined(SUPPORT_LOG_IDENTER) static CLog::LogStringType indentString (" "); #endif From 1f44b7a32827dfa3dd267dc34805e0067bdf00a4 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Mon, 23 Aug 2021 13:01:17 -0700 Subject: [PATCH 047/131] Code/Tools Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Code/Tools/AssetBundler/source/utils/utils.cpp | 1 - .../native/AssetDatabase/AssetDatabase.cpp | 14 -------------- .../native/resourcecompiler/rcjob.cpp | 1 - .../native/unittests/UtilitiesUnitTests.cpp | 9 --------- .../native/utilities/PlatformConfiguration.cpp | 1 - .../Driller/Annotations/AnnotationHeaderView.cpp | 1 - .../Standalone/Source/Driller/ChannelDataView.cpp | 4 ---- 7 files changed, 31 deletions(-) diff --git a/Code/Tools/AssetBundler/source/utils/utils.cpp b/Code/Tools/AssetBundler/source/utils/utils.cpp index 12830166b7..6daf3c571b 100644 --- a/Code/Tools/AssetBundler/source/utils/utils.cpp +++ b/Code/Tools/AssetBundler/source/utils/utils.cpp @@ -110,7 +110,6 @@ namespace AssetBundler const char RestrictedDirectoryName[] = "restricted"; const char PlatformsDirectoryName[] = "Platforms"; const char GemsDirectoryName[] = "Gems"; - const char GemsAssetsDirectoryName[] = "Assets"; const char GemsSeedFileName[] = "seedList"; const char EngineSeedFileName[] = "SeedAssetList"; diff --git a/Code/Tools/AssetProcessor/native/AssetDatabase/AssetDatabase.cpp b/Code/Tools/AssetProcessor/native/AssetDatabase/AssetDatabase.cpp index 8c334c4468..4d2053c6d1 100644 --- a/Code/Tools/AssetProcessor/native/AssetDatabase/AssetDatabase.cpp +++ b/Code/Tools/AssetProcessor/native/AssetDatabase/AssetDatabase.cpp @@ -174,12 +174,6 @@ namespace AssetProcessor static const char* CREATEINDEX_TYPEOFDEPENDENCY_SOURCEDEPENDENCY = "AssetProcessor::CreateIndexTypeOfDependency_SourceDependency"; static const char* CREATEINDEX_TYPEOFDEPENDENCY_SOURCEDEPENDENCY_STATEMENT = "CREATE INDEX IF NOT EXISTS TypeOfDependency_SourceDependency ON SourceDependency (TypeOfDependency);"; - - static const char* CREATEINDEX_SCANFOLDERS_SOURCES = "AssetProcesser::CreateIndexScanFoldersSources"; - static const char* CREATEINDEX_SCANFOLDERS_SOURCES_STATEMENT = - "CREATE INDEX IF NOT EXISTS ScanFolders_Sources ON Sources (ScanFolderPK);"; - static const char* DROPINDEX_SCANFOLDERS_SOURCES_STATEMENT = - "DROP INDEX IF EXISTS ScanFolders_Sources_idx;"; static const char* CREATEINDEX_SCANFOLDERS_SOURCES_SCANFOLDER = "AssetProcesser::CreateIndexScanFoldersSourcesScanFolder"; static const char* CREATEINDEX_SCANFOLDERS_SOURCES_SCANFOLDER_STATEMENT = @@ -188,20 +182,14 @@ namespace AssetProcessor static const char* CREATEINDEX_SOURCES_JOBS = "AssetProcesser::CreateIndexSourcesJobs"; static const char* CREATEINDEX_SOURCES_JOBS_STATEMENT = "CREATE INDEX IF NOT EXISTS Sources_Jobs ON Jobs (SourcePK);"; - static const char* DROPINDEX_SOURCES_JOBS_STATEMENT = - "DROP INDEX IF EXISTS Sources_Jobs_idx;"; static const char* CREATEINDEX_JOBS_PRODUCTS = "AssetProcesser::CreateIndexJobsProducts"; static const char* CREATEINDEX_JOBS_PRODUCTS_STATEMENT = "CREATE INDEX IF NOT EXISTS Jobs_Products ON Products (JobPK);"; - static const char* DROPINDEX_JOBS_PRODUCTS_STATEMENT = - "DROP INDEX IF EXISTS Jobs_Products_idx;"; static const char* CREATEINDEX_SOURCE_NAME = "AssetProcessor::CreateIndexSourceName"; static const char* CREATEINDEX_SOURCE_NAME_STATEMENT = "CREATE INDEX IF NOT EXISTS Sources_SourceName ON Sources (SourceName);"; - static const char* DROPINDEX_SOURCE_NAME_STATEMENT = - "DROP INDEX IF EXISTS Sources_SourceName_idx;"; static const char* CREATEINDEX_SOURCE_GUID = "AssetProcessor::CreateIndexSourceGuid"; static const char* CREATEINDEX_SOURCE_GUID_STATEMENT = @@ -210,8 +198,6 @@ namespace AssetProcessor static const char* CREATEINDEX_PRODUCT_NAME = "AssetProcessor::CreateIndexProductName"; static const char* CREATEINDEX_PRODUCT_NAME_STATEMENT = "CREATE INDEX IF NOT EXISTS Products_ProductName ON Products (ProductName);"; - static const char* DROPINDEX_PRODUCT_NAME_STATEMENT = - "DROP INDEX IF EXISTS Products_ProductName_idx;"; static const char* CREATEINDEX_PRODUCT_SUBID = "AssetProcessor::CreateIndexProductSubID"; static const char* CREATEINDEX_PRODUCT_SUBID_STATEMENT = diff --git a/Code/Tools/AssetProcessor/native/resourcecompiler/rcjob.cpp b/Code/Tools/AssetProcessor/native/resourcecompiler/rcjob.cpp index eacff14180..aaf6496f7b 100644 --- a/Code/Tools/AssetProcessor/native/resourcecompiler/rcjob.cpp +++ b/Code/Tools/AssetProcessor/native/resourcecompiler/rcjob.cpp @@ -22,7 +22,6 @@ namespace { - unsigned long s_jobSerial = 1; bool s_typesRegistered = false; // You have up to 60 minutes to finish processing an asset. // This was increased from 10 to account for PVRTC compression diff --git a/Code/Tools/AssetProcessor/native/unittests/UtilitiesUnitTests.cpp b/Code/Tools/AssetProcessor/native/unittests/UtilitiesUnitTests.cpp index b34f79142c..bbeafda342 100644 --- a/Code/Tools/AssetProcessor/native/unittests/UtilitiesUnitTests.cpp +++ b/Code/Tools/AssetProcessor/native/unittests/UtilitiesUnitTests.cpp @@ -30,15 +30,6 @@ using namespace AssetProcessor; namespace AssetProcessor { - const char* const TEST_BOOTSTRAP_DATA = - "project_path = TestProject \r\n\ - assets = pc \r\n\ - -- ip and port of the asset processor.Only if you need to change defaults \r\n\ - -- remote_ip = 127.0.0.1 \r\n\ - windows_remote_ip = 127.0.0.7 \r\n\ - remote_port = 45645 \r\n\ - assetProcessor_branch_token = 0xDD814240"; - // simple utility class to make sure threads join and don't cause asserts // if the unit test exits early. class AutoThreadJoiner final diff --git a/Code/Tools/AssetProcessor/native/utilities/PlatformConfiguration.cpp b/Code/Tools/AssetProcessor/native/utilities/PlatformConfiguration.cpp index 07106614cf..a1bc508899 100644 --- a/Code/Tools/AssetProcessor/native/utilities/PlatformConfiguration.cpp +++ b/Code/Tools/AssetProcessor/native/utilities/PlatformConfiguration.cpp @@ -681,7 +681,6 @@ namespace AssetProcessor const char AssetConfigPlatformDir[] = "AssetProcessorConfig/"; const char AssetProcessorPlatformConfigFileName[] = "AssetProcessorPlatformConfig.ini"; - const char RestrictedPlatformDir[] = "restricted"; PlatformConfiguration::PlatformConfiguration(QObject* pParent) : QObject(pParent) diff --git a/Code/Tools/Standalone/Source/Driller/Annotations/AnnotationHeaderView.cpp b/Code/Tools/Standalone/Source/Driller/Annotations/AnnotationHeaderView.cpp index 3152862d80..fa1598a224 100644 --- a/Code/Tools/Standalone/Source/Driller/Annotations/AnnotationHeaderView.cpp +++ b/Code/Tools/Standalone/Source/Driller/Annotations/AnnotationHeaderView.cpp @@ -14,7 +14,6 @@ namespace Driller { static const int k_contractedSize = 20; - static const int k_textWidth = 153; AnnotationHeaderView::AnnotationHeaderView(AnnotationsProvider* ptrAnnotations, QWidget* parent, Qt::WindowFlags flags) : QWidget(parent, flags) diff --git a/Code/Tools/Standalone/Source/Driller/ChannelDataView.cpp b/Code/Tools/Standalone/Source/Driller/ChannelDataView.cpp index 0fd94476e3..d5c845b438 100644 --- a/Code/Tools/Standalone/Source/Driller/ChannelDataView.cpp +++ b/Code/Tools/Standalone/Source/Driller/ChannelDataView.cpp @@ -24,10 +24,6 @@ namespace Driller { - static const int k_contractedSize = 28; - static const int k_expandedSize = 64; - static const int k_textWidth = 128; - static const int k_barHeight = 5; //////////////////////// From 804d833bb92fc3cc731720a84f4365cafe0c919a Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Mon, 23 Aug 2021 13:01:33 -0700 Subject: [PATCH 048/131] Gems/Atom Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../Code/Source/Editor/SrgLayoutUtility.cpp | 2 -- .../AuxGeom/DynamicPrimitiveProcessor.cpp | 3 --- .../OcclusionCullingPlane.cpp | 2 -- .../ReflectionProbe/ReflectionProbe.cpp | 2 -- .../Vulkan/Code/Source/RHI/PhysicalDevice.cpp | 2 -- .../Model/ModelAssetBuilderComponent.cpp | 6 ------ .../DynamicDraw/DynamicDrawContext.cpp | 3 +-- .../Source/RPI.Public/Shader/ShaderSystem.cpp | 2 -- Gems/Atom/RPI/Code/Source/RPI.Public/View.cpp | 2 ++ .../AtomFont/Code/Source/FFont.cpp | 1 - .../EMotionFXAtom/Code/Source/ActorAsset.cpp | 19 ------------------- 11 files changed, 3 insertions(+), 41 deletions(-) diff --git a/Gems/Atom/Asset/Shader/Code/Source/Editor/SrgLayoutUtility.cpp b/Gems/Atom/Asset/Shader/Code/Source/Editor/SrgLayoutUtility.cpp index dba95741ad..cb3318128e 100644 --- a/Gems/Atom/Asset/Shader/Code/Source/Editor/SrgLayoutUtility.cpp +++ b/Gems/Atom/Asset/Shader/Code/Source/Editor/SrgLayoutUtility.cpp @@ -15,8 +15,6 @@ namespace AZ { namespace SrgLayoutUtility { - static constexpr char SrgLayoutUtilityName[] = "SrgLayoutUtility"; - RHI::ShaderInputImageType ToShaderInputImageType(TextureType textureType) { switch (textureType) diff --git a/Gems/Atom/Feature/Common/Code/Source/AuxGeom/DynamicPrimitiveProcessor.cpp b/Gems/Atom/Feature/Common/Code/Source/AuxGeom/DynamicPrimitiveProcessor.cpp index 10d1bdc2c6..f35809f148 100644 --- a/Gems/Atom/Feature/Common/Code/Source/AuxGeom/DynamicPrimitiveProcessor.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/AuxGeom/DynamicPrimitiveProcessor.cpp @@ -27,9 +27,6 @@ namespace AZ { namespace { - // the max size of a vertex buffer - static const size_t MaxUploadBufferSize = MaxDynamicVertexCount * sizeof(AuxGeomDynamicVertex); - static const RHI::PrimitiveTopology PrimitiveTypeToTopology[PrimitiveType_Count] = { RHI::PrimitiveTopology::PointList, diff --git a/Gems/Atom/Feature/Common/Code/Source/OcclusionCullingPlane/OcclusionCullingPlane.cpp b/Gems/Atom/Feature/Common/Code/Source/OcclusionCullingPlane/OcclusionCullingPlane.cpp index 5ea5a496d6..0e644b9555 100644 --- a/Gems/Atom/Feature/Common/Code/Source/OcclusionCullingPlane/OcclusionCullingPlane.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/OcclusionCullingPlane/OcclusionCullingPlane.cpp @@ -16,8 +16,6 @@ namespace AZ { namespace Render { - static const char* OcclusionCullingPlaneDrawListTag("occlusioncullingplanevisualization"); - OcclusionCullingPlane::~OcclusionCullingPlane() { Data::AssetBus::MultiHandler::BusDisconnect(); diff --git a/Gems/Atom/Feature/Common/Code/Source/ReflectionProbe/ReflectionProbe.cpp b/Gems/Atom/Feature/Common/Code/Source/ReflectionProbe/ReflectionProbe.cpp index 276ea7683f..66c326e6e7 100644 --- a/Gems/Atom/Feature/Common/Code/Source/ReflectionProbe/ReflectionProbe.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/ReflectionProbe/ReflectionProbe.cpp @@ -22,8 +22,6 @@ namespace AZ { namespace Render { - static const char* ReflectionProbeDrawListTag("reflectionprobevisualization"); - ReflectionProbe::~ReflectionProbe() { Data::AssetBus::MultiHandler::BusDisconnect(); diff --git a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/PhysicalDevice.cpp b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/PhysicalDevice.cpp index c00c1804b9..cdb9bbc7bd 100644 --- a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/PhysicalDevice.cpp +++ b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/PhysicalDevice.cpp @@ -17,8 +17,6 @@ namespace AZ { namespace Vulkan { - static constexpr size_t MinGPUMemSize = AZ_TRAIT_ATOM_VULKAN_MIN_GPU_MEM; - RHI::PhysicalDeviceList PhysicalDevice::Enumerate() { RHI::PhysicalDeviceList physicalDeviceList; diff --git a/Gems/Atom/RPI/Code/Source/RPI.Builders/Model/ModelAssetBuilderComponent.cpp b/Gems/Atom/RPI/Code/Source/RPI.Builders/Model/ModelAssetBuilderComponent.cpp index 5fcbcd7180..9fc99e3ea4 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Builders/Model/ModelAssetBuilderComponent.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Builders/Model/ModelAssetBuilderComponent.cpp @@ -60,7 +60,6 @@ namespace { - const uint32_t IndicesPerFace = 3; const AZ::RHI::Format IndicesFormat = AZ::RHI::Format::R32_UINT; const uint32_t PositionFloatsPerVert = 3; @@ -84,11 +83,6 @@ namespace // Morph targets const char* ShaderSemanticName_MorphTargetDeltas = "MORPHTARGET_VERTEXDELTAS"; - const AZ::RHI::Format MorphTargetVertexIndexFormat = AZ::RHI::Format::R32_UINT; // Single-component, 32-bit integer as vertex index - const char* ShaderSemanticName_MorphTargetPositionDeltas = "MORPHTARGET_POSITIONDELTAS"; - const AZ::RHI::Format MorphTargetPositionDeltaFormat = AZ::RHI::Format::R16_UINT; // 16-bit integer per compressed position delta component - const char* ShaderSemanticName_MorphTargetNormalDeltas = "MORPHTARGET_NORMALDELTAS"; - const AZ::RHI::Format MorphTargetNormalDeltaFormat = AZ::RHI::Format::R8_UINT; // 8-bit integer per compressed normal delta component // Cloth data const char* const ShaderSemanticName_ClothData = "CLOTH_DATA"; diff --git a/Gems/Atom/RPI/Code/Source/RPI.Public/DynamicDraw/DynamicDrawContext.cpp b/Gems/Atom/RPI/Code/Source/RPI.Public/DynamicDraw/DynamicDrawContext.cpp index 29f57d6e0f..4da85823b3 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Public/DynamicDraw/DynamicDrawContext.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Public/DynamicDraw/DynamicDrawContext.cpp @@ -25,8 +25,7 @@ namespace AZ namespace { constexpr const char* PerContextSrgName = "PerContextSrg"; - constexpr const char* PerDrawSrgName = "PerDrawSrg"; - }; + } void DynamicDrawContext::MultiStates::UpdateHash(const DrawStateOptions& drawStateOptions) { diff --git a/Gems/Atom/RPI/Code/Source/RPI.Public/Shader/ShaderSystem.cpp b/Gems/Atom/RPI/Code/Source/RPI.Public/Shader/ShaderSystem.cpp index c1ae1f0be9..ec6aeb3771 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Public/Shader/ShaderSystem.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Public/Shader/ShaderSystem.cpp @@ -25,8 +25,6 @@ namespace AZ { namespace RPI { - static constexpr char ShaderSystemLog[] = "ShaderSystem"; - void ShaderSystem::Reflect(ReflectContext* context) { ShaderOptionDescriptor::Reflect(context); diff --git a/Gems/Atom/RPI/Code/Source/RPI.Public/View.cpp b/Gems/Atom/RPI/Code/Source/RPI.Public/View.cpp index f1f25e3303..c7d49e3dc7 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Public/View.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Public/View.cpp @@ -30,8 +30,10 @@ namespace AZ namespace RPI { // fixed-size software occlusion culling buffer +#if AZ_TRAIT_MASKED_OCCLUSION_CULLING_SUPPORTED const uint32_t MaskedSoftwareOcclusionCullingWidth = 1920; const uint32_t MaskedSoftwareOcclusionCullingHeight = 1080; +#endif ViewPtr View::CreateView(const AZ::Name& name, UsageFlags usage) { diff --git a/Gems/AtomLyIntegration/AtomFont/Code/Source/FFont.cpp b/Gems/AtomLyIntegration/AtomFont/Code/Source/FFont.cpp index b10edfae2e..5e96af0b1b 100644 --- a/Gems/AtomLyIntegration/AtomFont/Code/Source/FFont.cpp +++ b/Gems/AtomLyIntegration/AtomFont/Code/Source/FFont.cpp @@ -54,7 +54,6 @@ static const int TabCharCount = 4; // set buffer sizes to hold max characters that can be drawn in 1 DrawString call static const size_t MaxVerts = 8 * 1024; // 2048 quads static const size_t MaxIndices = (MaxVerts * 6) / 4; // 6 indices per quad, 6/4 * MaxVerts -static const char DrawList2DPassName[] = "2dpass"; AZ::FFont::FFont(AZ::AtomFont* atomFont, const char* fontName) : m_name(fontName) diff --git a/Gems/AtomLyIntegration/EMotionFXAtom/Code/Source/ActorAsset.cpp b/Gems/AtomLyIntegration/EMotionFXAtom/Code/Source/ActorAsset.cpp index 8d247eaf45..284e1ed35d 100644 --- a/Gems/AtomLyIntegration/EMotionFXAtom/Code/Source/ActorAsset.cpp +++ b/Gems/AtomLyIntegration/EMotionFXAtom/Code/Source/ActorAsset.cpp @@ -39,25 +39,6 @@ // Copied from ModelAssetBuilderComponent.cpp namespace { - const AZ::u32 IndicesPerFace = 3; - const AZ::RHI::Format IndicesFormat = AZ::RHI::Format::R32_UINT; - - const AZ::u32 PositionFloatsPerVert = 3; - const AZ::u32 NormalFloatsPerVert = 3; - const AZ::u32 UVFloatsPerVert = 2; - const AZ::u32 ColorFloatsPerVert = 4; - const AZ::u32 TangentFloatsPerVert = 4; - const AZ::u32 BitangentFloatsPerVert = 3; - - const AZ::RHI::Format PositionFormat = AZ::RHI::Format::R32G32B32_FLOAT; - const AZ::RHI::Format NormalFormat = AZ::RHI::Format::R32G32B32_FLOAT; - const AZ::RHI::Format UVFormat = AZ::RHI::Format::R32G32_FLOAT; - const AZ::RHI::Format ColorFormat = AZ::RHI::Format::R32G32B32A32_FLOAT; - const AZ::RHI::Format TangentFormat = AZ::RHI::Format::R32G32B32A32_FLOAT; - const AZ::RHI::Format BitangentFormat = AZ::RHI::Format::R32G32B32_FLOAT; - const AZ::RHI::Format BoneIndexFormat = AZ::RHI::Format::R32G32B32A32_UINT; - const AZ::RHI::Format BoneWeightFormat = AZ::RHI::Format::R32G32B32A32_FLOAT; - const uint32_t LinearSkinningFloatsPerBone = 12; const uint32_t DualQuaternionSkinningFloatsPerBone = 8; const uint32_t MaxSupportedSkinInfluences = 4; From 23f99aeb945bdb6e3a8308bb2f29f1703b2ca980 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Mon, 23 Aug 2021 13:03:37 -0700 Subject: [PATCH 049/131] more gems changes Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../AWSResourceMappingManagerTest.cpp | 2 -- .../Source/Editor/AudioControlsLoader.cpp | 1 - .../EMotionFX/Source/BlendSpace2DNode.cpp | 13 --------- .../AssetIdNodePropertyDisplay.cpp | 2 -- .../AssetIdNodePropertyDisplay.h | 2 -- .../ComboBoxNodePropertyDisplay.cpp | 2 -- .../ComboBoxNodePropertyDisplay.h | 2 -- .../EntityIdNodePropertyDisplay.cpp | 2 -- .../EntityIdNodePropertyDisplay.h | 2 -- .../Code/Source/Components/SceneComponent.cpp | 2 -- .../Source/Translation/TranslationBuilder.cpp | 2 -- .../Translation/TranslationSerializer.cpp | 8 ------ .../Animation/UiAVCustomizeTrackColorsDlg.cpp | 1 - .../Editor/Animation/UiAVEventsDialog.cpp | 6 ---- .../Editor/Animation/UiAnimViewDialog.cpp | 12 -------- Gems/LyShine/Code/Editor/EditorWindow.cpp | 18 ------------ .../Code/Source/Animation/AnimNode.cpp | 9 ------ .../Code/Source/Animation/AzEntityNode.cpp | 12 -------- Gems/LyShine/Code/Source/RenderGraph.cpp | 3 -- .../Code/Source/Cinematics/SceneNode.cpp | 2 -- .../Cinematics/Tests/AssetBlendTrackTest.cpp | 1 - .../Cinematics/Tests/EntityNodeTest.cpp | 2 -- .../Tests/Benchmarks/PhysXJointBenchmarks.cpp | 6 ---- .../ScriptCanvas/Core/NodeFunctionGeneric.h | 4 +-- .../Core/SubgraphInterfaceUtility.cpp | 1 - .../Interpreted/ExecutionInterpretedAPI.cpp | 2 -- .../Libraries/Logic/Sequencer.cpp | 2 -- .../Code/Tests/ScriptCanvas_Core.cpp | 2 -- .../Code/Source/Editor/AtlasBuilderWorker.cpp | 28 +++++++++++++++++-- .../Code/Source/Editor/AtlasBuilderWorker.h | 24 ---------------- 30 files changed, 27 insertions(+), 148 deletions(-) diff --git a/Gems/AWSCore/Code/Tests/ResourceMapping/AWSResourceMappingManagerTest.cpp b/Gems/AWSCore/Code/Tests/ResourceMapping/AWSResourceMappingManagerTest.cpp index 557fbc820c..91d85c2f99 100644 --- a/Gems/AWSCore/Code/Tests/ResourceMapping/AWSResourceMappingManagerTest.cpp +++ b/Gems/AWSCore/Code/Tests/ResourceMapping/AWSResourceMappingManagerTest.cpp @@ -30,8 +30,6 @@ static constexpr const char TEST_EXPECTED_BUCKET_TYPE[] = "AWS::S3::Bucket"; static constexpr const char TEST_EXPECTED_BUCKET_NAMEID[] = "MyTestS3Bucket"; static constexpr const char TEST_EXPECTED_SERVICE_KEYNAME[] = "TestService"; -static constexpr const char TEST_EXPECTED_RESTAPI_ID_KEYNAME[] = "TestService.RESTApiId"; -static constexpr const char TEST_EXPECTED_RESTAPI_STAGE_KEYNAME[] = "TestService.RESTApiStage"; static constexpr const char TEST_VALID_RESOURCE_MAPPING_CONFIG_FILE[] = R"({ diff --git a/Gems/AudioSystem/Code/Source/Editor/AudioControlsLoader.cpp b/Gems/AudioSystem/Code/Source/Editor/AudioControlsLoader.cpp index 30889e33f0..45f044be32 100644 --- a/Gems/AudioSystem/Code/Source/Editor/AudioControlsLoader.cpp +++ b/Gems/AudioSystem/Code/Source/Editor/AudioControlsLoader.cpp @@ -31,7 +31,6 @@ namespace AudioControls namespace LoaderStrings { static constexpr const char* LevelsSubFolder = "levels"; - static constexpr const char* PathAttribute = "path"; } // namespace LoaderStrings diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/BlendSpace2DNode.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/BlendSpace2DNode.cpp index b34a860b71..03a7552410 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/BlendSpace2DNode.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/BlendSpace2DNode.cpp @@ -24,19 +24,6 @@ namespace { - // Dimensions of the 2D grid into which we place the triangles for quick lookup - const uint32_t kGridCellCountX = 10; - const uint32_t kGridCellCountY = 10; - - AZ_FORCE_INLINE void GetBoundsOfTriangle(const AZ::Vector2 triVerts[3], - float& minX, float& minY, float& maxX, float& maxY) - { - minX = AZStd::min(triVerts[0].GetX(), AZStd::min(triVerts[1].GetX(), triVerts[2].GetX())); - minY = AZStd::min(triVerts[0].GetY(), AZStd::min(triVerts[1].GetY(), triVerts[2].GetY())); - maxX = AZStd::max(triVerts[0].GetX(), AZStd::max(triVerts[1].GetX(), triVerts[2].GetX())); - maxY = AZStd::max(triVerts[0].GetY(), AZStd::max(triVerts[1].GetY(), triVerts[2].GetY())); - } - AZ_FORCE_INLINE bool IsDegenerateTriangle(const AZ::Vector2& p0, const AZ::Vector2& p1, const AZ::Vector2& p2) { const AZ::Vector2 v01(p1 - p0); diff --git a/Gems/GraphCanvas/Code/Source/Components/NodePropertyDisplays/AssetIdNodePropertyDisplay.cpp b/Gems/GraphCanvas/Code/Source/Components/NodePropertyDisplays/AssetIdNodePropertyDisplay.cpp index afafa8350d..ce08f9b448 100644 --- a/Gems/GraphCanvas/Code/Source/Components/NodePropertyDisplays/AssetIdNodePropertyDisplay.cpp +++ b/Gems/GraphCanvas/Code/Source/Components/NodePropertyDisplays/AssetIdNodePropertyDisplay.cpp @@ -156,6 +156,4 @@ namespace GraphCanvas m_proxyWidget = nullptr; } } - -#include } diff --git a/Gems/GraphCanvas/Code/Source/Components/NodePropertyDisplays/AssetIdNodePropertyDisplay.h b/Gems/GraphCanvas/Code/Source/Components/NodePropertyDisplays/AssetIdNodePropertyDisplay.h index 0067d75bac..5b35386547 100644 --- a/Gems/GraphCanvas/Code/Source/Components/NodePropertyDisplays/AssetIdNodePropertyDisplay.h +++ b/Gems/GraphCanvas/Code/Source/Components/NodePropertyDisplays/AssetIdNodePropertyDisplay.h @@ -7,13 +7,11 @@ */ #pragma once -#if !defined(Q_MOC_RUN) #include #include #include #include -#endif class QGraphicsProxyWidget; diff --git a/Gems/GraphCanvas/Code/Source/Components/NodePropertyDisplays/ComboBoxNodePropertyDisplay.cpp b/Gems/GraphCanvas/Code/Source/Components/NodePropertyDisplays/ComboBoxNodePropertyDisplay.cpp index 9206d32d65..6d0590ed99 100644 --- a/Gems/GraphCanvas/Code/Source/Components/NodePropertyDisplays/ComboBoxNodePropertyDisplay.cpp +++ b/Gems/GraphCanvas/Code/Source/Components/NodePropertyDisplays/ComboBoxNodePropertyDisplay.cpp @@ -403,6 +403,4 @@ namespace GraphCanvas m_menuDisplayDirty = true; } } - -#include } diff --git a/Gems/GraphCanvas/Code/Source/Components/NodePropertyDisplays/ComboBoxNodePropertyDisplay.h b/Gems/GraphCanvas/Code/Source/Components/NodePropertyDisplays/ComboBoxNodePropertyDisplay.h index 8f0bb05421..3044456046 100644 --- a/Gems/GraphCanvas/Code/Source/Components/NodePropertyDisplays/ComboBoxNodePropertyDisplay.h +++ b/Gems/GraphCanvas/Code/Source/Components/NodePropertyDisplays/ComboBoxNodePropertyDisplay.h @@ -9,7 +9,6 @@ class QEvent; -#if !defined(Q_MOC_RUN) #include #include @@ -18,7 +17,6 @@ class QEvent; #include #include #include -#endif namespace GraphCanvas { diff --git a/Gems/GraphCanvas/Code/Source/Components/NodePropertyDisplays/EntityIdNodePropertyDisplay.cpp b/Gems/GraphCanvas/Code/Source/Components/NodePropertyDisplays/EntityIdNodePropertyDisplay.cpp index 01dab4c53b..21c5fffa86 100644 --- a/Gems/GraphCanvas/Code/Source/Components/NodePropertyDisplays/EntityIdNodePropertyDisplay.cpp +++ b/Gems/GraphCanvas/Code/Source/Components/NodePropertyDisplays/EntityIdNodePropertyDisplay.cpp @@ -208,6 +208,4 @@ namespace GraphCanvas m_proxyWidget = nullptr; } } - -#include } diff --git a/Gems/GraphCanvas/Code/Source/Components/NodePropertyDisplays/EntityIdNodePropertyDisplay.h b/Gems/GraphCanvas/Code/Source/Components/NodePropertyDisplays/EntityIdNodePropertyDisplay.h index 322ceef941..63b6d3d301 100644 --- a/Gems/GraphCanvas/Code/Source/Components/NodePropertyDisplays/EntityIdNodePropertyDisplay.h +++ b/Gems/GraphCanvas/Code/Source/Components/NodePropertyDisplays/EntityIdNodePropertyDisplay.h @@ -9,7 +9,6 @@ class QEvent; -#if !defined(Q_MOC_RUN) #include #include @@ -17,7 +16,6 @@ class QEvent; #include #include #include -#endif namespace GraphCanvas { diff --git a/Gems/GraphCanvas/Code/Source/Components/SceneComponent.cpp b/Gems/GraphCanvas/Code/Source/Components/SceneComponent.cpp index f236b6b1e1..52e7892364 100644 --- a/Gems/GraphCanvas/Code/Source/Components/SceneComponent.cpp +++ b/Gems/GraphCanvas/Code/Source/Components/SceneComponent.cpp @@ -1070,8 +1070,6 @@ namespace GraphCanvas // SceneComponent /////////////////// - static const char* k_copyPasteKey = "GraphCanvasScene"; - void SceneComponent::Reflect(AZ::ReflectContext* context) { GraphSerialization::Reflect(context); diff --git a/Gems/GraphCanvas/Code/Source/Translation/TranslationBuilder.cpp b/Gems/GraphCanvas/Code/Source/Translation/TranslationBuilder.cpp index 9b8d67aa62..bac58c3ba1 100644 --- a/Gems/GraphCanvas/Code/Source/Translation/TranslationBuilder.cpp +++ b/Gems/GraphCanvas/Code/Source/Translation/TranslationBuilder.cpp @@ -11,8 +11,6 @@ namespace GraphCanvas { - constexpr const char* s_graphCanvasTranslationBuilderName = "GraphCanvasTranslationBuilder"; - AZ::Uuid TranslationAssetWorker::GetUUID() { return AZ::Uuid::CreateString("{459EF910-CAAF-465A-BA19-C91979DA5729}"); diff --git a/Gems/GraphCanvas/Code/Source/Translation/TranslationSerializer.cpp b/Gems/GraphCanvas/Code/Source/Translation/TranslationSerializer.cpp index dd6ee187c0..3875f76d92 100644 --- a/Gems/GraphCanvas/Code/Source/Translation/TranslationSerializer.cpp +++ b/Gems/GraphCanvas/Code/Source/Translation/TranslationSerializer.cpp @@ -20,14 +20,6 @@ namespace GraphCanvas static constexpr char variant[] = "variant"; static constexpr char entries[] = "entries"; } - - static const AZStd::string_view RequiredFields[] = - { - Field::key, - Field::context, - Field::variant, - Field::entries - }; } AZ_CLASS_ALLOCATOR_IMPL(TranslationFormatSerializer, AZ::SystemAllocator, 0); diff --git a/Gems/LyShine/Code/Editor/Animation/UiAVCustomizeTrackColorsDlg.cpp b/Gems/LyShine/Code/Editor/Animation/UiAVCustomizeTrackColorsDlg.cpp index 533625c762..b1412a2d7c 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAVCustomizeTrackColorsDlg.cpp +++ b/Gems/LyShine/Code/Editor/Animation/UiAVCustomizeTrackColorsDlg.cpp @@ -63,7 +63,6 @@ namespace { eUiAnimParamType_User, "Muted", QColor(255, 224, 224) }, }; - const int kButtonsIdBase = 0x7fff; const int kMaxRows = 20; const int kColumnWidth = 300; const int kRowHeight = 24; diff --git a/Gems/LyShine/Code/Editor/Animation/UiAVEventsDialog.cpp b/Gems/LyShine/Code/Editor/Animation/UiAVEventsDialog.cpp index b45cee6948..910307c71a 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAVEventsDialog.cpp +++ b/Gems/LyShine/Code/Editor/Animation/UiAVEventsDialog.cpp @@ -18,12 +18,6 @@ // CUiAVEventsDialog dialog -namespace -{ - const int kCountSubItemIndex = 1; - const int kTimeSubItemIndex = 2; -} - class UiAVEventsModel : public QAbstractTableModel { diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewDialog.cpp b/Gems/LyShine/Code/Editor/Animation/UiAnimViewDialog.cpp index 6a3afe2036..16d3b2b921 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewDialog.cpp +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewDialog.cpp @@ -70,24 +70,12 @@ ////////////////////////////////////////////////////////////////////////// namespace { - const char* s_kUiAnimViewLayoutSection = "UiAnimViewLayout"; - const char* s_kUiAnimViewSection = "DockingPaneLayouts\\UiAnimView"; - const char* s_kSplitterEntry = "Splitter"; - const char* s_kVersionEntry = "UiAnimViewLayoutVersion"; - const char* s_kUiAnimViewSettingsSection = "UiAnimView"; const char* s_kSnappingModeEntry = "SnappingMode"; const char* s_kFrameSnappingFPSEntry = "FrameSnappingFPS"; const char* s_kTickDisplayModeEntry = "TickDisplayMode"; - const char* s_kDefaultTracksEntry = "DefaultTracks"; - - const char* s_kRebarVersionEntry = "UiAnimViewReBarVersion"; - const char* s_kRebarBandEntryPrefix = "ReBarBand"; const char* s_kNoSequenceComboBoxEntry = "--- No Sequence ---"; - - const int TRACKVIEW_LAYOUT_VERSION = 0x0001; // Bump this up on every substantial pane layout change - const int TRACKVIEW_REBAR_VERSION = 0x0002; // Bump this up on every substantial rebar change } ////////////////////////////////////////////////////////////////////////// diff --git a/Gems/LyShine/Code/Editor/EditorWindow.cpp b/Gems/LyShine/Code/Editor/EditorWindow.cpp index 8d7e20492d..5ae1eb44b9 100644 --- a/Gems/LyShine/Code/Editor/EditorWindow.cpp +++ b/Gems/LyShine/Code/Editor/EditorWindow.cpp @@ -2103,24 +2103,6 @@ void EditorWindow::RestoreModeSettings(UiEditorMode mode) settings.endGroup(); // UI canvas editor } -static const char* UIEDITOR_UNLOAD_SAVED_CANVAS_METRIC_EVENT_NAME = "UiEditorUnloadSavedCanvas"; -static const char* UIEDITOR_CANVAS_ID_ATTRIBUTE_NAME = "CanvasId"; -static const char* UIEDITOR_CANVAS_WIDTH_METRIC_NAME = "CanvasWidth"; -static const char* UIEDITOR_CANVAS_HEIGHT_METRIC_NAME = "CanvasHeight"; -static const char* UIEDITOR_CANVAS_MAX_HIERARCHY_DEPTH_METRIC_NAME = "MaxHierarchyDepth"; -static const char* UIEDITOR_CANVAS_NUM_ELEMENT_METRIC_NAME = "NumElement"; -static const char* UIEDITOR_CANVAS_NUM_ELEMENTS_WITH_COMPONENT_PREFIX_METRIC_NAME = "Num"; -static const char* UIEDITOR_CANVAS_NUM_ELEMENTS_WITH_CUSTOM_COMPONENT_METRIC_NAME = "NumCustomElement"; -static const char* UIEDITOR_CANVAS_NUM_UNIQUE_CUSTOM_COMPONENT_NAME = "NumUniqueCustomComponent"; -static const char* UIEDITOR_CANVAS_NUM_AVAILABLE_CUSTOM_COMPONENT_NAME = "NumAvailableCustomComponent"; -static const char* UIEDITOR_CANVAS_NUM_ANCHOR_PRESETS_ATTRIBUTE_NAME = "NumAnchorPreset"; -static const char* UIEDITOR_CANVAS_NUM_ANCHOR_CUSTOM_ATTRIBUTE_NAME = "NumAnchorCustom"; -static const char* UIEDITOR_CANVAS_NUM_PIVOT_PRESETS_ATTRIBUTE_NAME = "NumPivotPreset"; -static const char* UIEDITOR_CANVAS_NUM_PIVOT_CUSTOM_ATTRIBUTE_NAME = "NumPivotCustom"; -static const char* UIEDITOR_CANVAS_NUM_ROTATED_ELEMENT_METRIC_NAME = "NumRotatedElement"; -static const char* UIEDITOR_CANVAS_NUM_SCALED_ELEMENT_METRIC_NAME = "NumScaledElement"; -static const char* UIEDITOR_CANVAS_NUM_SCALE_TO_DEVICE_ELEMENT_METRIC_NAME = "NumScaleToDeviceElement"; - int EditorWindow::GetCanvasMaxHierarchyDepth(const LyShine::EntityArray& rootChildElements) { int depth = 0; diff --git a/Gems/LyShine/Code/Source/Animation/AnimNode.cpp b/Gems/LyShine/Code/Source/Animation/AnimNode.cpp index a87dae6fbd..be7ce78c9a 100644 --- a/Gems/LyShine/Code/Source/Animation/AnimNode.cpp +++ b/Gems/LyShine/Code/Source/Animation/AnimNode.cpp @@ -41,15 +41,6 @@ ////////////////////////////////////////////////////////////////////////// static const EUiAnimCurveType DEFAULT_TRACK_TYPE = eUiAnimCurveType_BezierFloat; -// Old serialization values that are no longer -// defined in IUiAnimationSystem.h, but needed for conversion: -static const int OLD_ACURVE_GOTO = 21; -static const int OLD_APARAM_PARTICLE_COUNT_SCALE = 95; -static const int OLD_APARAM_PARTICLE_PULSE_PERIOD = 96; -static const int OLD_APARAM_PARTICLE_SCALE = 97; -static const int OLD_APARAM_PARTICLE_SPEED_SCALE = 98; -static const int OLD_APARAM_PARTICLE_STRENGTH = 99; - ////////////////////////////////////////////////////////////////////////// // CUiAnimNode. ////////////////////////////////////////////////////////////////////////// diff --git a/Gems/LyShine/Code/Source/Animation/AzEntityNode.cpp b/Gems/LyShine/Code/Source/Animation/AzEntityNode.cpp index 4d178e2f10..b93453129e 100644 --- a/Gems/LyShine/Code/Source/Animation/AzEntityNode.cpp +++ b/Gems/LyShine/Code/Source/Animation/AzEntityNode.cpp @@ -27,18 +27,6 @@ #define s_nodeParams s_nodeParamsEnt #define AddSupportedParam AddSupportedParamEnt -static const float TIMEJUMPED_TRANSITION_TIME = 1.0f; -static const float EPSILON = 0.01f; - -static const char* s_VariablePrefixes[] = -{ - "n", "i", "b", "f", "s", "ei", "es", - "shader", "clr", "color", "vector", - "snd", "sound", "dialog", "tex", "texture", - "obj", "object", "file", "text", "equip", "reverbpreset", "eaxpreset", - "aianchor", "customaction", "gametoken", "seq_", "mission_", "seqid_", "lightanimation_" -}; - ////////////////////////////////////////////////////////////////////////// namespace { diff --git a/Gems/LyShine/Code/Source/RenderGraph.cpp b/Gems/LyShine/Code/Source/RenderGraph.cpp index 51f62fc7ad..588413783d 100644 --- a/Gems/LyShine/Code/Source/RenderGraph.cpp +++ b/Gems/LyShine/Code/Source/RenderGraph.cpp @@ -21,9 +21,6 @@ namespace LyShine { - static const char* s_maskIncrProfileMarker = "UI_MASK_STENCIL_INCR"; - static const char* s_maskDecrProfileMarker = "UI_MASK_STENCIL_DECR"; - enum UiColorOp { ColorOp_Unused = 0, // reusing shader flag value, FixedPipelineEmu shader uses 0 to mean eCO_NOSET diff --git a/Gems/Maestro/Code/Source/Cinematics/SceneNode.cpp b/Gems/Maestro/Code/Source/Cinematics/SceneNode.cpp index 8f55c4ebad..10014a8700 100644 --- a/Gems/Maestro/Code/Source/Cinematics/SceneNode.cpp +++ b/Gems/Maestro/Code/Source/Cinematics/SceneNode.cpp @@ -42,8 +42,6 @@ #define s_nodeParams s_nodeParamsSene #define AddSupportedParam AddSupportedParamScene -float const kDefaultCameraFOV = 60.0f; - namespace { bool s_nodeParamsInitialized = false; StaticInstance> s_nodeParams; diff --git a/Gems/Maestro/Code/Source/Cinematics/Tests/AssetBlendTrackTest.cpp b/Gems/Maestro/Code/Source/Cinematics/Tests/AssetBlendTrackTest.cpp index e995795198..09bbe640d4 100644 --- a/Gems/Maestro/Code/Source/Cinematics/Tests/AssetBlendTrackTest.cpp +++ b/Gems/Maestro/Code/Source/Cinematics/Tests/AssetBlendTrackTest.cpp @@ -20,7 +20,6 @@ namespace AssetBlendTrackTest const AZ::Data::AssetId KEY1_ASSET_ID = AZ::Data::AssetId(AZ::Uuid("{86CE36B5-D996-4CEF-943E-3F12008694E1}"), 1); const AZ::Data::AssetId KEY2_ASSET_ID = AZ::Data::AssetId(AZ::Uuid("{94D54D20-BACC-4A60-8A03-0DC9B5033E03}"), 2); const AZ::Data::AssetId KEY3_ASSET_ID = AZ::Data::AssetId(AZ::Uuid("{94D54D20-BACC-4A60-8A03-0DC9B5033E03}"), 3); - const float KEY_TIME = 1.0f; ///////////////////////////////////////////////////////////////////////////////////// // Testing sub-class diff --git a/Gems/Maestro/Code/Source/Cinematics/Tests/EntityNodeTest.cpp b/Gems/Maestro/Code/Source/Cinematics/Tests/EntityNodeTest.cpp index 595a5aac3c..763fa67c78 100644 --- a/Gems/Maestro/Code/Source/Cinematics/Tests/EntityNodeTest.cpp +++ b/Gems/Maestro/Code/Source/Cinematics/Tests/EntityNodeTest.cpp @@ -15,8 +15,6 @@ namespace EntityNodeTest { - // dummy entity id - const int ENTITY_ID = 0; // consants to set up test key frame, at 1.0 seconds, lasting for 1.0 seconds const int KEY_IDX = 0; const float KEY_TIME = 1.0f; diff --git a/Gems/PhysX/Code/Tests/Benchmarks/PhysXJointBenchmarks.cpp b/Gems/PhysX/Code/Tests/Benchmarks/PhysXJointBenchmarks.cpp index 37f099ec1c..17468b5cc6 100644 --- a/Gems/PhysX/Code/Tests/Benchmarks/PhysXJointBenchmarks.cpp +++ b/Gems/PhysX/Code/Tests/Benchmarks/PhysXJointBenchmarks.cpp @@ -40,9 +40,6 @@ namespace PhysX::Benchmarks //! used in BM_Joints_Snake static const float SnakeSegmentLength = 2.5f; - //! The size of the test terrain - static const float TerrainSize = 1000.0f; - //! Constant seed to use with random number generation static const long long RandGenSeed = 74111105110116; //(Number generated by concatenating 'Joint' ascii character codes (74 111 105 110 116) @@ -82,9 +79,6 @@ namespace PhysX::Benchmarks static const float SwingingJointUpperLimit = 90.0f; static const float SwingingJointLowerLimit = -180.0f; - //newtons cradle positioning - static const float ParentNewtonsCradleSpacing = 1.05f; - static const float NewtonsCradleArmLength = 10.0f; } // namespace JointSettings } // namespace JointConstants diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/NodeFunctionGeneric.h b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/NodeFunctionGeneric.h index 38b1e56f56..cb6c4bf942 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/NodeFunctionGeneric.h +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/NodeFunctionGeneric.h @@ -80,9 +80,7 @@ namespace ScriptCanvas using ResultType = FunctionTraits::result_type;\ static const size_t s_numArgs = FunctionTraits::arity;\ static const size_t s_numNames = SCRIPT_CANVAS_FUNCTION_VAR_ARGS(__VA_ARGS__);\ - static const size_t s_argsSlotIndicesStart = 2;\ - static const size_t s_resultsSlotIndicesStart = s_argsSlotIndicesStart + s_numArgs;\ - static const size_t s_numResults = ScriptCanvas::Internal::extended_tuple_size::value;\ + /*static const size_t s_numResults = ScriptCanvas::Internal::extended_tuple_size::value;*/\ \ static const char* GetArgName(size_t i)\ {\ diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/SubgraphInterfaceUtility.cpp b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/SubgraphInterfaceUtility.cpp index d8cdbc7585..74a41eb2c6 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/SubgraphInterfaceUtility.cpp +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/SubgraphInterfaceUtility.cpp @@ -13,7 +13,6 @@ namespace SubgraphInterfaceUtilityCpp { - const constexpr size_t k_uniqueOutIndex = 0; const constexpr size_t k_signatureIndex = 1; const constexpr AZ::u64 k_defaultOutIdSignature = 0x3ACF20E73ACF20E7ull; diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Execution/Interpreted/ExecutionInterpretedAPI.cpp b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Execution/Interpreted/ExecutionInterpretedAPI.cpp index e01a3a0e7a..cc2058f249 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Execution/Interpreted/ExecutionInterpretedAPI.cpp +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Execution/Interpreted/ExecutionInterpretedAPI.cpp @@ -34,8 +34,6 @@ namespace ExecutionInterpretedAPICpp constexpr size_t k_StringFastSize = 32; - constexpr size_t k_MaxNodeableOuts = 64; - constexpr size_t k_UuidSize = 16; constexpr unsigned char k_Bad = 77; diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Logic/Sequencer.cpp b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Logic/Sequencer.cpp index 2033f92430..c889c6ca17 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Logic/Sequencer.cpp +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Logic/Sequencer.cpp @@ -16,8 +16,6 @@ namespace ScriptCanvas { namespace Logic { - static const int NUMBER_OF_OUTPUTS = 8; - Sequencer::Sequencer() : Node() , m_selectedIndex(0) diff --git a/Gems/ScriptCanvasTesting/Code/Tests/ScriptCanvas_Core.cpp b/Gems/ScriptCanvasTesting/Code/Tests/ScriptCanvas_Core.cpp index f6fce5ddb5..2f51f47230 100644 --- a/Gems/ScriptCanvasTesting/Code/Tests/ScriptCanvas_Core.cpp +++ b/Gems/ScriptCanvasTesting/Code/Tests/ScriptCanvas_Core.cpp @@ -472,8 +472,6 @@ TEST_F(ScriptCanvasTestFixture, Contracts) delete graph->GetEntity(); } -const int k_executionCount = 998; - TEST_F(ScriptCanvasTestFixture, While) { RunUnitTestGraph("LY_SC_UnitTest_While", ScriptCanvas::ExecutionMode::Interpreted); diff --git a/Gems/TextureAtlas/Code/Source/Editor/AtlasBuilderWorker.cpp b/Gems/TextureAtlas/Code/Source/Editor/AtlasBuilderWorker.cpp index ed0d889299..abcdce99b9 100644 --- a/Gems/TextureAtlas/Code/Source/Editor/AtlasBuilderWorker.cpp +++ b/Gems/TextureAtlas/Code/Source/Editor/AtlasBuilderWorker.cpp @@ -33,6 +33,30 @@ namespace TextureAtlasBuilder { + //! Used for sorting ImageDimensions + bool operator<(ImageDimension a, ImageDimension b); + + //! Used to expose the ImageDimension in a pair to AZStd::Sort + bool operator<(IndexImageDimension a, IndexImageDimension b); + + //! Returns true if two coordinate sets overlap + bool Collides(AtlasCoordinates a, AtlasCoordinates b); + + //! Returns true if item collides with any object in list + bool Collides(AtlasCoordinates item, AZStd::vector list); + + //! Returns the portion of the second item that overlaps with the first + AtlasCoordinates GetOverlap(AtlasCoordinates a, AtlasCoordinates b); + + //! Performs an operation that copies a pixel to the output + void SetPixels(AZ::u8* dest, const AZ::u8* source, int destBytes); + + //! Checks if we can insert an image into a slot + bool CanInsert(AtlasCoordinates slot, ImageDimension image, int padding, int farRight, int farBot); + + //! Adds the necessary padding to an Atlas Coordinate + void AddPadding(AtlasCoordinates& slot, int padding, int farRight, int farBot); + //! Counts leading zeros uint32_t CountLeadingZeros32(uint32_t x) { @@ -1411,7 +1435,7 @@ namespace TextureAtlasBuilder // Defines priority so that sorting can be meaningful. It may seem odd that larger items are "less than" smaller // ones, but as this is a deduction of priority, not value, it is correct. - static bool operator<(ImageDimension a, ImageDimension b) + bool operator<(ImageDimension a, ImageDimension b) { // Prioritize first by longest size if ((a.m_width > a.m_height ? a.m_width : a.m_height) != (b.m_width > b.m_height ? b.m_width : b.m_height)) @@ -1431,7 +1455,7 @@ namespace TextureAtlasBuilder } // Exposes priority logic to the sorting algorithm - static bool operator<(IndexImageDimension a, IndexImageDimension b) { return a.second < b.second; } + bool operator<(IndexImageDimension a, IndexImageDimension b) { return a.second < b.second; } // Tests if two coordinate sets intersect bool Collides(AtlasCoordinates a, AtlasCoordinates b) diff --git a/Gems/TextureAtlas/Code/Source/Editor/AtlasBuilderWorker.h b/Gems/TextureAtlas/Code/Source/Editor/AtlasBuilderWorker.h index 7bff2be678..86faeac616 100644 --- a/Gems/TextureAtlas/Code/Source/Editor/AtlasBuilderWorker.h +++ b/Gems/TextureAtlas/Code/Source/Editor/AtlasBuilderWorker.h @@ -200,28 +200,4 @@ namespace TextureAtlasBuilder //! Returns the height of the tallest area static int GetTallest(const ImageDimensionData& imageList); }; - - //! Used for sorting ImageDimensions - static bool operator<(ImageDimension a, ImageDimension b); - - //! Used to expose the ImageDimension in a pair to AZStd::Sort - static bool operator<(IndexImageDimension a, IndexImageDimension b); - - //! Returns true if two coordinate sets overlap - static bool Collides(AtlasCoordinates a, AtlasCoordinates b); - - //! Returns true if item collides with any object in list - static bool Collides(AtlasCoordinates item, AZStd::vector list); - - //! Returns the portion of the second item that overlaps with the first - static AtlasCoordinates GetOverlap(AtlasCoordinates a, AtlasCoordinates b); - - //! Performs an operation that copies a pixel to the output - static void SetPixels(AZ::u8* dest, const AZ::u8* source, int destBytes); - - //! Checks if we can insert an image into a slot - static bool CanInsert(AtlasCoordinates slot, ImageDimension image, int padding, int farRight, int farBot); - - //! Adds the necessary padding to an Atlas Coordinate - static void AddPadding(AtlasCoordinates& slot, int padding, int farRight, int farBot); } From 31addc43dc742917e8feba1be32036d709d574be Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Mon, 23 Aug 2021 14:02:45 -0700 Subject: [PATCH 050/131] Windows and Linux compiling Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Code/Editor/TrackView/DirectorNodeAnimator.cpp | 1 - Code/Editor/TrackView/TrackViewNode.cpp | 4 ---- .../Widgets/ColorPicker/PaletteCardCollection.cpp | 2 +- .../AssetBrowser/AssetBrowserFilterModel.cpp | 4 ++-- .../AzToolsFramework/Slice/SliceUtilities.cpp | 2 +- .../Tests/Prefab/PrefabInstantiateTests.cpp | 3 ++- Code/Tools/SerializeContextTools/Converter.cpp | 4 ++-- .../Artifact/Factory/TestImpactTestRunSuiteFactory.cpp | 4 ++-- .../TestImpactTestSelectorAndPrioritizer.cpp | 4 ++-- .../Process/JobRunner/TestImpactProcessJobRunner.h | 4 ++-- .../Enumeration/TestImpactTestEnumerator.cpp | 2 +- .../Run/TestImpactInstrumentedTestRunner.cpp | 2 +- .../Source/TestEngine/Run/TestImpactTestRunner.cpp | 2 +- .../Runtime/Code/Source/TestImpactRuntime.cpp | 2 +- Gems/Atom/RHI/DX12/Code/Source/RHI/CommandListPool.cpp | 2 +- Gems/Atom/RHI/DX12/Code/Source/RHI/CommandQueue.cpp | 2 +- .../ShaderManagementConsoleBrowserInteractions.cpp | 4 ++-- .../Source/Window/ShaderManagementConsoleWindow.cpp | 10 +++++----- Gems/LyShine/Code/Editor/Animation/UiAnimViewNode.cpp | 4 ---- Gems/LyShine/Code/Editor/HierarchyMenu.cpp | 4 ++-- .../Code/Editor/Assets/ScriptCanvasMemoryAsset.cpp | 2 +- .../Vegetation/Code/Source/InstanceSystemComponent.cpp | 2 +- .../Code/Source/EditorWhiteBoxComponentMode.cpp | 2 +- 23 files changed, 32 insertions(+), 40 deletions(-) diff --git a/Code/Editor/TrackView/DirectorNodeAnimator.cpp b/Code/Editor/TrackView/DirectorNodeAnimator.cpp index d9736075ce..01663fbf69 100644 --- a/Code/Editor/TrackView/DirectorNodeAnimator.cpp +++ b/Code/Editor/TrackView/DirectorNodeAnimator.cpp @@ -21,7 +21,6 @@ //////////////////////////////////////////////////////////////////////////// CDirectorNodeAnimator::CDirectorNodeAnimator([[maybe_unused]] CTrackViewAnimNode* pDirectorNode) { - assert(m_pDirectorNode != nullptr); } //////////////////////////////////////////////////////////////////////////// diff --git a/Code/Editor/TrackView/TrackViewNode.cpp b/Code/Editor/TrackView/TrackViewNode.cpp index d8507d9b0a..b61f7fcf29 100644 --- a/Code/Editor/TrackView/TrackViewNode.cpp +++ b/Code/Editor/TrackView/TrackViewNode.cpp @@ -22,16 +22,12 @@ //////////////////////////////////////////////////////////////////////////// void CTrackViewKeyConstHandle::GetKey(IKey* pKey) const { - assert(m_bIsValid); - m_pTrack->GetKey(m_keyIndex, pKey); } //////////////////////////////////////////////////////////////////////////// float CTrackViewKeyConstHandle::GetTime() const { - assert(m_bIsValid); - return m_pTrack->GetKeyTime(m_keyIndex); } diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/ColorPicker/PaletteCardCollection.cpp b/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/ColorPicker/PaletteCardCollection.cpp index 40b95af321..fea843a565 100644 --- a/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/ColorPicker/PaletteCardCollection.cpp +++ b/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/ColorPicker/PaletteCardCollection.cpp @@ -208,7 +208,7 @@ namespace AzQtComponents QString PaletteCardCollection::uniquePaletteName(QSharedPointer card, const QString& name) const { - const auto paletteNameExists = [this, card](const QString& name) + const auto paletteNameExists = [this](const QString& name) { auto it = std::find_if(m_paletteCards.begin(), m_paletteCards.end(), [&name](QSharedPointer card) diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/AssetBrowserFilterModel.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/AssetBrowserFilterModel.cpp index c729ac4d6f..0601a34cf5 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/AssetBrowserFilterModel.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/AssetBrowser/AssetBrowserFilterModel.cpp @@ -134,7 +134,7 @@ namespace AzToolsFramework { const auto& subFilters = compFilter->GetSubFilters(); const auto& compFilterIter = AZStd::find_if(subFilters.cbegin(), subFilters.cend(), - [subFilters](FilterConstType filter) -> bool + [](FilterConstType filter) -> bool { const auto assetTypeFilter = qobject_cast>(filter); return !assetTypeFilter.isNull(); @@ -146,7 +146,7 @@ namespace AzToolsFramework } const auto& compositeStringFilterIter = AZStd::find_if(subFilters.cbegin(), subFilters.cend(), - [subFilters](FilterConstType filter) -> bool + [](FilterConstType filter) -> bool { // The real StringFilter is really a CompositeFilter with just one StringFilter in its subfilter list // To know if it is actually a StringFilter we have to get that subfilter and check if it is a Stringfilter. diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Slice/SliceUtilities.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Slice/SliceUtilities.cpp index 6668b5bc3d..aca667b9aa 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Slice/SliceUtilities.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Slice/SliceUtilities.cpp @@ -4094,7 +4094,7 @@ namespace AzToolsFramework using SCCommandBus = AzToolsFramework::SourceControlCommandBus; SCCommandBus::Broadcast(&SCCommandBus::Events::RequestEdit, fullFilePath.c_str(), true, - [sliceEntity, fullFilePath, tmpFileName, tmpFilesaved](bool /*success*/, const AzToolsFramework::SourceControlFileInfo& info) + [fullFilePath, tmpFileName, tmpFilesaved](bool /*success*/, const AzToolsFramework::SourceControlFileInfo& info) { if (!info.IsReadOnly()) { diff --git a/Code/Framework/AzToolsFramework/Tests/Prefab/PrefabInstantiateTests.cpp b/Code/Framework/AzToolsFramework/Tests/Prefab/PrefabInstantiateTests.cpp index 11efe07e90..09aac8dcf5 100644 --- a/Code/Framework/AzToolsFramework/Tests/Prefab/PrefabInstantiateTests.cpp +++ b/Code/Framework/AzToolsFramework/Tests/Prefab/PrefabInstantiateTests.cpp @@ -33,7 +33,8 @@ namespace UnitTest CompareInstances(*firstInstance, *secondInstance, true, false); } - TEST_F(PrefabInstantiateTest, PrefabInstantiate_TripleNestingTemplate_InstantiateSucceeds) + // TODO: Issue #3398 will re-enable + TEST_F(PrefabInstantiateTest, DISABLED_PrefabInstantiate_TripleNestingTemplate_InstantiateSucceeds) { AZ::Entity* newEntity = CreateEntity("New Entity"); AzToolsFramework::EditorEntityContextRequestBus::Broadcast( diff --git a/Code/Tools/SerializeContextTools/Converter.cpp b/Code/Tools/SerializeContextTools/Converter.cpp index 38e114855a..eff5f140d5 100644 --- a/Code/Tools/SerializeContextTools/Converter.cpp +++ b/Code/Tools/SerializeContextTools/Converter.cpp @@ -82,7 +82,7 @@ namespace AZ AZ_Printf("Convert", "Converting '%s'\n", filePath.c_str()); PathDocumentContainer documents; - auto callback = [&result, &documents, &extension, &convertSettings, &verifySettings, skipVerify] + auto callback = [&result, &documents, &convertSettings, &verifySettings, skipVerify] (void* classPtr, const Uuid& classId, SerializeContext* /*context*/) { rapidjson::Document document; @@ -346,7 +346,7 @@ namespace AZ // Convert the supplied file list to an absolute path AZStd::optional absFilePath = AZ::Utils::ConvertToAbsolutePath(configFileView); AZ::IO::FixedMaxPath configFilePath = absFilePath ? *absFilePath : configFileView; - auto callback = [&documents, &outputExtension, &configFilePath](AZ::IO::PathView configFileView, bool isFile) -> bool + auto callback = [&documents, &configFilePath](AZ::IO::PathView configFileView, bool isFile) -> bool { if (configFileView == "." || configFileView == "..") { diff --git a/Code/Tools/TestImpactFramework/Runtime/Code/Source/Artifact/Factory/TestImpactTestRunSuiteFactory.cpp b/Code/Tools/TestImpactFramework/Runtime/Code/Source/Artifact/Factory/TestImpactTestRunSuiteFactory.cpp index f5d7d3a8a2..57c65837bd 100644 --- a/Code/Tools/TestImpactFramework/Runtime/Code/Source/Artifact/Factory/TestImpactTestRunSuiteFactory.cpp +++ b/Code/Tools/TestImpactFramework/Runtime/Code/Source/Artifact/Factory/TestImpactTestRunSuiteFactory.cpp @@ -64,7 +64,7 @@ namespace TestImpact return !name.starts_with("DISABLED_") && name.find("/DISABLED_") == AZStd::string::npos; }; - const auto getDuration = [&Keys](const AZ::rapidxml::xml_node<>* node) + const auto getDuration = [](const AZ::rapidxml::xml_node<>* node) { const AZStd::string duration = node->first_attribute(Keys[DurationKey])->value(); return AZStd::chrono::milliseconds(static_cast(AZStd::stof(duration) * 1000.f)); @@ -78,7 +78,7 @@ namespace TestImpact for (auto testcase_node = testsuite_node->first_node(Keys[TestCaseKey]); testcase_node; testcase_node = testcase_node->next_sibling()) { - const auto getStatus = [&Keys](const AZ::rapidxml::xml_node<>* node) + const auto getStatus = [](const AZ::rapidxml::xml_node<>* node) { const AZStd::string status = node->first_attribute(Keys[StatusKey])->value(); if (status == Keys[RunKey]) diff --git a/Code/Tools/TestImpactFramework/Runtime/Code/Source/Dependency/TestImpactTestSelectorAndPrioritizer.cpp b/Code/Tools/TestImpactFramework/Runtime/Code/Source/Dependency/TestImpactTestSelectorAndPrioritizer.cpp index 74d8f354bd..7aae55a20a 100644 --- a/Code/Tools/TestImpactFramework/Runtime/Code/Source/Dependency/TestImpactTestSelectorAndPrioritizer.cpp +++ b/Code/Tools/TestImpactFramework/Runtime/Code/Source/Dependency/TestImpactTestSelectorAndPrioritizer.cpp @@ -87,7 +87,7 @@ namespace TestImpact { for (const auto& parentTarget : sourceDependency.GetParentTargets()) { - AZStd::visit([&selectedTestTargetMap, &sourceDependency, this](auto&& target) + AZStd::visit([&selectedTestTargetMap, &sourceDependency](auto&& target) { if constexpr (IsProductionTarget) { @@ -129,7 +129,7 @@ namespace TestImpact { for (const auto& parentTarget : sourceDependency.GetParentTargets()) { - AZStd::visit([&selectedTestTargetMap, &sourceDependency, this](auto&& target) + AZStd::visit([&selectedTestTargetMap](auto&& target) { if constexpr (IsTestTarget) { diff --git a/Code/Tools/TestImpactFramework/Runtime/Code/Source/Process/JobRunner/TestImpactProcessJobRunner.h b/Code/Tools/TestImpactFramework/Runtime/Code/Source/Process/JobRunner/TestImpactProcessJobRunner.h index 6a898931a0..8144615aeb 100644 --- a/Code/Tools/TestImpactFramework/Runtime/Code/Source/Process/JobRunner/TestImpactProcessJobRunner.h +++ b/Code/Tools/TestImpactFramework/Runtime/Code/Source/Process/JobRunner/TestImpactProcessJobRunner.h @@ -107,7 +107,7 @@ namespace TestImpact } // Wrapper around low-level process launch callback to gather job meta-data and present a simplified callback interface to the client - const ProcessLaunchCallback processLaunchCallback = [&jobCallback, &jobInfos, &metas]( + const ProcessLaunchCallback processLaunchCallback = [&jobCallback, &metas]( TestImpact::ProcessId pid, TestImpact::LaunchResult launchResult, AZStd::chrono::high_resolution_clock::time_point createTime) @@ -126,7 +126,7 @@ namespace TestImpact }; // Wrapper around low-level process exit callback to gather job meta-data and present a simplified callback interface to the client - const ProcessExitCallback processExitCallback = [&jobCallback, &jobInfos, &metas]( + const ProcessExitCallback processExitCallback = [&jobCallback, &metas]( TestImpact::ProcessId pid, TestImpact::ExitCondition exitCondition, TestImpact::ReturnCode returnCode, diff --git a/Code/Tools/TestImpactFramework/Runtime/Code/Source/TestEngine/Enumeration/TestImpactTestEnumerator.cpp b/Code/Tools/TestImpactFramework/Runtime/Code/Source/TestEngine/Enumeration/TestImpactTestEnumerator.cpp index 756b1c75d6..dba1053ee1 100644 --- a/Code/Tools/TestImpactFramework/Runtime/Code/Source/TestEngine/Enumeration/TestImpactTestEnumerator.cpp +++ b/Code/Tools/TestImpactFramework/Runtime/Code/Source/TestEngine/Enumeration/TestImpactTestEnumerator.cpp @@ -151,7 +151,7 @@ namespace TestImpact } */ - const auto payloadGenerator = [this](const JobDataMap& jobDataMap) + const auto payloadGenerator = [](const JobDataMap& jobDataMap) { PayloadMap enumerations; for (const auto& [jobId, jobData] : jobDataMap) diff --git a/Code/Tools/TestImpactFramework/Runtime/Code/Source/TestEngine/Run/TestImpactInstrumentedTestRunner.cpp b/Code/Tools/TestImpactFramework/Runtime/Code/Source/TestEngine/Run/TestImpactInstrumentedTestRunner.cpp index bf7e4d2c34..51a3445a53 100644 --- a/Code/Tools/TestImpactFramework/Runtime/Code/Source/TestEngine/Run/TestImpactInstrumentedTestRunner.cpp +++ b/Code/Tools/TestImpactFramework/Runtime/Code/Source/TestEngine/Run/TestImpactInstrumentedTestRunner.cpp @@ -40,7 +40,7 @@ namespace TestImpact AZStd::optional runnerTimeout, AZStd::optional clientCallback) { - const auto payloadGenerator = [this](const JobDataMap& jobDataMap) + const auto payloadGenerator = [](const JobDataMap& jobDataMap) { PayloadMap runs; for (const auto& [jobId, jobData] : jobDataMap) diff --git a/Code/Tools/TestImpactFramework/Runtime/Code/Source/TestEngine/Run/TestImpactTestRunner.cpp b/Code/Tools/TestImpactFramework/Runtime/Code/Source/TestEngine/Run/TestImpactTestRunner.cpp index a480f4aa4a..28c38d05d4 100644 --- a/Code/Tools/TestImpactFramework/Runtime/Code/Source/TestEngine/Run/TestImpactTestRunner.cpp +++ b/Code/Tools/TestImpactFramework/Runtime/Code/Source/TestEngine/Run/TestImpactTestRunner.cpp @@ -28,7 +28,7 @@ namespace TestImpact AZStd::optional runnerTimeout, AZStd::optional clientCallback) { - const auto payloadGenerator = [this](const JobDataMap& jobDataMap) + const auto payloadGenerator = [](const JobDataMap& jobDataMap) { PayloadMap runs; for (const auto& [jobId, jobData] : jobDataMap) diff --git a/Code/Tools/TestImpactFramework/Runtime/Code/Source/TestImpactRuntime.cpp b/Code/Tools/TestImpactFramework/Runtime/Code/Source/TestImpactRuntime.cpp index 515118dd7a..770a1458b8 100644 --- a/Code/Tools/TestImpactFramework/Runtime/Code/Source/TestImpactRuntime.cpp +++ b/Code/Tools/TestImpactFramework/Runtime/Code/Source/TestImpactRuntime.cpp @@ -323,7 +323,7 @@ namespace TestImpact void Runtime::EnumerateMutatedTestTargets(const ChangeDependencyList& changeDependencyList) { AZStd::vector testTargets; - const auto addMutatedTestTargetsToEnumerationList = [this, &testTargets](const AZStd::vector& sourceDependencies) + const auto addMutatedTestTargetsToEnumerationList = [&testTargets](const AZStd::vector& sourceDependencies) { for (const auto& sourceDependency : sourceDependencies) { diff --git a/Gems/Atom/RHI/DX12/Code/Source/RHI/CommandListPool.cpp b/Gems/Atom/RHI/DX12/Code/Source/RHI/CommandListPool.cpp index 3d3ec472a7..c31fe8ada8 100644 --- a/Gems/Atom/RHI/DX12/Code/Source/RHI/CommandListPool.cpp +++ b/Gems/Atom/RHI/DX12/Code/Source/RHI/CommandListPool.cpp @@ -138,7 +138,7 @@ namespace AZ commandAllocatorPoolDescriptor.m_collectLatency = descriptor.m_frameCountMax; commandAllocatorPool.Init(commandAllocatorPoolDescriptor); - m_commandListSubAllocators[queueIdx].SetInitFunction([this, &commandListPool, &commandAllocatorPool] + m_commandListSubAllocators[queueIdx].SetInitFunction([&commandListPool, &commandAllocatorPool] (Internal::CommandListSubAllocator& subAllocator) { subAllocator.Init(commandAllocatorPool, commandListPool); diff --git a/Gems/Atom/RHI/DX12/Code/Source/RHI/CommandQueue.cpp b/Gems/Atom/RHI/DX12/Code/Source/RHI/CommandQueue.cpp index b73228e717..5f2c737b38 100644 --- a/Gems/Atom/RHI/DX12/Code/Source/RHI/CommandQueue.cpp +++ b/Gems/Atom/RHI/DX12/Code/Source/RHI/CommandQueue.cpp @@ -108,7 +108,7 @@ namespace AZ void CommandQueue::QueueGpuSignal(Fence& fence) { - QueueCommand([this, &fence](void* commandQueue) + QueueCommand([&fence](void* commandQueue) { AZ_PROFILE_SCOPE(AzRender, "SignalFence"); ID3D12CommandQueue* dx12CommandQueue = static_cast(commandQueue); diff --git a/Gems/Atom/Tools/ShaderManagementConsole/Code/Source/Window/ShaderManagementConsoleBrowserInteractions.cpp b/Gems/Atom/Tools/ShaderManagementConsole/Code/Source/Window/ShaderManagementConsoleBrowserInteractions.cpp index b82d348df3..ca836b1b8d 100644 --- a/Gems/Atom/Tools/ShaderManagementConsole/Code/Source/Window/ShaderManagementConsoleBrowserInteractions.cpp +++ b/Gems/Atom/Tools/ShaderManagementConsole/Code/Source/Window/ShaderManagementConsoleBrowserInteractions.cpp @@ -84,7 +84,7 @@ namespace ShaderManagementConsole } }); - menu->addAction("Duplicate...", [entry, caller]() + menu->addAction("Duplicate...", [entry]() { const QFileInfo duplicateFileInfo(AtomToolsFramework::GetDuplicationFileInfo(entry->GetFullPath().c_str())); if (!duplicateFileInfo.absoluteFilePath().isEmpty()) @@ -189,7 +189,7 @@ namespace ShaderManagementConsole }); // add get latest action - m_getLatestAction = sourceControlMenu->addAction("Get Latest", [path, this]() + m_getLatestAction = sourceControlMenu->addAction("Get Latest", [path]() { SourceControlCommandBus::Broadcast(&SourceControlCommandBus::Events::RequestLatest, path.c_str(), [](bool, const SourceControlFileInfo&) {}); diff --git a/Gems/Atom/Tools/ShaderManagementConsole/Code/Source/Window/ShaderManagementConsoleWindow.cpp b/Gems/Atom/Tools/ShaderManagementConsole/Code/Source/Window/ShaderManagementConsoleWindow.cpp index 6354f8beba..3812e47d70 100644 --- a/Gems/Atom/Tools/ShaderManagementConsole/Code/Source/Window/ShaderManagementConsoleWindow.cpp +++ b/Gems/Atom/Tools/ShaderManagementConsole/Code/Source/Window/ShaderManagementConsoleWindow.cpp @@ -202,7 +202,7 @@ namespace ShaderManagementConsole // Generating the main menu manually because it's easier and we will have some dynamic or data driven entries m_menuFile = menuBar()->addMenu("&File"); - m_actionOpen = m_menuFile->addAction("&Open...", [this]() { + m_actionOpen = m_menuFile->addAction("&Open...", []() { const AZStd::vector assetTypes = { }; @@ -256,7 +256,7 @@ namespace ShaderManagementConsole AtomToolsFramework::AtomToolsDocumentSystemRequestBus::Broadcast(&AtomToolsFramework::AtomToolsDocumentSystemRequestBus::Events::CloseDocument, documentId); }, QKeySequence::Close); - m_actionCloseAll = m_menuFile->addAction("Close All", [this]() { + m_actionCloseAll = m_menuFile->addAction("Close All", []() { AtomToolsFramework::AtomToolsDocumentSystemRequestBus::Broadcast(&AtomToolsFramework::AtomToolsDocumentSystemRequestBus::Events::CloseAllDocuments); }); @@ -305,7 +305,7 @@ namespace ShaderManagementConsole m_menuEdit->addSeparator(); - m_actionSettings = m_menuEdit->addAction("&Settings...", [this]() { + m_actionSettings = m_menuEdit->addAction("&Settings...", []() { }, QKeySequence::Preferences); m_actionSettings->setEnabled(false); @@ -334,10 +334,10 @@ namespace ShaderManagementConsole m_menuHelp = menuBar()->addMenu("&Help"); - m_actionHelp = m_menuHelp->addAction("&Help...", [this]() { + m_actionHelp = m_menuHelp->addAction("&Help...", []() { }); - m_actionAbout = m_menuHelp->addAction("&About...", [this]() { + m_actionAbout = m_menuHelp->addAction("&About...", []() { }); } diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewNode.cpp b/Gems/LyShine/Code/Editor/Animation/UiAnimViewNode.cpp index 2b14a38015..3c1292910f 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewNode.cpp +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewNode.cpp @@ -14,16 +14,12 @@ //////////////////////////////////////////////////////////////////////////// void CUiAnimViewKeyConstHandle::GetKey(IKey* pKey) const { - assert(m_bIsValid); - m_pTrack->GetKey(m_keyIndex, pKey); } //////////////////////////////////////////////////////////////////////////// float CUiAnimViewKeyConstHandle::GetTime() const { - assert(m_bIsValid); - return m_pTrack->GetKeyTime(m_keyIndex); } diff --git a/Gems/LyShine/Code/Editor/HierarchyMenu.cpp b/Gems/LyShine/Code/Editor/HierarchyMenu.cpp index 31c5255538..004fe53354 100644 --- a/Gems/LyShine/Code/Editor/HierarchyMenu.cpp +++ b/Gems/LyShine/Code/Editor/HierarchyMenu.cpp @@ -236,14 +236,14 @@ void HierarchyMenu::SliceMenuItems(HierarchyWidget* hierarchy, if (showMask & Show::kNewSlice) { QAction* action = addAction("Make Cascaded Slice from Selected Slices && Entities..."); - QObject::connect(action, &QAction::triggered, hierarchy, [hierarchy, selectedEntities] + QObject::connect(action, &QAction::triggered, hierarchy, [hierarchy] { hierarchy->GetEditorWindow()->GetSliceManager()->MakeSliceFromSelectedItems(hierarchy, true); } ); action = addAction(QObject::tr("Make Detached Slice from Selected Entities...")); - QObject::connect(action, &QAction::triggered, hierarchy, [hierarchy, selectedEntities] + QObject::connect(action, &QAction::triggered, hierarchy, [hierarchy] { hierarchy->GetEditorWindow()->GetSliceManager()->MakeSliceFromSelectedItems(hierarchy, false); } diff --git a/Gems/ScriptCanvas/Code/Editor/Assets/ScriptCanvasMemoryAsset.cpp b/Gems/ScriptCanvas/Code/Editor/Assets/ScriptCanvasMemoryAsset.cpp index dbb95828f7..165007b79b 100644 --- a/Gems/ScriptCanvas/Code/Editor/Assets/ScriptCanvasMemoryAsset.cpp +++ b/Gems/ScriptCanvas/Code/Editor/Assets/ScriptCanvasMemoryAsset.cpp @@ -503,7 +503,7 @@ namespace ScriptCanvasEditor m_pendingSave.emplace_back(normPath); m_assetSaveFinalizer.Reset(); - m_assetSaveFinalizer.Start(this, fileInfo, saveInfo, onSaveCallback, AssetSaveFinalizer::OnCompleteHandler([saveInfo](AZ::Data::AssetId /*assetId*/) + m_assetSaveFinalizer.Start(this, fileInfo, saveInfo, onSaveCallback, AssetSaveFinalizer::OnCompleteHandler([](AZ::Data::AssetId /*assetId*/) { })); } diff --git a/Gems/Vegetation/Code/Source/InstanceSystemComponent.cpp b/Gems/Vegetation/Code/Source/InstanceSystemComponent.cpp index d4185fde6c..dd38daa633 100644 --- a/Gems/Vegetation/Code/Source/InstanceSystemComponent.cpp +++ b/Gems/Vegetation/Code/Source/InstanceSystemComponent.cpp @@ -582,7 +582,7 @@ namespace Vegetation } //offloading garbage collection to job to save time deallocating tasks on main thread - auto garbageCollectionJob = AZ::CreateJobFunction([removedTasksPtr]() mutable {}, true); + auto garbageCollectionJob = AZ::CreateJobFunction([]() mutable {}, true); garbageCollectionJob->Start(); } diff --git a/Gems/WhiteBox/Code/Source/EditorWhiteBoxComponentMode.cpp b/Gems/WhiteBox/Code/Source/EditorWhiteBoxComponentMode.cpp index cd9e8090cd..13dc29599d 100644 --- a/Gems/WhiteBox/Code/Source/EditorWhiteBoxComponentMode.cpp +++ b/Gems/WhiteBox/Code/Source/EditorWhiteBoxComponentMode.cpp @@ -397,7 +397,7 @@ namespace WhiteBox const auto edgeHandlesPair = Api::MeshUserEdgeHandles(*whiteBox); - const auto edgeHandles = [whiteBox, edgeSelectionMode, &edgeHandlesPair]() + const auto edgeHandles = [edgeSelectionMode, &edgeHandlesPair]() { switch (edgeSelectionMode) { From 7308578e55c112f4687d8d535f50cbe6d80c4a5b Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Mon, 23 Aug 2021 14:58:47 -0700 Subject: [PATCH 051/131] reverting a change that will be cleaned by another PR Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Code/Legacy/CryCommon/platform_impl.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Code/Legacy/CryCommon/platform_impl.cpp b/Code/Legacy/CryCommon/platform_impl.cpp index a89df5471a..13aa67ca21 100644 --- a/Code/Legacy/CryCommon/platform_impl.cpp +++ b/Code/Legacy/CryCommon/platform_impl.cpp @@ -18,6 +18,7 @@ #include #include + // Section dictionary #if defined(AZ_RESTRICTED_PLATFORM) #define PLATFORM_IMPL_H_SECTION_TRAITS 1 @@ -404,7 +405,7 @@ _MS_ALIGN(64) uint32 BoxSides[0x40 * 8] = { 0, 0, 0, 0, 0, 0, 0, 0, //3d 0, 0, 0, 0, 0, 0, 0, 0, //3e 0, 0, 0, 0, 0, 0, 0, 0, //3f -} _ALIGN(64); +}; //////////////////////////////////////////////////////////////////////////////////////////////////////////// #if defined(AZ_RESTRICTED_PLATFORM) From a75994e0b949b6447305563ef7c4fb38b2ba49a5 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Mon, 23 Aug 2021 15:11:09 -0700 Subject: [PATCH 052/131] more fixes Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Code/Legacy/CryCommon/WinBase.cpp | 2 +- .../Artifact/Factory/TestImpactTestRunSuiteFactory.cpp | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Code/Legacy/CryCommon/WinBase.cpp b/Code/Legacy/CryCommon/WinBase.cpp index f9b1978e74..8473417d4a 100644 --- a/Code/Legacy/CryCommon/WinBase.cpp +++ b/Code/Legacy/CryCommon/WinBase.cpp @@ -825,7 +825,7 @@ const int comparePathNames(const char* cpFirst, const char* cpSecond, unsigned i return memicmp(first.c_str(), second.c_str(), length); } -#if defined(FIX_FILENAME_CASE) +#if FIX_FILENAME_CASE static bool FixOnePathElement(char* path) { if (*path == '\0') diff --git a/Code/Tools/TestImpactFramework/Runtime/Code/Source/Artifact/Factory/TestImpactTestRunSuiteFactory.cpp b/Code/Tools/TestImpactFramework/Runtime/Code/Source/Artifact/Factory/TestImpactTestRunSuiteFactory.cpp index 57c65837bd..b7a44d43ea 100644 --- a/Code/Tools/TestImpactFramework/Runtime/Code/Source/Artifact/Factory/TestImpactTestRunSuiteFactory.cpp +++ b/Code/Tools/TestImpactFramework/Runtime/Code/Source/Artifact/Factory/TestImpactTestRunSuiteFactory.cpp @@ -64,8 +64,9 @@ namespace TestImpact return !name.starts_with("DISABLED_") && name.find("/DISABLED_") == AZStd::string::npos; }; - const auto getDuration = [](const AZ::rapidxml::xml_node<>* node) + const auto getDuration = [Keys](const AZ::rapidxml::xml_node<>* node) { + AZ_UNUSED(Keys); const AZStd::string duration = node->first_attribute(Keys[DurationKey])->value(); return AZStd::chrono::milliseconds(static_cast(AZStd::stof(duration) * 1000.f)); }; @@ -78,8 +79,9 @@ namespace TestImpact for (auto testcase_node = testsuite_node->first_node(Keys[TestCaseKey]); testcase_node; testcase_node = testcase_node->next_sibling()) { - const auto getStatus = [](const AZ::rapidxml::xml_node<>* node) + const auto getStatus = [Keys](const AZ::rapidxml::xml_node<>* node) { + AZ_UNUSED(Keys); const AZStd::string status = node->first_attribute(Keys[StatusKey])->value(); if (status == Keys[RunKey]) { From 63a292572097054989ea7fbb141bea3a0c26d8ce Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Mon, 23 Aug 2021 17:21:59 -0700 Subject: [PATCH 053/131] more fixes Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Code/Framework/AzCore/AzCore/Math/Guid.h | 2 +- .../Windows/AzCore/PlatformIncl_Windows.h | 31 ++++++++++--------- Code/Legacy/CryCommon/platform_impl.cpp | 2 +- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/Code/Framework/AzCore/AzCore/Math/Guid.h b/Code/Framework/AzCore/AzCore/Math/Guid.h index 53bab4d7ed..a061858265 100644 --- a/Code/Framework/AzCore/AzCore/Math/Guid.h +++ b/Code/Framework/AzCore/AzCore/Math/Guid.h @@ -22,7 +22,7 @@ typedef struct _GUID { _GUID() = default; - uint32_t Data1; + unsigned long Data1; unsigned short Data2; unsigned short Data3; unsigned char Data4[ 8 ]; diff --git a/Code/Framework/AzCore/Platform/Windows/AzCore/PlatformIncl_Windows.h b/Code/Framework/AzCore/Platform/Windows/AzCore/PlatformIncl_Windows.h index f58e772155..0e798b531d 100644 --- a/Code/Framework/AzCore/Platform/Windows/AzCore/PlatformIncl_Windows.h +++ b/Code/Framework/AzCore/Platform/Windows/AzCore/PlatformIncl_Windows.h @@ -34,7 +34,6 @@ ////#define NOMB //- MB_* and MessageBox() //#define NOMEMMGR //- GMEM_*, LMEM_*, GHND, LHND, associated routines //#define NOMETAFILE //- typedef METAFILEPICT -////#define NOMINMAX //- Macros min(a,b) and max(a,b) //#define NOMSG //- typedef MSG and associated routines //#define NOOPENFILE //- OpenFile(), OemToAnsi, AnsiToOem, and OF_* //#define NOSCROLL //- SB_* and scrolling routines @@ -50,27 +49,29 @@ //#define NODEFERWINDOWPOS //- DeferWindowPos routines //#define NOMCX //- Modem Configuration Extensions -// //declare intrinsics to make sure we get the inline intrinsic versions and not a function call #if !defined(_WIN32_WINNT) || (_WIN32_WINNT < 0x0602) -# undef _WIN32_WINNT -# define _WIN32_WINNT 0x0602 // Windows Server 2012 and later + #undef _WIN32_WINNT + #define _WIN32_WINNT 0x0602 // Windows Server 2012 and later #endif -#ifdef NOMINMAX -# include -# include -#else -# define NOMINMAX -# include -# include -# undef NOMINMAX +#if !defined(NOMINMAX) + #define NOMINMAX // - Dont define Macros min(a,b) and max(a,b) #endif + +#pragma warning(push) +#pragma warning(disable: 5032) // winioctl.h(161,17): error C5032: detected #pragma warning(push) with no corresponding #pragma warning(pop) + +#include +#include + +#pragma warning(pop) + // Undef common function names that Windows.h defines #if defined(SetJob) -#undef SetJob + #undef SetJob #endif #if defined(GetObject) -#undef GetObject + #undef GetObject #endif #if defined(GetCommandLine) -#undef GetCommandLine + #undef GetCommandLine #endif diff --git a/Code/Legacy/CryCommon/platform_impl.cpp b/Code/Legacy/CryCommon/platform_impl.cpp index 13aa67ca21..d61bfe6ee4 100644 --- a/Code/Legacy/CryCommon/platform_impl.cpp +++ b/Code/Legacy/CryCommon/platform_impl.cpp @@ -340,7 +340,7 @@ inline void CryDebugStr([[maybe_unused]] const char* format, ...) */ } -_MS_ALIGN(64) uint32 BoxSides[0x40 * 8] = { +alignas(64) uint32 BoxSides[0x40 * 8] = { 0, 0, 0, 0, 0, 0, 0, 0, //00 0, 4, 6, 2, 0, 0, 0, 4, //01 7, 5, 1, 3, 0, 0, 0, 4, //02 From 07ea4edbc2d4dfad38ab094cd39525687776091e Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Mon, 23 Aug 2021 17:51:13 -0700 Subject: [PATCH 054/131] Fixes for Mac/iOS Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Code/Editor/LogFile.cpp | 2 +- Code/Editor/Platform/Mac/main_dummy.cpp | 4 ++-- .../Mac/AzFramework/Process/ProcessWatcher_Mac.cpp | 2 -- Code/Tools/AssetProcessor/Platform/Mac/main_dummy.cpp | 4 ++-- Gems/Atom/RHI/Code/Tests/AllocatorTests.cpp | 1 - Gems/Atom/RHI/Code/Tests/ShaderResourceGroupTests.cpp | 3 +-- .../Source/RHI.Builders/ShaderPlatformInterface.cpp | 4 +--- .../RHI/Metal/Code/Source/RHI/AsyncUploadQueue.cpp | 7 ------- Gems/Atom/RHI/Metal/Code/Source/RHI/BufferPool.cpp | 3 +-- .../Atom/RHI/Metal/Code/Source/RHI/CommandListPool.cpp | 2 +- Gems/Atom/RHI/Metal/Code/Source/RHI/CommandListPool.h | 2 +- .../RHI/Metal/Code/Source/RHI/ImagePoolResolver.cpp | 6 ++---- .../Metal/Code/Source/RHI/NullDescriptorManager.cpp | 3 --- Gems/Atom/RHI/Metal/Code/Source/RHI/QueryPool.cpp | 10 ++++------ Gems/Atom/RHI/Metal/Code/Source/RHI/Scope.cpp | 3 --- .../Metal/Code/Source/RHI/ShaderResourceGroupPool.cpp | 1 - .../RHI/Metal/Code/Source/RHI/StreamingImagePool.cpp | 1 - Gems/Atom/RHI/Metal/Code/Source/RHI/SwapChain.cpp | 3 --- .../Platform/Mac/MicrophoneSystemComponent_Mac.mm | 7 ++++--- .../Platform/iOS/MicrophoneSystemComponent_iOS.mm | 7 ++++--- 20 files changed, 24 insertions(+), 51 deletions(-) diff --git a/Code/Editor/LogFile.cpp b/Code/Editor/LogFile.cpp index 2ebb353915..9692dd264a 100644 --- a/Code/Editor/LogFile.cpp +++ b/Code/Editor/LogFile.cpp @@ -179,7 +179,6 @@ void CLogFile::FormatLineV(const char * format, va_list argList) void CLogFile::AboutSystem() { - char szBuffer[MAX_LOGBUFFER_SIZE]; #if defined(AZ_PLATFORM_WINDOWS) || defined(AZ_PLATFORM_LINUX) ////////////////////////////////////////////////////////////////////// // Write the system informations to the log @@ -190,6 +189,7 @@ void CLogFile::AboutSystem() #endif // defined(AZ_PLATFORM_WINDOWS) || defined(AZ_PLATFORM_LINUX) #if defined(AZ_PLATFORM_WINDOWS) + char szBuffer[MAX_LOGBUFFER_SIZE]; wchar_t szLanguageBufferW[64]; DEVMODE DisplayConfig; OSVERSIONINFO OSVerInfo; diff --git a/Code/Editor/Platform/Mac/main_dummy.cpp b/Code/Editor/Platform/Mac/main_dummy.cpp index fb4a431295..082384db58 100644 --- a/Code/Editor/Platform/Mac/main_dummy.cpp +++ b/Code/Editor/Platform/Mac/main_dummy.cpp @@ -66,8 +66,8 @@ int main(int argc, char* argv[]) processLaunchInfo.m_environmentVariables = &envVars; processLaunchInfo.m_showWindow = true; - AzFramework::ProcessWatcher* processWatcher = AzFramework::ProcessWatcher::LaunchProcess(processLaunchInfo, AzFramework::ProcessCommunicationType::COMMUNICATOR_TYPE_NONE); - + AzFramework::ProcessWatcher::LaunchProcess(processLaunchInfo, AzFramework::ProcessCommunicationType::COMMUNICATOR_TYPE_NONE); + application.Destroy(); return 0; diff --git a/Code/Framework/AzFramework/Platform/Mac/AzFramework/Process/ProcessWatcher_Mac.cpp b/Code/Framework/AzFramework/Platform/Mac/AzFramework/Process/ProcessWatcher_Mac.cpp index 4099443913..1ba9ff3067 100644 --- a/Code/Framework/AzFramework/Platform/Mac/AzFramework/Process/ProcessWatcher_Mac.cpp +++ b/Code/Framework/AzFramework/Platform/Mac/AzFramework/Process/ProcessWatcher_Mac.cpp @@ -205,8 +205,6 @@ namespace AzFramework bool ProcessLauncher::LaunchProcess(const ProcessLaunchInfo& processLaunchInfo, ProcessData& processData) { - bool result = false; - // note that the convention here is that it uses windows-shell style escaping of combined args with spaces in it // (so surrounding with quotes like param="hello world") // this is so that the callers (which could be numerous) do not have to worry about this and sprinkle ifdefs diff --git a/Code/Tools/AssetProcessor/Platform/Mac/main_dummy.cpp b/Code/Tools/AssetProcessor/Platform/Mac/main_dummy.cpp index 12832cc488..cd080f9572 100644 --- a/Code/Tools/AssetProcessor/Platform/Mac/main_dummy.cpp +++ b/Code/Tools/AssetProcessor/Platform/Mac/main_dummy.cpp @@ -66,8 +66,8 @@ int main(int argc, char* argv[]) processLaunchInfo.m_environmentVariables = &envVars; processLaunchInfo.m_showWindow = true; - AzFramework::ProcessWatcher* processWatcher = AzFramework::ProcessWatcher::LaunchProcess(processLaunchInfo, AzFramework::ProcessCommunicationType::COMMUNICATOR_TYPE_NONE); - + AzFramework::ProcessWatcher::LaunchProcess(processLaunchInfo, AzFramework::ProcessCommunicationType::COMMUNICATOR_TYPE_NONE); + application.Destroy(); return 0; diff --git a/Gems/Atom/RHI/Code/Tests/AllocatorTests.cpp b/Gems/Atom/RHI/Code/Tests/AllocatorTests.cpp index fa4c14089f..e43510adb5 100644 --- a/Gems/Atom/RHI/Code/Tests/AllocatorTests.cpp +++ b/Gems/Atom/RHI/Code/Tests/AllocatorTests.cpp @@ -67,7 +67,6 @@ namespace UnitTest AZStd::vector retiredAllocationsCurrent; AZStd::vector retiredAllocationsPrevious; - const size_t AllocationCount = 100; const size_t AllocationSizeRange = descriptor.m_allocationSizeMax - descriptor.m_allocationSizeMin; AZStd::string outputString; diff --git a/Gems/Atom/RHI/Code/Tests/ShaderResourceGroupTests.cpp b/Gems/Atom/RHI/Code/Tests/ShaderResourceGroupTests.cpp index 32d89cd596..83b3b68b25 100644 --- a/Gems/Atom/RHI/Code/Tests/ShaderResourceGroupTests.cpp +++ b/Gems/Atom/RHI/Code/Tests/ShaderResourceGroupTests.cpp @@ -56,8 +56,7 @@ namespace UnitTest const uint32_t BufferConstantCount = 2; const uint32_t BufferReadCount = 2; const uint32_t BufferReadWriteCount = 2; - const uint32_t BindingIndex = 1; - + AZStd::unique_ptr m_factory; AZStd::unique_ptr m_serializeContext; diff --git a/Gems/Atom/RHI/Metal/Code/Source/RHI.Builders/ShaderPlatformInterface.cpp b/Gems/Atom/RHI/Metal/Code/Source/RHI.Builders/ShaderPlatformInterface.cpp index b65db2a993..903b25e16f 100644 --- a/Gems/Atom/RHI/Metal/Code/Source/RHI.Builders/ShaderPlatformInterface.cpp +++ b/Gems/Atom/RHI/Metal/Code/Source/RHI.Builders/ShaderPlatformInterface.cpp @@ -252,9 +252,7 @@ namespace AZ // Output file AZStd::string shaderMSLOutputFile = RHI::BuildFileNameWithExtension(shaderSourceFile, tempFolder, "metal"); - - bool outputFileWriteResult = false; - + // Stage profile name parameter const AZStd::string shaderModelVersion = "6_2"; diff --git a/Gems/Atom/RHI/Metal/Code/Source/RHI/AsyncUploadQueue.cpp b/Gems/Atom/RHI/Metal/Code/Source/RHI/AsyncUploadQueue.cpp index 2c9eb95ad4..bd163f1419 100644 --- a/Gems/Atom/RHI/Metal/Code/Source/RHI/AsyncUploadQueue.cpp +++ b/Gems/Atom/RHI/Metal/Code/Source/RHI/AsyncUploadQueue.cpp @@ -105,7 +105,6 @@ namespace AZ } Fence* fenceToSignal = nullptr; - uint64_t fenceToSignalValue = 0; size_t byteCount = uploadRequest.m_byteCount; size_t byteOffset = destMemoryView.GetOffset() + uploadRequest.m_byteOffset; uint64_t queueValue = m_uploadFence.Increment(); @@ -183,8 +182,6 @@ namespace AZ { CommandQueue* commandQueue = static_cast(queue); FramePacket* framePacket = BeginFramePacket(commandQueue); - const uint16_t arraySize = image->GetDescriptor().m_arraySize; - const uint16_t imageMipLevels = image->GetDescriptor().m_mipLevels; //[GFX TODO][ATOM-5605] - Cache alignments for all formats at Init const static uint32_t bufferOffsetAlign = [mtlDevice minimumTextureBufferAlignmentForPixelFormat: ConvertPixelFormat(image->GetDescriptor().m_format)]; @@ -212,7 +209,6 @@ namespace AZ if (subresourceLayout.m_size.m_height < subresourceLayout.m_rowCount) { AZ_Error("Metal", false, "AsyncUploadQueue::QueueUpload expects ImageHeight '%d' to be bigger than or equal to the image's RowCount '%d'.", subresourceLayout.m_size.m_height, subresourceLayout.m_rowCount); - RHI::AsyncWorkHandle::Null; } // The final staging size for each CopyTextureRegion command @@ -281,8 +277,6 @@ namespace AZ { const uint8_t* subresourceDataStart = reinterpret_cast(subresourceData.m_data) + depth * subresourceSlicePitch; - MTLTextureDescriptor* mtlTextureDesc = ConvertImageDescriptor(image->GetDescriptor()); - uint32_t startRow = 0; uint32_t destHeight = 0; while (startRow < subresourceLayout.m_rowCount) @@ -468,7 +462,6 @@ namespace AZ MTLBlitOption mtlBlitOption = GetBlitOption(destImage->GetDescriptor().m_format); - id tempTex = destImage->GetMemoryView().GetGpuAddress>(); [blitEncoder copyFromBuffer:framePacket->m_stagingResource sourceOffset:framePacket->m_dataOffset sourceBytesPerRow:stagingRowPitch diff --git a/Gems/Atom/RHI/Metal/Code/Source/RHI/BufferPool.cpp b/Gems/Atom/RHI/Metal/Code/Source/RHI/BufferPool.cpp index a1bd9533bc..13f216e098 100644 --- a/Gems/Atom/RHI/Metal/Code/Source/RHI/BufferPool.cpp +++ b/Gems/Atom/RHI/Metal/Code/Source/RHI/BufferPool.cpp @@ -102,8 +102,7 @@ namespace AZ void BufferPool::ShutdownResourceInternal(RHI::Resource& resourceBase) { Buffer& buffer = static_cast(resourceBase); - auto& device = static_cast(GetDevice()); - + if (auto* resolver = GetResolver()) { resolver->OnResourceShutdown(resourceBase); diff --git a/Gems/Atom/RHI/Metal/Code/Source/RHI/CommandListPool.cpp b/Gems/Atom/RHI/Metal/Code/Source/RHI/CommandListPool.cpp index 62091b794a..7753968122 100644 --- a/Gems/Atom/RHI/Metal/Code/Source/RHI/CommandListPool.cpp +++ b/Gems/Atom/RHI/Metal/Code/Source/RHI/CommandListPool.cpp @@ -72,7 +72,7 @@ namespace AZ commandListPoolDescriptor.m_collectLatency = descriptor.m_frameCountMax; commandListPool.Init(commandListPoolDescriptor); - m_commandListSubAllocators[queueIdx].SetInitFunction([this, &commandListPool] + m_commandListSubAllocators[queueIdx].SetInitFunction([&commandListPool] (CommandListSubAllocator& subAllocator) { subAllocator.Init(commandListPool); diff --git a/Gems/Atom/RHI/Metal/Code/Source/RHI/CommandListPool.h b/Gems/Atom/RHI/Metal/Code/Source/RHI/CommandListPool.h index ca40f3c7aa..0ec5952525 100644 --- a/Gems/Atom/RHI/Metal/Code/Source/RHI/CommandListPool.h +++ b/Gems/Atom/RHI/Metal/Code/Source/RHI/CommandListPool.h @@ -90,7 +90,7 @@ namespace AZ void Collect(); private: - CommandListPool* m_commandListPool = nullptr; + [[maybe_unused]] CommandListPool* m_commandListPool = nullptr; AZStd::vector m_activeLists; AZStd::array m_commandListPools; diff --git a/Gems/Atom/RHI/Metal/Code/Source/RHI/ImagePoolResolver.cpp b/Gems/Atom/RHI/Metal/Code/Source/RHI/ImagePoolResolver.cpp index 94dacb2488..d8a0c2e788 100644 --- a/Gems/Atom/RHI/Metal/Code/Source/RHI/ImagePoolResolver.cpp +++ b/Gems/Atom/RHI/Metal/Code/Source/RHI/ImagePoolResolver.cpp @@ -25,11 +25,9 @@ namespace AZ RHI::ResultCode ImagePoolResolver::UpdateImage(const RHI::ImageUpdateRequest& request, size_t& bytesTransferred) { Image* image = static_cast(request.m_image); - auto& device = static_cast(GetDevice()); - + const RHI::ImageSubresourceLayout& sourceSubresourceLayout = request.m_sourceSubresourceLayout; - const RHI::Origin& imageSubresourcePixelOffset = request.m_imageSubresourcePixelOffset; - + const uint32_t stagingRowPitch = sourceSubresourceLayout.m_bytesPerRow; const uint32_t stagingSlicePitch = sourceSubresourceLayout.m_bytesPerImage; const uint32_t stagingSize = stagingSlicePitch * sourceSubresourceLayout.m_size.m_depth; diff --git a/Gems/Atom/RHI/Metal/Code/Source/RHI/NullDescriptorManager.cpp b/Gems/Atom/RHI/Metal/Code/Source/RHI/NullDescriptorManager.cpp index e86ba3c2c3..749e47f6b5 100644 --- a/Gems/Atom/RHI/Metal/Code/Source/RHI/NullDescriptorManager.cpp +++ b/Gems/Atom/RHI/Metal/Code/Source/RHI/NullDescriptorManager.cpp @@ -42,8 +42,6 @@ namespace AZ void NullDescriptorManager::Shutdown() { - const Device& device = static_cast(GetDevice()); - m_nullImages.clear(); m_nullBuffer.m_memoryView = {}; m_nullMtlSamplerState = nil; @@ -94,7 +92,6 @@ namespace AZ textureSizeAndAlign.size = memoryRequirements.m_sizeInBytes; const size_t alignedHeapSize = RHI::AlignUp(heapSize, textureSizeAndAlign.align); - const uint32_t bytesPerPixel = RHI::GetFormatSize(m_nullImages[imageIndex].m_imageDescriptor.m_format); if(imageIndex == static_cast(NullDescriptorManager::ImageTypes::TextureBuffer)) { m_nullImages[imageIndex].m_memoryView = device.CreateImagePlaced(m_nullImages[imageIndex].m_imageDescriptor, m_nullDescriptorHeap, alignedHeapSize, textureSizeAndAlign, MTLTextureTypeTextureBuffer); diff --git a/Gems/Atom/RHI/Metal/Code/Source/RHI/QueryPool.cpp b/Gems/Atom/RHI/Metal/Code/Source/RHI/QueryPool.cpp index c8f2b89346..1f85d92692 100644 --- a/Gems/Atom/RHI/Metal/Code/Source/RHI/QueryPool.cpp +++ b/Gems/Atom/RHI/Metal/Code/Source/RHI/QueryPool.cpp @@ -26,10 +26,9 @@ namespace AZ RHI::ResultCode QueryPool::InitInternal(RHI::Device& baseDevice, const RHI::QueryPoolDescriptor& descriptor) { auto& device = static_cast(baseDevice); - id mtlDevice = device.GetMtlDevice(); - NSError* error = nil; - + #if AZ_TRAIT_ATOM_METAL_COUNTER_SAMPLING + id mtlDevice = device.GetMtlDevice(); NSArray> * counterSets = [mtlDevice counterSets]; CacheCounterIndices(counterSets); #endif @@ -47,6 +46,7 @@ namespace AZ #if AZ_TRAIT_ATOM_METAL_COUNTER_SAMPLING case RHI::QueryType::Timestamp: { + NSError* error = nil; NSUInteger timeStampCounterIndex = [counterSets indexOfObjectPassingTest:^BOOL(id mtlCounterSet, NSUInteger idx, BOOL *stop) { if ([mtlCounterSet.name isEqualToString:MTLCommonCounterSetTimestamp]) @@ -77,6 +77,7 @@ namespace AZ } case RHI::QueryType::PipelineStatistics: { + NSError* error = nil; NSUInteger statisticCounterIndex = [counterSets indexOfObjectPassingTest:^BOOL(id mtlCounterSet, NSUInteger idx, BOOL *stop) { if ([mtlCounterSet.name isEqualToString:MTLCommonCounterSetStatistic]) @@ -127,9 +128,6 @@ namespace AZ RHI::ResultCode QueryPool::GetResultsInternal(uint32_t startIndex, uint32_t queryCount, uint64_t* results, uint32_t resultsCount, RHI::QueryResultFlagBits flags) { - auto& device = static_cast(GetDevice()); - MTLCommandBufferStatus commandBufferStatus = MTLCommandBufferStatusError; - switch(GetDescriptor().m_type) { case RHI::QueryType::Occlusion: diff --git a/Gems/Atom/RHI/Metal/Code/Source/RHI/Scope.cpp b/Gems/Atom/RHI/Metal/Code/Source/RHI/Scope.cpp index d70a4d4e60..7e4d510dfa 100644 --- a/Gems/Atom/RHI/Metal/Code/Source/RHI/Scope.cpp +++ b/Gems/Atom/RHI/Metal/Code/Source/RHI/Scope.cpp @@ -115,12 +115,10 @@ namespace AZ const RHI::ImageScopeAttachmentDescriptor& bindingDescriptor = scopeAttachment->GetDescriptor(); id imageViewMtlTexture = imageView->GetMemoryView().GetGpuAddress>(); - const bool isFullView = imageView->IsFullView(); const bool isClearAction = bindingDescriptor.m_loadStoreAction.m_loadAction == RHI::AttachmentLoadAction::Clear; const bool isClearActionStencil = bindingDescriptor.m_loadStoreAction.m_loadActionStencil == RHI::AttachmentLoadAction::Clear; const bool isLoadAction = bindingDescriptor.m_loadStoreAction.m_loadAction == RHI::AttachmentLoadAction::Load; - const bool isLoadActionStencil = bindingDescriptor.m_loadStoreAction.m_loadActionStencil == RHI::AttachmentLoadAction::Load; const bool isStoreAction = bindingDescriptor.m_loadStoreAction.m_storeAction == RHI::AttachmentStoreAction::Store; const bool isStoreActionStencil = bindingDescriptor.m_loadStoreAction.m_storeActionStencil == RHI::AttachmentStoreAction::Store; @@ -158,7 +156,6 @@ namespace AZ { mtlStoreActionStencil = MTLStoreActionStore; } - const RHI::ImageViewDescriptor& imgViewDescriptor = imageView->GetDescriptor(); const AZStd::vector& usagesAndAccesses = scopeAttachment->GetUsageAndAccess(); for (const RHI::ScopeAttachmentUsageAndAccess& usageAndAccess : usagesAndAccesses) { diff --git a/Gems/Atom/RHI/Metal/Code/Source/RHI/ShaderResourceGroupPool.cpp b/Gems/Atom/RHI/Metal/Code/Source/RHI/ShaderResourceGroupPool.cpp index 3862885395..6be5ec7259 100644 --- a/Gems/Atom/RHI/Metal/Code/Source/RHI/ShaderResourceGroupPool.cpp +++ b/Gems/Atom/RHI/Metal/Code/Source/RHI/ShaderResourceGroupPool.cpp @@ -26,7 +26,6 @@ namespace AZ { Device& device = static_cast(deviceBase); m_device = &device; - const RHI::ShaderResourceGroupLayout& layout = *descriptor.m_layout; m_srgLayout = descriptor.m_layout; return RHI::ResultCode::Success; } diff --git a/Gems/Atom/RHI/Metal/Code/Source/RHI/StreamingImagePool.cpp b/Gems/Atom/RHI/Metal/Code/Source/RHI/StreamingImagePool.cpp index 03d898bc60..3d90b595e4 100644 --- a/Gems/Atom/RHI/Metal/Code/Source/RHI/StreamingImagePool.cpp +++ b/Gems/Atom/RHI/Metal/Code/Source/RHI/StreamingImagePool.cpp @@ -50,7 +50,6 @@ namespace AZ RHI::ResultCode StreamingImagePool::InitImageInternal(const RHI::StreamingImageInitRequest& request) { Image& image = static_cast(*request.m_image); - auto& device = static_cast(GetDevice()); MemoryView memoryView = GetDevice().CreateImageCommitted(image.GetDescriptor()); if (!memoryView.IsValid()) diff --git a/Gems/Atom/RHI/Metal/Code/Source/RHI/SwapChain.cpp b/Gems/Atom/RHI/Metal/Code/Source/RHI/SwapChain.cpp index 0065ea724e..90ba04c3db 100644 --- a/Gems/Atom/RHI/Metal/Code/Source/RHI/SwapChain.cpp +++ b/Gems/Atom/RHI/Metal/Code/Source/RHI/SwapChain.cpp @@ -123,9 +123,6 @@ namespace AZ RHI::ResultCode SwapChain::InitImageInternal(const InitImageRequest& request) { - const RHI::SwapChainDescriptor& descriptor = GetDescriptor(); - Device& device = GetDevice(); - Name name(AZStd::string::format("SwapChainImage_%d", request.m_imageIndex)); Image& image = static_cast(*request.m_image); diff --git a/Gems/Microphone/Code/Source/Platform/Mac/MicrophoneSystemComponent_Mac.mm b/Gems/Microphone/Code/Source/Platform/Mac/MicrophoneSystemComponent_Mac.mm index 1f7cef7b0c..567f2db6b2 100644 --- a/Gems/Microphone/Code/Source/Platform/Mac/MicrophoneSystemComponent_Mac.mm +++ b/Gems/Microphone/Code/Source/Platform/Mac/MicrophoneSystemComponent_Mac.mm @@ -241,13 +241,14 @@ public: AZStd::size_t GetData(void** outputData, AZStd::size_t numFrames, const SAudioInputConfig& targetConfig, bool shouldDeinterleave) override { - bool changeSampleType = (targetConfig.m_sampleType != m_config.m_sampleType); - bool changeSampleRate = (targetConfig.m_sampleRate != m_config.m_sampleRate); - bool changeNumChannels = (targetConfig.m_numChannels != m_config.m_numChannels); #if defined(USE_LIBSAMPLERATE) // pending port of LIBSAMPLERATE to MacOS return {}; #else + bool changeSampleType = (targetConfig.m_sampleType != m_config.m_sampleType); + bool changeSampleRate = (targetConfig.m_sampleRate != m_config.m_sampleRate); + bool changeNumChannels = (targetConfig.m_numChannels != m_config.m_numChannels); + if (changeSampleType || changeNumChannels) { // Without the SRC library, any change is unsupported! diff --git a/Gems/Microphone/Code/Source/Platform/iOS/MicrophoneSystemComponent_iOS.mm b/Gems/Microphone/Code/Source/Platform/iOS/MicrophoneSystemComponent_iOS.mm index fe8580723a..a3d4f9434f 100644 --- a/Gems/Microphone/Code/Source/Platform/iOS/MicrophoneSystemComponent_iOS.mm +++ b/Gems/Microphone/Code/Source/Platform/iOS/MicrophoneSystemComponent_iOS.mm @@ -187,13 +187,14 @@ public: AZStd::size_t GetData(void** outputData, AZStd::size_t numFrames, const SAudioInputConfig& targetConfig, bool shouldDeinterleave) override { - bool changeSampleType = (targetConfig.m_sampleType != m_config.m_sampleType); - bool changeSampleRate = (targetConfig.m_sampleRate != m_config.m_sampleRate); - bool changeNumChannels = (targetConfig.m_numChannels != m_config.m_numChannels); #if defined(USE_LIBSAMPLERATE) // pending port of LIBSAMPLERATE to iOS return {}; #else + bool changeSampleType = (targetConfig.m_sampleType != m_config.m_sampleType); + bool changeSampleRate = (targetConfig.m_sampleRate != m_config.m_sampleRate); + bool changeNumChannels = (targetConfig.m_numChannels != m_config.m_numChannels); + if (changeSampleType || changeNumChannels) { // Without the SRC library, any change is unsupported! From 91077b0dcdfac07fe55cf8d65e9f35eea0819165 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Mon, 23 Aug 2021 18:06:27 -0700 Subject: [PATCH 055/131] small fix from previous commit Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Gems/Atom/RHI/Metal/Code/Source/RHI/QueryPool.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/Gems/Atom/RHI/Metal/Code/Source/RHI/QueryPool.cpp b/Gems/Atom/RHI/Metal/Code/Source/RHI/QueryPool.cpp index 1f85d92692..629aeb24f1 100644 --- a/Gems/Atom/RHI/Metal/Code/Source/RHI/QueryPool.cpp +++ b/Gems/Atom/RHI/Metal/Code/Source/RHI/QueryPool.cpp @@ -46,7 +46,6 @@ namespace AZ #if AZ_TRAIT_ATOM_METAL_COUNTER_SAMPLING case RHI::QueryType::Timestamp: { - NSError* error = nil; NSUInteger timeStampCounterIndex = [counterSets indexOfObjectPassingTest:^BOOL(id mtlCounterSet, NSUInteger idx, BOOL *stop) { if ([mtlCounterSet.name isEqualToString:MTLCommonCounterSetTimestamp]) From a2cab41cdcb1455855fc13d9b6c0dac29ab92bd3 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Mon, 23 Aug 2021 18:15:13 -0700 Subject: [PATCH 056/131] trying a better fix for winioctl issue Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../AzCore/IO/Streamer/StreamerConfiguration_Windows.cpp | 3 +++ .../AzCore/Platform/Windows/AzCore/PlatformIncl_Windows.h | 5 ----- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Code/Framework/AzCore/Platform/Windows/AzCore/IO/Streamer/StreamerConfiguration_Windows.cpp b/Code/Framework/AzCore/Platform/Windows/AzCore/IO/Streamer/StreamerConfiguration_Windows.cpp index 0813d2d057..fe6d83b7a4 100644 --- a/Code/Framework/AzCore/Platform/Windows/AzCore/IO/Streamer/StreamerConfiguration_Windows.cpp +++ b/Code/Framework/AzCore/Platform/Windows/AzCore/IO/Streamer/StreamerConfiguration_Windows.cpp @@ -14,6 +14,9 @@ #include #include #include + +// https://developercommunity.visualstudio.com/t/windows-sdk-100177630-pragma-push-pop-mismatch-in/386142 +#define _NTDDSCM_H_ #include namespace AZ::IO diff --git a/Code/Framework/AzCore/Platform/Windows/AzCore/PlatformIncl_Windows.h b/Code/Framework/AzCore/Platform/Windows/AzCore/PlatformIncl_Windows.h index 0e798b531d..8563dc9251 100644 --- a/Code/Framework/AzCore/Platform/Windows/AzCore/PlatformIncl_Windows.h +++ b/Code/Framework/AzCore/Platform/Windows/AzCore/PlatformIncl_Windows.h @@ -57,14 +57,9 @@ #define NOMINMAX // - Dont define Macros min(a,b) and max(a,b) #endif -#pragma warning(push) -#pragma warning(disable: 5032) // winioctl.h(161,17): error C5032: detected #pragma warning(push) with no corresponding #pragma warning(pop) - #include #include -#pragma warning(pop) - // Undef common function names that Windows.h defines #if defined(SetJob) #undef SetJob From b609d5e2cb2c63e6f38568f7793d0c414e07cd88 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Mon, 23 Aug 2021 19:41:57 -0700 Subject: [PATCH 057/131] supporting multiple directories automatically excluding obvious things cleanup and verification Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Assets/CMakeLists.txt | 2 +- Code/LauncherUnified/CMakeLists.txt | 18 ++--- Registry/CMakeLists.txt | 5 +- Templates/CMakeLists.txt | 2 +- Tools/LyTestTools/CMakeLists.txt | 2 +- Tools/RemoteConsole/CMakeLists.txt | 4 +- cmake/Install.cmake | 77 ++++++++++++------- scripts/CMakeLists.txt | 12 +-- scripts/bundler/CMakeLists.txt | 6 +- scripts/o3de/CMakeLists.txt | 25 +++--- .../Platform/Linux/o3de_install_linux.cmake | 12 +++ .../o3de/Platform/Mac/o3de_install_mac.cmake | 11 +++ .../Windows/o3de_install_windows.cmake | 11 +++ 13 files changed, 123 insertions(+), 64 deletions(-) create mode 100644 scripts/o3de/Platform/Linux/o3de_install_linux.cmake create mode 100644 scripts/o3de/Platform/Mac/o3de_install_mac.cmake create mode 100644 scripts/o3de/Platform/Windows/o3de_install_windows.cmake diff --git a/Assets/CMakeLists.txt b/Assets/CMakeLists.txt index 11b30db8c3..300e11ac3e 100644 --- a/Assets/CMakeLists.txt +++ b/Assets/CMakeLists.txt @@ -6,4 +6,4 @@ # # -ly_install_directory(DIRECTORY .) +ly_install_directory(DIRECTORIES .) diff --git a/Code/LauncherUnified/CMakeLists.txt b/Code/LauncherUnified/CMakeLists.txt index d496e4fae6..c3d152a777 100644 --- a/Code/LauncherUnified/CMakeLists.txt +++ b/Code/LauncherUnified/CMakeLists.txt @@ -100,19 +100,17 @@ endif() ly_install_files( FILES - ${LY_ROOT_FOLDER}/Code/LauncherUnified/launcher_generator.cmake - ${LY_ROOT_FOLDER}/Code/LauncherUnified/launcher_project_files.cmake - ${LY_ROOT_FOLDER}/Code/LauncherUnified/LauncherProject.cpp - ${LY_ROOT_FOLDER}/Code/LauncherUnified/StaticModules.in + launcher_generator.cmake + launcher_project_files.cmake + LauncherProject.cpp + StaticModules.in DESTINATION LauncherGenerator ) ly_install_directory( - DIRECTORY Platform/${PAL_PLATFORM_NAME} - DESTINATION LauncherGenerator -) -ly_install_directory( - DIRECTORY Platform/Common - DESTINATION LauncherGenerator + DIRECTORIES + Platform/${PAL_PLATFORM_NAME} + Platform/Common + DESTINATION LauncherGenerator/Platform ) ly_install_files( FILES FindLauncherGenerator.cmake diff --git a/Registry/CMakeLists.txt b/Registry/CMakeLists.txt index 4e0d433496..f78df700e7 100644 --- a/Registry/CMakeLists.txt +++ b/Registry/CMakeLists.txt @@ -6,11 +6,10 @@ # # -ly_install_directory(DIRECTORY .) +ly_install_directory(DIRECTORIES .) cmake_path(RELATIVE_PATH CMAKE_RUNTIME_OUTPUT_DIRECTORY BASE_DIRECTORY ${CMAKE_BINARY_DIR} OUTPUT_VARIABLE runtime_output_directory) -ly_install_directory(DIRECTORY - ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$/Registry +ly_install_directory(DIRECTORIES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$/Registry DESTINATION ${runtime_output_directory}/${PAL_PLATFORM_NAME}/$ ) diff --git a/Templates/CMakeLists.txt b/Templates/CMakeLists.txt index 11b30db8c3..300e11ac3e 100644 --- a/Templates/CMakeLists.txt +++ b/Templates/CMakeLists.txt @@ -6,4 +6,4 @@ # # -ly_install_directory(DIRECTORY .) +ly_install_directory(DIRECTORIES .) diff --git a/Tools/LyTestTools/CMakeLists.txt b/Tools/LyTestTools/CMakeLists.txt index 72321a8915..5506099842 100644 --- a/Tools/LyTestTools/CMakeLists.txt +++ b/Tools/LyTestTools/CMakeLists.txt @@ -11,4 +11,4 @@ if(NOT PAL_PLATFORM_NAME STREQUAL "Mac") add_subdirectory(tests) endif() -ly_install_directory(DIRECTORY .) +ly_install_directory(DIRECTORIES .) diff --git a/Tools/RemoteConsole/CMakeLists.txt b/Tools/RemoteConsole/CMakeLists.txt index cabe27c7ea..5504d9b46d 100644 --- a/Tools/RemoteConsole/CMakeLists.txt +++ b/Tools/RemoteConsole/CMakeLists.txt @@ -11,4 +11,6 @@ if(NOT PAL_PLATFORM_NAME STREQUAL "Mac") add_subdirectory(ly_remote_console/tests) endif() -ly_install_directory(DIRECTORY .) +ly_install_directory(DIRECTORIES . + EXCLUDE_PATTERNS tests +) diff --git a/cmake/Install.cmake b/cmake/Install.cmake index 81f323dc95..9135e141d5 100644 --- a/cmake/Install.cmake +++ b/cmake/Install.cmake @@ -13,7 +13,7 @@ endif() #! ly_install_directory: specifies a directory to be copied to the install layout at install time # -# \arg:DIRECTORY directory to install +# \arg:DIRECTORIES directories to install # \arg:DESTINATION (optional) destination to install the directory to (relative to CMAKE_PREFIX_PATH) # \arg:EXCLUDE_PATTERNS (optional) patterns to exclude # @@ -22,40 +22,53 @@ endif() function(ly_install_directory) set(options) - set(oneValueArgs DIRECTORY DESTINATION) - set(multiValueArgs EXCLUDE_PATTERNS) + set(oneValueArgs DESTINATION) + set(multiValueArgs DIRECTORIES EXCLUDE_PATTERNS) cmake_parse_arguments(ly_install_directory "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - if(NOT ly_install_directory_DIRECTORY) - message(FATAL_ERROR "You must provide a directory to install") + if(NOT ly_install_directory_DIRECTORIES) + message(FATAL_ERROR "You must provide at least a directory to install") endif() - if(NOT ly_install_directory_DESTINATION) - # maintain the same structure relative to LY_ROOT_FOLDER - set(ly_install_directory_DESTINATION ${ly_install_directory_DIRECTORY}) - if(${ly_install_directory_DESTINATION} STREQUAL ".") - set(ly_install_directory_DESTINATION ${CMAKE_CURRENT_LIST_DIR}) - else() - cmake_path(ABSOLUTE_PATH ly_install_directory_DESTINATION BASE_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}) + foreach(directory ${ly_install_directory_DIRECTORIES}) + + cmake_path(ABSOLUTE_PATH directory) + + if(NOT ly_install_directory_DESTINATION) + # maintain the same structure relative to LY_ROOT_FOLDER + set(ly_install_directory_DESTINATION ${directory}) + if(${ly_install_directory_DESTINATION} STREQUAL ".") + set(ly_install_directory_DESTINATION ${CMAKE_CURRENT_LIST_DIR}) + else() + cmake_path(ABSOLUTE_PATH ly_install_directory_DESTINATION BASE_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}) + endif() + # take out the last directory since install asks for the destination of the folder, without including the fodler itself + cmake_path(GET ly_install_directory_DESTINATION PARENT_PATH ly_install_directory_DESTINATION) + cmake_path(RELATIVE_PATH ly_install_directory_DESTINATION BASE_DIRECTORY ${LY_ROOT_FOLDER}) endif() - # take out the last directory since install asks for the destination of the folder, without including the fodler itself - cmake_path(GET ly_install_directory_DESTINATION PARENT_PATH ly_install_directory_DESTINATION) - cmake_path(RELATIVE_PATH ly_install_directory_DESTINATION BASE_DIRECTORY ${LY_ROOT_FOLDER}) - endif() - unset(exclude_patterns) - if(ly_install_directory_EXCLUDE_PATTERNS) - foreach(exclude_pattern ${ly_install_directory_EXCLUDE_PATTERNS}) - list(APPEND exclude_patterns PATTERN ${exclude_pattern} EXCLUDE) - endforeach() - endif() + unset(exclude_patterns) + if(ly_install_directory_EXCLUDE_PATTERNS) + foreach(exclude_pattern ${ly_install_directory_EXCLUDE_PATTERNS}) + list(APPEND exclude_patterns PATTERN ${exclude_pattern} EXCLUDE) + endforeach() + endif() + + # Exclude cmake since that has to be generated + list(APPEND exclude_patterns PATTERN CMakeLists.txt EXCLUDE) + list(APPEND exclude_patterns PATTERN *.cmake EXCLUDE) - install(DIRECTORY ${ly_install_directory_DIRECTORY} - DESTINATION ${ly_install_directory_DESTINATION} - COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME} # use the deafult for the time being - ${exclude_patterns} - ) + # Exclude python-related things that dont need to be installed + list(APPEND exclude_patterns PATTERN __pycache__ EXCLUDE) + list(APPEND exclude_patterns PATTERN *.egg-info EXCLUDE) + + install(DIRECTORY ${directory} + DESTINATION ${ly_install_directory_DESTINATION} + COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME} # use the deafult for the time being + ${exclude_patterns} + ) + endforeach() endfunction() @@ -65,7 +78,7 @@ endfunction() # \arg:DESTINATION (optional) destination to install the directory to (relative to CMAKE_PREFIX_PATH) # \arg:PROGRAMS (optional) indicates if the files are programs that should be installed with EXECUTE permissions # -# \notes: refer to cmake's install(DIRECTORY documentation for more information +# \notes: refer to cmake's install(FILES/PROGRAMS documentation for more information # function(ly_install_files) @@ -82,13 +95,19 @@ function(ly_install_files) message(FATAL_ERROR "You must provide a destination to install filest to") endif() + unset(files) + foreach(file ${ly_install_files_FILES}) + cmake_path(ABSOLUTE_PATH file) + list(APPEND files ${file}) + endforeach() + if(ly_install_files_PROGRAMS) set(install_type PROGRAMS) else() set(install_type FILES) endif() - install(${install_type} ${ly_install_files_FILES} + install(${install_type} ${files} DESTINATION ${ly_install_files_DESTINATION} COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME} # use the deafult for the time being ) diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index 5dcd739fb4..5c55c58209 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -6,8 +6,10 @@ # # -add_subdirectory(bundler) -add_subdirectory(detect_file_changes) -add_subdirectory(commit_validation) -add_subdirectory(o3de) -add_subdirectory(ctest) +if(PAL_TRAIT_BUILD_HOST_TOOLS) + add_subdirectory(bundler) + add_subdirectory(detect_file_changes) + add_subdirectory(commit_validation) + add_subdirectory(o3de) + add_subdirectory(ctest) +endif() diff --git a/scripts/bundler/CMakeLists.txt b/scripts/bundler/CMakeLists.txt index 3642b34cbc..c2670d465c 100644 --- a/scripts/bundler/CMakeLists.txt +++ b/scripts/bundler/CMakeLists.txt @@ -6,8 +6,6 @@ # # -ly_install_directory(DIRECTORY . - EXCLUDE_PATTERNS - __pycache__ - CMakeLists.txt +ly_install_directory(DIRECTORIES . + EXCLUDE_PATTERNS tests ) diff --git a/scripts/o3de/CMakeLists.txt b/scripts/o3de/CMakeLists.txt index 3c60fa4b16..79836305c0 100644 --- a/scripts/o3de/CMakeLists.txt +++ b/scripts/o3de/CMakeLists.txt @@ -8,15 +8,22 @@ add_subdirectory(tests) -file(GLOB o3de_scripts "${LY_ROOT_FOLDER}/scripts/o3de.*") -ly_install_files(FILES ${o3de_scripts} -PROGRAMS - DESTINATION ./scripts +ly_get_list_relative_pal_filename(pal_dir ${CMAKE_CURRENT_LIST_DIR}/Platform/${PAL_PLATFORM_NAME}) +include(${pal_dir}/o3de_install_${PAL_PLATFORM_NAME_LOWERCASE}.cmake) + +ly_install_files(FILES ../o3de.py + DESTINATION scripts ) -ly_install_directory(DIRECTORY . - EXCLUDE_PATTERNS - __pycache__ - CMakeLists.txt - tests +ly_install_files(FILES setup.py PROGRAMS + DESTINATION scripts/o3de +) +ly_install_files(FILES README.txt + DESTINATION scripts/o3de +) + +ly_install_directory(DIRECTORIES . + EXCLUDE_PATTERNS + tests + Platform ) diff --git a/scripts/o3de/Platform/Linux/o3de_install_linux.cmake b/scripts/o3de/Platform/Linux/o3de_install_linux.cmake new file mode 100644 index 0000000000..3dff9ebaad --- /dev/null +++ b/scripts/o3de/Platform/Linux/o3de_install_linux.cmake @@ -0,0 +1,12 @@ +# +# Copyright (c) Contributors to the Open 3D Engine Project. +# For complete copyright and license terms please see the LICENSE at the root of this distribution. +# +# SPDX-License-Identifier: Apache-2.0 OR MIT +# +# + +ly_install_files(FILES ../o3de.sh PROGRAMS + DESTINATION scripts +) + diff --git a/scripts/o3de/Platform/Mac/o3de_install_mac.cmake b/scripts/o3de/Platform/Mac/o3de_install_mac.cmake new file mode 100644 index 0000000000..56488c1cf4 --- /dev/null +++ b/scripts/o3de/Platform/Mac/o3de_install_mac.cmake @@ -0,0 +1,11 @@ +# +# Copyright (c) Contributors to the Open 3D Engine Project. +# For complete copyright and license terms please see the LICENSE at the root of this distribution. +# +# SPDX-License-Identifier: Apache-2.0 OR MIT +# +# + +ly_install_files(FILES ../o3de.sh PROGRAMS + DESTINATION scripts +) diff --git a/scripts/o3de/Platform/Windows/o3de_install_windows.cmake b/scripts/o3de/Platform/Windows/o3de_install_windows.cmake new file mode 100644 index 0000000000..8503ad8345 --- /dev/null +++ b/scripts/o3de/Platform/Windows/o3de_install_windows.cmake @@ -0,0 +1,11 @@ +# +# Copyright (c) Contributors to the Open 3D Engine Project. +# For complete copyright and license terms please see the LICENSE at the root of this distribution. +# +# SPDX-License-Identifier: Apache-2.0 OR MIT +# +# + +ly_install_files(FILES ../o3de.bat PROGRAMS + DESTINATION scripts +) From 871cb6761ea3f6763539cddd2dc1c150b11c437a Mon Sep 17 00:00:00 2001 From: jckand-amzn Date: Tue, 24 Aug 2021 11:47:46 -0500 Subject: [PATCH 058/131] More Editor automation conversions to TestAutomationBase Signed-off-by: jckand-amzn --- .../Gem/PythonTests/editor/CMakeLists.txt | 13 -- .../AssetBrowser_SearchFiltering.py | 107 +++++----- .../AssetBrowser_TreeNavigation.py | 195 +++++++++--------- .../editor/EditorScripts/AssetPicker_UI_UX.py | 186 ++++++++++------- .../ComponentCRUD_Add_Delete_Components.py | 99 +++++---- .../EditorScripts/Docking_BasicDockedTools.py | 90 ++++---- .../InputBindings_Add_Remove_Input_Events.py | 93 +++++---- .../EditorScripts/Menus_EditMenuOptions.py | 137 ++++++------ .../EditorScripts/Menus_FileMenuOptions.py | 115 +++++------ .../EditorScripts/Menus_ViewMenuOptions.py | 113 +++++----- .../editor/test_Editor_Main_Optimized.py | 12 +- .../editor/test_Editor_Periodic.py | 70 +++++++ .../editor/test_Editor_Periodic_Optimized.py | 61 ++++++ 13 files changed, 717 insertions(+), 574 deletions(-) create mode 100644 AutomatedTesting/Gem/PythonTests/editor/test_Editor_Periodic.py create mode 100644 AutomatedTesting/Gem/PythonTests/editor/test_Editor_Periodic_Optimized.py diff --git a/AutomatedTesting/Gem/PythonTests/editor/CMakeLists.txt b/AutomatedTesting/Gem/PythonTests/editor/CMakeLists.txt index 770a46c178..18eaef287e 100644 --- a/AutomatedTesting/Gem/PythonTests/editor/CMakeLists.txt +++ b/AutomatedTesting/Gem/PythonTests/editor/CMakeLists.txt @@ -49,17 +49,4 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS AND PAL_TRAIT_ Editor ) - ly_add_pytest( - NAME AutomatedTesting::EditorTests_Sandbox - TEST_SUITE sandbox - TEST_SERIAL - PATH ${CMAKE_CURRENT_LIST_DIR} - PYTEST_MARKS "SUITE_sandbox" - RUNTIME_DEPENDENCIES - Legacy::Editor - AZ::AssetProcessor - AutomatedTesting.Assets - COMPONENT - Editor - ) endif() diff --git a/AutomatedTesting/Gem/PythonTests/editor/EditorScripts/AssetBrowser_SearchFiltering.py b/AutomatedTesting/Gem/PythonTests/editor/EditorScripts/AssetBrowser_SearchFiltering.py index 60c8926eb2..33c48c7a77 100644 --- a/AutomatedTesting/Gem/PythonTests/editor/EditorScripts/AssetBrowser_SearchFiltering.py +++ b/AutomatedTesting/Gem/PythonTests/editor/EditorScripts/AssetBrowser_SearchFiltering.py @@ -5,30 +5,24 @@ For complete copyright and license terms please see the LICENSE at the root of t SPDX-License-Identifier: Apache-2.0 OR MIT """ -""" -C13660194 : Asset Browser - Filtering -""" -import os -import sys -from PySide2 import QtWidgets, QtTest, QtCore -from PySide2.QtCore import Qt - -import azlmbr.legacy.general as general -import azlmbr.paths - -sys.path.append(os.path.join(azlmbr.paths.devroot, 'AutomatedTesting', 'Gem', 'PythonTests')) -import editor_python_test_tools.hydra_editor_utils as hydra -import editor_python_test_tools.pyside_utils as pyside_utils -from editor_python_test_tools.editor_test_helper import EditorTestHelper +class Tests: + asset_filtered = ( + "Asset was filtered to in the Asset Browser", + "Failed to filter to the expected asset" + ) + asset_type_filtered = ( + "Expected asset type was filtered to in the Asset Browser", + "Failed to filter to the expected asset type" + ) -class AssetBrowserSearchFilteringTest(EditorTestHelper): - def __init__(self): - EditorTestHelper.__init__(self, log_prefix="AssetBrowser_SearchFiltering", args=["level"]) +def AssetBrowser_SearchFiltering(): + + import editor_python_test_tools.pyside_utils as pyside_utils @pyside_utils.wrap_async - async def run_test(self): + async def run_test(): """ Summary: Asset Browser - Filtering @@ -60,7 +54,13 @@ class AssetBrowserSearchFilteringTest(EditorTestHelper): :return: None """ - self.incorrect_file_found = False + from PySide2 import QtWidgets, QtTest, QtCore + from PySide2.QtCore import Qt + + import azlmbr.legacy.general as general + + from editor_python_test_tools.utils import Report + from editor_python_test_tools.utils import TestHelper as helper def verify_files_appeared(model, allowed_asset_extentions, parent_index=QtCore.QModelIndex()): indexes = [parent_index] @@ -74,25 +74,24 @@ class AssetBrowserSearchFilteringTest(EditorTestHelper): and (cur_data.lower().split(".")[-1] not in allowed_asset_extentions) and not cur_data[-1] == ")" ): - print(f"Incorrect file found: {cur_data}") - self.incorrect_file_found = True - indexes = list() - break + Report.info(f"Incorrect file found: {cur_data}") + return False indexes.append(cur_index) + return True + # 1) Open an existing simple level + helper.init_idle() + helper.open_level("Physics", "Base") - # 1) Open level - self.test_success = self.create_level( - self.args["level"], - heightmap_resolution=1024, - heightmap_meters_per_pixel=1, - terrain_texture_resolution=4096, - use_terrain=False, - ) - - # 2) Open Asset Browser - general.close_pane("Asset Browser") - general.open_pane("Asset Browser") + # 2) Open Asset Browser (if not opened already) + editor_window = pyside_utils.get_editor_main_window() + asset_browser_open = general.is_pane_visible("Asset Browser") + if not asset_browser_open: + Report.info("Opening Asset Browser") + action = pyside_utils.get_action_for_menu_path(editor_window, "Tools", "Asset Browser") + action.trigger() + else: + Report.info("Asset Browser is already open") editor_window = pyside_utils.get_editor_main_window() app = QtWidgets.QApplication.instance() @@ -103,10 +102,9 @@ class AssetBrowserSearchFilteringTest(EditorTestHelper): asset_browser_tree = asset_browser.findChild(QtWidgets.QTreeView, "m_assetBrowserTreeViewWidget") model_index = pyside_utils.find_child_by_pattern(asset_browser_tree, "cedar.fbx") pyside_utils.item_view_index_mouse_click(asset_browser_tree, model_index) - is_filtered = pyside_utils.wait_for_condition( + is_filtered = await pyside_utils.wait_for_condition( lambda: asset_browser_tree.indexBelow(asset_browser_tree.currentIndex()) == QtCore.QModelIndex(), 5.0) - if is_filtered: - print("cedar.fbx asset is filtered in Asset Browser") + Report.result(Tests.asset_filtered, is_filtered) # 4) Click the "X" in the search bar. clear_search = asset_browser.findChild(QtWidgets.QToolButton, "ClearToolButton") @@ -122,40 +120,47 @@ class AssetBrowserSearchFilteringTest(EditorTestHelper): tree.model().setData(animation_model_index, 2, Qt.CheckStateRole) general.idle_wait(1.0) # check asset types after clicking on Animation filter - verify_files_appeared(asset_browser_tree.model(), ["i_caf", "fbx", "xml", "animgraph", "motionset"]) - print(f"Animation file type(s) is present in the file tree: {not self.incorrect_file_found}") + asset_type_filter = verify_files_appeared(asset_browser_tree.model(), ["i_caf", "fbx", "xml", "animgraph", "motionset"]) + Report.result(Tests.asset_type_filtered, asset_type_filter) # 6) Add additional filter(FileTag) from the filter menu - self.incorrect_file_found = False line_edit.setText("FileTag") filetag_model_index = await pyside_utils.wait_for_child_by_pattern(tree, "FileTag") tree.model().setData(filetag_model_index, 2, Qt.CheckStateRole) general.idle_wait(1.0) # check asset types after clicking on FileTag filter - verify_files_appeared( + more_types_filtered = verify_files_appeared( asset_browser_tree.model(), ["i_caf", "fbx", "xml", "animgraph", "motionset", "filetag"] ) - print(f"FileTag file type(s) and Animation file type(s) is present in the file tree: {not self.incorrect_file_found}") + Report.result(Tests.asset_type_filtered, more_types_filtered) # 7) Remove one of the filtered asset types from the list of applied filters - self.incorrect_file_found = False filter_layout = asset_browser.findChild(QtWidgets.QFrame, "filteredLayout") animation_close_button = filter_layout.children()[1] first_close_button = animation_close_button.findChild(QtWidgets.QPushButton, "closeTag") first_close_button.click() general.idle_wait(1.0) # check asset types after removing Animation filter - verify_files_appeared(asset_browser_tree.model(), ["filetag"]) - print(f"FileTag file type(s) is present in the file tree after removing Animation filter: {not self.incorrect_file_found}") + remove_filtered = verify_files_appeared(asset_browser_tree.model(), ["filetag"]) + Report.result(Tests.asset_type_filtered, remove_filtered) # 8) Remove all of the filter asset types from the list of filters filetag_close_button = filter_layout.children()[1] second_close_button = filetag_close_button.findChild(QtWidgets.QPushButton, "closeTag") second_close_button.click() - # 9) Close the asset browser - asset_browser.close() + # Click off of the Asset Browser filter window to close it + QtTest.QTest.mouseClick(tree, Qt.LeftButton, Qt.NoModifier) + + # 9) Restore Asset Browser tool state and + if not asset_browser_open: + Report.info("Closing Asset Browser") + general.close_pane("Asset Browser") + + run_test() -test = AssetBrowserSearchFilteringTest() -test.run() +if __name__ == "__main__": + + from editor_python_test_tools.utils import Report + Report.start_test(AssetBrowser_SearchFiltering) diff --git a/AutomatedTesting/Gem/PythonTests/editor/EditorScripts/AssetBrowser_TreeNavigation.py b/AutomatedTesting/Gem/PythonTests/editor/EditorScripts/AssetBrowser_TreeNavigation.py index d57d9cda5e..b4f0dc7f6c 100644 --- a/AutomatedTesting/Gem/PythonTests/editor/EditorScripts/AssetBrowser_TreeNavigation.py +++ b/AutomatedTesting/Gem/PythonTests/editor/EditorScripts/AssetBrowser_TreeNavigation.py @@ -5,124 +5,119 @@ For complete copyright and license terms please see the LICENSE at the root of t SPDX-License-Identifier: Apache-2.0 OR MIT """ -""" -C13660195: Asset Browser - File Tree Navigation -""" -import os -import sys -from PySide2 import QtWidgets, QtTest, QtCore - -import azlmbr.legacy.general as general -import azlmbr.paths - -sys.path.append(os.path.join(azlmbr.paths.devroot, 'AutomatedTesting', 'Gem', 'PythonTests')) -from editor_python_test_tools.editor_test_helper import EditorTestHelper -import editor_python_test_tools.pyside_utils as pyside_utils +class Tests: + collapse_expand = ( + "Asset Browser hierarchy successfully collapsed/expanded", + "Failed to collapse/expand Asset Browser hierarchy" + ) + asset_visible = ( + "Expected asset is visible in the Asset Browser hierarchy", + "Failed to find expected asset in the Asset Browser hierarchy" + ) + scrollbar_visible = ( + "Scrollbar is visible", + "Scrollbar was not found" + ) -class AssetBrowserTreeNavigationTest(EditorTestHelper): - def __init__(self): - EditorTestHelper.__init__(self, log_prefix="AssetBrowser_TreeNavigation", args=["level"]) +def AssetBrowser_TreeNavigation(): + """ + Summary: + Verify if we are able to expand a file hierarchy in the Asset Browser and ScrollBar appears + appropriately. - def run_test(self): - """ - Summary: - Verify if we are able to expand a file hierarchy in the Asset Browser and ScrollBar appears - appropriately. + Expected Behavior: + The folder list is expanded to display the children of the selected folder. + A scroll bar appears to allow scrolling up and down through the asset browser. + Assets are present in the Asset Browser. - Expected Behavior: - The folder list is expanded to display the children of the selected folder. - A scroll bar appears to allow scrolling up and down through the asset browser. - Assets are present in the Asset Browser. + Test Steps: + 1) Open a simple level + 2) Open Asset Browser + 3) Collapse all files initially + 4) Get all Model Indexes + 5) Expand each of the folder and verify if it is opened + 6) Verify if the ScrollBar appears after expanding the tree - Test Steps: - 1) Open a new level - 2) Open Asset Browser - 3) Collapse all files initially - 4) Get all Model Indexes - 5) Expand each of the folder and verify if it is opened - 6) Verify if the ScrollBar appears after expanding the tree + Note: + - This test file must be called from the Open 3D Engine Editor command terminal + - Any passed and failed tests are written to the Editor.log file. + Parsing the file or running a log_monitor are required to observe the test results. - Note: - - This test file must be called from the Open 3D Engine Editor command terminal - - Any passed and failed tests are written to the Editor.log file. - Parsing the file or running a log_monitor are required to observe the test results. + :return: None + """ - :return: None - """ + from PySide2 import QtWidgets, QtTest, QtCore - def collapse_expand_and_verify(model_index, hierarchy_level): - tree.collapse(model_index) - collapse_success = not tree.isExpanded(model_index) - self.log(f"Level {hierarchy_level} collapsed: {collapse_success}") - tree.expand(model_index) - expand_success = tree.isExpanded(model_index) - self.log(f"Level {hierarchy_level} expanded: {expand_success}") - return collapse_success and expand_success + import azlmbr.legacy.general as general - # This is the hierarchy we are expanding (4 steps inside) - self.file_path = ("AutomatedTesting", "Assets", "ImageGradients", "image_grad_test_gsi.png") + import editor_python_test_tools.pyside_utils as pyside_utils + from editor_python_test_tools.utils import Report + from editor_python_test_tools.utils import TestHelper as helper - # 1) Open a new level - self.test_success = self.create_level( - self.args["level"], - heightmap_resolution=1024, - heightmap_meters_per_pixel=1, - terrain_texture_resolution=4096, - use_terrain=False, - ) + def collapse_expand_and_verify(model_index, hierarchy_level): + tree.collapse(model_index) + collapse_success = not tree.isExpanded(model_index) + Report.info(f"Level {hierarchy_level} collapsed: {collapse_success}") + tree.expand(model_index) + expand_success = tree.isExpanded(model_index) + Report.info(f"Level {hierarchy_level} expanded: {expand_success}") + return collapse_success and expand_success - # 2) Open Asset Browser (if not opened already) - editor_window = pyside_utils.get_editor_main_window() - asset_browser_open = general.is_pane_visible("Asset Browser") - if not asset_browser_open: - self.log("Opening Asset Browser") - action = pyside_utils.get_action_for_menu_path(editor_window, "Tools", "Asset Browser") - action.trigger() - else: - self.log("Asset Browser is already open") + # This is the hierarchy we are expanding (4 steps inside) + file_path = ("AutomatedTesting", "Assets", "ImageGradients", "image_grad_test_gsi.png") - # 3) Collapse all files initially - main_window = editor_window.findChild(QtWidgets.QMainWindow) - asset_browser = pyside_utils.find_child_by_hierarchy(main_window, ..., "Asset Browser") - tree = pyside_utils.find_child_by_hierarchy(asset_browser, ..., "m_assetBrowserTreeViewWidget") - scroll_area = tree.findChild(QtWidgets.QWidget, "qt_scrollarea_vcontainer") - scroll_bar = scroll_area.findChild(QtWidgets.QScrollBar) - tree.collapseAll() + # 1) Open an existing simple level + helper.init_idle() + helper.open_level("Physics", "Base") - # 4) Get all Model Indexes - model_index_1 = pyside_utils.find_child_by_hierarchy(tree, self.file_path[0]) - model_index_2 = pyside_utils.find_child_by_hierarchy(model_index_1, self.file_path[1]) - model_index_3 = pyside_utils.find_child_by_hierarchy(model_index_2, self.file_path[2]) - model_index_4 = pyside_utils.find_child_by_hierarchy(model_index_3, self.file_path[3]) + # 2) Open Asset Browser (if not opened already) + editor_window = pyside_utils.get_editor_main_window() + asset_browser_open = general.is_pane_visible("Asset Browser") + if not asset_browser_open: + Report.info("Opening Asset Browser") + action = pyside_utils.get_action_for_menu_path(editor_window, "Tools", "Asset Browser") + action.trigger() + else: + Report.info("Asset Browser is already open") - # 5) Verify each level of the hierarchy to the file can be collapsed/expanded - self.test_success = collapse_expand_and_verify(model_index_1, 1) and self.test_success - self.test_success = collapse_expand_and_verify(model_index_2, 2) and self.test_success - self.test_success = collapse_expand_and_verify(model_index_3, 3) and self.test_success - self.log(f"Collapse/Expand tests: {self.test_success}") + # 3) Collapse all files initially + main_window = editor_window.findChild(QtWidgets.QMainWindow) + asset_browser = pyside_utils.find_child_by_hierarchy(main_window, ..., "Asset Browser") + tree = pyside_utils.find_child_by_hierarchy(asset_browser, ..., "m_assetBrowserTreeViewWidget") + scroll_area = tree.findChild(QtWidgets.QWidget, "qt_scrollarea_vcontainer") + scroll_bar = scroll_area.findChild(QtWidgets.QScrollBar) + tree.collapseAll() - # Select the asset - tree.scrollTo(model_index_4) - pyside_utils.item_view_index_mouse_click(tree, model_index_4) + # 4) Get all Model Indexes + model_index_1 = pyside_utils.find_child_by_hierarchy(tree, file_path[0]) + model_index_2 = pyside_utils.find_child_by_hierarchy(model_index_1, file_path[1]) + model_index_3 = pyside_utils.find_child_by_hierarchy(model_index_2, file_path[2]) + model_index_4 = pyside_utils.find_child_by_hierarchy(model_index_3, file_path[3]) - # Verify if the currently selected item model index is same as the Asset Model index - # to prove that it is visible - asset_visible = tree.currentIndex() == model_index_4 - self.test_success = asset_visible and self.test_success - self.log(f"Asset visibility test: {asset_visible}") + # 5) Verify each level of the hierarchy to the file can be collapsed/expanded + Report.result(Tests.collapse_expand, collapse_expand_and_verify(model_index_1, 1) and + collapse_expand_and_verify(model_index_2, 2) and collapse_expand_and_verify(model_index_3, 3)) - # 6) Verify if the ScrollBar appears after expanding the tree - scrollbar_visible = scroll_bar.isVisible() - self.test_success = scrollbar_visible and self.test_success - self.log(f"Scrollbar visibility test: {scrollbar_visible}") + # Select the asset + tree.scrollTo(model_index_4) + pyside_utils.item_view_index_mouse_click(tree, model_index_4) - # 7) Restore Asset Browser tool state - if not asset_browser_open: - self.log("Closing Asset Browser") - general.close_pane("Asset Browser") + # Verify if the currently selected item model index is same as the Asset Model index + # to prove that it is visible + Report.result(Tests.asset_visible, tree.currentIndex() == model_index_4) + + # 6) Verify if the ScrollBar appears after expanding the tree + Report.result(Tests.scrollbar_visible, scroll_bar.isVisible()) + + # 7) Restore Asset Browser tool state + if not asset_browser_open: + Report.info("Closing Asset Browser") + general.close_pane("Asset Browser") -test = AssetBrowserTreeNavigationTest() -test.run() +if __name__ == "__main__": + + from editor_python_test_tools.utils import Report + Report.start_test(AssetBrowser_TreeNavigation) diff --git a/AutomatedTesting/Gem/PythonTests/editor/EditorScripts/AssetPicker_UI_UX.py b/AutomatedTesting/Gem/PythonTests/editor/EditorScripts/AssetPicker_UI_UX.py index 068f25fb1e..59a78c9e5d 100644 --- a/AutomatedTesting/Gem/PythonTests/editor/EditorScripts/AssetPicker_UI_UX.py +++ b/AutomatedTesting/Gem/PythonTests/editor/EditorScripts/AssetPicker_UI_UX.py @@ -5,33 +5,13 @@ For complete copyright and license terms please see the LICENSE at the root of t SPDX-License-Identifier: Apache-2.0 OR MIT """ -""" -C13751579: Asset Picker UI/UX -""" -import os -import sys -from PySide2 import QtWidgets, QtTest, QtCore -from PySide2.QtCore import Qt +def AssetPicker_UI_UX(): -import azlmbr.asset as asset -import azlmbr.bus as bus -import azlmbr.legacy.general as general -import azlmbr.paths -import azlmbr.math as math - -sys.path.append(os.path.join(azlmbr.paths.devroot, 'AutomatedTesting', 'Gem', 'PythonTests')) -import editor_python_test_tools.hydra_editor_utils as hydra -import editor_python_test_tools.pyside_utils as pyside_utils -from editor_python_test_tools.editor_test_helper import EditorTestHelper - - -class AssetPickerUIUXTest(EditorTestHelper): - def __init__(self): - EditorTestHelper.__init__(self, log_prefix="AssetPicker_UI_UX", args=["level"]) + import editor_python_test_tools.pyside_utils as pyside_utils @pyside_utils.wrap_async - async def run_test(self): + async def run_test(): """ Summary: Verify the functionality of Asset Picker and UI/UX properties @@ -45,7 +25,7 @@ class AssetPickerUIUXTest(EditorTestHelper): The asset picker is closed and the selected asset is assigned to the mesh component. Test Steps: - 1) Open a new level + 1) Open a simple level 2) Create entity and add Mesh component 3) Access Entity Inspector 4) Click Asset Picker (Mesh Asset) @@ -68,10 +48,20 @@ class AssetPickerUIUXTest(EditorTestHelper): :return: None """ - self.file_path = ["AutomatedTesting", "Assets", "Objects", "Foliage"] - self.incorrect_file_found = False - self.mesh_asset = "cedar.azmodel" - self.prefix = "" + import os + from PySide2 import QtWidgets, QtTest, QtCore + from PySide2.QtCore import Qt + + import azlmbr.asset as asset + import azlmbr.bus as bus + import azlmbr.legacy.general as general + import azlmbr.math as math + + import editor_python_test_tools.hydra_editor_utils as hydra + from editor_python_test_tools.utils import Report + from editor_python_test_tools.utils import TestHelper as helper + + file_path = ["AutomatedTesting", "Assets", "Objects", "Foliage"] def is_asset_assigned(component, interaction_option): path = os.path.join("assets", "objects", "foliage", "cedar.azmodel") @@ -80,7 +70,7 @@ class AssetPickerUIUXTest(EditorTestHelper): result = hydra.get_component_property_value(component, "Controller|Configuration|Mesh Asset") expected_asset_str = expected_asset_id.invoke("ToString") result_str = result.invoke("ToString") - print(f"Asset assigned for {interaction_option} option: {expected_asset_str == result_str}") + Report.info(f"Asset assigned for {interaction_option} option: {expected_asset_str == result_str}") return expected_asset_str == result_str def move_and_resize_widget(widget): @@ -89,9 +79,11 @@ class AssetPickerUIUXTest(EditorTestHelper): x, y = initial_position.x() + 5, initial_position.y() + 5 widget.move(x, y) curr_position = widget.pos() - move_success = curr_position.x() == x and curr_position.y() == y - self.test_success = move_success and self.test_success - self.log(f"Widget Move Test: {move_success}") + asset_picker_moved = ( + "Asset Picker widget moved successfully", + "Failed to move Asset Picker widget" + ) + Report.result(asset_picker_moved, curr_position.x() == x and curr_position.y() == y) # Resize the widget and verify size width, height = ( @@ -99,9 +91,36 @@ class AssetPickerUIUXTest(EditorTestHelper): widget.geometry().height() + 10, ) widget.resize(width, height) - resize_success = widget.geometry().width() == width and widget.geometry().height() == height - self.test_success = resize_success and self.test_success - self.log(f"Widget Resize Test: {resize_success}") + asset_picker_resized = ( + "Resized Asset Picker widget successfully", + "Failed to resize Asset Picker widget" + ) + Report.result(asset_picker_resized, widget.geometry().width() == width and widget.geometry().height() == + height) + + def verify_expand(model_index, tree): + initially_collapsed = ( + "Folder initially collapsed", + "Folder unexpectedly expanded" + ) + expanded = ( + "Folder expanded successfully", + "Failed to expand folder" + ) + # Check initial collapse + Report.result(initially_collapsed, not tree.isExpanded(model_index)) + # Expand at the specified index + tree.expand(model_index) + # Verify expansion + Report.result(expanded, tree.isExpanded(model_index)) + + def verify_collapse(model_index, tree): + collapsed = ( + "Folder hierarchy collapsed successfully", + "Failed to collapse folder hierarchy" + ) + tree.collapse(model_index) + Report.result(collapsed, not tree.isExpanded(model_index)) def verify_files_appeared(model, allowed_asset_extensions, parent_index=QtCore.QModelIndex()): indices = [parent_index] @@ -115,22 +134,20 @@ class AssetPickerUIUXTest(EditorTestHelper): and (cur_data.lower().split(".")[-1] not in allowed_asset_extensions) and not cur_data[-1] == ")" ): - print(f"Incorrect file found: {cur_data}") - self.incorrect_file_found = True - indices = list() - break + Report.info(f"Incorrect file found: {cur_data}") + return False indices.append(cur_index) - self.test_success = not self.incorrect_file_found and self.test_success + return True - def print_message_prefix(message): - print(f"{self.prefix}: {message}") - - async def asset_picker(prefix, allowed_asset_extensions, asset, interaction_option): + async def asset_picker(allowed_asset_extensions, asset, interaction_option): active_modal_widget = await pyside_utils.wait_for_modal_widget() - if active_modal_widget and self.prefix == "": - self.prefix = prefix + if active_modal_widget: dialog = active_modal_widget.findChildren(QtWidgets.QDialog, "AssetPickerDialogClass")[0] - print_message_prefix(f"Asset Picker title for Mesh: {dialog.windowTitle()}") + asset_picker_title = ( + "Asset Picker window is titled as expected", + "Asset Picker window has an unexpected title" + ) + Report.result(asset_picker_title, dialog.windowTitle() == "Pick ModelAsset") tree = dialog.findChildren(QtWidgets.QTreeView, "m_assetBrowserTreeViewWidget")[0] scroll_area = tree.findChild(QtWidgets.QWidget, "qt_scrollarea_vcontainer") scroll_bar = scroll_area.findChild(QtWidgets.QScrollBar) @@ -138,39 +155,42 @@ class AssetPickerUIUXTest(EditorTestHelper): # a) Collapse all the files initially and verify if scroll bar is not visible tree.collapseAll() await pyside_utils.wait_for_condition(lambda: not scroll_bar.isVisible(), 0.5) - print_message_prefix( - f"Scroll Bar is not visible before expanding the tree: {not scroll_bar.isVisible()}" + scroll_bar_hidden = ( + "Scroll Bar is not visible before tree expansion", + "Scroll Bar is visible before tree expansion" ) + Report.result(scroll_bar_hidden, not scroll_bar.isVisible()) # Get Model Index of the file paths - model_index_1 = pyside_utils.find_child_by_pattern(tree, self.file_path[0]) - print(model_index_1.model()) - model_index_2 = pyside_utils.find_child_by_pattern(model_index_1, self.file_path[1]) + model_index_1 = pyside_utils.find_child_by_pattern(tree, file_path[0]) + model_index_2 = pyside_utils.find_child_by_pattern(model_index_1, file_path[1]) # b) Expand/Verify Top folder of file path - print_message_prefix(f"Top level folder initially collapsed: {not tree.isExpanded(model_index_1)}") - tree.expand(model_index_1) - print_message_prefix(f"Top level folder expanded: {tree.isExpanded(model_index_1)}") + verify_expand(model_index_1, tree) # c) Expand/Verify Nested folder of file path - print_message_prefix(f"Nested folder initially collapsed: {not tree.isExpanded(model_index_2)}") - tree.expand(model_index_2) - print_message_prefix(f"Nested folder expanded: {tree.isExpanded(model_index_2)}") + verify_expand(model_index_2, tree) # d) Verify if the ScrollBar appears after expanding folders tree.expandAll() await pyside_utils.wait_for_condition(lambda: scroll_bar.isVisible(), 0.5) - print_message_prefix(f"Scroll Bar appeared after expanding tree: {scroll_bar.isVisible()}") + scroll_bar_visible = ( + "Scroll Bar is visible after tree expansion", + "Scroll Bar is not visible after tree expansion" + ) + Report.result(scroll_bar_visible, scroll_bar.isVisible()) # e) Collapse Nested and Top Level folders and verify if collapsed - tree.collapse(model_index_2) - print_message_prefix(f"Nested folder collapsed: {not tree.isExpanded(model_index_2)}") - tree.collapse(model_index_1) - print_message_prefix(f"Top level folder collapsed: {not tree.isExpanded(model_index_1)}") + verify_collapse(model_index_2, tree) + verify_collapse(model_index_1, tree) # f) Verify if the correct files are appearing in the Asset Picker - verify_files_appeared(tree.model(), allowed_asset_extensions) - print_message_prefix(f"Expected Assets populated in the file picker: {not self.incorrect_file_found}") + asset_picker_correct_files_appear = ( + "Expected assets populated in the file picker", + "Found unexpected assets in the file picker" + ) + Report.result(asset_picker_correct_files_appear, verify_files_appeared(tree.model(), + allowed_asset_extensions)) # While we are here we can also check if we can resize and move the widget move_and_resize_widget(active_modal_widget) @@ -193,16 +213,10 @@ class AssetPickerUIUXTest(EditorTestHelper): await pyside_utils.click_button_async(ok_button) elif interaction_option == "enter": QtTest.QTest.keyClick(tree, Qt.Key_Enter, Qt.NoModifier) - self.prefix = "" - # 1) Open a new level - self.test_success = self.create_level( - self.args["level"], - heightmap_resolution=1024, - heightmap_meters_per_pixel=1, - terrain_texture_resolution=4096, - use_terrain=False, - ) + # 1) Open an existing simple level + helper.init_idle() + helper.open_level("Physics", "Base") # 2) Create entity and add Mesh component entity_position = math.Vector3(125.0, 136.0, 32.0) @@ -222,7 +236,7 @@ class AssetPickerUIUXTest(EditorTestHelper): # Assign Mesh Asset via OK button pyside_utils.click_button_async(attached_button) - await asset_picker("Mesh Asset", ["azmodel", "fbx"], "cedar (ModelAsset)", "ok") + await asset_picker(["azmodel", "fbx"], "cedar (ModelAsset)", "ok") # 5) Verify if Mesh Asset is assigned try: @@ -231,7 +245,11 @@ class AssetPickerUIUXTest(EditorTestHelper): except pyside_utils.EventLoopTimeoutException as err: print(err) mesh_success = False - self.test_success = mesh_success and self.test_success + mesh_asset_assigned_ok = ( + "Successfully assigned Mesh asset via OK button", + "Failed to assign Mesh asset via OK button" + ) + Report.result(mesh_asset_assigned_ok, mesh_success) # Clear Mesh Asset hydra.get_set_test(entity, 0, "Controller|Configuration|Mesh Asset", None) @@ -242,7 +260,7 @@ class AssetPickerUIUXTest(EditorTestHelper): # Assign Mesh Asset via Enter pyside_utils.click_button_async(attached_button) - await asset_picker("Mesh Asset", ["azmodel", "fbx"], "cedar (ModelAsset)", "enter") + await asset_picker(["azmodel", "fbx"], "cedar (ModelAsset)", "enter") # 5) Verify if Mesh Asset is assigned try: @@ -251,8 +269,16 @@ class AssetPickerUIUXTest(EditorTestHelper): except pyside_utils.EventLoopTimeoutException as err: print(err) mesh_success = False - self.test_success = mesh_success and self.test_success + mesh_asset_assigned_enter = ( + "Successfully assigned Mesh asset via Enter button", + "Failed to assign Mesh asset via Enter button" + ) + Report.result(mesh_asset_assigned_enter, mesh_success) + + run_test() -test = AssetPickerUIUXTest() -test.run() +if __name__ == "__main__": + + from editor_python_test_tools.utils import Report + Report.start_test(AssetPicker_UI_UX) diff --git a/AutomatedTesting/Gem/PythonTests/editor/EditorScripts/ComponentCRUD_Add_Delete_Components.py b/AutomatedTesting/Gem/PythonTests/editor/EditorScripts/ComponentCRUD_Add_Delete_Components.py index 8f2264c9d1..779f1ef953 100755 --- a/AutomatedTesting/Gem/PythonTests/editor/EditorScripts/ComponentCRUD_Add_Delete_Components.py +++ b/AutomatedTesting/Gem/PythonTests/editor/EditorScripts/ComponentCRUD_Add_Delete_Components.py @@ -5,37 +5,39 @@ For complete copyright and license terms please see the LICENSE at the root of t SPDX-License-Identifier: Apache-2.0 OR MIT """ -""" -C16929880: Add Delete Components -""" -import os -import sys -from PySide2 import QtWidgets, QtTest, QtCore -from PySide2.QtCore import Qt - -import azlmbr.legacy.general as general -import azlmbr.bus as bus -import azlmbr.editor as editor -import azlmbr.entity as entity -import azlmbr.math as math -import azlmbr.paths - -sys.path.append(os.path.join(azlmbr.paths.devroot, 'AutomatedTesting', 'Gem', 'PythonTests')) -import editor_python_test_tools.hydra_editor_utils as hydra -import editor_python_test_tools.pyside_utils as pyside_utils -from editor_python_test_tools.editor_test_helper import EditorTestHelper +class Tests: + entity_created = ( + "Entity created successfully", + "Failed to create entity" + ) + box_component_added = ( + "Box Shape component added to entity", + "Failed to add Box Shape component to entity" + ) + mesh_component_added = ( + "Mesh component added to entity", + "Failed to add Mesh component to entity" + ) + mesh_component_deleted = ( + "Mesh component removed from entity", + "Failed to remove Mesh component from entity" + ) + mesh_component_delete_undo = ( + "Mesh component removal was successfully undone", + "Failed to undo Mesh component removal" + ) -class AddDeleteComponentsTest(EditorTestHelper): - def __init__(self): - EditorTestHelper.__init__(self, log_prefix="ComponentCRUD_Add_Delete_Components", args=["level"]) +def ComponentCRUD_Add_Delete_Components(): + + import editor_python_test_tools.pyside_utils as pyside_utils @pyside_utils.wrap_async - async def run_test(self): + async def run_test(): """ Summary: - Add/Delete Components to an entity. + Add/Delete Components to/from an entity. Expected Behavior: 1) Components can be added to an entity. @@ -61,36 +63,43 @@ class AddDeleteComponentsTest(EditorTestHelper): :return: None """ + from PySide2 import QtWidgets, QtTest, QtCore + from PySide2.QtCore import Qt + + import azlmbr.legacy.general as general + import azlmbr.bus as bus + import azlmbr.editor as editor + import azlmbr.entity as entity + import azlmbr.math as math + + import editor_python_test_tools.hydra_editor_utils as hydra + from editor_python_test_tools.utils import Report + from editor_python_test_tools.utils import TestHelper as helper + async def add_component(component_name): pyside_utils.click_button_async(add_comp_btn) popup = await pyside_utils.wait_for_popup_widget() tree = popup.findChild(QtWidgets.QTreeView, "Tree") component_index = pyside_utils.find_child_by_pattern(tree, component_name) if component_index.isValid(): - print(f"{component_name} found") + Report.info(f"{component_name} found") tree.expand(component_index) tree.setCurrentIndex(component_index) QtTest.QTest.keyClick(tree, Qt.Key_Enter, Qt.NoModifier) - # 1) Open level - self.test_success = self.create_level( - self.args["level"], - heightmap_resolution=1024, - heightmap_meters_per_pixel=1, - terrain_texture_resolution=4096, - use_terrain=False, - ) + # 1) Open an existing simple level + helper.init_idle() + helper.open_level("Physics", "Base") # 2) Create entity entity_position = math.Vector3(125.0, 136.0, 32.0) entity_id = editor.ToolsApplicationRequestBus( bus.Broadcast, "CreateNewEntityAtPosition", entity_position, entity.EntityId() ) - if entity_id.IsValid(): - print("Entity Created") + Report.critical_result(Tests.entity_created, entity_id.IsValid()) # 3) Select the newly created entity - general.select_object("Entity2") + general.select_object("Entity1") # Give the Entity Inspector time to fully create its contents general.idle_wait(0.5) @@ -100,11 +109,11 @@ class AddDeleteComponentsTest(EditorTestHelper): entity_inspector = editor_window.findChild(QtWidgets.QDockWidget, "Entity Inspector") add_comp_btn = entity_inspector.findChild(QtWidgets.QPushButton, "m_addComponentButton") await add_component("Box Shape") - print(f"Box Shape Component added: {hydra.has_components(entity_id, ['Box Shape'])}") + Report.result(Tests.box_component_added, hydra.has_components(entity_id, ['Box Shape'])) # 5) Add/verify Mesh component await add_component("Mesh") - print(f"Mesh Component added: {hydra.has_components(entity_id, ['Mesh'])}") + Report.result(Tests.mesh_component_added, hydra.has_components(entity_id, ['Mesh'])) # 6) Delete Mesh Component general.idle_wait(0.5) @@ -116,15 +125,17 @@ class AddDeleteComponentsTest(EditorTestHelper): QtTest.QTest.mouseClick(mesh_frame, Qt.LeftButton, Qt.NoModifier) QtTest.QTest.keyClick(mesh_frame, Qt.Key_Delete, Qt.NoModifier) success = await pyside_utils.wait_for_condition(lambda: not hydra.has_components(entity_id, ['Mesh']), 5.0) - if success: - print(f"Mesh Component deleted: {not hydra.has_components(entity_id, ['Mesh'])}") + Report.result(Tests.mesh_component_deleted, success) # 7) Undo deletion of component QtTest.QTest.keyPress(entity_inspector, Qt.Key_Z, Qt.ControlModifier) success = await pyside_utils.wait_for_condition(lambda: hydra.has_components(entity_id, ['Mesh']), 5.0) - if success: - print(f"Mesh Component deletion undone: {hydra.has_components(entity_id, ['Mesh'])}") + Report.result(Tests.mesh_component_delete_undo, success) + + run_test() -test = AddDeleteComponentsTest() -test.run() +if __name__ == "__main__": + + from editor_python_test_tools.utils import Report + Report.start_test(ComponentCRUD_Add_Delete_Components) diff --git a/AutomatedTesting/Gem/PythonTests/editor/EditorScripts/Docking_BasicDockedTools.py b/AutomatedTesting/Gem/PythonTests/editor/EditorScripts/Docking_BasicDockedTools.py index cc8ab24bed..2a91e7a374 100644 --- a/AutomatedTesting/Gem/PythonTests/editor/EditorScripts/Docking_BasicDockedTools.py +++ b/AutomatedTesting/Gem/PythonTests/editor/EditorScripts/Docking_BasicDockedTools.py @@ -7,27 +7,32 @@ SPDX-License-Identifier: Apache-2.0 OR MIT C6376081: Basic Function: Docked/Undocked Tools """ -import os -import sys -from PySide2 import QtWidgets, QtTest, QtCore -import azlmbr.legacy.general as general -import azlmbr.bus as bus -import azlmbr.editor as editor -import azlmbr.entity as entity -import azlmbr.paths - -sys.path.append(os.path.join(azlmbr.paths.devroot, 'AutomatedTesting', 'Gem', 'PythonTests')) -from editor_python_test_tools.editor_test_helper import EditorTestHelper -import editor_python_test_tools.pyside_utils as pyside_utils +class Tests: + all_tools_docked = ( + "The tools are all docked together in a tabbed widget", + "Failed to dock all tools together" + ) + docked_outliner_works = ( + "Entity Outliner works when docked, can select an Entity", + "Failed to select an Entity in the Outliner while docked" + ) + docked_inspector_works = ( + "Entity Inspector works when docked, Entity name changed", + "Failed to change Entity name in the Inspector while docked" + ) + docked_console_works = ( + "Console works when docked, sent a Console Command", + "Failed to send Console Command in the Console while docked" + ) -class TestDockingBasicDockedTools(EditorTestHelper): - def __init__(self): - EditorTestHelper.__init__(self, log_prefix="Docking_BasicDockedTools", args=["level"]) +def Docking_BasicDockedTools(): + + import editor_python_test_tools.pyside_utils as pyside_utils @pyside_utils.wrap_async - async def run_test(self): + async def run_test(): """ Summary: Test that tools still work as expected when docked together. @@ -50,14 +55,19 @@ class TestDockingBasicDockedTools(EditorTestHelper): :return: None """ - # Create a level since we are going to be dealing with an Entity. - self.create_level( - self.args["level"], - heightmap_resolution=1024, - heightmap_meters_per_pixel=1, - terrain_texture_resolution=4096, - use_terrain=False, - ) + from PySide2 import QtWidgets, QtTest, QtCore + + import azlmbr.legacy.general as general + import azlmbr.bus as bus + import azlmbr.editor as editor + import azlmbr.entity as entity + + from editor_python_test_tools.utils import Report + from editor_python_test_tools.utils import TestHelper as helper + + # Open an existing simple level + helper.init_idle() + helper.open_level("Physics", "Base") # Make sure the Entity Outliner, Entity Inspector and Console tools are open general.open_pane("Entity Outliner (PREVIEW)") @@ -101,12 +111,14 @@ class TestDockingBasicDockedTools(EditorTestHelper): entity_inspector_parent = entity_inspector.parentWidget() entity_outliner_parent = entity_outliner.parentWidget() console_parent = console.parentWidget() - print(f"Entity Inspector parent = {entity_inspector_parent}, Entity Outliner parent = {entity_outliner_parent}, Console parent = {console_parent}") - return isinstance(entity_inspector_parent, QtWidgets.QStackedWidget) and (entity_inspector_parent == entity_outliner_parent) and (entity_outliner_parent == console_parent) + Report.info(f"Entity Inspector parent = {entity_inspector_parent}, Entity Outliner parent = " + f"{entity_outliner_parent}, Console parent = {console_parent}") + return isinstance(entity_inspector_parent, QtWidgets.QStackedWidget) and \ + (entity_inspector_parent == entity_outliner_parent) and \ + (entity_outliner_parent == console_parent) success = await pyside_utils.wait_for(check_all_panes_tabbed, timeout=3.0) - if success: - print("The tools are all docked together in a tabbed widget") + Report.result(Tests.all_tools_docked, success) # 2.1,2) Select an Entity in the Entity Outliner. entity_inspector = editor_window.findChild(QtWidgets.QDockWidget, "Entity Inspector") @@ -116,8 +128,7 @@ class TestDockingBasicDockedTools(EditorTestHelper): test_entity_index = pyside_utils.find_child_by_pattern(object_tree, entity_original_name) object_tree.clearSelection() object_tree.setCurrentIndex(test_entity_index) - if object_tree.currentIndex(): - print("Entity Outliner works when docked, can select an Entity") + Report.result(Tests.docked_outliner_works, object_tree.currentIndex() == test_entity_index) # 2.3,4) Change the name of the selected Entity via the Entity Inspector. entity_inspector_name_field = entity_inspector.findChild(QtWidgets.QLineEdit, "m_entityNameEditor") @@ -125,14 +136,23 @@ class TestDockingBasicDockedTools(EditorTestHelper): entity_inspector_name_field.setText(expected_new_name) QtTest.QTest.keyClick(entity_inspector_name_field, QtCore.Qt.Key_Enter) entity_new_name = editor.EditorEntityInfoRequestBus(bus.Event, "GetName", entity_id) - if entity_new_name == expected_new_name: - print(f"Entity Inspector works when docked, Entity name changed to {entity_new_name}") + Report.result(Tests.docked_inspector_works, entity_new_name == expected_new_name) # 2.5,6) Send a console command. console_line_edit = console.findChild(QtWidgets.QLineEdit, "lineEdit") - console_line_edit.setText("Hello, world!") + console_line_edit.setText("t_Scale 2") + QtTest.QTest.keyClick(console_line_edit, QtCore.Qt.Key_Enter) + general.get_cvar("t_Scale") + Report.result(Tests.docked_console_works, general.get_cvar("t_Scale") == "2") + + # Reset the altered cvar + console_line_edit.setText("t_Scale 1") QtTest.QTest.keyClick(console_line_edit, QtCore.Qt.Key_Enter) + run_test() -test = TestDockingBasicDockedTools() -test.run() + +if __name__ == "__main__": + + from editor_python_test_tools.utils import Report + Report.start_test(Docking_BasicDockedTools) diff --git a/AutomatedTesting/Gem/PythonTests/editor/EditorScripts/InputBindings_Add_Remove_Input_Events.py b/AutomatedTesting/Gem/PythonTests/editor/EditorScripts/InputBindings_Add_Remove_Input_Events.py index 4693f20155..f4769dab4d 100755 --- a/AutomatedTesting/Gem/PythonTests/editor/EditorScripts/InputBindings_Add_Remove_Input_Events.py +++ b/AutomatedTesting/Gem/PythonTests/editor/EditorScripts/InputBindings_Add_Remove_Input_Events.py @@ -5,32 +5,36 @@ For complete copyright and license terms please see the LICENSE at the root of t SPDX-License-Identifier: Apache-2.0 OR MIT """ -""" -C1506881: Adding/Removing Event Groups -""" -import os -import sys -from PySide2 import QtWidgets +class Tests: + asset_editor_opened = ( + "Successfully opened the Asset Editor", + "Failed to open the Asset Editor" + ) + event_groups_added = ( + "Successfully added event groups via +", + "Failed to add event groups" + ) + single_event_group_deleted = ( + "Successfully deleted an event group", + "Failed to delete event group" + ) + all_event_groups_deleted = ( + "Successfully deleted all event groups", + "Failed to delete all event groups" + ) + asset_editor_closed = ( + "Successfully closed the Asset Editor", + "Failed to close the Asset Editor" + ) -import azlmbr.legacy.general as general -import azlmbr.bus as bus -import azlmbr.editor as editor -import azlmbr.entity as entity -import azlmbr.math as math -import azlmbr.paths -sys.path.append(os.path.join(azlmbr.paths.devroot, 'AutomatedTesting', 'Gem', 'PythonTests')) -import editor_python_test_tools.hydra_editor_utils as hydra -import editor_python_test_tools.pyside_utils as pyside_utils -from editor_python_test_tools.editor_test_helper import EditorTestHelper +def InputBindings_Add_Remove_Input_Events(): -class AddRemoveInputEventsTest(EditorTestHelper): - def __init__(self): - EditorTestHelper.__init__(self, log_prefix="InputBindings_Add_Remove_Input_Events", args=["level"]) + import editor_python_test_tools.pyside_utils as pyside_utils @pyside_utils.wrap_async - async def run_test(self): + async def run_test(): """ Summary: Verify if we are able add/remove input events in inputbindings file. @@ -42,7 +46,7 @@ class AddRemoveInputEventsTest(EditorTestHelper): Test Steps: - 1) Open a new level + 1) Open an existing level 2) Open Asset Editor 3) Access Asset Editor 4) Create a new .inputbindings file and add event groups @@ -61,6 +65,13 @@ class AddRemoveInputEventsTest(EditorTestHelper): :return: None """ + from PySide2 import QtWidgets + + import azlmbr.legacy.general as general + + from editor_python_test_tools.utils import Report + from editor_python_test_tools.utils import TestHelper as helper + def open_asset_editor(): general.open_pane("Asset Editor") return general.is_pane_visible("Asset Editor") @@ -69,17 +80,12 @@ class AddRemoveInputEventsTest(EditorTestHelper): general.close_pane("Asset Editor") return not general.is_pane_visible("Asset Editor") - # 1) Open a new level - self.test_success = self.create_level( - self.args["level"], - heightmap_resolution=1024, - heightmap_meters_per_pixel=1, - terrain_texture_resolution=4096, - use_terrain=False, - ) + # 1) Open an existing simple level + helper.init_idle() + helper.open_level("Physics", "Base") # 2) Open Asset Editor - print(f"Asset Editor opened: {open_asset_editor()}") + Report.result(Tests.asset_editor_opened, open_asset_editor()) # 3) Access Asset Editor editor_window = pyside_utils.get_editor_main_window() @@ -103,8 +109,7 @@ class AddRemoveInputEventsTest(EditorTestHelper): # 5) Verify if there are 3 elements in the Input Event Groups label no_of_elements_label = input_event_groups.findChild(QtWidgets.QLabel, "DefaultLabel") success = await pyside_utils.wait_for_condition(lambda: "3 elements" in no_of_elements_label.text(), 2.0) - if success: - print("New Event Groups added when + is clicked") + Report.result(Tests.event_groups_added, success) # 6) Delete one event group event = asset_editor_widget.findChildren(QtWidgets.QFrame, "")[0] @@ -121,11 +126,11 @@ class AddRemoveInputEventsTest(EditorTestHelper): input_event_group = input_event_groups[1] no_of_elements_label = input_event_group.findChild(QtWidgets.QLabel, "DefaultLabel") return no_of_elements_label.text() + return "" - return ""; - success = await pyside_utils.wait_for_condition(lambda: "2 elements" in get_elements_label_text(asset_editor_widget), 2.0) - if success: - print("Event Group deleted when the Delete button is clicked on an Event Group") + success = await pyside_utils.wait_for_condition(lambda: "2 elements" in + get_elements_label_text(asset_editor_widget), 2.0) + Report.result(Tests.single_event_group_deleted, success) # 8) Click on Delete button to delete all the Event Groups # First QToolButton child of active input_event_groups is +, Second QToolButton is Delete @@ -141,13 +146,17 @@ class AddRemoveInputEventsTest(EditorTestHelper): yes_button.click() # 9) Verify if all the elements are deleted - success = await pyside_utils.wait_for_condition(lambda: "0 elements" in get_elements_label_text(asset_editor_widget), 2.0) - if success: - print("All event groups deleted on clicking the Delete button") + success = await pyside_utils.wait_for_condition(lambda: "0 elements" in + get_elements_label_text(asset_editor_widget), 2.0) + Report.result(Tests.all_event_groups_deleted, success) # 10) Close Asset Editor - print(f"Asset Editor closed: {close_asset_editor()}") + Report.result(Tests.asset_editor_closed, close_asset_editor()) + + run_test() -test = AddRemoveInputEventsTest() -test.run() +if __name__ == "__main__": + + from editor_python_test_tools.utils import Report + Report.start_test(InputBindings_Add_Remove_Input_Events) diff --git a/AutomatedTesting/Gem/PythonTests/editor/EditorScripts/Menus_EditMenuOptions.py b/AutomatedTesting/Gem/PythonTests/editor/EditorScripts/Menus_EditMenuOptions.py index 53a8da4116..c7088a54c5 100644 --- a/AutomatedTesting/Gem/PythonTests/editor/EditorScripts/Menus_EditMenuOptions.py +++ b/AutomatedTesting/Gem/PythonTests/editor/EditorScripts/Menus_EditMenuOptions.py @@ -5,93 +5,78 @@ For complete copyright and license terms please see the LICENSE at the root of t SPDX-License-Identifier: Apache-2.0 OR MIT """ -""" -C24064529: Base Edit Menu Options -""" -import os -import sys +def Menus_EditMenuOptions_Work(): + """ + Summary: + Interact with Edit Menu options and verify if all the options are working. -import azlmbr.paths + Expected Behavior: + The Edit menu functions normally. -sys.path.append(os.path.join(azlmbr.paths.devroot, 'AutomatedTesting', 'Gem', 'PythonTests')) -from editor_python_test_tools.editor_test_helper import EditorTestHelper -import editor_python_test_tools.pyside_utils as pyside_utils + Test Steps: + 1) Open an existing level + 2) Interact with Edit Menu options + Note: + - This test file must be called from the O3DE Editor command terminal + - Any passed and failed tests are written to the Editor.log file. + Parsing the file or running a log_monitor are required to observe the test results. -class TestEditMenuOptions(EditorTestHelper): - def __init__(self): - EditorTestHelper.__init__(self, log_prefix="Menus_EditMenuOptions", args=["level"]) + :return: None + """ - def run_test(self): - """ - Summary: - Interact with Edit Menu options and verify if all the options are working. + import editor_python_test_tools.pyside_utils as pyside_utils + from editor_python_test_tools.utils import Report + from editor_python_test_tools.utils import TestHelper as helper - Expected Behavior: - The Edit menu functions normally. + edit_menu_options = [ + ("Undo",), + ("Redo",), + ("Duplicate",), + ("Delete",), + ("Select All",), + ("Invert Selection",), + ("Toggle Pivot Location",), + ("Reset Entity Transform",), + ("Reset Manipulator",), + ("Reset Transform (Local)",), + ("Reset Transform (World)",), + ("Hide Selection",), + ("Show All",), + ("Modify", "Snap", "Snap angle"), + ("Modify", "Transform Mode", "Move"), + ("Modify", "Transform Mode", "Rotate"), + ("Modify", "Transform Mode", "Scale"), + ("Editor Settings", "Global Preferences"), + ("Editor Settings", "Editor Settings Manager"), + ("Editor Settings", "Keyboard Customization", "Customize Keyboard"), + ("Editor Settings", "Keyboard Customization", "Export Keyboard Settings"), + ("Editor Settings", "Keyboard Customization", "Import Keyboard Settings"), + ] - Test Steps: - 1) Create a temp level - 2) Interact with Edit Menu options + # 1) Open an existing simple level + helper.init_idle() + helper.open_level("Physics", "Base") - Note: - - This test file must be called from the O3DE Editor command terminal - - Any passed and failed tests are written to the Editor.log file. - Parsing the file or running a log_monitor are required to observe the test results. - - :return: None - """ - edit_menu_options = [ - ("Undo",), - ("Redo",), - ("Duplicate",), - ("Delete",), - ("Select All",), - ("Invert Selection",), - ("Toggle Pivot Location",), - ("Reset Entity Transform",), - ("Reset Manipulator",), - ("Reset Transform (Local)",), - ("Reset Transform (World)",), - ("Hide Selection",), - ("Show All",), - ("Modify", "Snap", "Snap angle"), - ("Modify", "Transform Mode", "Move"), - ("Modify", "Transform Mode", "Rotate"), - ("Modify", "Transform Mode", "Scale"), - ("Editor Settings", "Global Preferences"), - ("Editor Settings", "Editor Settings Manager"), - ("Editor Settings", "Keyboard Customization", "Customize Keyboard"), - ("Editor Settings", "Keyboard Customization", "Export Keyboard Settings"), - ("Editor Settings", "Keyboard Customization", "Import Keyboard Settings"), - ] - - # 1) Create and open the temp level - self.test_success = self.create_level( - self.args["level"], - heightmap_resolution=1024, - heightmap_meters_per_pixel=1, - terrain_texture_resolution=4096, - use_terrain=False, - ) - - def on_action_triggered(action_name): - print(f"{action_name} Action triggered") - - # 2) Interact with Edit Menu options + # 2) Interact with Edit Menu options + editor_window = pyside_utils.get_editor_main_window() + for option in edit_menu_options: try: - editor_window = pyside_utils.get_editor_main_window() - for option in edit_menu_options: - action = pyside_utils.get_action_for_menu_path(editor_window, "Edit", *option) - trig_func = lambda: on_action_triggered(action.iconText()) - action.triggered.connect(trig_func) - action.trigger() - action.triggered.disconnect(trig_func) + action = pyside_utils.get_action_for_menu_path(editor_window, "Edit", *option) + action.trigger() + action_triggered = True except Exception as e: - self.test_success = False + action_triggered = False print(e) + menu_action_triggered = ( + f"{action.iconText()} action triggered successfully", + f"Failed to trigger {action.iconText()} action" + ) + Report.result(menu_action_triggered, action_triggered) -test = TestEditMenuOptions() -test.run() +if __name__ == "__main__": + + from editor_python_test_tools.utils import Report + Report.start_test(Menus_EditMenuOptions_Work) diff --git a/AutomatedTesting/Gem/PythonTests/editor/EditorScripts/Menus_FileMenuOptions.py b/AutomatedTesting/Gem/PythonTests/editor/EditorScripts/Menus_FileMenuOptions.py index 77ee9ac61d..a3e7611b5e 100644 --- a/AutomatedTesting/Gem/PythonTests/editor/EditorScripts/Menus_FileMenuOptions.py +++ b/AutomatedTesting/Gem/PythonTests/editor/EditorScripts/Menus_FileMenuOptions.py @@ -5,80 +5,69 @@ For complete copyright and license terms please see the LICENSE at the root of t SPDX-License-Identifier: Apache-2.0 OR MIT """ -import os -import sys -import azlmbr.paths +def Menus_FileMenuOptions_Work(): + """ + Summary: + Interact with File Menu options and verify if all the options are working. -sys.path.append(os.path.join(azlmbr.paths.devroot, 'AutomatedTesting', 'Gem', 'PythonTests')) -from editor_python_test_tools.editor_test_helper import EditorTestHelper -import editor_python_test_tools.pyside_utils as pyside_utils + Expected Behavior: + The File menu functions normally. + Test Steps: + 1) Open level + 2) Interact with File Menu options -class TestFileMenuOptions(EditorTestHelper): - def __init__(self): - EditorTestHelper.__init__(self, log_prefix="file_menu_options: ", args=["level"]) + Note: + - This test file must be called from the O3DE Editor command terminal + - Any passed and failed tests are written to the Editor.log file. + Parsing the file or running a log_monitor are required to observe the test results. - def run_test(self): - """ - Summary: - Interact with File Menu options and verify if all the options are working. + :return: None + """ - Expected Behavior: - The File menu functions normally. + import editor_python_test_tools.pyside_utils as pyside_utils + from editor_python_test_tools.utils import Report + from editor_python_test_tools.utils import TestHelper as helper - Test Steps: - 1) Open level - 2) Interact with File Menu options + file_menu_options = [ + ("New Level",), + ("Open Level",), + ("Import",), + ("Save",), + ("Save As",), + ("Save Level Statistics",), + ("Edit Project Settings",), + ("Edit Platform Settings",), + ("New Project",), + ("Open Project",), + ("Show Log File",), + ("Resave All Slices",), + ("Exit",), + ] - Note: - - This test file must be called from the O3DE Editor command terminal - - Any passed and failed tests are written to the Editor.log file. - Parsing the file or running a log_monitor are required to observe the test results. + # 1) Open an existing simple level + helper.init_idle() + helper.open_level("Physics", "Base") - :return: None - """ - file_menu_options = [ - ("New Level",), - ("Open Level",), - ("Import",), - ("Save",), - ("Save As",), - ("Save Level Statistics",), - ("Edit Project Settings",), - ("Edit Platform Settings",), - ("New Project",), - ("Open Project",), - ("Show Log File",), - ("Resave All Slices",), - ("Exit",), - ] - - # 1) Open level - self.test_success = self.create_level( - self.args["level"], - heightmap_resolution=1024, - heightmap_meters_per_pixel=1, - terrain_texture_resolution=4096, - use_terrain=False, - ) - - def on_action_triggered(action_name): - print(f"{action_name} Action triggered") - - # 2) Interact with File Menu options + # 2) Interact with File Menu options + editor_window = pyside_utils.get_editor_main_window() + for option in file_menu_options: try: - editor_window = pyside_utils.get_editor_main_window() - for option in file_menu_options: - action = pyside_utils.get_action_for_menu_path(editor_window, "File", *option) - trig_func = lambda: on_action_triggered(action.iconText()) - action.triggered.connect(trig_func) - action.trigger() - action.triggered.disconnect(trig_func) + action = pyside_utils.get_action_for_menu_path(editor_window, "File", *option) + action.trigger() + action_triggered = True except Exception as e: - self.test_success = False + action_triggered = False print(e) + menu_action_triggered = ( + f"{action.iconText()} action triggered successfully", + f"Failed to trigger {action.iconText()} action" + ) + Report.result(menu_action_triggered, action_triggered) -test = TestFileMenuOptions() -test.run() +if __name__ == "__main__": + + from editor_python_test_tools.utils import Report + Report.start_test(Menus_FileMenuOptions_Work) diff --git a/AutomatedTesting/Gem/PythonTests/editor/EditorScripts/Menus_ViewMenuOptions.py b/AutomatedTesting/Gem/PythonTests/editor/EditorScripts/Menus_ViewMenuOptions.py index d2db4210ce..f1b9e5d4d8 100644 --- a/AutomatedTesting/Gem/PythonTests/editor/EditorScripts/Menus_ViewMenuOptions.py +++ b/AutomatedTesting/Gem/PythonTests/editor/EditorScripts/Menus_ViewMenuOptions.py @@ -5,81 +5,66 @@ For complete copyright and license terms please see the LICENSE at the root of t SPDX-License-Identifier: Apache-2.0 OR MIT """ -""" -C24064534: The View menu options function normally -""" -import os -import sys +def Menus_ViewMenuOptions_Work(): + """ + Summary: + Interact with View Menu options and verify if all the options are working. -import azlmbr.paths + Expected Behavior: + The View menu functions normally. -sys.path.append(os.path.join(azlmbr.paths.devroot, 'AutomatedTesting', 'Gem', 'PythonTests')) -from editor_python_test_tools.editor_test_helper import EditorTestHelper -import editor_python_test_tools.pyside_utils as pyside_utils + Test Steps: + 1) Open an existing level + 2) Interact with View Menu options + Note: + - This test file must be called from the O3DE Editor command terminal + - Any passed and failed tests are written to the Editor.log file. + Parsing the file or running a log_monitor are required to observe the test results. -class TestViewMenuOptions(EditorTestHelper): - def __init__(self): - EditorTestHelper.__init__(self, log_prefix="Menus_EditMenuOptions", args=["level"]) + :return: None + """ - def run_test(self): - """ - Summary: - Interact with View Menu options and verify if all the options are working. + import editor_python_test_tools.pyside_utils as pyside_utils + from editor_python_test_tools.utils import Report + from editor_python_test_tools.utils import TestHelper as helper - Expected Behavior: - The View menu functions normally. + view_menu_options = [ + ("Center on Selection",), + ("Show Quick Access Bar",), + ("Viewport", "Configure Layout"), + ("Viewport", "Go to Position"), + ("Viewport", "Center on Selection"), + ("Viewport", "Go to Location"), + ("Viewport", "Remember Location"), + ("Viewport", "Switch Camera"), + ("Viewport", "Show/Hide Helpers"), + ("Refresh Style",), + ] - Test Steps: - 1) Create a temp level - 2) Interact with View Menu options + # 1) Open an existing simple level + helper.init_idle() + helper.open_level("Physics", "Base") - Note: - - This test file must be called from the O3DE Editor command terminal - - Any passed and failed tests are written to the Editor.log file. - Parsing the file or running a log_monitor are required to observe the test results. - - :return: None - """ - view_menu_options = [ - ("Center on Selection",), - ("Show Quick Access Bar",), - ("Viewport", "Configure Layout"), - ("Viewport", "Go to Position"), - ("Viewport", "Center on Selection"), - ("Viewport", "Go to Location"), - ("Viewport", "Remember Location"), - ("Viewport", "Switch Camera"), - ("Viewport", "Show/Hide Helpers"), - ("Refresh Style",), - ] - - # 1) Create and open the temp level - self.test_success = self.create_level( - self.args["level"], - heightmap_resolution=1024, - heightmap_meters_per_pixel=1, - terrain_texture_resolution=4096, - use_terrain=False, - ) - - def on_action_triggered(action_name): - print(f"{action_name} Action triggered") - - # 2) Interact with View Menu options + # 2) Interact with View Menu options + editor_window = pyside_utils.get_editor_main_window() + for option in view_menu_options: try: - editor_window = pyside_utils.get_editor_main_window() - for option in view_menu_options: - action = pyside_utils.get_action_for_menu_path(editor_window, "View", *option) - trig_func = lambda: on_action_triggered(action.iconText()) - action.triggered.connect(trig_func) - action.trigger() - action.triggered.disconnect(trig_func) + action = pyside_utils.get_action_for_menu_path(editor_window, "View", *option) + action.trigger() + action_triggered = True except Exception as e: - self.test_success = False + action_triggered = False print(e) + menu_action_triggered = ( + f"{action.iconText()} action triggered successfully", + f"Failed to trigger {action.iconText()} action" + ) + Report.result(menu_action_triggered, action_triggered) -test = TestViewMenuOptions() -test.run() +if __name__ == "__main__": + + from editor_python_test_tools.utils import Report + Report.start_test(Menus_ViewMenuOptions_Work) diff --git a/AutomatedTesting/Gem/PythonTests/editor/test_Editor_Main_Optimized.py b/AutomatedTesting/Gem/PythonTests/editor/test_Editor_Main_Optimized.py index dffba9b983..953ef35692 100644 --- a/AutomatedTesting/Gem/PythonTests/editor/test_Editor_Main_Optimized.py +++ b/AutomatedTesting/Gem/PythonTests/editor/test_Editor_Main_Optimized.py @@ -15,12 +15,13 @@ from ly_test_tools.o3de.editor_test import EditorSingleTest, EditorSharedTest, E @pytest.mark.SUITE_main @pytest.mark.parametrize("launcher_platform", ['windows_editor']) @pytest.mark.parametrize("project", ["AutomatedTesting"]) -class TestAutomation(EditorTestSuite): +class TestAutomationNoAutoTestMode(EditorTestSuite): + + # Disable -autotest_mode and -BatchMode. Tests cannot run in -BatchMode due to UI interactions, and these tests + # interact with modal dialogs + global_extra_cmdline_args = [] class test_BasicEditorWorkflows_LevelEntityComponentCRUD(EditorSingleTest): - # Disable -BatchMode and -autotest_mode - EditorTestSuite.global_extra_cmdline_args = [] - # Custom teardown to remove slice asset created during test def teardown(self, request, workspace, editor, editor_test_results, launcher_platform): file_system.delete([os.path.join(workspace.paths.engine_root(), "AutomatedTesting", "Levels", "tmp_level")], @@ -29,8 +30,7 @@ class TestAutomation(EditorTestSuite): @pytest.mark.REQUIRES_gpu class test_BasicEditorWorkflows_GPU_LevelEntityComponentCRUD(EditorSingleTest): - # Disable -BatchMode, -autotest_mode, and null renderer - EditorTestSuite.global_extra_cmdline_args = [] + # Disable null renderer EditorTestSuite.use_null_renderer = False # Custom teardown to remove slice asset created during test diff --git a/AutomatedTesting/Gem/PythonTests/editor/test_Editor_Periodic.py b/AutomatedTesting/Gem/PythonTests/editor/test_Editor_Periodic.py new file mode 100644 index 0000000000..606afa0620 --- /dev/null +++ b/AutomatedTesting/Gem/PythonTests/editor/test_Editor_Periodic.py @@ -0,0 +1,70 @@ +""" +Copyright (c) Contributors to the Open 3D Engine Project. +For complete copyright and license terms please see the LICENSE at the root of this distribution. + +SPDX-License-Identifier: Apache-2.0 OR MIT +""" + +import os +import pytest +import sys + +import ly_test_tools.environment.file_system as file_system + +sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/../automatedtesting_shared') +from base import TestAutomationBase + + +@pytest.fixture +def remove_test_level(request, workspace, project): + file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", "tmp_level")], True, True) + + def teardown(): + file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", "tmp_level")], True, True) + + request.addfinalizer(teardown) + + +@pytest.mark.SUITE_periodic +@pytest.mark.parametrize("launcher_platform", ['windows_editor']) +@pytest.mark.parametrize("project", ["AutomatedTesting"]) +class TestAutomation(TestAutomationBase): + + def test_AssetBrowser_TreeNavigation(self, request, workspace, editor, launcher_platform): + from .EditorScripts import AssetBrowser_TreeNavigation as test_module + self._run_test(request, workspace, editor, test_module, batch_mode=False) + + @pytest.mark.skip(reason="Crashes Editor: ATOM-15493") + def test_AssetBrowser_SearchFiltering(self, request, workspace, editor, launcher_platform): + from .EditorScripts import AssetBrowser_SearchFiltering as test_module + self._run_test(request, workspace, editor, test_module, batch_mode=False) + + @pytest.mark.skip(reason="Crashes Editor: ATOM-15493") + def test_AssetPicker_UI_UX(self, request, workspace, editor, launcher_platform): + from .EditorScripts import AssetPicker_UI_UX as test_module + self._run_test(request, workspace, editor, test_module, autotest_mode=False, batch_mode=False) + + def test_ComponentCRUD_Add_Delete_Components(self, request, workspace, editor, launcher_platform): + from .EditorScripts import ComponentCRUD_Add_Delete_Components as test_module + self._run_test(request, workspace, editor, test_module, batch_mode=False) + + def test_Docking_BasicDockedTools(self, request, workspace, editor, launcher_platform): + from .EditorScripts import Docking_BasicDockedTools as test_module + self._run_test(request, workspace, editor, test_module, batch_mode=False) + + def test_InputBindings_Add_Remove_Input_Events(self, request, workspace, editor, launcher_platform): + from .EditorScripts import InputBindings_Add_Remove_Input_Events as test_module + self._run_test(request, workspace, editor, test_module, batch_mode=False, autotest_mode=False) + + def test_Menus_EditMenuOptions_Work(self, request, workspace, editor, launcher_platform): + from .EditorScripts import Menus_EditMenuOptions as test_module + self._run_test(request, workspace, editor, test_module, batch_mode=False) + + def test_Menus_ViewMenuOptions_Work(self, request, workspace, editor, launcher_platform): + from .EditorScripts import Menus_ViewMenuOptions as test_module + self._run_test(request, workspace, editor, test_module, batch_mode=False) + + @pytest.mark.skip(reason="Times out due to dialogs failing to dismiss: LYN-4208") + def test_Menus_FileMenuOptions_Work(self, request, workspace, editor, launcher_platform): + from .EditorScripts import Menus_FileMenuOptions as test_module + self._run_test(request, workspace, editor, test_module, batch_mode=False) diff --git a/AutomatedTesting/Gem/PythonTests/editor/test_Editor_Periodic_Optimized.py b/AutomatedTesting/Gem/PythonTests/editor/test_Editor_Periodic_Optimized.py new file mode 100644 index 0000000000..8e121439f9 --- /dev/null +++ b/AutomatedTesting/Gem/PythonTests/editor/test_Editor_Periodic_Optimized.py @@ -0,0 +1,61 @@ +""" +Copyright (c) Contributors to the Open 3D Engine Project. +For complete copyright and license terms please see the LICENSE at the root of this distribution. + +SPDX-License-Identifier: Apache-2.0 OR MIT +""" + +import os +import pytest + +import ly_test_tools.environment.file_system as file_system +from ly_test_tools.o3de.editor_test import EditorSingleTest, EditorSharedTest, EditorParallelTest, EditorTestSuite + + +@pytest.mark.SUITE_periodic +@pytest.mark.parametrize("launcher_platform", ['windows_editor']) +@pytest.mark.parametrize("project", ["AutomatedTesting"]) +class TestAutomationAutoTestMode(EditorTestSuite): + + # Enable only -autotest_mode for these tests. Tests cannot run in -BatchMode due to UI interactions + global_extra_cmdline_args = ["-autotest_mode"] + + class test_AssetBrowser_TreeNavigation(EditorSharedTest): + from .EditorScripts import AssetBrowser_TreeNavigation as test_module + + @pytest.mark.skip(reason="Crashes Editor: ATOM-15493") + class test_AssetBrowser_SearchFiltering(EditorSharedTest): + from .EditorScripts import AssetBrowser_SearchFiltering as test_module + + class test_ComponentCRUD_Add_Delete_Components(EditorSharedTest): + from .EditorScripts import ComponentCRUD_Add_Delete_Components as test_module + + class test_Docking_BasicDockedTools(EditorSharedTest): + from .EditorScripts import Docking_BasicDockedTools as test_module + + class test_Menus_EditMenuOptions_Work(EditorSharedTest): + from .EditorScripts import Menus_EditMenuOptions as test_module + + class test_Menus_ViewMenuOptions_Work(EditorSharedTest): + from .EditorScripts import Menus_ViewMenuOptions as test_module + + @pytest.mark.skip(reason="Times out due to dialogs failing to dismiss: LYN-4208") + class test_Menus_FileMenuOptions_Work(EditorSharedTest): + from .EditorScripts import Menus_FileMenuOptions as test_module + + +@pytest.mark.SUITE_periodic +@pytest.mark.parametrize("launcher_platform", ['windows_editor']) +@pytest.mark.parametrize("project", ["AutomatedTesting"]) +class TestAutomationNoAutoTestMode(EditorTestSuite): + + # Disable -autotest_mode and -BatchMode. Tests cannot run in -BatchMode due to UI interactions, and these tests + # interact with modal dialogs + global_extra_cmdline_args = [] + + class test_InputBindings_Add_Remove_Input_Events(EditorSharedTest): + from .EditorScripts import InputBindings_Add_Remove_Input_Events as test_module + + @pytest.mark.skip(reason="Crashes Editor: ATOM-15493") + class test_AssetPicker_UI_UX(EditorSharedTest): + from .EditorScripts import AssetPicker_UI_UX as test_module \ No newline at end of file From dc8b48601cd03c79f45598d65467abc060d0b8ee Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Tue, 24 Aug 2021 10:36:31 -0700 Subject: [PATCH 059/131] PR comments/improvements Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Gems/AWSCore/Code/CMakeLists.txt | 6 +----- cmake/Install.cmake | 16 +++++++++++----- python/CMakeLists.txt | 4 ++++ scripts/CMakeLists.txt | 4 ++-- 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/Gems/AWSCore/Code/CMakeLists.txt b/Gems/AWSCore/Code/CMakeLists.txt index 8489e38550..5fdefa9f9e 100644 --- a/Gems/AWSCore/Code/CMakeLists.txt +++ b/Gems/AWSCore/Code/CMakeLists.txt @@ -167,8 +167,4 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED) endif() endif() -install(DIRECTORY "Tools/ResourceMappingTool" - DESTINATION "Gems/AWSCore/Code/Tools" - COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME} - PATTERN "__pycache__" EXCLUDE -) +ly_install_directory(DIRECTORIES Tools/ResourceMappingTool) diff --git a/cmake/Install.cmake b/cmake/Install.cmake index 9135e141d5..5781fc7ae5 100644 --- a/cmake/Install.cmake +++ b/cmake/Install.cmake @@ -17,7 +17,12 @@ endif() # \arg:DESTINATION (optional) destination to install the directory to (relative to CMAKE_PREFIX_PATH) # \arg:EXCLUDE_PATTERNS (optional) patterns to exclude # -# \notes: refer to cmake's install(DIRECTORY documentation for more information +# \notes: +# - refer to cmake's install(DIRECTORY documentation for more information +# - If the directory contains programs/scripts, exclude them from this call and add a specific ly_install_files with +# PROGRAMS set. This is necessary to set the proper execution permissions. +# - This function will automatically filter out __pycache__, *.egg-info, CMakeLists.txt, *.cmake files. If those files +# need to be installed, use ly_install_files. # function(ly_install_directory) @@ -75,10 +80,11 @@ endfunction() #! ly_install_files: specifies files to be copied to the install layout at install time # # \arg:FILES files to install -# \arg:DESTINATION (optional) destination to install the directory to (relative to CMAKE_PREFIX_PATH) +# \arg:DESTINATION destination to install the directory to (relative to CMAKE_PREFIX_PATH) # \arg:PROGRAMS (optional) indicates if the files are programs that should be installed with EXECUTE permissions # -# \notes: refer to cmake's install(FILES/PROGRAMS documentation for more information +# \notes: +# - refer to cmake's install(FILES/PROGRAMS documentation for more information # function(ly_install_files) @@ -92,7 +98,7 @@ function(ly_install_files) message(FATAL_ERROR "You must provide a list of files to install") endif() if(NOT ly_install_files_DESTINATION) - message(FATAL_ERROR "You must provide a destination to install filest to") + message(FATAL_ERROR "You must provide a destination to install files to") endif() unset(files) @@ -109,7 +115,7 @@ function(ly_install_files) install(${install_type} ${files} DESTINATION ${ly_install_files_DESTINATION} - COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME} # use the deafult for the time being + COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME} # use the default for the time being ) endfunction() \ No newline at end of file diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 4e49c6396a..b2d01a08f8 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -6,6 +6,10 @@ # # +if(NOT PAL_TRAIT_BUILD_HOST_TOOLS) + return() +endif() + # common files to all platforms ly_install_files( FILES diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index 5c55c58209..4e2dd1d780 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -8,8 +8,8 @@ if(PAL_TRAIT_BUILD_HOST_TOOLS) add_subdirectory(bundler) - add_subdirectory(detect_file_changes) add_subdirectory(commit_validation) - add_subdirectory(o3de) add_subdirectory(ctest) + add_subdirectory(detect_file_changes) + add_subdirectory(o3de) endif() From 0f3381a7a7e89b24cb5fcc11bff09f2b1b51e36e Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Tue, 24 Aug 2021 11:13:04 -0700 Subject: [PATCH 060/131] required warning to disable until we get to the right MSVC version Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- cmake/Platform/Common/MSVC/Configurations_msvc.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/Platform/Common/MSVC/Configurations_msvc.cmake b/cmake/Platform/Common/MSVC/Configurations_msvc.cmake index 83ae51b408..41fa9cbb5b 100644 --- a/cmake/Platform/Common/MSVC/Configurations_msvc.cmake +++ b/cmake/Platform/Common/MSVC/Configurations_msvc.cmake @@ -36,6 +36,7 @@ ly_append_configurations_options( # Disabling some warnings /wd4201 # nonstandard extension used: nameless struct/union. This actually became part of the C++11 std, MS has an open issue: https://developercommunity.visualstudio.com/t/warning-level-4-generates-a-bogus-warning-c4201-no/103064 + /wd4619 # unknown #pragma warning. Unfortunately some versions of MSVC 16.X dont filter this warning coming from external headers and Qt has a bad warning in QtCore/qvector.h(340,12) # Enabling warnings that are disabled by default from /W4 # https://docs.microsoft.com/en-us/cpp/preprocessor/compiler-warnings-that-are-off-by-default?view=vs-2019 From d7fda783a82eee5baa5a5e1bcf066428cc051286 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Tue, 24 Aug 2021 11:48:49 -0700 Subject: [PATCH 061/131] improves comment Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- cmake/Platform/Common/MSVC/Configurations_msvc.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/Platform/Common/MSVC/Configurations_msvc.cmake b/cmake/Platform/Common/MSVC/Configurations_msvc.cmake index 41fa9cbb5b..7ee118e2f4 100644 --- a/cmake/Platform/Common/MSVC/Configurations_msvc.cmake +++ b/cmake/Platform/Common/MSVC/Configurations_msvc.cmake @@ -36,7 +36,7 @@ ly_append_configurations_options( # Disabling some warnings /wd4201 # nonstandard extension used: nameless struct/union. This actually became part of the C++11 std, MS has an open issue: https://developercommunity.visualstudio.com/t/warning-level-4-generates-a-bogus-warning-c4201-no/103064 - /wd4619 # unknown #pragma warning. Unfortunately some versions of MSVC 16.X dont filter this warning coming from external headers and Qt has a bad warning in QtCore/qvector.h(340,12) + /wd4619 # #pragma warning : there is no warning number 'number'. Unfortunately some versions of MSVC 16.X dont filter this warning coming from external headers and Qt has a bad warning in QtCore/qvector.h(340,12) # Enabling warnings that are disabled by default from /W4 # https://docs.microsoft.com/en-us/cpp/preprocessor/compiler-warnings-that-are-off-by-default?view=vs-2019 From d51330702315eeafe2c085e15090f415dd47030b Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Tue, 24 Aug 2021 12:10:31 -0700 Subject: [PATCH 062/131] another warn fix Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../Code/Source/Document/AtomToolsDocumentMainWindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gems/Atom/Tools/AtomToolsFramework/Code/Source/Document/AtomToolsDocumentMainWindow.cpp b/Gems/Atom/Tools/AtomToolsFramework/Code/Source/Document/AtomToolsDocumentMainWindow.cpp index c39bfc8327..0d62adc9ee 100644 --- a/Gems/Atom/Tools/AtomToolsFramework/Code/Source/Document/AtomToolsDocumentMainWindow.cpp +++ b/Gems/Atom/Tools/AtomToolsFramework/Code/Source/Document/AtomToolsDocumentMainWindow.cpp @@ -121,7 +121,7 @@ namespace AtomToolsFramework }, QKeySequence::Close); m_menuFile->insertAction(insertPostion, m_actionClose); - m_actionCloseAll = CreateAction("Close All", [this]() { + m_actionCloseAll = CreateAction("Close All", []() { AtomToolsDocumentSystemRequestBus::Broadcast(&AtomToolsDocumentSystemRequestBus::Events::CloseAllDocuments); }); m_menuFile->insertAction(insertPostion, m_actionCloseAll); From 306a7a622df6a427dbe75bb0eb38cba2b2ed18de Mon Sep 17 00:00:00 2001 From: Chris Galvan Date: Tue, 24 Aug 2021 15:29:00 -0500 Subject: [PATCH 063/131] Fixed memory stomping leading to Track View nodes with invalid labels and crash. Signed-off-by: Chris Galvan --- Code/Editor/TrackView/TrackViewDialog.cpp | 3 ++- Code/Editor/TrackView/TrackViewNodes.cpp | 21 +++++++++++-------- Code/Legacy/CryCommon/IMovieSystem.h | 2 +- .../Source/Cinematics/AnimComponentNode.h | 8 +++---- .../Code/Source/Cinematics/AnimNode.cpp | 2 +- 5 files changed, 20 insertions(+), 16 deletions(-) diff --git a/Code/Editor/TrackView/TrackViewDialog.cpp b/Code/Editor/TrackView/TrackViewDialog.cpp index f1701f9e20..26d844a68b 100644 --- a/Code/Editor/TrackView/TrackViewDialog.cpp +++ b/Code/Editor/TrackView/TrackViewDialog.cpp @@ -2033,7 +2033,8 @@ void CTrackViewDialog::UpdateTracksToolBar() continue; } - name = pAnimNode->GetParamName(paramType); + AZStd::string paramName = pAnimNode->GetParamName(paramType); + name = paramName.c_str(); QString sToolTipText("Add " + name + " Track"); QIcon hIcon = m_wndNodesCtrl->GetIconForTrack(pTrack); diff --git a/Code/Editor/TrackView/TrackViewNodes.cpp b/Code/Editor/TrackView/TrackViewNodes.cpp index ae38323cc3..62b134a508 100644 --- a/Code/Editor/TrackView/TrackViewNodes.cpp +++ b/Code/Editor/TrackView/TrackViewNodes.cpp @@ -616,7 +616,8 @@ CTrackViewNodesCtrl::CRecord* CTrackViewNodesCtrl::AddAnimNodeRecord(CRecord* pP { CRecord* pNewRecord = new CRecord(animNode); - pNewRecord->setText(0, animNode->GetName()); + AZStd::string nodeName = animNode->GetName(); + pNewRecord->setText(0, nodeName.c_str()); UpdateAnimNodeRecord(pNewRecord, animNode); pParentRecord->insertChild(GetInsertPosition(pParentRecord, animNode), pNewRecord); FillNodesRec(pNewRecord, animNode); @@ -629,7 +630,8 @@ CTrackViewNodesCtrl::CRecord* CTrackViewNodesCtrl::AddTrackRecord(CRecord* pPare { CRecord* pNewTrackRecord = new CRecord(pTrack); pNewTrackRecord->setSizeHint(0, QSize(30, 18)); - pNewTrackRecord->setText(0, pTrack->GetName()); + AZStd::string trackName = pTrack->GetName(); + pNewTrackRecord->setText(0, trackName.c_str()); UpdateTrackRecord(pNewTrackRecord, pTrack); pParentRecord->insertChild(GetInsertPosition(pParentRecord, pTrack), pNewTrackRecord); FillNodesRec(pNewTrackRecord, pTrack); @@ -2348,13 +2350,13 @@ bool CTrackViewNodesCtrl::FillAddTrackMenu(STrackMenuTreeNode& menuAddTrack, con continue; } } - name = animNode->GetParamName(paramType); + AZStd::string paramName = animNode->GetParamName(paramType); + name = paramName.c_str(); QStringList splittedName = name.split("/", Qt::SkipEmptyParts); STrackMenuTreeNode* pCurrentNode = &menuAddTrack; - for (int j = 0; j < splittedName.size() - 1; ++j) + for (const QString& segment : splittedName) { - const QString& segment = splittedName[j]; auto findIter = pCurrentNode->children.find(segment); if (findIter != pCurrentNode->children.end()) { @@ -2370,7 +2372,7 @@ bool CTrackViewNodesCtrl::FillAddTrackMenu(STrackMenuTreeNode& menuAddTrack, con // only add tracks to the that STrackMenuTreeNode tree that haven't already been added CTrackViewTrackBundle matchedTracks = animNode->GetTracksByParam(paramType); - if (matchedTracks.GetCount() == 0) + if (matchedTracks.GetCount() == 0 && !splittedName.isEmpty()) { STrackMenuTreeNode* pParamNode = new STrackMenuTreeNode; pCurrentNode->children[splittedName.back()] = std::unique_ptr(pParamNode); @@ -2580,10 +2582,11 @@ void CTrackViewNodesCtrl::Update() { const CTrackViewAnimNode* track = static_cast(node); if (track) - { - record->setText(0, track->GetName()); + { + AZStd::string trackName = track->GetName(); + record->setText(0, trackName.c_str()); } - } + } } } } diff --git a/Code/Legacy/CryCommon/IMovieSystem.h b/Code/Legacy/CryCommon/IMovieSystem.h index 915dc925bf..2385f3c358 100644 --- a/Code/Legacy/CryCommon/IMovieSystem.h +++ b/Code/Legacy/CryCommon/IMovieSystem.h @@ -625,7 +625,7 @@ public: , valueType(_valueType) , flags(_flags) {}; - const char* name; // parameter name. + AZStd::string name; // parameter name. CAnimParamType paramType; // parameter id. AnimValueType valueType; // value type, defines type of track to use for animating this parameter. ESupportedParamFlags flags; // combination of flags from ESupportedParamFlags. diff --git a/Gems/Maestro/Code/Source/Cinematics/AnimComponentNode.h b/Gems/Maestro/Code/Source/Cinematics/AnimComponentNode.h index 5ad3ab6f94..867afcb28e 100644 --- a/Gems/Maestro/Code/Source/Cinematics/AnimComponentNode.h +++ b/Gems/Maestro/Code/Source/Cinematics/AnimComponentNode.h @@ -150,16 +150,16 @@ private: } BehaviorPropertyInfo(const BehaviorPropertyInfo& other) { - m_displayName = other.m_displayName; - m_animNodeParamInfo.paramType = other.m_displayName; - m_animNodeParamInfo.name = &m_displayName[0]; + m_displayName = AZStd::move(other.m_displayName); + m_animNodeParamInfo.paramType = m_displayName; + m_animNodeParamInfo.name = m_displayName; } BehaviorPropertyInfo& operator=(const AZStd::string& str) { // TODO: clean this up - this weird memory sharing was copied from legacy Cry - could be better. m_displayName = str; m_animNodeParamInfo.paramType = str; // set type to AnimParamType::ByString by assigning a string - m_animNodeParamInfo.name = &m_displayName[0]; + m_animNodeParamInfo.name = m_displayName; return *this; } diff --git a/Gems/Maestro/Code/Source/Cinematics/AnimNode.cpp b/Gems/Maestro/Code/Source/Cinematics/AnimNode.cpp index 828e5ad20f..c238d40ca8 100644 --- a/Gems/Maestro/Code/Source/Cinematics/AnimNode.cpp +++ b/Gems/Maestro/Code/Source/Cinematics/AnimNode.cpp @@ -82,7 +82,7 @@ const char* CAnimNode::GetParamName(const CAnimParamType& paramType) const SParamInfo info; if (GetParamInfoFromType(paramType, info)) { - return info.name; + return info.name.c_str(); } return "Unknown"; From fc44063a0aed144337064f5316cb60c1d1c4a004 Mon Sep 17 00:00:00 2001 From: jckand-amzn Date: Tue, 24 Aug 2021 16:00:45 -0500 Subject: [PATCH 064/131] Renaming test files for standardization. Keeping old, unoptimized files temporarily. Signed-off-by: jckand-amzn --- ...or_Main_Optimized.py => TestSuite_Main.py} | 41 ++++++++++++++++++- ...t_Editor_Main.py => TestSuite_Main_OLD.py} | 0 ..._Periodic.py => TestSuite_Periodic_OLD.py} | 0 3 files changed, 40 insertions(+), 1 deletion(-) rename AutomatedTesting/Gem/PythonTests/editor/{test_Editor_Main_Optimized.py => TestSuite_Main.py} (50%) rename AutomatedTesting/Gem/PythonTests/editor/{test_Editor_Main.py => TestSuite_Main_OLD.py} (100%) rename AutomatedTesting/Gem/PythonTests/editor/{test_Editor_Periodic.py => TestSuite_Periodic_OLD.py} (100%) diff --git a/AutomatedTesting/Gem/PythonTests/editor/test_Editor_Main_Optimized.py b/AutomatedTesting/Gem/PythonTests/editor/TestSuite_Main.py similarity index 50% rename from AutomatedTesting/Gem/PythonTests/editor/test_Editor_Main_Optimized.py rename to AutomatedTesting/Gem/PythonTests/editor/TestSuite_Main.py index 953ef35692..4be6c22e79 100644 --- a/AutomatedTesting/Gem/PythonTests/editor/test_Editor_Main_Optimized.py +++ b/AutomatedTesting/Gem/PythonTests/editor/TestSuite_Main.py @@ -31,10 +31,49 @@ class TestAutomationNoAutoTestMode(EditorTestSuite): @pytest.mark.REQUIRES_gpu class test_BasicEditorWorkflows_GPU_LevelEntityComponentCRUD(EditorSingleTest): # Disable null renderer - EditorTestSuite.use_null_renderer = False + use_null_renderer = False # Custom teardown to remove slice asset created during test def teardown(self, request, workspace, editor, editor_test_results, launcher_platform): file_system.delete([os.path.join(workspace.paths.engine_root(), "AutomatedTesting", "Levels", "tmp_level")], True, True) from .EditorScripts import BasicEditorWorkflows_LevelEntityComponentCRUD as test_module + + class test_InputBindings_Add_Remove_Input_Events(EditorSharedTest): + from .EditorScripts import InputBindings_Add_Remove_Input_Events as test_module + + @pytest.mark.skip(reason="Crashes Editor: ATOM-15493") + class test_AssetPicker_UI_UX(EditorSharedTest): + from .EditorScripts import AssetPicker_UI_UX as test_module + + +@pytest.mark.SUITE_main +@pytest.mark.parametrize("launcher_platform", ['windows_editor']) +@pytest.mark.parametrize("project", ["AutomatedTesting"]) +class TestAutomationAutoTestMode(EditorTestSuite): + + # Enable only -autotest_mode for these tests. Tests cannot run in -BatchMode due to UI interactions + global_extra_cmdline_args = ["-autotest_mode"] + + class test_AssetBrowser_TreeNavigation(EditorSharedTest): + from .EditorScripts import AssetBrowser_TreeNavigation as test_module + + @pytest.mark.skip(reason="Crashes Editor: ATOM-15493") + class test_AssetBrowser_SearchFiltering(EditorSharedTest): + from .EditorScripts import AssetBrowser_SearchFiltering as test_module + + class test_ComponentCRUD_Add_Delete_Components(EditorSharedTest): + from .EditorScripts import ComponentCRUD_Add_Delete_Components as test_module + + class test_Docking_BasicDockedTools(EditorSharedTest): + from .EditorScripts import Docking_BasicDockedTools as test_module + + class test_Menus_EditMenuOptions_Work(EditorSharedTest): + from .EditorScripts import Menus_EditMenuOptions as test_module + + class test_Menus_ViewMenuOptions_Work(EditorSharedTest): + from .EditorScripts import Menus_ViewMenuOptions as test_module + + @pytest.mark.skip(reason="Times out due to dialogs failing to dismiss: LYN-4208") + class test_Menus_FileMenuOptions_Work(EditorSharedTest): + from .EditorScripts import Menus_FileMenuOptions as test_module diff --git a/AutomatedTesting/Gem/PythonTests/editor/test_Editor_Main.py b/AutomatedTesting/Gem/PythonTests/editor/TestSuite_Main_OLD.py similarity index 100% rename from AutomatedTesting/Gem/PythonTests/editor/test_Editor_Main.py rename to AutomatedTesting/Gem/PythonTests/editor/TestSuite_Main_OLD.py diff --git a/AutomatedTesting/Gem/PythonTests/editor/test_Editor_Periodic.py b/AutomatedTesting/Gem/PythonTests/editor/TestSuite_Periodic_OLD.py similarity index 100% rename from AutomatedTesting/Gem/PythonTests/editor/test_Editor_Periodic.py rename to AutomatedTesting/Gem/PythonTests/editor/TestSuite_Periodic_OLD.py From 8c1ab469014898812311e31cffa3669e45e63a81 Mon Sep 17 00:00:00 2001 From: jckand-amzn Date: Tue, 24 Aug 2021 16:02:01 -0500 Subject: [PATCH 065/131] Removing unneeded periodic suite test file Signed-off-by: jckand-amzn --- .../editor/test_Editor_Periodic_Optimized.py | 61 ------------------- 1 file changed, 61 deletions(-) delete mode 100644 AutomatedTesting/Gem/PythonTests/editor/test_Editor_Periodic_Optimized.py diff --git a/AutomatedTesting/Gem/PythonTests/editor/test_Editor_Periodic_Optimized.py b/AutomatedTesting/Gem/PythonTests/editor/test_Editor_Periodic_Optimized.py deleted file mode 100644 index 8e121439f9..0000000000 --- a/AutomatedTesting/Gem/PythonTests/editor/test_Editor_Periodic_Optimized.py +++ /dev/null @@ -1,61 +0,0 @@ -""" -Copyright (c) Contributors to the Open 3D Engine Project. -For complete copyright and license terms please see the LICENSE at the root of this distribution. - -SPDX-License-Identifier: Apache-2.0 OR MIT -""" - -import os -import pytest - -import ly_test_tools.environment.file_system as file_system -from ly_test_tools.o3de.editor_test import EditorSingleTest, EditorSharedTest, EditorParallelTest, EditorTestSuite - - -@pytest.mark.SUITE_periodic -@pytest.mark.parametrize("launcher_platform", ['windows_editor']) -@pytest.mark.parametrize("project", ["AutomatedTesting"]) -class TestAutomationAutoTestMode(EditorTestSuite): - - # Enable only -autotest_mode for these tests. Tests cannot run in -BatchMode due to UI interactions - global_extra_cmdline_args = ["-autotest_mode"] - - class test_AssetBrowser_TreeNavigation(EditorSharedTest): - from .EditorScripts import AssetBrowser_TreeNavigation as test_module - - @pytest.mark.skip(reason="Crashes Editor: ATOM-15493") - class test_AssetBrowser_SearchFiltering(EditorSharedTest): - from .EditorScripts import AssetBrowser_SearchFiltering as test_module - - class test_ComponentCRUD_Add_Delete_Components(EditorSharedTest): - from .EditorScripts import ComponentCRUD_Add_Delete_Components as test_module - - class test_Docking_BasicDockedTools(EditorSharedTest): - from .EditorScripts import Docking_BasicDockedTools as test_module - - class test_Menus_EditMenuOptions_Work(EditorSharedTest): - from .EditorScripts import Menus_EditMenuOptions as test_module - - class test_Menus_ViewMenuOptions_Work(EditorSharedTest): - from .EditorScripts import Menus_ViewMenuOptions as test_module - - @pytest.mark.skip(reason="Times out due to dialogs failing to dismiss: LYN-4208") - class test_Menus_FileMenuOptions_Work(EditorSharedTest): - from .EditorScripts import Menus_FileMenuOptions as test_module - - -@pytest.mark.SUITE_periodic -@pytest.mark.parametrize("launcher_platform", ['windows_editor']) -@pytest.mark.parametrize("project", ["AutomatedTesting"]) -class TestAutomationNoAutoTestMode(EditorTestSuite): - - # Disable -autotest_mode and -BatchMode. Tests cannot run in -BatchMode due to UI interactions, and these tests - # interact with modal dialogs - global_extra_cmdline_args = [] - - class test_InputBindings_Add_Remove_Input_Events(EditorSharedTest): - from .EditorScripts import InputBindings_Add_Remove_Input_Events as test_module - - @pytest.mark.skip(reason="Crashes Editor: ATOM-15493") - class test_AssetPicker_UI_UX(EditorSharedTest): - from .EditorScripts import AssetPicker_UI_UX as test_module \ No newline at end of file From 07a14bdce159622c34f298a9c800961e3d5565a4 Mon Sep 17 00:00:00 2001 From: Jeremy Ong Date: Sat, 21 Aug 2021 02:27:56 -0600 Subject: [PATCH 066/131] Add AZ_BUDGET_DEFINE/AZ_BUDGET_DECLARE and remove driller NOTE: The memory driller is still intact for now to avoid needing to modify allocators, but the frame/cpu portions of driller and the standalone executable are now gone. Signed-off-by: Jeremy Ong --- Code/Editor/CryEditDoc.cpp | 8 +- Code/Editor/EditorDefs.h | 4 - Code/Editor/EditorViewportWidget.cpp | 8 - Code/Editor/IEditor.h | 7 +- Code/Editor/IEditorImpl.cpp | 2 - Code/Editor/Objects/BaseObject.cpp | 5 +- Code/Editor/Objects/DisplayContextShared.inl | 4 - Code/Editor/Objects/EntityObject.cpp | 2 +- Code/Editor/Objects/GizmoManager.cpp | 2 - Code/Editor/Objects/ObjectManager.cpp | 1 - .../Objects/ObjectManagerLegacyUndo.cpp | 1 - Code/Editor/TopRendererWnd.cpp | 2 - Code/Editor/Util/GeometryUtil.cpp | 4 - Code/Editor/Viewport.cpp | 4 - Code/Framework/AzCore/AzCore/AzCoreModule.cpp | 5 +- .../AzCore/Component/ComponentApplication.cpp | 3 - .../AzCore/AzCore/Component/Entity.h | 2 + Code/Framework/AzCore/AzCore/Debug/Budget.cpp | 45 + Code/Framework/AzCore/AzCore/Debug/Budget.h | 114 + .../AzCore/AzCore/Debug/BudgetsComponent.cpp | 29 + .../AzCore/AzCore/Debug/BudgetsComponent.h | 31 + .../AzCore/AzCore/Debug/FrameProfiler.h | 63 - .../AzCore/AzCore/Debug/FrameProfilerBus.h | 38 - .../AzCore/Debug/FrameProfilerComponent.cpp | 250 --- .../AzCore/Debug/FrameProfilerComponent.h | 75 - .../AzCore/AzCore/Debug/Profiler.cpp | 654 +----- Code/Framework/AzCore/AzCore/Debug/Profiler.h | 361 +-- .../AzCore/AzCore/Debug/ProfilerDriller.cpp | 310 --- .../AzCore/AzCore/Debug/ProfilerDriller.h | 102 - .../AzCore/AzCore/Debug/ProfilerDrillerBus.h | 45 - Code/Framework/AzCore/AzCore/IO/FileIO.cpp | 2 - .../AzCore/AzCore/azcore_files.cmake | 13 +- Code/Framework/AzCore/Tests/Components.cpp | 2 - .../AzCore/Tests/TimeDataStatistics.cpp | 208 -- .../AzCore/Tests/azcoretests_files.cmake | 1 - .../AzFramework/Application/Application.cpp | 2 - .../AzFramework/Application/Application.h | 2 + .../AzFramework/AzFrameworkModule.cpp | 2 + .../Entity/EntityOwnershipService.h | 3 + .../AzFramework/Script/ScriptComponent.cpp | 2 + .../TargetManagement/TargetManagementAPI.h | 3 + .../EntityVisibilityBoundsUnionSystem.cpp | 2 + .../API/ToolsApplicationAPI.h | 11 +- .../AzToolsFrameworkModule.cpp | 2 + .../Core/EditorFrameworkApplication.cpp | 1 - .../UI/PropertyEditor/PropertyEditorAPI.h | 5 +- .../Undo/UndoCacheInterface.h | 3 + Code/Framework/GridMate/GridMate/GridMate.cpp | 3 + .../GridMate/GridMate/Replica/ReplicaDefs.h | 9 +- .../Replica/Tasks/ReplicaMarshalTasks.cpp | 2 - Code/Legacy/CryCommon/FrameProfiler.h | 67 - Code/Legacy/CryCommon/ISystem.h | 7 - Code/Legacy/CryCommon/crycommon_files.cmake | 1 - .../CrySystem/LocalizedStringManager.cpp | 1 - Code/Legacy/CrySystem/Log.cpp | 3 - Code/Legacy/CrySystem/System.cpp | 16 +- .../CrySystem/ViewSystem/ViewSystem.cpp | 2 - Code/Tools/Standalone/CMakeLists.txt | 31 - .../Annotations/AnnotationHeaderView.cpp | 84 - .../Annotations/AnnotationHeaderView.hxx | 74 - .../Annotations/AnnotationHeaderView.ui | 178 -- .../Driller/Annotations/Annotations.cpp | 405 ---- .../Driller/Annotations/Annotations.hxx | 135 -- .../Annotations/AnnotationsDataView.cpp | 211 -- .../Annotations/AnnotationsDataView.hxx | 61 - .../AnnotationsDataView_Events.cpp | 250 --- .../AnnotationsDataView_Events.hxx | 77 - .../AnnotationsHeaderView_Events.cpp | 74 - .../AnnotationsHeaderView_Events.hxx | 65 - .../Annotations/ConfigureAnnotationsDialog.ui | 151 -- .../ConfigureAnnotationsWindow.cpp | 248 --- .../ConfigureAnnotationsWindow.hxx | 91 - .../Standalone/Source/Driller/AreaChart.cpp | 636 ------ .../Standalone/Source/Driller/AreaChart.hxx | 212 -- Code/Tools/Standalone/Source/Driller/Axis.cpp | 648 ------ Code/Tools/Standalone/Source/Driller/Axis.hxx | 98 - .../Source/Driller/CSVExportSettings.h | 48 - .../Driller/Carrier/CarrierDataAggregator.cpp | 392 ---- .../Driller/Carrier/CarrierDataAggregator.hxx | 154 -- .../Driller/Carrier/CarrierDataEvents.h | 62 - .../Driller/Carrier/CarrierDataParser.cpp | 131 -- .../Driller/Carrier/CarrierDataParser.h | 50 - .../Driller/Carrier/CarrierDataView.cpp | 268 --- .../Driller/Carrier/CarrierDataView.hxx | 70 - .../Source/Driller/Carrier/CarrierDataView.ui | 327 --- .../Carrier/CarrierOperationTelemetryEvent.h | 26 - .../Driller/ChannelConfigurationDialog.cpp | 27 - .../Driller/ChannelConfigurationDialog.hxx | 38 - .../Driller/ChannelConfigurationWidget.cpp | 21 - .../Driller/ChannelConfigurationWidget.hxx | 37 - .../Source/Driller/ChannelControl.cpp | 484 ---- .../Source/Driller/ChannelControl.hxx | 133 -- .../Source/Driller/ChannelControl.ui | 218 -- .../Source/Driller/ChannelDataView.cpp | 875 -------- .../Source/Driller/ChannelDataView.hxx | 162 -- .../Source/Driller/ChannelProfilerWidget.cpp | 292 --- .../Source/Driller/ChannelProfilerWidget.hxx | 92 - .../Source/Driller/ChannelProfilerWidget.ui | 150 -- .../Source/Driller/ChartNumberFormats.cpp | 52 - .../Source/Driller/ChartNumberFormats.h | 22 - .../Standalone/Source/Driller/ChartTypes.cpp | 17 - .../Standalone/Source/Driller/ChartTypes.hxx | 44 - .../Source/Driller/CollapsiblePanel.cpp | 87 - .../Source/Driller/CollapsiblePanel.hxx | 60 - .../Source/Driller/CollapsiblePanel.ui | 125 -- .../Source/Driller/CombinedEventsControl.cpp | 254 --- .../Source/Driller/CombinedEventsControl.hxx | 116 - .../Driller/CustomizeCSVExportWidget.cpp | 39 - .../Driller/CustomizeCSVExportWidget.hxx | 43 - .../Source/Driller/DoubleListSelector.cpp | 145 -- .../Source/Driller/DoubleListSelector.hxx | 60 - .../Source/Driller/DoubleListSelector.ui | 174 -- .../Source/Driller/DrillerAggregator.cpp | 223 -- .../Source/Driller/DrillerAggregator.hxx | 155 -- .../Driller/DrillerAggregatorOptions.hxx | 34 - .../Source/Driller/DrillerCaptureWindow.cpp | 1952 ----------------- .../Source/Driller/DrillerCaptureWindow.hxx | 269 --- .../Source/Driller/DrillerCaptureWindow.ui | 610 ------ .../Source/Driller/DrillerContext.cpp | 299 --- .../Source/Driller/DrillerContext.h | 101 - .../Source/Driller/DrillerContextInterface.h | 29 - .../Source/Driller/DrillerDataContainer.cpp | 283 --- .../Source/Driller/DrillerDataContainer.h | 82 - .../Source/Driller/DrillerDataTypes.h | 30 - .../Source/Driller/DrillerEvent.cpp | 16 - .../Standalone/Source/Driller/DrillerEvent.h | 53 - .../Source/Driller/DrillerMainChannelsView.ui | 147 -- .../Source/Driller/DrillerMainWindow.cpp | 509 ----- .../Source/Driller/DrillerMainWindow.hxx | 139 -- .../Source/Driller/DrillerMainWindow.ui | 245 --- .../Driller/DrillerMainWindowMessages.cpp | 15 - .../Driller/DrillerMainWindowMessages.h | 128 -- .../Source/Driller/DrillerNetworkMessages.h | 53 - .../DrillerOperationTelemetryEvent.cpp | 30 - .../Driller/DrillerOperationTelemetryEvent.h | 43 - .../EventTrace/EventTraceDataAggregator.cpp | 224 -- .../EventTrace/EventTraceDataAggregator.h | 91 - .../EventTrace/EventTraceDataParser.cpp | 106 - .../Driller/EventTrace/EventTraceDataParser.h | 41 - .../Driller/EventTrace/EventTraceEvents.h | 98 - .../Source/Driller/FilteredListView.cpp | 212 -- .../Source/Driller/FilteredListView.hxx | 89 - .../Source/Driller/FilteredListView.ui | 124 -- .../GenericCustomizeCSVExportWidget.cpp | 66 - .../GenericCustomizeCSVExportWidget.hxx | 73 - .../GenericCustomizeCSVExportWidget.ui | 74 - .../Driller/IO/StreamerDataAggregator.cpp | 584 ----- .../Source/Driller/IO/StreamerDataParser.cpp | 327 --- .../Source/Driller/IO/StreamerDataView.cpp | 54 - .../Driller/IO/StreamerDrillerDialog.cpp | 1527 ------------- .../Source/Driller/IO/StreamerEvents.cpp | 228 -- .../Driller/Memory/MemoryDataAggregator.cpp | 271 --- .../Driller/Memory/MemoryDataAggregator.hxx | 95 - .../Driller/Memory/MemoryDataParser.cpp | 172 -- .../Source/Driller/Memory/MemoryDataParser.h | 50 - .../Source/Driller/Memory/MemoryDataView.cpp | 642 ------ .../Source/Driller/Memory/MemoryDataView.hxx | 126 -- .../Source/Driller/Memory/MemoryDataView.ui | 188 -- .../Source/Driller/Memory/MemoryEvents.cpp | 161 -- .../Source/Driller/Memory/MemoryEvents.h | 183 -- .../Profiler/ProfilerDataAggregator.cpp | 465 ---- .../Profiler/ProfilerDataAggregator.hxx | 121 - .../Driller/Profiler/ProfilerDataPanel.cpp | 1517 ------------- .../Driller/Profiler/ProfilerDataPanel.hxx | 199 -- .../Driller/Profiler/ProfilerDataParser.cpp | 255 --- .../Driller/Profiler/ProfilerDataParser.h | 52 - .../Driller/Profiler/ProfilerDataView.cpp | 628 ------ .../Driller/Profiler/ProfilerDataView.hxx | 121 - .../Driller/Profiler/ProfilerDataView.ui | 490 ----- .../Driller/Profiler/ProfilerEvents.cpp | 168 -- .../Source/Driller/Profiler/ProfilerEvents.h | 237 -- .../ProfilerOperationTelemetryEvent.h | 26 - .../Source/Driller/RacetrackChart.cpp | 608 ----- .../Source/Driller/RacetrackChart.hxx | 128 -- .../Rendering/VRAM/VRAMDataAggregator.cpp | 377 ---- .../Rendering/VRAM/VRAMDataAggregator.hxx | 121 - .../Driller/Rendering/VRAM/VRAMDataParser.cpp | 148 -- .../Driller/Rendering/VRAM/VRAMDataParser.h | 63 - .../Driller/Rendering/VRAM/VRAMEvents.cpp | 125 -- .../Driller/Rendering/VRAM/VRAMEvents.h | 159 -- .../Source/Driller/Replica/BaseDetailView.h | 674 ------ .../Source/Driller/Replica/BaseDetailView.inl | 456 ---- .../Driller/Replica/BaseDetailViewQObject.cpp | 122 -- .../Driller/Replica/BaseDetailViewQObject.hxx | 88 - .../Replica/BaseDetailViewSavedState.h | 63 - .../Replica/OverallReplicaDetailView.cpp | 746 ------- .../Replica/OverallReplicaDetailView.hxx | 470 ---- .../Replica/ReplicaBandwidthChartData.cpp | 397 ---- .../Replica/ReplicaBandwidthChartData.h | 401 ---- .../Replica/ReplicaChunkTypeDetailView.cpp | 430 ---- .../Replica/ReplicaChunkTypeDetailView.h | 118 - .../ReplicaChunkUsageDataContainers.cpp | 67 - .../Replica/ReplicaChunkUsageDataContainers.h | 69 - .../Driller/Replica/ReplicaDataAggregator.cpp | 690 ------ .../Driller/Replica/ReplicaDataAggregator.hxx | 203 -- ...eplicaDataAggregatorConfigurationPanel.cpp | 171 -- ...eplicaDataAggregatorConfigurationPanel.hxx | 59 - ...ReplicaDataAggregatorConfigurationPanel.ui | 345 --- .../Driller/Replica/ReplicaDataEvents.h | 291 --- .../Driller/Replica/ReplicaDataParser.cpp | 217 -- .../Driller/Replica/ReplicaDataParser.h | 50 - .../Driller/Replica/ReplicaDataView.cpp | 1808 --------------- .../Driller/Replica/ReplicaDataView.hxx | 438 ---- .../Replica/ReplicaDataViewConfigDialog.ui | 106 - .../Driller/Replica/ReplicaDetailView.cpp | 346 --- .../Driller/Replica/ReplicaDetailView.h | 116 - .../Driller/Replica/ReplicaDisplayHelpers.cpp | 568 ----- .../Driller/Replica/ReplicaDisplayHelpers.h | 512 ----- .../Driller/Replica/ReplicaDisplayTypes.cpp | 18 - .../Driller/Replica/ReplicaDisplayTypes.h | 31 - .../Replica/ReplicaDrillerConfigToolbar.cpp | 46 - .../Replica/ReplicaDrillerConfigToolbar.hxx | 58 - .../Replica/ReplicaDrillerConfigToolbar.ui | 158 -- .../Replica/ReplicaOperationTelemetryEvent.h | 26 - .../Driller/Replica/ReplicaTreeViewModel.cpp | 88 - .../Driller/Replica/ReplicaTreeViewModel.hxx | 46 - .../Replica/ReplicaUsageDataContainers.cpp | 71 - .../Replica/ReplicaUsageDataContainers.h | 67 - .../Source/Driller/Replica/basedetailview.ui | 504 ----- .../Replica/overallreplicadetailview.ui | 718 ------ .../Source/Driller/Replica/replicadataview.ui | 558 ----- .../Standalone/Source/Driller/StripChart.cpp | 991 --------- .../Standalone/Source/Driller/StripChart.hxx | 220 -- .../Driller/Trace/TraceDrillerDialog.cpp | 487 ---- .../Driller/Trace/TraceDrillerDialog.hxx | 151 -- .../Driller/Trace/TraceDrillerDialog.ui | 124 -- .../Trace/TraceMessageDataAggregator.cpp | 220 -- .../Trace/TraceMessageDataAggregator.hxx | 85 - .../Driller/Trace/TraceMessageDataParser.cpp | 67 - .../Driller/Trace/TraceMessageDataParser.h | 39 - .../Source/Driller/Trace/TraceMessageEvents.h | 59 - .../Trace/TraceOperationTelemetryEvent.h | 26 - .../Unsupported/UnsupportedDataAggregator.cpp | 72 - .../Unsupported/UnsupportedDataAggregator.hxx | 63 - .../Unsupported/UnsupportedDataParser.cpp | 21 - .../Unsupported/UnsupportedDataParser.h | 41 - .../Driller/Unsupported/UnsupportedEvents.h | 31 - .../Source/Driller/Workspaces/Workspace.cpp | 114 - .../Source/Driller/Workspaces/Workspace.h | 74 - .../Standalone/Source/ProfilerApplication.cpp | 36 - .../Standalone/Source/ProfilerApplication.h | 26 - Code/Tools/Standalone/profiler_files.cmake | 190 -- .../SkinnedMesh/SkinnedMeshInputBuffers.cpp | 2 + .../RHI/Code/Include/Atom/RHI.Reflect/Base.h | 2 + Gems/Atom/RHI/Code/Include/Atom/RHI/Factory.h | 3 + .../Include/Atom/RHI/RHISystemInterface.h | 3 + .../RHI/Code/Source/RHI/AsyncWorkQueue.cpp | 4 +- .../Atom/RHI/Code/Source/RHI/CommandQueue.cpp | 4 +- Gems/Atom/RHI/Code/Source/RHI/Fence.cpp | 2 +- .../RHI/Code/Source/RHI/FrameScheduler.cpp | 24 +- .../Code/Source/RHI/PipelineStateCache.cpp | 2 +- Gems/Atom/RHI/Code/Source/RHI/RHISystem.cpp | 6 +- .../DX12/Code/Source/RHI/AsyncUploadQueue.cpp | 24 +- .../DX12/Code/Source/RHI/CommandListBase.cpp | 4 +- .../RHI/DX12/Code/Source/RHI/CommandQueue.cpp | 8 +- .../Code/Source/RHI/CommandQueueContext.cpp | 10 +- Gems/Atom/RHI/DX12/Code/Source/RHI/Fence.cpp | 2 +- .../Code/Source/RHI/StreamingImagePool.cpp | 2 +- .../Metal/Code/Source/RHI/CommandQueue.cpp | 2 +- .../Code/Source/RHI/CommandQueueContext.cpp | 4 +- .../Code/Source/RHI/AsyncUploadQueue.cpp | 16 +- .../Vulkan/Code/Source/RHI/CommandQueue.cpp | 2 +- .../Code/Source/RHI/CommandQueueContext.cpp | 6 +- .../RPI/Code/Include/Atom/RPI.Public/Base.h | 5 + .../RPI/Code/Include/Atom/RPI.Reflect/Base.h | 3 + .../RPI/Code/Source/RPI.Public/Culling.cpp | 14 +- .../Source/RPI.Public/Material/Material.cpp | 2 +- .../Code/Source/RPI.Public/MeshDrawPacket.cpp | 6 +- .../Code/Source/RPI.Public/Model/Model.cpp | 10 +- .../Code/Source/RPI.Public/Model/ModelLod.cpp | 4 +- .../Source/RPI.Public/Model/ModelLodUtils.cpp | 2 +- .../Source/RPI.Public/Pass/PassSystem.cpp | 8 +- .../Source/RPI.Public/Pass/RasterPass.cpp | 4 +- .../RPI/Code/Source/RPI.Public/RPISystem.cpp | 5 +- .../Code/Source/RPI.Public/RenderPipeline.cpp | 2 +- .../Atom/RPI/Code/Source/RPI.Public/Scene.cpp | 8 +- .../Shader/Metrics/ShaderMetricsSystem.cpp | 2 +- .../Code/Source/RPI.Public/Shader/Shader.cpp | 6 +- Gems/Atom/RPI/Code/Source/RPI.Public/View.cpp | 2 +- .../Source/RPI.Reflect/Model/ModelAsset.cpp | 2 +- .../Source/RPI.Reflect/Shader/ShaderAsset.cpp | 4 +- .../Shader/ShaderVariantTreeAsset.cpp | 2 +- .../Code/Source/Engine/AudioSystem.cpp | 1 + .../Code/Source/Engine/AudioSystem.h | 3 + .../Components/BlastFamilyComponent.cpp | 4 +- .../Components/BlastSystemComponent.cpp | 4 +- .../ExpressionEvaluationSystemComponent.cpp | 2 + Gems/LyShine/Code/Source/LyShine.cpp | 8 - Gems/NvCloth/Code/Include/NvCloth/ICloth.h | 3 + Gems/NvCloth/Code/Source/System/Cloth.cpp | 2 + Gems/PhysX/Code/Source/System/PhysXSystem.cpp | 2 + .../Source/ScriptEventsSystemComponent.cpp | 2 + .../Code/Source/ScriptEventsSystemComponent.h | 2 + 293 files changed, 459 insertions(+), 44183 deletions(-) create mode 100644 Code/Framework/AzCore/AzCore/Debug/Budget.cpp create mode 100644 Code/Framework/AzCore/AzCore/Debug/Budget.h create mode 100644 Code/Framework/AzCore/AzCore/Debug/BudgetsComponent.cpp create mode 100644 Code/Framework/AzCore/AzCore/Debug/BudgetsComponent.h delete mode 100644 Code/Framework/AzCore/AzCore/Debug/FrameProfiler.h delete mode 100644 Code/Framework/AzCore/AzCore/Debug/FrameProfilerBus.h delete mode 100644 Code/Framework/AzCore/AzCore/Debug/FrameProfilerComponent.cpp delete mode 100644 Code/Framework/AzCore/AzCore/Debug/FrameProfilerComponent.h delete mode 100644 Code/Framework/AzCore/AzCore/Debug/ProfilerDriller.cpp delete mode 100644 Code/Framework/AzCore/AzCore/Debug/ProfilerDriller.h delete mode 100644 Code/Framework/AzCore/AzCore/Debug/ProfilerDrillerBus.h delete mode 100644 Code/Framework/AzCore/Tests/TimeDataStatistics.cpp delete mode 100644 Code/Legacy/CryCommon/FrameProfiler.h delete mode 100644 Code/Tools/Standalone/Source/Driller/Annotations/AnnotationHeaderView.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/Annotations/AnnotationHeaderView.hxx delete mode 100644 Code/Tools/Standalone/Source/Driller/Annotations/AnnotationHeaderView.ui delete mode 100644 Code/Tools/Standalone/Source/Driller/Annotations/Annotations.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/Annotations/Annotations.hxx delete mode 100644 Code/Tools/Standalone/Source/Driller/Annotations/AnnotationsDataView.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/Annotations/AnnotationsDataView.hxx delete mode 100644 Code/Tools/Standalone/Source/Driller/Annotations/AnnotationsDataView_Events.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/Annotations/AnnotationsDataView_Events.hxx delete mode 100644 Code/Tools/Standalone/Source/Driller/Annotations/AnnotationsHeaderView_Events.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/Annotations/AnnotationsHeaderView_Events.hxx delete mode 100644 Code/Tools/Standalone/Source/Driller/Annotations/ConfigureAnnotationsDialog.ui delete mode 100644 Code/Tools/Standalone/Source/Driller/Annotations/ConfigureAnnotationsWindow.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/Annotations/ConfigureAnnotationsWindow.hxx delete mode 100644 Code/Tools/Standalone/Source/Driller/AreaChart.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/AreaChart.hxx delete mode 100644 Code/Tools/Standalone/Source/Driller/Axis.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/Axis.hxx delete mode 100644 Code/Tools/Standalone/Source/Driller/CSVExportSettings.h delete mode 100644 Code/Tools/Standalone/Source/Driller/Carrier/CarrierDataAggregator.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/Carrier/CarrierDataAggregator.hxx delete mode 100644 Code/Tools/Standalone/Source/Driller/Carrier/CarrierDataEvents.h delete mode 100644 Code/Tools/Standalone/Source/Driller/Carrier/CarrierDataParser.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/Carrier/CarrierDataParser.h delete mode 100644 Code/Tools/Standalone/Source/Driller/Carrier/CarrierDataView.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/Carrier/CarrierDataView.hxx delete mode 100644 Code/Tools/Standalone/Source/Driller/Carrier/CarrierDataView.ui delete mode 100644 Code/Tools/Standalone/Source/Driller/Carrier/CarrierOperationTelemetryEvent.h delete mode 100644 Code/Tools/Standalone/Source/Driller/ChannelConfigurationDialog.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/ChannelConfigurationDialog.hxx delete mode 100644 Code/Tools/Standalone/Source/Driller/ChannelConfigurationWidget.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/ChannelConfigurationWidget.hxx delete mode 100644 Code/Tools/Standalone/Source/Driller/ChannelControl.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/ChannelControl.hxx delete mode 100644 Code/Tools/Standalone/Source/Driller/ChannelControl.ui delete mode 100644 Code/Tools/Standalone/Source/Driller/ChannelDataView.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/ChannelDataView.hxx delete mode 100644 Code/Tools/Standalone/Source/Driller/ChannelProfilerWidget.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/ChannelProfilerWidget.hxx delete mode 100644 Code/Tools/Standalone/Source/Driller/ChannelProfilerWidget.ui delete mode 100644 Code/Tools/Standalone/Source/Driller/ChartNumberFormats.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/ChartNumberFormats.h delete mode 100644 Code/Tools/Standalone/Source/Driller/ChartTypes.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/ChartTypes.hxx delete mode 100644 Code/Tools/Standalone/Source/Driller/CollapsiblePanel.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/CollapsiblePanel.hxx delete mode 100644 Code/Tools/Standalone/Source/Driller/CollapsiblePanel.ui delete mode 100644 Code/Tools/Standalone/Source/Driller/CombinedEventsControl.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/CombinedEventsControl.hxx delete mode 100644 Code/Tools/Standalone/Source/Driller/CustomizeCSVExportWidget.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/CustomizeCSVExportWidget.hxx delete mode 100644 Code/Tools/Standalone/Source/Driller/DoubleListSelector.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/DoubleListSelector.hxx delete mode 100644 Code/Tools/Standalone/Source/Driller/DoubleListSelector.ui delete mode 100644 Code/Tools/Standalone/Source/Driller/DrillerAggregator.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/DrillerAggregator.hxx delete mode 100644 Code/Tools/Standalone/Source/Driller/DrillerAggregatorOptions.hxx delete mode 100644 Code/Tools/Standalone/Source/Driller/DrillerCaptureWindow.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/DrillerCaptureWindow.hxx delete mode 100644 Code/Tools/Standalone/Source/Driller/DrillerCaptureWindow.ui delete mode 100644 Code/Tools/Standalone/Source/Driller/DrillerContext.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/DrillerContext.h delete mode 100644 Code/Tools/Standalone/Source/Driller/DrillerContextInterface.h delete mode 100644 Code/Tools/Standalone/Source/Driller/DrillerDataContainer.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/DrillerDataContainer.h delete mode 100644 Code/Tools/Standalone/Source/Driller/DrillerDataTypes.h delete mode 100644 Code/Tools/Standalone/Source/Driller/DrillerEvent.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/DrillerEvent.h delete mode 100644 Code/Tools/Standalone/Source/Driller/DrillerMainChannelsView.ui delete mode 100644 Code/Tools/Standalone/Source/Driller/DrillerMainWindow.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/DrillerMainWindow.hxx delete mode 100644 Code/Tools/Standalone/Source/Driller/DrillerMainWindow.ui delete mode 100644 Code/Tools/Standalone/Source/Driller/DrillerMainWindowMessages.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/DrillerMainWindowMessages.h delete mode 100644 Code/Tools/Standalone/Source/Driller/DrillerNetworkMessages.h delete mode 100644 Code/Tools/Standalone/Source/Driller/DrillerOperationTelemetryEvent.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/DrillerOperationTelemetryEvent.h delete mode 100644 Code/Tools/Standalone/Source/Driller/EventTrace/EventTraceDataAggregator.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/EventTrace/EventTraceDataAggregator.h delete mode 100644 Code/Tools/Standalone/Source/Driller/EventTrace/EventTraceDataParser.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/EventTrace/EventTraceDataParser.h delete mode 100644 Code/Tools/Standalone/Source/Driller/EventTrace/EventTraceEvents.h delete mode 100644 Code/Tools/Standalone/Source/Driller/FilteredListView.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/FilteredListView.hxx delete mode 100644 Code/Tools/Standalone/Source/Driller/FilteredListView.ui delete mode 100644 Code/Tools/Standalone/Source/Driller/GenericCustomizeCSVExportWidget.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/GenericCustomizeCSVExportWidget.hxx delete mode 100644 Code/Tools/Standalone/Source/Driller/GenericCustomizeCSVExportWidget.ui delete mode 100644 Code/Tools/Standalone/Source/Driller/IO/StreamerDataAggregator.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/IO/StreamerDataParser.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/IO/StreamerDataView.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/IO/StreamerDrillerDialog.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/IO/StreamerEvents.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/Memory/MemoryDataAggregator.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/Memory/MemoryDataAggregator.hxx delete mode 100644 Code/Tools/Standalone/Source/Driller/Memory/MemoryDataParser.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/Memory/MemoryDataParser.h delete mode 100644 Code/Tools/Standalone/Source/Driller/Memory/MemoryDataView.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/Memory/MemoryDataView.hxx delete mode 100644 Code/Tools/Standalone/Source/Driller/Memory/MemoryDataView.ui delete mode 100644 Code/Tools/Standalone/Source/Driller/Memory/MemoryEvents.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/Memory/MemoryEvents.h delete mode 100644 Code/Tools/Standalone/Source/Driller/Profiler/ProfilerDataAggregator.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/Profiler/ProfilerDataAggregator.hxx delete mode 100644 Code/Tools/Standalone/Source/Driller/Profiler/ProfilerDataPanel.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/Profiler/ProfilerDataPanel.hxx delete mode 100644 Code/Tools/Standalone/Source/Driller/Profiler/ProfilerDataParser.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/Profiler/ProfilerDataParser.h delete mode 100644 Code/Tools/Standalone/Source/Driller/Profiler/ProfilerDataView.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/Profiler/ProfilerDataView.hxx delete mode 100644 Code/Tools/Standalone/Source/Driller/Profiler/ProfilerDataView.ui delete mode 100644 Code/Tools/Standalone/Source/Driller/Profiler/ProfilerEvents.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/Profiler/ProfilerEvents.h delete mode 100644 Code/Tools/Standalone/Source/Driller/Profiler/ProfilerOperationTelemetryEvent.h delete mode 100644 Code/Tools/Standalone/Source/Driller/RacetrackChart.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/RacetrackChart.hxx delete mode 100644 Code/Tools/Standalone/Source/Driller/Rendering/VRAM/VRAMDataAggregator.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/Rendering/VRAM/VRAMDataAggregator.hxx delete mode 100644 Code/Tools/Standalone/Source/Driller/Rendering/VRAM/VRAMDataParser.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/Rendering/VRAM/VRAMDataParser.h delete mode 100644 Code/Tools/Standalone/Source/Driller/Rendering/VRAM/VRAMEvents.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/Rendering/VRAM/VRAMEvents.h delete mode 100644 Code/Tools/Standalone/Source/Driller/Replica/BaseDetailView.h delete mode 100644 Code/Tools/Standalone/Source/Driller/Replica/BaseDetailView.inl delete mode 100644 Code/Tools/Standalone/Source/Driller/Replica/BaseDetailViewQObject.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/Replica/BaseDetailViewQObject.hxx delete mode 100644 Code/Tools/Standalone/Source/Driller/Replica/BaseDetailViewSavedState.h delete mode 100644 Code/Tools/Standalone/Source/Driller/Replica/OverallReplicaDetailView.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/Replica/OverallReplicaDetailView.hxx delete mode 100644 Code/Tools/Standalone/Source/Driller/Replica/ReplicaBandwidthChartData.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/Replica/ReplicaBandwidthChartData.h delete mode 100644 Code/Tools/Standalone/Source/Driller/Replica/ReplicaChunkTypeDetailView.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/Replica/ReplicaChunkTypeDetailView.h delete mode 100644 Code/Tools/Standalone/Source/Driller/Replica/ReplicaChunkUsageDataContainers.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/Replica/ReplicaChunkUsageDataContainers.h delete mode 100644 Code/Tools/Standalone/Source/Driller/Replica/ReplicaDataAggregator.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/Replica/ReplicaDataAggregator.hxx delete mode 100644 Code/Tools/Standalone/Source/Driller/Replica/ReplicaDataAggregatorConfigurationPanel.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/Replica/ReplicaDataAggregatorConfigurationPanel.hxx delete mode 100644 Code/Tools/Standalone/Source/Driller/Replica/ReplicaDataAggregatorConfigurationPanel.ui delete mode 100644 Code/Tools/Standalone/Source/Driller/Replica/ReplicaDataEvents.h delete mode 100644 Code/Tools/Standalone/Source/Driller/Replica/ReplicaDataParser.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/Replica/ReplicaDataParser.h delete mode 100644 Code/Tools/Standalone/Source/Driller/Replica/ReplicaDataView.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/Replica/ReplicaDataView.hxx delete mode 100644 Code/Tools/Standalone/Source/Driller/Replica/ReplicaDataViewConfigDialog.ui delete mode 100644 Code/Tools/Standalone/Source/Driller/Replica/ReplicaDetailView.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/Replica/ReplicaDetailView.h delete mode 100644 Code/Tools/Standalone/Source/Driller/Replica/ReplicaDisplayHelpers.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/Replica/ReplicaDisplayHelpers.h delete mode 100644 Code/Tools/Standalone/Source/Driller/Replica/ReplicaDisplayTypes.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/Replica/ReplicaDisplayTypes.h delete mode 100644 Code/Tools/Standalone/Source/Driller/Replica/ReplicaDrillerConfigToolbar.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/Replica/ReplicaDrillerConfigToolbar.hxx delete mode 100644 Code/Tools/Standalone/Source/Driller/Replica/ReplicaDrillerConfigToolbar.ui delete mode 100644 Code/Tools/Standalone/Source/Driller/Replica/ReplicaOperationTelemetryEvent.h delete mode 100644 Code/Tools/Standalone/Source/Driller/Replica/ReplicaTreeViewModel.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/Replica/ReplicaTreeViewModel.hxx delete mode 100644 Code/Tools/Standalone/Source/Driller/Replica/ReplicaUsageDataContainers.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/Replica/ReplicaUsageDataContainers.h delete mode 100644 Code/Tools/Standalone/Source/Driller/Replica/basedetailview.ui delete mode 100644 Code/Tools/Standalone/Source/Driller/Replica/overallreplicadetailview.ui delete mode 100644 Code/Tools/Standalone/Source/Driller/Replica/replicadataview.ui delete mode 100644 Code/Tools/Standalone/Source/Driller/StripChart.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/StripChart.hxx delete mode 100644 Code/Tools/Standalone/Source/Driller/Trace/TraceDrillerDialog.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/Trace/TraceDrillerDialog.hxx delete mode 100644 Code/Tools/Standalone/Source/Driller/Trace/TraceDrillerDialog.ui delete mode 100644 Code/Tools/Standalone/Source/Driller/Trace/TraceMessageDataAggregator.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/Trace/TraceMessageDataAggregator.hxx delete mode 100644 Code/Tools/Standalone/Source/Driller/Trace/TraceMessageDataParser.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/Trace/TraceMessageDataParser.h delete mode 100644 Code/Tools/Standalone/Source/Driller/Trace/TraceMessageEvents.h delete mode 100644 Code/Tools/Standalone/Source/Driller/Trace/TraceOperationTelemetryEvent.h delete mode 100644 Code/Tools/Standalone/Source/Driller/Unsupported/UnsupportedDataAggregator.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/Unsupported/UnsupportedDataAggregator.hxx delete mode 100644 Code/Tools/Standalone/Source/Driller/Unsupported/UnsupportedDataParser.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/Unsupported/UnsupportedDataParser.h delete mode 100644 Code/Tools/Standalone/Source/Driller/Unsupported/UnsupportedEvents.h delete mode 100644 Code/Tools/Standalone/Source/Driller/Workspaces/Workspace.cpp delete mode 100644 Code/Tools/Standalone/Source/Driller/Workspaces/Workspace.h delete mode 100644 Code/Tools/Standalone/Source/ProfilerApplication.cpp delete mode 100644 Code/Tools/Standalone/Source/ProfilerApplication.h delete mode 100644 Code/Tools/Standalone/profiler_files.cmake diff --git a/Code/Editor/CryEditDoc.cpp b/Code/Editor/CryEditDoc.cpp index e5988918f5..647732a895 100644 --- a/Code/Editor/CryEditDoc.cpp +++ b/Code/Editor/CryEditDoc.cpp @@ -1047,7 +1047,7 @@ static bool TryRenameFile(const QString& oldPath, const QString& newPath, int re bool CCryEditDoc::SaveLevel(const QString& filename) { - AZ_PROFILE_FUNCTION(AzToolsFramework); + AZ_PROFILE_FUNCTION(Editor); QWaitCursor wait; CAutoCheckOutDialogEnableForAll enableForAll; @@ -1067,7 +1067,7 @@ bool CCryEditDoc::SaveLevel(const QString& filename) { - AZ_PROFILE_SCOPE(AzToolsFramework, "CCryEditDoc::SaveLevel BackupBeforeSave"); + AZ_PROFILE_SCOPE(Editor, "CCryEditDoc::SaveLevel BackupBeforeSave"); BackupBeforeSave(); } @@ -1178,7 +1178,7 @@ bool CCryEditDoc::SaveLevel(const QString& filename) CPakFile pakFile; { - AZ_PROFILE_SCOPE(AzToolsFramework, "CCryEditDoc::SaveLevel Open PakFile"); + AZ_PROFILE_SCOPE(Editor, "CCryEditDoc::SaveLevel Open PakFile"); if (!pakFile.Open(tempSaveFile.toUtf8().data(), false)) { gEnv->pLog->LogWarning("Unable to open pack file %s for writing", tempSaveFile.toUtf8().data()); @@ -1209,7 +1209,7 @@ bool CCryEditDoc::SaveLevel(const QString& filename) AZ::IO::ByteContainerStream> entitySaveStream(&entitySaveBuffer); { - AZ_PROFILE_SCOPE(AzToolsFramework, "CCryEditDoc::SaveLevel Save Entities To Stream"); + AZ_PROFILE_SCOPE(Editor, "CCryEditDoc::SaveLevel Save Entities To Stream"); EBUS_EVENT_RESULT( savedEntities, AzToolsFramework::EditorEntityContextRequestBus, SaveToStreamForEditor, entitySaveStream, layerEntities, instancesInLayers); diff --git a/Code/Editor/EditorDefs.h b/Code/Editor/EditorDefs.h index 423f4c5f73..4115e8433a 100644 --- a/Code/Editor/EditorDefs.h +++ b/Code/Editor/EditorDefs.h @@ -8,8 +8,6 @@ #pragma once -#ifndef CRYINCLUDE_EDITOR_EDITORDEFS_H -#define CRYINCLUDE_EDITOR_EDITORDEFS_H #include @@ -186,5 +184,3 @@ #endif #endif - -#endif // CRYINCLUDE_EDITOR_EDITORDEFS_H diff --git a/Code/Editor/EditorViewportWidget.cpp b/Code/Editor/EditorViewportWidget.cpp index ec965cc51f..81e3abf550 100644 --- a/Code/Editor/EditorViewportWidget.cpp +++ b/Code/Editor/EditorViewportWidget.cpp @@ -394,8 +394,6 @@ void EditorViewportWidget::UpdateContent(int flags) ////////////////////////////////////////////////////////////////////////// void EditorViewportWidget::Update() { - FUNCTION_PROFILER(GetIEditor()->GetSystem(), PROFILE_EDITOR); - if (Editor::EditorQtApplication::instance()->isMovingOrResizing()) { return; @@ -957,15 +955,11 @@ AzFramework::CameraState EditorViewportWidget::GetCameraState() AZ::Vector3 EditorViewportWidget::PickTerrain(const AzFramework::ScreenPoint& point) { - FUNCTION_PROFILER(GetIEditor()->GetSystem(), PROFILE_EDITOR); - return LYVec3ToAZVec3(ViewToWorld(AzToolsFramework::ViewportInteraction::QPointFromScreenPoint(point), nullptr, true)); } AZ::EntityId EditorViewportWidget::PickEntity(const AzFramework::ScreenPoint& point) { - FUNCTION_PROFILER(GetIEditor()->GetSystem(), PROFILE_EDITOR); - PreWidgetRendering(); AZ::EntityId entityId; @@ -992,8 +986,6 @@ float EditorViewportWidget::TerrainHeight(const AZ::Vector2& position) void EditorViewportWidget::FindVisibleEntities(AZStd::vector& visibleEntitiesOut) { - FUNCTION_PROFILER(GetIEditor()->GetSystem(), PROFILE_EDITOR); - visibleEntitiesOut.assign(m_entityVisibilityQuery.Begin(), m_entityVisibilityQuery.End()); } diff --git a/Code/Editor/IEditor.h b/Code/Editor/IEditor.h index 7d0fc653fa..de7b0ec3f9 100644 --- a/Code/Editor/IEditor.h +++ b/Code/Editor/IEditor.h @@ -6,9 +6,6 @@ * */ - -#ifndef CRYINCLUDE_EDITOR_IEDITOR_H -#define CRYINCLUDE_EDITOR_IEDITOR_H #pragma once #ifdef PLUGIN_EXPORTS @@ -25,6 +22,7 @@ #include #include +#include class QMenu; @@ -738,4 +736,5 @@ struct IInitializeUIInfo virtual void SetInfoText(const char* text) = 0; }; -#endif // CRYINCLUDE_EDITOR_IEDITOR_H +AZ_DECLARE_BUDGET(Editor); + diff --git a/Code/Editor/IEditorImpl.cpp b/Code/Editor/IEditorImpl.cpp index 1e268d64ef..8f4abae9dd 100644 --- a/Code/Editor/IEditorImpl.cpp +++ b/Code/Editor/IEditorImpl.cpp @@ -405,8 +405,6 @@ void CEditorImpl::Update() // Make sure this is not called recursively m_bUpdates = false; - FUNCTION_PROFILER(GetSystem(), PROFILE_EDITOR); - //@FIXME: Restore this latter. //if (GetGameEngine() && GetGameEngine()->IsLevelLoaded()) { diff --git a/Code/Editor/Objects/BaseObject.cpp b/Code/Editor/Objects/BaseObject.cpp index c89bd50559..c653830e70 100644 --- a/Code/Editor/Objects/BaseObject.cpp +++ b/Code/Editor/Objects/BaseObject.cpp @@ -38,7 +38,6 @@ // To use the Andrew's algorithm in order to make convex hull from the points, this header is needed. #include "Util/GeometryUtil.h" - namespace { QColor kLinkColorParent = QColor(0, 255, 255); QColor kLinkColorChild = QColor(0, 0, 255); @@ -1928,7 +1927,7 @@ bool CBaseObject::HitTestRectBounds(HitContext& hc, const AABB& box) ////////////////////////////////////////////////////////////////////////// bool CBaseObject::HitTestRect(HitContext& hc) { - AZ_PROFILE_FUNCTION(Entity); + AZ_PROFILE_FUNCTION(Editor); AABB box; @@ -1965,7 +1964,7 @@ bool CBaseObject::HitHelperTest(HitContext& hc) ////////////////////////////////////////////////////////////////////////// bool CBaseObject::HitHelperAtTest(HitContext& hc, const Vec3& pos) { - AZ_PROFILE_FUNCTION(Entity); + AZ_PROFILE_FUNCTION(Editor); bool bResult = false; diff --git a/Code/Editor/Objects/DisplayContextShared.inl b/Code/Editor/Objects/DisplayContextShared.inl index 5af04d821e..90c6ba09b0 100644 --- a/Code/Editor/Objects/DisplayContextShared.inl +++ b/Code/Editor/Objects/DisplayContextShared.inl @@ -1261,10 +1261,6 @@ void DisplayContext::DrawTextureLabel(const Vec3& pos, int nWidth, int nHeight, ////////////////////////////////////////////////////////////////////////// void DisplayContext::Flush2D() { -#ifndef PHYSICS_EDITOR - FUNCTION_PROFILER(GetIEditor()->GetSystem(), PROFILE_EDITOR); -#endif - if (m_textureLabels.empty()) { return; diff --git a/Code/Editor/Objects/EntityObject.cpp b/Code/Editor/Objects/EntityObject.cpp index 68264f9ea4..6e2354998c 100644 --- a/Code/Editor/Objects/EntityObject.cpp +++ b/Code/Editor/Objects/EntityObject.cpp @@ -497,7 +497,7 @@ bool CEntityObject::HitTestRect(HitContext& hc) ////////////////////////////////////////////////////////////////////////// int CEntityObject::MouseCreateCallback(CViewport* view, EMouseEvent event, QPoint& point, int flags) { - AZ_PROFILE_FUNCTION(Editor); + AZ_PROFILE_FUNCTION(Entity); if (event == eMouseMove || event == eMouseLDown) { diff --git a/Code/Editor/Objects/GizmoManager.cpp b/Code/Editor/Objects/GizmoManager.cpp index e0fdd69c8e..1704fd9322 100644 --- a/Code/Editor/Objects/GizmoManager.cpp +++ b/Code/Editor/Objects/GizmoManager.cpp @@ -18,8 +18,6 @@ ////////////////////////////////////////////////////////////////////////// void CGizmoManager::Display(DisplayContext& dc) { - FUNCTION_PROFILER(GetIEditor()->GetSystem(), PROFILE_EDITOR); - AABB bbox; std::vector todelete; for (Gizmos::iterator it = m_gizmos.begin(); it != m_gizmos.end(); ++it) diff --git a/Code/Editor/Objects/ObjectManager.cpp b/Code/Editor/Objects/ObjectManager.cpp index 940ef5b551..aec5835565 100644 --- a/Code/Editor/Objects/ObjectManager.cpp +++ b/Code/Editor/Objects/ObjectManager.cpp @@ -37,7 +37,6 @@ AZ_CVAR( bool, ed_visibility_use, true, nullptr, AZ::ConsoleFunctorFlags::Null, "Enable/disable using the new IVisibilitySystem for Entity visibility determination"); - /*! * Class Description used for object templates. * This description filled from Xml template files. diff --git a/Code/Editor/Objects/ObjectManagerLegacyUndo.cpp b/Code/Editor/Objects/ObjectManagerLegacyUndo.cpp index 08a7f4cf48..10f3a25b6d 100644 --- a/Code/Editor/Objects/ObjectManagerLegacyUndo.cpp +++ b/Code/Editor/Objects/ObjectManagerLegacyUndo.cpp @@ -19,7 +19,6 @@ #include "Objects/ObjectLoader.h" #include "Objects/SelectionGroup.h" - ////////////////////////////////////////////////////////////////////////// // CUndoBaseObjectNew implementation. ////////////////////////////////////////////////////////////////////////// diff --git a/Code/Editor/TopRendererWnd.cpp b/Code/Editor/TopRendererWnd.cpp index 7bbefdd63f..541e967dd0 100644 --- a/Code/Editor/TopRendererWnd.cpp +++ b/Code/Editor/TopRendererWnd.cpp @@ -148,8 +148,6 @@ void QTopRendererWnd::UpdateContent(int flags) ////////////////////////////////////////////////////////////////////////// void QTopRendererWnd::Draw([[maybe_unused]] DisplayContext& dc) { - FUNCTION_PROFILER(GetIEditor()->GetSystem(), PROFILE_EDITOR); - //////////////////////////////////////////////////////////////////////// // Perform the rendering for this window //////////////////////////////////////////////////////////////////////// diff --git a/Code/Editor/Util/GeometryUtil.cpp b/Code/Editor/Util/GeometryUtil.cpp index d4442e8d03..6025f0c771 100644 --- a/Code/Editor/Util/GeometryUtil.cpp +++ b/Code/Editor/Util/GeometryUtil.cpp @@ -41,7 +41,6 @@ struct SPointSorter //=================================================================== void ConvexHull2DGraham(std::vector& ptsOut, const std::vector& ptsIn) { - FUNCTION_PROFILER(gEnv->pSystem, PROFILE_AI); const unsigned nPtsIn = ptsIn.size(); if (nPtsIn < 3) { @@ -66,7 +65,6 @@ void ConvexHull2DGraham(std::vector& ptsOut, const std::vector& ptsI std::swap(ptsSorted[0], ptsSorted[iBotRight]); { - FRAME_PROFILER("SORT Graham", gEnv->pSystem, PROFILE_AI) std::sort(ptsSorted.begin() + 1, ptsSorted.end(), SPointSorter(ptsSorted[0])); } ptsSorted.erase(std::unique(ptsSorted.begin(), ptsSorted.end(), ptEqual), ptsSorted.end()); @@ -196,7 +194,6 @@ inline bool PointSorterAndrew(const Vec3& lhs, const Vec3& rhs) //=================================================================== SANDBOX_API void ConvexHull2DAndrew(std::vector& ptsOut, const std::vector& ptsIn) { - FUNCTION_PROFILER(gEnv->pSystem, PROFILE_AI); const int n = (int)ptsIn.size(); if (n < 3) { @@ -206,7 +203,6 @@ SANDBOX_API void ConvexHull2DAndrew(std::vector& ptsOut, const std::vector std::vector P = ptsIn; { - FRAME_PROFILER("SORT Andrew", gEnv->pSystem, PROFILE_AI) std::sort(P.begin(), P.end(), PointSorterAndrew); } diff --git a/Code/Editor/Viewport.cpp b/Code/Editor/Viewport.cpp index 3c34f464b8..0ddad5c31e 100644 --- a/Code/Editor/Viewport.cpp +++ b/Code/Editor/Viewport.cpp @@ -400,7 +400,6 @@ void QtViewport::UpdateContent(int flags) ////////////////////////////////////////////////////////////////////////// void QtViewport::Update() { - FUNCTION_PROFILER(GetIEditor()->GetSystem(), PROFILE_EDITOR); m_viewportUi.Update(); m_bAdvancedSelectMode = false; @@ -1436,9 +1435,6 @@ bool QtViewport::MouseCallback(EMouseEvent event, const QPoint& point, Qt::Keybo ////////////////////////////////////////////////////////////////////////// void QtViewport::ProcessRenderLisneters(DisplayContext& rstDisplayContext) { - FUNCTION_PROFILER(GetIEditor()->GetSystem(), PROFILE_EDITOR); - - size_t nCount(0); size_t nTotal(0); diff --git a/Code/Framework/AzCore/AzCore/AzCoreModule.cpp b/Code/Framework/AzCore/AzCore/AzCoreModule.cpp index d2b1b141a9..db89598b6e 100644 --- a/Code/Framework/AzCore/AzCore/AzCoreModule.cpp +++ b/Code/Framework/AzCore/AzCore/AzCoreModule.cpp @@ -10,7 +10,7 @@ // Component includes #include -#include +#include #include #include #include @@ -36,7 +36,7 @@ namespace AZ JsonSystemComponent::CreateDescriptor(), AssetManagerComponent::CreateDescriptor(), UserSettingsComponent::CreateDescriptor(), - Debug::FrameProfilerComponent::CreateDescriptor(), + Debug::BudgetsComponent::CreateDescriptor(), SliceComponent::CreateDescriptor(), SliceSystemComponent::CreateDescriptor(), SliceMetadataInfoComponent::CreateDescriptor(), @@ -54,6 +54,7 @@ namespace AZ { return AZ::ComponentTypeList { + azrtti_typeid(), azrtti_typeid(), azrtti_typeid(), azrtti_typeid(), diff --git a/Code/Framework/AzCore/AzCore/Component/ComponentApplication.cpp b/Code/Framework/AzCore/AzCore/Component/ComponentApplication.cpp index 5114ea19ec..5c59ebc6ae 100644 --- a/Code/Framework/AzCore/AzCore/Component/ComponentApplication.cpp +++ b/Code/Framework/AzCore/AzCore/Component/ComponentApplication.cpp @@ -51,7 +51,6 @@ #include #include #include -#include #include #include #include @@ -918,8 +917,6 @@ namespace AZ { m_drillerManager->Register(aznew Debug::MemoryDriller); } - // Profiler driller will consume resources only when started. - m_drillerManager->Register(aznew Debug::ProfilerDriller); // Trace messages driller will consume resources only when started. m_drillerManager->Register(aznew Debug::TraceMessagesDriller); m_drillerManager->Register(aznew Debug::EventTraceDriller); diff --git a/Code/Framework/AzCore/AzCore/Component/Entity.h b/Code/Framework/AzCore/AzCore/Component/Entity.h index becb0b085a..7ec63a56ac 100644 --- a/Code/Framework/AzCore/AzCore/Component/Entity.h +++ b/Code/Framework/AzCore/AzCore/Component/Entity.h @@ -16,6 +16,7 @@ #pragma once #include +#include #include #include #include @@ -438,3 +439,4 @@ namespace AZ return component; } } // namespace AZ + diff --git a/Code/Framework/AzCore/AzCore/Debug/Budget.cpp b/Code/Framework/AzCore/AzCore/Debug/Budget.cpp new file mode 100644 index 0000000000..1337ca5a31 --- /dev/null +++ b/Code/Framework/AzCore/AzCore/Debug/Budget.cpp @@ -0,0 +1,45 @@ +/* + * Copyright (c) Contributors to the Open 3D Engine Project. + * For complete copyright and license terms please see the LICENSE at the root of this distribution. + * + * SPDX-License-Identifier: Apache-2.0 OR MIT + * + */ + +#include "Budget.h" + +#include +#include + +AZ_DEFINE_BUDGET(AzCore); +AZ_DEFINE_BUDGET(Editor); +AZ_DEFINE_BUDGET(Entity); +AZ_DEFINE_BUDGET(Game); +AZ_DEFINE_BUDGET(System); +AZ_DEFINE_BUDGET(Audio); +AZ_DEFINE_BUDGET(Animation); + +namespace AZ::Debug +{ + // Global container for all registered budgets + class BudgetRegistry + { + public: + static BudgetRegistry& Instance() + { + } + + private: + }; + + void Budget::ResetAll() + { + } + + Budget::Budget(const char* name) + : m_name{ name } + , m_crc{ Crc32(name) } + { + // TODO: Register budget with singleton budget registry + } +} // namespace AZ::Debug diff --git a/Code/Framework/AzCore/AzCore/Debug/Budget.h b/Code/Framework/AzCore/AzCore/Debug/Budget.h new file mode 100644 index 0000000000..89b3fa10b3 --- /dev/null +++ b/Code/Framework/AzCore/AzCore/Debug/Budget.h @@ -0,0 +1,114 @@ +/* + * Copyright (c) Contributors to the Open 3D Engine Project. + * For complete copyright and license terms please see the LICENSE at the root of this distribution. + * + * SPDX-License-Identifier: Apache-2.0 OR MIT + * + */ +#pragma once + +#include +#include +#include + +#pragma warning(push) +// This warning must be disabled because Budget::Get may not have an implementation if this file is transitively included +// in a source file that doesn't actually have any budgets declared in scope (via AZ_DEFINE_BUDGET or AZ_DECLARE_BUDGET). +// In this situation, the warning about internal linkage without an implementation is benign because we know that this function +// cannot be invoked from that translation unit. +#pragma warning(disable: 5046) + +namespace AZ::Debug +{ + // A budget collates per-frame resource utilization and memory for a particular category + class Budget final + { + public: + // Invoked once at the start of the frame to reset per-frame counters + static void ResetAll(); + + // If you encounter a linker error complaining that this function is not defined, you have likely forgotten to either + // define or declare the budget used in a profile or memory marker. See AZ_DEFINE_BUDGET and AZ_DECLARE_BUDGET below + // for usage. + template + static Budget* Get(); + + explicit Budget(const char* name); + + const char* Name() const + { + return m_name; + } + + uint32_t Crc() const + { + return m_crc; + } + + private: + const char* m_name; + uint32_t m_crc; + }; +} // namespace AZ::Debug +#pragma warning(pop) + +#define AZ_BUDGET_NAME(name) AzBudget##name + +// Usage example: +// In a single C++ source file: +// AZ_DEFINE_BUDGET(AzCore); +// +// Anywhere the budget is used, the budget must be declared (either in a header or in the source file itself) +// AZ_DECLARE_BUDGET(AzCore); +// +// The budget is usable in the same file it was defined without needing an additional declaration + +// Implementation notes: +// Every budget definition is declared in static storage along with the environment variable and mutex. This imposes a slight +// memory overhead in the data segment only in instances where the same static module defining a budget is linked against multiple +// DLLs, however, this simplifies the implementation and works regardless of whether the budget is defined in a static or dynamic +// library. When loading the budget, a relaxed load is sufficient because Environment::CreateVariable internally locks and returns +// the element found if the environment variable was already created (skipping construction in the process). Thus, the budget pointer +// will reference the statically stored budget for the first thread that grabs the lock. +#define AZ_DEFINE_BUDGET(name) \ + template<> \ + ::AZ::Debug::Budget* ::AZ::Debug::Budget::Get() \ + { \ + static ::AZStd::mutex s_azBudgetMutex##name; \ + static ::AZ::EnvironmentVariable<::AZ::Debug::Budget*> s_azBudgetEnv##name; \ + static ::AZ::Debug::Budget s_azBudget##name{ #name }; \ + static ::AZStd::atomic<::AZ::Debug::Budget*> budget; \ + ::AZ::Debug::Budget* out = budget.load(AZStd::memory_order_relaxed); \ + if (out) \ + { \ + return out; \ + } \ + else \ + { \ + { \ + AZStd::scoped_lock lock{ s_azBudgetMutex##name }; \ + if (!s_azBudgetEnv##name) \ + { \ + s_azBudgetEnv##name = ::AZ::Environment::CreateVariable<::AZ::Debug::Budget*>("budgetEnv" #name, &s_azBudget##name); \ + } \ + } \ + out = *s_azBudgetEnv##name; \ + budget = out; \ + return out; \ + } \ + } + +// If using a budget defined in a different C++ source file, add AZ_DECLARE_BUDGET(yourBudget); somewhere in your source file at namespace +// scope Alternatively, AZ_DECLARE_BUDGET can be used in a header to declare the budget for use across any users of the header +#define AZ_DECLARE_BUDGET(name) extern template ::AZ::Debug::Budget* ::AZ::Debug::Budget::Get() + +// Declare budgets that are core engine budgets, or may be shared/needed across multiple external gems +// You should NOT need to declare user-space or budgets with isolated usage here. Prefer declaring them local to the module(s) that use +// the budget and defining them within a single module to avoid needing to recompile the entire engine. +AZ_DECLARE_BUDGET(AzCore); +AZ_DECLARE_BUDGET(Editor); +AZ_DECLARE_BUDGET(Entity); +AZ_DECLARE_BUDGET(Game); +AZ_DECLARE_BUDGET(System); +AZ_DECLARE_BUDGET(Physics); +AZ_DECLARE_BUDGET(Animation); diff --git a/Code/Framework/AzCore/AzCore/Debug/BudgetsComponent.cpp b/Code/Framework/AzCore/AzCore/Debug/BudgetsComponent.cpp new file mode 100644 index 0000000000..d61694b6ff --- /dev/null +++ b/Code/Framework/AzCore/AzCore/Debug/BudgetsComponent.cpp @@ -0,0 +1,29 @@ +#include + +namespace AZ::Debug +{ + void BudgetsComponent::Reflect(AZ::ReflectContext*) + { + } + + BudgetsComponent::BudgetsComponent() + { + } + + BudgetsComponent::~BudgetsComponent() + { + } + + void BudgetsComponent::Init() + { + } + + void BudgetsComponent::Activate() + { + } + + void BudgetsComponent::Deactivate() + { + } + +} // namespace AZ::Debug diff --git a/Code/Framework/AzCore/AzCore/Debug/BudgetsComponent.h b/Code/Framework/AzCore/AzCore/Debug/BudgetsComponent.h new file mode 100644 index 0000000000..31790cb642 --- /dev/null +++ b/Code/Framework/AzCore/AzCore/Debug/BudgetsComponent.h @@ -0,0 +1,31 @@ +/* + * Copyright (c) Contributors to the Open 3D Engine Project. + * For complete copyright and license terms please see the LICENSE at the root of this distribution. + * + * SPDX-License-Identifier: Apache-2.0 OR MIT + * + */ + +#pragma once + +#include + +namespace AZ::Debug +{ + class BudgetsComponent : public Component + { + public: + AZ_COMPONENT(AZ::Debug::BudgetsComponent, "{52063706-5B36-4B24-A781-B49AFDBB5BC5}"); + + static void Reflect(AZ::ReflectContext* context); + + BudgetsComponent(); + ~BudgetsComponent() override; + + void Init() override; + void Activate() override; + void Deactivate() override; + + private: + }; +} // namespace AZ::Debug diff --git a/Code/Framework/AzCore/AzCore/Debug/FrameProfiler.h b/Code/Framework/AzCore/AzCore/Debug/FrameProfiler.h deleted file mode 100644 index 2b86168b82..0000000000 --- a/Code/Framework/AzCore/AzCore/Debug/FrameProfiler.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ -#ifndef AZCORE_FRAME_PROFILER_H -#define AZCORE_FRAME_PROFILER_H - -#include -#include -#include -#include -#include - -namespace AZ -{ - namespace Debug - { - namespace FrameProfiler - { - /** - * This structure is used for frame data history, make sure it's memory efficient. - */ - struct FrameData - { - unsigned int m_frameId; ///< Id of the frame this data belongs to. - union - { - ProfilerRegister::TimeData m_timeData; - ProfilerRegister::ValuesData m_userValues; - }; - }; - - struct RegisterData - { - ////////////////////////////////////////////////////////////////////////// - // Profile register snapshot - /// data that doesn't change - const char* m_name; ///< Name of the profiler register. - const char* m_function; ///< Function name in the code. - int m_line; ///< Line number if the code. - AZ::u32 m_systemId; ///< Register system id. - ProfilerRegister::Type m_type; - RegisterData* m_lastParent; ///< Pointer to the last parent register data. - AZStd::ring_buffer m_frames; ///< History of all frame deltas (basically the data you want to display) - }; - - struct ThreadData - { - typedef AZStd::unordered_map RegistersMap; - AZStd::thread_id m_id; ///< Thread id (same as AZStd::thread::id) - RegistersMap m_registers; ///< Map with all the registers (with history) - }; - - typedef AZStd::fixed_vector ThreadDataArray; ///< Array with samplers for all threads - } // namespace FrameProfiler - } // namespace Debug -} // namespace AZ - -#endif // AZCORE_FRAME_PROFILER_H -#pragma once diff --git a/Code/Framework/AzCore/AzCore/Debug/FrameProfilerBus.h b/Code/Framework/AzCore/AzCore/Debug/FrameProfilerBus.h deleted file mode 100644 index 93fd8be8bb..0000000000 --- a/Code/Framework/AzCore/AzCore/Debug/FrameProfilerBus.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ -#ifndef AZCORE_FRAME_PROFILER_BUS_H -#define AZCORE_FRAME_PROFILER_BUS_H - -#include -#include - -namespace AZ -{ - namespace Debug - { - class FrameProfilerComponent; - - /** - * Interface class for frame profiler events. - */ - class FrameProfilerEvents - : public AZ::EBusTraits - { - public: - virtual ~FrameProfilerEvents() {} - - /// Called when the frame profiler has computed a new frame (even is there is no new data). - virtual void OnFrameProfilerData(const FrameProfiler::ThreadDataArray& data) = 0; - }; - - typedef AZ::EBus FrameProfilerBus; - } // namespace Debug -} // namespace AZ - -#endif // AZCORE_FRAME_PROFILER_BUS_H -#pragma once diff --git a/Code/Framework/AzCore/AzCore/Debug/FrameProfilerComponent.cpp b/Code/Framework/AzCore/AzCore/Debug/FrameProfilerComponent.cpp deleted file mode 100644 index 1bd825b7af..0000000000 --- a/Code/Framework/AzCore/AzCore/Debug/FrameProfilerComponent.cpp +++ /dev/null @@ -1,250 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include -#include - -#include -#include - -#include - -namespace AZ -{ - namespace Debug - { - //========================================================================= - // FrameProfilerComponent - // [12/5/2012] - //========================================================================= - FrameProfilerComponent::FrameProfilerComponent() - : m_numFramesStored(2) - , m_frameId(0) - , m_pauseOnFrame(0) - , m_currentThreadData(NULL) - { - } - - //========================================================================= - // ~FrameProfilerComponent - // [12/5/2012] - //========================================================================= - FrameProfilerComponent::~FrameProfilerComponent() - { - } - - //========================================================================= - // Activate - // [12/5/2012] - //========================================================================= - void FrameProfilerComponent::Activate() - { - if (!Profiler::IsReady()) - { - Profiler::Create(); - } - - Profiler::AddReference(); - - TickBus::Handler::BusConnect(); - AZ_Assert(m_numFramesStored >= 1, "We must have at least one frame to store, otherwise this component is useless!"); - } - - //========================================================================= - // Deactivate - // [12/5/2012] - //========================================================================= - void FrameProfilerComponent::Deactivate() - { - TickBus::Handler::BusDisconnect(); - - Profiler::ReleaseReference(); - } - - //========================================================================= - // OnTick - // [12/5/2012] - //========================================================================= - void FrameProfilerComponent::OnTick(float deltaTime, ScriptTimePoint time) - { - (void)deltaTime; - (void)time; - ++m_frameId; - AZ_Error("Profiler", m_frameId != m_pauseOnFrame, "Triggered user pause/error on this frame! Check FrameProfilerComponent pauseOnFrame value!"); - - if (!Profiler::IsReady()) - { - return; // we can't sample registers without profiler - } - // collect data from the profiler - m_currentThreadData = NULL; - Profiler::Instance().ReadRegisterValues(AZStd::bind(&FrameProfilerComponent::ReadProfilerRegisters, this, AZStd::placeholders::_1, AZStd::placeholders::_2)); - - // process all the resulting data here, not while reading the registers - for (size_t iThread = 0; iThread < m_threads.size(); ++iThread) - { - FrameProfiler::ThreadData& td = m_threads[iThread]; - FrameProfiler::ThreadData::RegistersMap::iterator it = td.m_registers.begin(); - FrameProfiler::ThreadData::RegistersMap::iterator last = td.m_registers.end(); - for (; it != last; ++it) - { - // fix up parents - FrameProfiler::RegisterData& rd = it->second; - if (rd.m_type == ProfilerRegister::PRT_TIME) - { - const FrameProfiler::FrameData& fd = rd.m_frames.back(); - if (fd.m_timeData.m_lastParent != nullptr) - { - FrameProfiler::ThreadData::RegistersMap::iterator parentIt = td.m_registers.find(fd.m_timeData.m_lastParent); - AZ_Assert(parentIt != td.m_registers.end(), "We have a parent register that is not in our register map. This should not happen!"); - rd.m_lastParent = &parentIt->second; - } - else - { - rd.m_lastParent = NULL; - } - } - } - } - - // send an even to whomever cares - EBUS_EVENT(FrameProfilerBus, OnFrameProfilerData, m_threads); - } - - int FrameProfilerComponent::GetTickOrder() - { - // Even it's not critical we should tick last to capture the current frame - // so TICK_LAST (since it's not the last int +1 is a valid assumption) - return TICK_LAST + 1; - } - - //========================================================================= - // ReadRegisterCallback - // [12/5/2012] - //========================================================================= - bool FrameProfilerComponent::ReadProfilerRegisters(const ProfilerRegister& reg, const AZStd::thread_id& id) - { - if (m_currentThreadData == NULL || m_currentThreadData->m_id != id) - { - m_currentThreadData = NULL; - - // find the thread and cache it, as we will received registers thread by thread... so we don't search. - for (size_t i = 0; i < m_threads.size(); ++i) - { - FrameProfiler::ThreadData* td = &m_threads[i]; - if (td->m_id == id) - { - m_currentThreadData = td; - break; - } - } - - if (m_currentThreadData == NULL) - { - m_threads.push_back(); - m_currentThreadData = &m_threads.back(); - m_currentThreadData->m_id = id; - } - } - - const ProfilerRegister* profReg = ® - FrameProfiler::ThreadData::RegistersMap::pair_iter_bool pairIterBool = m_currentThreadData->m_registers.insert_key(profReg); - FrameProfiler::RegisterData& regData = pairIterBool.first->second; - - // now update dynamic data with as little as possible computation (we must be fast) - FrameProfiler::FrameData fd; // we can actually move this computation (FrameData and push) for later but we will need to use more memory - fd.m_frameId = m_frameId; - - if (pairIterBool.second) - { - // when insert copy the static data only once - regData.m_name = profReg->m_name; - regData.m_function = profReg->m_function; - regData.m_line = profReg->m_line; - regData.m_systemId = profReg->m_systemId; - regData.m_frames.set_capacity(m_numFramesStored); - regData.m_type = static_cast(profReg->m_type); - } - - switch (regData.m_type) - { - case ProfilerRegister::PRT_TIME: - { - fd.m_timeData.m_time = profReg->m_timeData.m_time; - fd.m_timeData.m_childrenTime = profReg->m_timeData.m_childrenTime; - fd.m_timeData.m_calls = profReg->m_timeData.m_calls; - fd.m_timeData.m_childrenCalls = profReg->m_timeData.m_childrenCalls; - fd.m_timeData.m_lastParent = profReg->m_timeData.m_lastParent; - } break; - case ProfilerRegister::PRT_VALUE: - { - fd.m_userValues.m_value1 = profReg->m_userValues.m_value1; - fd.m_userValues.m_value2 = profReg->m_userValues.m_value2; - fd.m_userValues.m_value3 = profReg->m_userValues.m_value3; - fd.m_userValues.m_value4 = profReg->m_userValues.m_value4; - fd.m_userValues.m_value5 = profReg->m_userValues.m_value5; - } break; - } - - regData.m_frames.push_back(fd); - return true; - } - - //========================================================================= - // GetProvidedServices - //========================================================================= - void FrameProfilerComponent::GetProvidedServices(ComponentDescriptor::DependencyArrayType& provided) - { - provided.push_back(AZ_CRC("FrameProfilerService", 0x05d1bb90)); - } - - //========================================================================= - // GetIncompatibleServices - //========================================================================= - void FrameProfilerComponent::GetIncompatibleServices(ComponentDescriptor::DependencyArrayType& incompatible) - { - incompatible.push_back(AZ_CRC("FrameProfilerService", 0x05d1bb90)); - } - - //========================================================================= - // GetDependentServices - //========================================================================= - void FrameProfilerComponent::GetDependentServices(ComponentDescriptor::DependencyArrayType& dependent) - { - dependent.push_back(AZ_CRC("MemoryService", 0x5c4d473c)); - } - - //========================================================================= - // Reflect - //========================================================================= - void FrameProfilerComponent::Reflect(ReflectContext* context) - { - if (SerializeContext* serializeContext = azrtti_cast(context)) - { - serializeContext->Class() - ->Version(1) - ->Field("numFramesStored", &FrameProfilerComponent::m_numFramesStored) - ->Field("pauseOnFrame", &FrameProfilerComponent::m_pauseOnFrame) - ; - - if (EditContext* editContext = serializeContext->GetEditContext()) - { - editContext->Class( - "Frame Profiler", "Performs per frame profiling (FPS counter, registers, etc.)") - ->ClassElement(AZ::Edit::ClassElements::EditorData, "") - ->Attribute(AZ::Edit::Attributes::Category, "Profiling") - ->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("System", 0xc94d118b)) - ->DataElement(AZ::Edit::UIHandlers::SpinBox, &FrameProfilerComponent::m_numFramesStored, "Number of Frames", "How many frames we will keep with the RUNTIME buffers.") - ->Attribute(AZ::Edit::Attributes::Min, 1) - ->DataElement(AZ::Edit::UIHandlers::SpinBox, &FrameProfilerComponent::m_pauseOnFrame, "Pause on frame", "Paused the engine (debug break) on a specific frame. 0 means no pause!") - ; - } - } - } - } // namespace Debug -} // namespace AZ diff --git a/Code/Framework/AzCore/AzCore/Debug/FrameProfilerComponent.h b/Code/Framework/AzCore/AzCore/Debug/FrameProfilerComponent.h deleted file mode 100644 index a92202ed7d..0000000000 --- a/Code/Framework/AzCore/AzCore/Debug/FrameProfilerComponent.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ -#ifndef AZCORE_FRAME_PROFILER_COMPONENT_H -#define AZCORE_FRAME_PROFILER_COMPONENT_H - -#include -#include -#include -#include -#include - -namespace AZ -{ - namespace Debug - { - /** - * Frame profiler component provides a frame profiling information - * (from FPS counter to profiler registers manipulation and so on). - * It's a debug system so it should not be active in release - */ - class FrameProfilerComponent - : public Component - , public AZ::TickBus::Handler - { - public: - AZ_COMPONENT(AZ::Debug::FrameProfilerComponent, "{B81739EF-ED77-4F67-9D05-6ADF94F0431A}") - - FrameProfilerComponent(); - virtual ~FrameProfilerComponent(); - - private: - ////////////////////////////////////////////////////////////////////////// - // Component base - void Activate() override; - void Deactivate() override; - ////////////////////////////////////////////////////////////////////////// - - ////////////////////////////////////////////////////////////////////////// - // Tick bus - void OnTick(float deltaTime, ScriptTimePoint time) override; - int GetTickOrder() override; - ////////////////////////////////////////////////////////////////////////// - - /// \ref ComponentDescriptor::GetProvidedServices - static void GetProvidedServices(ComponentDescriptor::DependencyArrayType& provided); - /// \ref ComponentDescriptor::GetIncompatibleServices - static void GetIncompatibleServices(ComponentDescriptor::DependencyArrayType& incompatible); - /// \ref ComponentDescriptor::GetDependentServices - static void GetDependentServices(ComponentDescriptor::DependencyArrayType& dependent); - /// \red ComponentDescriptor::Reflect - static void Reflect(ReflectContext* reflection); - - /// callback for reading profiler registers - bool ReadProfilerRegisters(const ProfilerRegister& reg, const AZStd::thread_id& id); - - // Keep in mind memory usage, increases quickly. Prefer remote tools (where the history is kept on the PC) instead of keeping long history - unsigned int m_numFramesStored; ///< Number of frames that we will store in history buffers. >= 1 - unsigned int m_frameId; ///< Frame id (it's just counted from the start). - - unsigned int m_pauseOnFrame; ///< Allows you to specify a frame the code will pause onto. - - - FrameProfiler::ThreadDataArray m_threads; ///< Array with samplers for all threads - FrameProfiler::ThreadData* m_currentThreadData; ///< Cached pointer to the last accessed thread data. - }; - } -} - -#endif // AZCORE_FRAME_PROFILER_COMPONENT_H -#pragma once diff --git a/Code/Framework/AzCore/AzCore/Debug/Profiler.cpp b/Code/Framework/AzCore/AzCore/Debug/Profiler.cpp index 649bb0b8d7..eb9158ad56 100644 --- a/Code/Framework/AzCore/AzCore/Debug/Profiler.cpp +++ b/Code/Framework/AzCore/AzCore/Debug/Profiler.cpp @@ -7,664 +7,14 @@ */ #include -#include -#include -#include -#include -#include -#include -#include -#include #include -namespace AZ +namespace AZ::Debug { uint32_t ProfileScope::GetSystemID(const char* system) { // TODO: stable ids for registered budgets return AZ::Crc32(system); } - - namespace Debug - { - ////////////////////////////////////////////////////////////////////////// - // Globals - AZStd::chrono::microseconds ProfilerRegister::TimeData::s_startStopOverheadPer1000Calls(0); - Profiler* Profiler::s_instance = nullptr; - u64 Profiler::s_id = 0; - int Profiler::s_useCount = 0; - ////////////////////////////////////////////////////////////////////////// - - /** - * Profile data stored per thread. - */ - struct ProfilerThreadData - { - static const int m_maxStackSize = 32; - typedef AZStd::list ProfilerRegisterList; - typedef AZStd::fixed_vector ProfilerSectionStack; - - AZStd::thread::id m_id; ///< Thread id. - ProfilerRegisterList m_registers; ///< Thread profiler registers (for this thread). - mutable AZStd::shared_spin_mutex m_registersLock; ///< Lock for accessing thread profiler entries. Sadly the only reason for this to exists is so we can read safe the register counters. - ProfilerSectionStack m_stack; ///< Current active sections stack. - }; - - struct ProfilerSystemData - { - AZ::u32 m_id; - const char* m_name; - bool m_isActive; - }; - - /** - * Profiler class data (hidden in from the header file) - */ - struct ProfilerData - { - AZ_CLASS_ALLOCATOR(ProfilerData, OSAllocator, 0); - - AZStd::fixed_vector m_threads; ///< Array with thread with all belonging information. - AZStd::shared_spin_mutex m_threadDataMutex; ///< Spin read/write lock (shared_mutex) for access to the m_threads. - AZStd::fixed_vector m_systems; ///< Array with systems (profiler/timer groups) that you can enable/disable. - }; - - //========================================================================= - // Profiler - // [12/3/2012] - //========================================================================= - Profiler::Profiler(const Descriptor& desc) - { - (void)desc; - m_data = aznew ProfilerData; - - // we can periodically call this function (like the end of every frame to refresh the current estimation). - ProfilerRegister::TimerComputeStartStopOverhead(); - - // use a timestamp as and id. - s_id = AZStd::GetTimeUTCMilliSecond(); - } - - //========================================================================= - // ~Profiler - // [12/3/2012] - //========================================================================= - Profiler::~Profiler() - { - AZ_Assert(s_useCount == 0, "You deleted the profiler while it's still in use."); - s_id = 0; - delete m_data; - } - - //========================================================================= - // Create - // [12/3/2012] - //========================================================================= - bool Profiler::Create(const Descriptor& desc) - { - AZ_Assert(s_instance == nullptr, "Profiler is already created!"); - if (s_instance != nullptr) - { - return false; - } - s_instance = azcreate(Profiler, (desc), AZ::OSAllocator, "Profiler", 0); - return true; - } - - //========================================================================= - // Destroy - // [12/3/2012] - //========================================================================= - void Profiler::Destroy() - { - AZ_Assert(s_instance != nullptr, "Profiler not created"); - if (s_instance) - { - azdestroy(s_instance, AZ::OSAllocator); - s_instance = nullptr; - } - } - - //========================================================================= - // AddReference - // [5/24/2013] - //========================================================================= - void Profiler::AddReference() - { - ++s_useCount; - } - - //========================================================================= - // - // [5/24/2013] - //========================================================================= - void Profiler::ReleaseReference() - { - AZ_Assert(s_useCount > 0, "Use count is already 0, you can't release it!"); - --s_useCount; - if (s_useCount == 0) - { - Destroy(); - } - } - - //========================================================================= - // RegisterSystem - // [12/3/2012] - //========================================================================= - bool Profiler::RegisterSystem(AZ::u32 systemId, const char* name, bool isActive) - { - for (size_t i = 0; i < m_data->m_systems.size(); ++i) - { - if (m_data->m_systems[i].m_id == systemId) - { - return false; - } - } - ProfilerSystemData sd; - sd.m_id = systemId; - sd.m_isActive = isActive; - sd.m_name = name; - m_data->m_systems.push_back(sd); - return true; - } - - //========================================================================= - // UnregisterSystem - // [12/3/2012] - //========================================================================= - bool Profiler::UnregisterSystem(AZ::u32 systemId) - { - size_t i = 0; - for (; i < m_data->m_systems.size(); ++i) - { - ProfilerSystemData& sd = m_data->m_systems[i]; - if (sd.m_id == systemId) - { - if (sd.m_isActive) - { - DeactivateSystem(sd.m_name); - } - // Make sure we triggest driller message when the m_threadDataMutex is NOT locked - // as we lock them in reverse order when we update the profile driller. - AZ_Assert(false, "Currently this code is unused. If we do use it, we should make call EBUS even outside of this function. Where m_threadDataMutex is NOT locked!"); - //EBUS_DBG_EVENT(ProfilerDrillerBus,OnUnregisterSystem,systemId); - break; - } - } - if (i < m_data->m_systems.size()) - { - m_data->m_systems.erase(m_data->m_systems.begin() + i); - return true; - } - return false; - } - - //========================================================================= - // ActivateSystem - // [12/3/2012] - //========================================================================= - bool Profiler::SetSystemState(AZ::u32 systemId, bool isActive) - { - for (size_t i = 0; i < m_data->m_systems.size(); ++i) - { - ProfilerSystemData& sd = m_data->m_systems[i]; - if (sd.m_id == systemId) - { - if (sd.m_isActive != isActive) - { - sd.m_isActive = isActive; - size_t numThreads = m_data->m_threads.size(); - for (size_t j = 0; j < numThreads; ++j) - { - ProfilerThreadData& data = m_data->m_threads[j]; - ProfilerThreadData::ProfilerRegisterList::iterator it = data.m_registers.begin(); - ProfilerThreadData::ProfilerRegisterList::iterator end = data.m_registers.end(); - for (; it != end; ++it) - { - ProfilerRegister& reg = *it; - // This is a big question since this is the only writer - // and the timers are readers and value should be read atomically (1 byte) - // we should be safe without a synchronization here (as data should be written as we exit) - // at worst we can put a volatile in front of the bool. Either way this should not cause - // crashes or anything - if (reg.m_systemId == systemId) - { - reg.m_isActive = isActive ? 1 : 0; - } - } - } - } - return true; - } - } - return false; - } - - //========================================================================= - // ActivateSystem - // [5/24/2013] - //========================================================================= - void Profiler::ActivateSystem(const char* systemName) - { - AZ::u32 systemId = AZ::Crc32(systemName); - bool isNewSystem = false; - { - AZStd::unique_lock writeLock(m_data->m_threadDataMutex); - if (!SetSystemState(systemId, true)) - { - // if the system is new add it - RegisterSystem(systemId, systemName, true); - isNewSystem = true; - } - } - if (isNewSystem) - { - // Make sure we triggest driller message when the m_threadDataMutex is NOT locked - // as we lock them in reverse order when we update the profile driller. - EBUS_DBG_EVENT(ProfilerDrillerBus, OnRegisterSystem, systemId, systemName); - } - } - - //========================================================================= - // DeactivateSystem - // [5/24/2013] - //========================================================================= - void Profiler::DeactivateSystem(const char* systemName) - { - AZ::u32 systemId = AZ::Crc32(systemName); - bool isNewSystem = false; - { - AZStd::unique_lock writeLock(m_data->m_threadDataMutex); - if (!SetSystemState(systemId, false)) - { - // if the system is new add it - RegisterSystem(systemId, systemName, false); - isNewSystem = true; - } - } - if (isNewSystem) - { - // Make sure we triggest driller message when the m_threadDataMutex is NOT locked - // as we lock them in reverse order when we update the profile driller. - EBUS_DBG_EVENT(ProfilerDrillerBus, OnRegisterSystem, systemId, systemName); - } - } - - - //========================================================================= - // IsSystemActive - // [5/24/2013] - //========================================================================= - bool Profiler::IsSystemActive(const char* systemName) const - { - return IsSystemActive(AZ::Crc32(systemName)); - } - - //========================================================================= - // IsSystemActive - // [12/3/2012] - //========================================================================= - bool Profiler::IsSystemActive(AZ::u32 systemId) const - { - for (size_t i = 0; i < m_data->m_systems.size(); ++i) - { - if (m_data->m_systems[i].m_id == systemId) - { - return m_data->m_systems[i].m_isActive != 0; - } - } - return false; - } - - //========================================================================= - // GetNumberOfSystems - // [12/3/2012] - //========================================================================= - int Profiler::GetNumberOfSystems() const - { - return static_cast(m_data->m_systems.size()); - } - - //========================================================================= - // GetSystemName - // [12/3/2012] - //========================================================================= - const char* Profiler::GetSystemName(int index) const - { - return m_data->m_systems[index].m_name; - } - - //========================================================================= - // GetSystemName - // [12/3/2012] - //========================================================================= - const char* Profiler::GetSystemName(AZ::u32 systemId) const - { - for (size_t i = 0; i < m_data->m_systems.size(); ++i) - { - if (m_data->m_systems[i].m_id == systemId) - { - return m_data->m_systems[i].m_name; - } - } - return NULL; - } - - //========================================================================= - // RemoveThreadData - // [12/3/2012] - //========================================================================= - void Profiler::RemoveThreadData(AZStd::thread_id id) - { - // this is very tricky we must be sure that thread is no longer operational - // otherwise we will crash badly. We can do only because nobody should - // reference this registers but the thread local data. - AZStd::unique_lock writeLock(m_data->m_threadDataMutex); - size_t numThreads = m_data->m_threads.size(); - ProfilerThreadData* threadData = NULL; - for (size_t i = 0; i < numThreads; ++i) - { - ProfilerThreadData& data = m_data->m_threads[i]; - if (data.m_id == id) - { - threadData = &data; - break; - } - } - - if (threadData) - { - // delete all registers, we can remove the thread data too, but we will need to switch the structure to list - // so far this is super minimal overhead, registers are more. - threadData->m_registers.clear(); - } - } - - //========================================================================= - // ReadRegisterValues - // [12/3/2012] - //========================================================================= - void Profiler::ReadRegisterValues(const ReadProfileRegisterCB& callback, AZ::u32 systemFilter, const AZStd::thread_id* threadFilter) const - { - AZStd::shared_lock readLock(s_instance->m_data->m_threadDataMutex); - size_t numThreads = Profiler::s_instance->m_data->m_threads.size(); - for (size_t i = 0; i < numThreads; ++i) - { - const ProfilerThreadData& data = s_instance->m_data->m_threads[i]; - if (threadFilter && *threadFilter != data.m_id) - { - continue; - } - { - AZStd::shared_lock registersLock(data.m_registersLock); - ProfilerThreadData::ProfilerRegisterList::const_iterator it = data.m_registers.begin(); - ProfilerThreadData::ProfilerRegisterList::const_iterator end = data.m_registers.end(); - for (; it != end; ++it) - { - const ProfilerRegister& reg = *it; - if (!reg.m_isActive || (systemFilter != 0 && systemFilter != reg.m_systemId)) - { - continue; - } - if (!callback(reg, data.m_id)) - { - return; - } - } - } - } - } - - //========================================================================= - // ResetRegisters - // [12/4/2012] - //========================================================================= - void Profiler::ResetRegisters() - { - AZStd::unique_lock writeLock(s_instance->m_data->m_threadDataMutex); - size_t numThreads = Profiler::s_instance->m_data->m_threads.size(); - for (size_t i = 0; i < numThreads; ++i) - { - ProfilerThreadData& data = s_instance->m_data->m_threads[i]; - { - AZStd::unique_lock registersLock(data.m_registersLock); - ProfilerThreadData::ProfilerRegisterList::iterator it = data.m_registers.begin(); - ProfilerThreadData::ProfilerRegisterList::iterator end = data.m_registers.end(); - for (; it != end; ++it) - { - ProfilerRegister& reg = *it; - reg.Reset(); - } - } - } - - // Reset registers event - } - - //========================================================================= - // CreateRegister - // [6/28/2013] - //========================================================================= - ProfilerRegister* - ProfilerRegister::CreateRegister(const char* systemName, const char* name, const char* function, int line, ProfilerRegister::Type type) - { - static AZ_THREAD_LOCAL ProfilerThreadData* threadData = nullptr; - static AZ_THREAD_LOCAL u64 profilerId = 0; - if (profilerId != Profiler::s_id) - { - threadData = nullptr; // profiler has changed - profilerId = Profiler::s_id; - } - AZ::u32 systemId = AZ::Crc32(systemName); - ProfilerRegister* reg; - { - AZStd::unique_lock writeLock(Profiler::s_instance->m_data->m_threadDataMutex); - - // make sure we have the system registered. This function will just return false if the system exists. - if (systemName) - { - Profiler::s_instance->RegisterSystem(systemId, systemName, true); - } - - if (threadData == nullptr) // if this is a new thread add the data - { - AZStd::thread::id threadId = AZStd::this_thread::get_id(); - Profiler::s_instance->m_data->m_threads.push_back(); - threadData = &Profiler::s_instance->m_data->m_threads.back(); - threadData->m_id = threadId; - } - threadData->m_registers.push_back(); - reg = &threadData->m_registers.back(); - reg->m_name = name; - reg->m_function = function; - reg->m_line = line; - reg->m_systemId = systemId; - reg->m_isActive = Profiler::s_instance->IsSystemActive(systemId) ? 1 : 0; - reg->m_type = type; - reg->m_threadData = threadData; - - reg->Reset(); - } - // Make sure we triggest driller message when the m_threadDataMutex is NOT locked - // as we lock them in reverse order when we update the profile driller. - EBUS_DBG_EVENT(ProfilerDrillerBus, OnNewRegister, *reg, threadData->m_id); - - return reg; - } - - //========================================================================= - // TimerCreateAndStart - // [11/30/2012] - //========================================================================= - ProfilerRegister* - ProfilerRegister::TimerCreateAndStart(const char* systemName, const char* name, ProfilerSection * section, const char* function, int line) - { - AZStd::chrono::system_clock::time_point start = AZStd::chrono::system_clock::now(); - ProfilerRegister* reg = CreateRegister(systemName, name, function, line, ProfilerRegister::PRT_TIME); - AZStd::chrono::system_clock::time_point end = AZStd::chrono::system_clock::now(); - - // adjust the parent timer with the overhead we incur during timer operations. (TODO with TLS this is so fast that we might not need to do it) - if (!reg->m_threadData->m_stack.empty()) // if we are not he last element - { - AZStd::chrono::microseconds elapsed = end - start; - reg->m_threadData->m_stack.back()->m_childTime += elapsed; // no need to check if we go in the future as this will happen on Stop - } - - if (reg->m_isActive) - { - section->m_register = reg; - section->m_start = end; - reg->m_threadData->m_stack.push_back(section); - } - else - { - section->m_register = nullptr; - } - - return reg; - } - - //========================================================================= - // ValueCreate - // [6/28/2013] - //========================================================================= - ProfilerRegister* - ProfilerRegister::ValueCreate(const char* systemName, const char* name, const char* function, int line) - { - return CreateRegister(systemName, name, function, line, ProfilerRegister::PRT_VALUE); - } - - //========================================================================= - // TimerStart - // [11/29/2012] - //========================================================================= - void ProfilerRegister::TimerStart(ProfilerSection* section) - { - ProfilerRegister* reg = this; - - if (reg->m_isActive) - { - section->m_register = reg; - reg->m_threadData->m_stack.push_back(section); - section->m_start = AZStd::chrono::system_clock::now(); - } - else - { - section->m_register = nullptr; - } - } - - //========================================================================= - // TimerStop - // [11/29/2012] - //========================================================================= - void ProfilerRegister::TimerStop() - { - AZStd::chrono::system_clock::time_point end = AZStd::chrono::system_clock::now(); - ProfilerSection* section = m_threadData->m_stack.back(); - AZStd::chrono::microseconds elapsedTime = end - section->m_start; - { - m_threadData->m_registersLock.lock(); // lock for write - ++m_timeData.m_calls; - m_timeData.m_time += elapsedTime.count(); - m_timeData.m_childrenTime += section->m_childTime.count(); - m_timeData.m_childrenCalls += section->m_childCalls; - m_threadData->m_registersLock.unlock(); // unlock - } - m_threadData->m_stack.pop_back(); - - // adjust the parent timer with the overhead we incur during timer operations. - if (!m_threadData->m_stack.empty()) - { - ProfilerSection* parent = m_threadData->m_stack.back(); - m_timeData.m_lastParent = parent->m_register; - parent->m_childTime += elapsedTime /*+ s_startStopOverhead*/; // add the overhead since most of it is in Stop() - ++parent->m_childCalls; - } - } - - //========================================================================= - // Reset - // [12/4/2012] - //========================================================================= - void ProfilerRegister::Reset() - { - switch (m_type) - { - case PRT_TIME: - { - m_timeData.m_time = 0; - m_timeData.m_childrenTime = 0; - m_timeData.m_calls = 0; - m_timeData.m_childrenCalls = 0; - m_timeData.m_lastParent = nullptr; - } break; - case PRT_VALUE: - { - m_userValues.m_value1 = 0; - m_userValues.m_value2 = 0; - m_userValues.m_value3 = 0; - m_userValues.m_value4 = 0; - m_userValues.m_value5 = 0; - } break; - } - } - - //========================================================================= - // ComputeStartStopOverhead - // [12/3/2012] - //========================================================================= - void ProfilerRegister::TimerComputeStartStopOverhead() - { - // compute default thread start stop overhead - ProfilerThreadData sampleThreadData; - sampleThreadData.m_id = AZStd::this_thread::get_id(); - sampleThreadData.m_registers.push_back(); - ProfilerRegister& sampleRegister = sampleThreadData.m_registers.back(); - sampleRegister.m_isActive = true; - sampleRegister.m_name = nullptr; - sampleRegister.m_systemId = 0; - sampleRegister.m_threadData = &sampleThreadData; - - const int numSamples = 1000; - for (int iRepetition = 0; iRepetition < 1000; ++iRepetition) // just for test - { - ProfilerSection section; - sampleRegister.TimerStart(§ion); - AZStd::chrono::system_clock::time_point start = AZStd::chrono::system_clock::now(); - for (int i = 0; i < numSamples; ++i) - { - static AZ::Debug::ProfilerRegister* sampleRegisterPtr = &sampleRegister; // the creation is timed differently - ProfilerSection subSection; - if (sampleRegisterPtr != NULL) - { - sampleRegister.TimerStart(&subSection); - } - } - AZStd::chrono::microseconds elapsed = (AZStd::chrono::system_clock::now() - start); - if (TimeData::s_startStopOverheadPer1000Calls.count() == 0) // if first time set otherwise smooth average - { - TimeData::s_startStopOverheadPer1000Calls = elapsed; - } - else - { - float fNew = static_cast(elapsed.count()); - float fCurrent = static_cast(TimeData::s_startStopOverheadPer1000Calls.count()); - int deltaValue = static_cast((fNew - fCurrent) * 0.1f); - if (deltaValue < 0) - { - TimeData::s_startStopOverheadPer1000Calls -= AZStd::chrono::microseconds(-deltaValue); - } - else - { - TimeData::s_startStopOverheadPer1000Calls += AZStd::chrono::microseconds(deltaValue); - } - } - } - //AZ_TracePrintf("Profiler","Overhead %d microseconds per 1000 profile calls!\n",TimeData::s_startStopOverheadPer1000Calls.count()); - } - - } -} // namespace AZ +} // namespace AZ::Debug diff --git a/Code/Framework/AzCore/AzCore/Debug/Profiler.h b/Code/Framework/AzCore/AzCore/Debug/Profiler.h index f173bb8e17..3d88fb784c 100644 --- a/Code/Framework/AzCore/AzCore/Debug/Profiler.h +++ b/Code/Framework/AzCore/AzCore/Debug/Profiler.h @@ -7,42 +7,50 @@ */ #pragma once -#include -#include +#include #ifdef USE_PIX #include #include #endif -#if defined(AZ_PROFILER_MACRO_DISABLE) // by default we never disable the profiler registers as their overhead should be minimal, you can still do that for your code though. -# define AZ_PROFILE_SCOPE(...) -# define AZ_PROFILE_FUNCTION(...) -# define AZ_PROFILE_BEGIN(...) -# define AZ_PROFILE_END(...) +#if defined(AZ_PROFILER_MACRO_DISABLE) // by default we never disable the profiler registers as their overhead should be minimal, you can + // still do that for your code though. +#define AZ_PROFILE_SCOPE(...) +#define AZ_PROFILE_FUNCTION(...) +#define AZ_PROFILE_BEGIN(...) +#define AZ_PROFILE_END(...) #else + /** * Macro to declare a profile section for the current scope { }. * format is: AZ_PROFILE_SCOPE(categoryName, const char* formatStr, ...) */ -# define AZ_PROFILE_SCOPE(category, ...) ::AZ::ProfileScope AZ_JOIN(azProfileScope, __LINE__){ #category, __VA_ARGS__ } -# define AZ_PROFILE_FUNCTION(category) AZ_PROFILE_SCOPE(category, AZ_FUNCTION_SIGNATURE) +#define AZ_PROFILE_SCOPE(budget, ...) \ + ::AZ::Debug::ProfileScope AZ_JOIN(azProfileScope, __LINE__) \ + { \ + *::AZ::Debug::Budget::Get(), __VA_ARGS__ \ + } + +#define AZ_PROFILE_FUNCTION(category) AZ_PROFILE_SCOPE(category, AZ_FUNCTION_SIGNATURE) // Prefer using the scoped macros which automatically end the event (AZ_PROFILE_SCOPE/AZ_PROFILE_FUNCTION) -# define AZ_PROFILE_BEGIN(category, ...) ::AZ::ProfileScope::BeginRegion(#category, __VA_ARGS__) -# define AZ_PROFILE_END() ::AZ::ProfileScope::EndRegion() +#define AZ_PROFILE_BEGIN(budget, ...) \ + ::AZ::Debug::ProfileScope::BeginRegion(*::AZ::Debug::Budget::Get(), __VA_ARGS__) +#define AZ_PROFILE_END() ::AZ::Debug::ProfileScope::EndRegion() + #endif // AZ_PROFILER_MACRO_DISABLE #ifndef AZ_PROFILE_INTERVAL_START -# define AZ_PROFILE_INTERVAL_START(...) -# define AZ_PROFILE_INTERVAL_START_COLORED(...) -# define AZ_PROFILE_INTERVAL_END(...) -# define AZ_PROFILE_INTERVAL_SCOPED(...) +#define AZ_PROFILE_INTERVAL_START(...) +#define AZ_PROFILE_INTERVAL_START_COLORED(...) +#define AZ_PROFILE_INTERVAL_END(...) +#define AZ_PROFILE_INTERVAL_SCOPED(...) #endif #ifndef AZ_PROFILE_DATAPOINT -# define AZ_PROFILE_DATAPOINT(...) -# define AZ_PROFILE_DATAPOINT_PERCENT(...) +#define AZ_PROFILE_DATAPOINT(...) +#define AZ_PROFILE_DATAPOINT_PERCENT(...) #endif namespace AZStd @@ -50,7 +58,7 @@ namespace AZStd struct thread_id; // forward declare. This is the same type as AZStd::thread::id } -namespace AZ +namespace AZ::Debug { class ProfileScope { @@ -58,28 +66,33 @@ namespace AZ static uint32_t GetSystemID(const char* system); template - static void BeginRegion([[maybe_unused]] const char* system, [[maybe_unused]] const char* eventName, [[maybe_unused]] T const&... args) + static void BeginRegion( + [[maybe_unused]] const Budget& budget, [[maybe_unused]] const char* eventName, [[maybe_unused]] T const&... args) { +#if !defined(_RELEASE) // TODO: Verification that the supplied system name corresponds to a known budget #if defined(USE_PIX) - PIXBeginEvent(PIX_COLOR_INDEX(GetSystemID(system) & 0xff), eventName, args...); + PIXBeginEvent(PIX_COLOR_INDEX(budget.Crc() & 0xff), eventName, args...); +#endif +// TODO: injecting instrumentation for other profilers +// NOTE: external profiler registration won't occur inline in a header necessarily in this manner, but the exact mechanism +// will be introduced in a future PR #endif - // TODO: injecting instrumentation for other profilers - // NOTE: external profiler registration won't occur inline in a header necessarily in this manner, but the exact mechanism - // will be introduced in a future PR } static void EndRegion() { +#if !defined(_RELEASE) #if defined(USE_PIX) PIXEndEvent(); +#endif #endif } template - ProfileScope(const char* system, char const* eventName, T const&... args) + ProfileScope(const Budget& budget, char const* eventName, T const&... args) { - BeginRegion(system, eventName, args...); + BeginRegion(budget, eventName, args...); } ~ProfileScope() @@ -87,303 +100,7 @@ namespace AZ EndRegion(); } }; - - namespace Debug - { - class ProfilerSection; - class ProfilerRegister; - struct ProfilerThreadData; - struct ProfilerData; - - /** - * - */ - class Profiler - { - friend class ProfilerRegister; - friend struct ProfilerData; - public: - /// Max number of threads supported by the profiler. - static const int m_maxNumberOfThreads = 32; - /// Max number of systems supported by the profiler. (We can switch this container if needed) - static const int m_maxNumberOfSystems = 64; - - ~Profiler(); - - struct Descriptor - { - }; - - static bool Create(const Descriptor& desc = Descriptor()); - static void Destroy(); - static bool IsReady() { return s_instance != NULL; } - static Profiler& Instance() { return *s_instance; } - static u64 GetId() { return s_id; } - - /// Increment the use count. - static void AddReference(); - /// Release the use count if 0 a Destroy will be called automatically. - static void ReleaseReference(); - - void ActivateSystem(const char* systemName); - void DeactivateSystem(const char* systemName); - bool IsSystemActive(const char* systemName) const; - bool IsSystemActive(AZ::u32 systemId) const; - int GetNumberOfSystems() const; - const char* GetSystemName(int index) const; - const char* GetSystemName(AZ::u32 systemId) const; - - /** Callback to read a single register. Make sure you read the data as fast as possible. Don't compute inside the callback - * it will lock and hold all the registers that we process. The best is just to read the value and push it into a - * history buffer. - */ - typedef AZStd::function ReadProfileRegisterCB; - /** - * Read register values, make sure the code here is fast and efficient as we are holding a lock. - * provide a callback that will be called for each register. - * You can choose to filter your values by thread or a system. Use this filter only to narrow you samples. Don't - * use it for multiple calls to sort your counters, use the history data. - * It addition keep in mind that you can run this function is parallel, as we only read the values. - */ - void ReadRegisterValues(const ReadProfileRegisterCB& callback, AZ::u32 systemFilter = 0, const AZStd::thread_id* threadFilter = NULL) const; - /** - * This is slow operation that will cause contention try to avoid using it. A better way will be each frame instead of reset to read and store - * register values (this is good for history too) and make the difference that way. - */ - void ResetRegisters(); - - /// You can remove thread data ONLY IF YOU ARE SURE THIS THREAD IS NO LONGER ACTIVE! This will work only is specific cases. - void RemoveThreadData(AZStd::thread_id id); - - private: - /// Register a new system in the profiler. Make sure the proper locks are LOCKED when calling this function (m_threadDataMutex) - bool RegisterSystem(AZ::u32 systemId, const char* name, bool isActive); - /// Unregister a system. Make sure the proper locks are LOCKED when calling this function (m_threadDataMutex) - bool UnregisterSystem(AZ::u32 systemId); - /// Sets the system active/inactive state. Make sure the proper locks are LOCKED when calling this function (m_threadDataMutex) - bool SetSystemState(AZ::u32 systemId, bool isActive); - - Profiler(const Descriptor& desc); - Profiler& operator=(const Profiler&); - - ProfilerData* m_data; ///< Hidden data to reduce the number of header files included; - static Profiler* s_instance; ///< The only instance of the profiler. - static u64 s_id; ///< Profiler unique (over time) id (don't use the pointer as it might be reused). - static int s_useCount; - }; - - /** - * A profiler "virtual" register that contains data about a certain place in the code. - */ - class ProfilerRegister - { - friend class Profiler; - public: - ProfilerRegister() - {} - - enum Type - { - PRT_TIME = 0, ///< Time (members m_time,m_childrenTime,m_calls, m_childrenCalls and m_lastParant are used) register. - PRT_VALUE, ///< Value register - }; - - /// Time register data. - struct TimeData - { - AZ::u64 m_time; ///< Total inclusive time current and children in microseconds. - AZ::u64 m_childrenTime; ///< Time taken by child profilers in microseconds. - AZ::s64 m_calls; ///< Number of calls for this register. - AZ::s64 m_childrenCalls;///< Number of children calls. - ProfilerRegister* m_lastParent; ///< Pointer to the last parent register. - - static AZStd::chrono::microseconds s_startStopOverheadPer1000Calls; ///< Static constant representing a standard start stop overhead per 1000 calls. You can use this to adjust timings. - }; - - /// Value register data. - struct ValuesData - { - AZ::s64 m_value1; - AZ::s64 m_value2; - AZ::s64 m_value3; - AZ::s64 m_value4; - AZ::s64 m_value5; - }; - - static ProfilerRegister* TimerCreateAndStart(const char* systemName, const char* name, ProfilerSection* section, const char* function, int line); - static ProfilerRegister* ValueCreate(const char* systemName, const char* name, const char* function, int line); - void TimerStart(ProfilerSection* section); - - void ValueSet(const AZ::s64& v1); - void ValueSet(const AZ::s64& v1, const AZ::s64& v2); - void ValueSet(const AZ::s64& v1, const AZ::s64& v2, const AZ::s64& v3); - void ValueSet(const AZ::s64& v1, const AZ::s64& v2, const AZ::s64& v3, const AZ::s64& v4); - void ValueSet(const AZ::s64& v1, const AZ::s64& v2, const AZ::s64& v3, const AZ::s64& v4, const AZ::s64& v5); - - void ValueAdd(const AZ::s64& v1); - void ValueAdd(const AZ::s64& v1, const AZ::s64& v2); - void ValueAdd(const AZ::s64& v1, const AZ::s64& v2, const AZ::s64& v3); - void ValueAdd(const AZ::s64& v1, const AZ::s64& v2, const AZ::s64& v3, const AZ::s64& v4); - void ValueAdd(const AZ::s64& v1, const AZ::s64& v2, const AZ::s64& v3, const AZ::s64& v4, const AZ::s64& v5); - - // Dynamic register data - union - { - TimeData m_timeData; - ValuesData m_userValues; - }; - - // Static value data. - const char* m_name; ///< Name of the profiler register. - const char* m_function; ///< Function name in the code. - int m_line; ///< Line number if the code. - AZ::u32 m_systemId; ///< ID of the system this profiler belongs to. - unsigned char m_type : 7; ///< Register type - unsigned char m_isActive : 1; ///< Flag if the profiler is active. - - private: - friend class ProfilerSection; - - static ProfilerRegister* CreateRegister(const char* systemName, const char* name, const char* function, int line, ProfilerRegister::Type type); - - /// Compute static start/stop overhead approximation. You can call this periodically (or not) to update the overhead. - static void TimerComputeStartStopOverhead(); - - void TimerStop(); - - void Reset(); - - ProfilerRegister* GetValueRegisterForThisThread(); - - ProfilerThreadData* m_threadData; ///< Pointer to this entry thread data. - }; - - /** - * Scoped stop register count on destruction. - */ - class ProfilerSection - { - friend class ProfilerRegister; - public: - ProfilerSection() - : m_register(nullptr) - , m_profilerId(AZ::Debug::Profiler::GetId()) - , m_childTime(0) - , m_childCalls(0) - {} - - ~ProfilerSection() - { - // If we have a valid register and the profiler did not change while we were active stop the register. - if (m_register && m_profilerId == AZ::Debug::Profiler::GetId()) - { - m_register->TimerStop(); - } - } - - void Stop() - { - // If we have a valid register and the profiler did not change while we were active stop the register. - if (m_register && m_profilerId == AZ::Debug::Profiler::GetId()) - { - m_register->TimerStop(); - } - m_register = nullptr; - } - private: - ProfilerRegister* m_register; ///< Pointer to the owning profiler register. - u64 m_profilerId; ///< Id of the profiler when we started this section. - AZStd::chrono::system_clock::time_point m_start; ///< Start mark. - AZStd::chrono::microseconds m_childTime; ///< Time spent in child profilers. - int m_childCalls; ///< Number of children calls. - }; - - AZ_FORCE_INLINE ProfilerRegister* ProfilerRegister::GetValueRegisterForThisThread() - { - return this; - } - - AZ_FORCE_INLINE void ProfilerRegister::ValueSet(const AZ::s64& v1) - { - ProfilerRegister* reg = GetValueRegisterForThisThread(); - reg->m_userValues.m_value1 = v1; - } - AZ_FORCE_INLINE void ProfilerRegister::ValueSet(const AZ::s64& v1, const AZ::s64& v2) - { - ProfilerRegister* reg = GetValueRegisterForThisThread(); - reg->m_userValues.m_value1 = v1; - reg->m_userValues.m_value2 = v2; - } - AZ_FORCE_INLINE void ProfilerRegister::ValueSet(const AZ::s64& v1, const AZ::s64& v2, const AZ::s64& v3) - { - ProfilerRegister* reg = GetValueRegisterForThisThread(); - reg->m_userValues.m_value1 = v1; - reg->m_userValues.m_value2 = v2; - reg->m_userValues.m_value3 = v3; - } - AZ_FORCE_INLINE void ProfilerRegister::ValueSet(const AZ::s64& v1, const AZ::s64& v2, const AZ::s64& v3, const AZ::s64& v4) - { - ProfilerRegister* reg = GetValueRegisterForThisThread(); - reg->m_userValues.m_value1 = v1; - reg->m_userValues.m_value2 = v2; - reg->m_userValues.m_value3 = v3; - reg->m_userValues.m_value4 = v4; - } - AZ_FORCE_INLINE void ProfilerRegister::ValueSet(const AZ::s64& v1, const AZ::s64& v2, const AZ::s64& v3, const AZ::s64& v4, const AZ::s64& v5) - { - ProfilerRegister* reg = GetValueRegisterForThisThread(); - reg->m_userValues.m_value1 = v1; - reg->m_userValues.m_value2 = v2; - reg->m_userValues.m_value3 = v3; - reg->m_userValues.m_value4 = v4; - reg->m_userValues.m_value5 = v5; - } - AZ_FORCE_INLINE void ProfilerRegister::ValueAdd(const AZ::s64& v1) - { - ProfilerRegister* reg = GetValueRegisterForThisThread(); - reg->m_userValues.m_value1 += v1; - } - AZ_FORCE_INLINE void ProfilerRegister::ValueAdd(const AZ::s64& v1, const AZ::s64& v2) - { - ProfilerRegister* reg = GetValueRegisterForThisThread(); - reg->m_userValues.m_value1 += v1; - reg->m_userValues.m_value2 += v2; - } - AZ_FORCE_INLINE void ProfilerRegister::ValueAdd(const AZ::s64& v1, const AZ::s64& v2, const AZ::s64& v3) - { - ProfilerRegister* reg = GetValueRegisterForThisThread(); - reg->m_userValues.m_value1 += v1; - reg->m_userValues.m_value2 += v2; - reg->m_userValues.m_value3 += v3; - } - AZ_FORCE_INLINE void ProfilerRegister::ValueAdd(const AZ::s64& v1, const AZ::s64& v2, const AZ::s64& v3, const AZ::s64& v4) - { - ProfilerRegister* reg = GetValueRegisterForThisThread(); - reg->m_userValues.m_value1 += v1; - reg->m_userValues.m_value2 += v2; - reg->m_userValues.m_value3 += v3; - reg->m_userValues.m_value4 += v4; - } - AZ_FORCE_INLINE void ProfilerRegister::ValueAdd(const AZ::s64& v1, const AZ::s64& v2, const AZ::s64& v3, const AZ::s64& v4, const AZ::s64& v5) - { - ProfilerRegister* reg = GetValueRegisterForThisThread(); - reg->m_userValues.m_value1 += v1; - reg->m_userValues.m_value2 += v2; - reg->m_userValues.m_value3 += v3; - reg->m_userValues.m_value4 += v4; - reg->m_userValues.m_value5 += v5; - } - } // namespace Debug - - namespace Internal - { - struct RegisterData - { - AZ::Debug::ProfilerRegister* m_register; ///< Pointer to the register data. - AZ::u64 m_profilerId; ///< Profiler ID which create the \ref register data. - }; - } -} // namespace AZ +} // namespace AZ::Debug #ifdef USE_PIX // The pix3 header unfortunately brings in other Windows macros we need to undef diff --git a/Code/Framework/AzCore/AzCore/Debug/ProfilerDriller.cpp b/Code/Framework/AzCore/AzCore/Debug/ProfilerDriller.cpp deleted file mode 100644 index a2dd2f4f5d..0000000000 --- a/Code/Framework/AzCore/AzCore/Debug/ProfilerDriller.cpp +++ /dev/null @@ -1,310 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include -#include -#include - -#include -#include -#include - -namespace AZ -{ - namespace Debug - { - //========================================================================= - // ProfilerDriller - // [7/9/2013] - //========================================================================= - ProfilerDriller::ProfilerDriller() - { - AZStd::ThreadDrillerEventBus::Handler::BusConnect(); - } - - //========================================================================= - // ~ProfilerDriller - // [7/9/2013] - //========================================================================= - ProfilerDriller::~ProfilerDriller() - { - AZStd::ThreadDrillerEventBus::Handler::BusDisconnect(); - } - - //========================================================================= - // Start - // [5/24/2013] - //========================================================================= - void ProfilerDriller::Start(const Param* params, int numParams) - { - for (int i = 0; i < m_numberOfSystemFilters; ++i) - { - m_systemFilters[i].desc = "SystemID of the system which counters we are interested in"; - m_systemFilters[i].type = Param::PT_INT; - m_systemFilters[i].value = 0; - } - - // Copy valid filters. - m_numberOfValidFilters = 0; - if (params) - { - for (int i = 0; i < numParams; ++i) - { - if (params[i].type == Param::PT_INT && params[i].value != 0) - { - m_systemFilters[m_numberOfValidFilters++].value = params[i].value; - } - } - } - - // output current threads - for (ThreadArrayType::iterator it = m_threads.begin(); it != m_threads.end(); ++it) - { - OutputThreadEnter(*it); - } - - ProfilerDrillerBus::Handler::BusConnect(); - - if (!Profiler::IsReady()) - { - Profiler::Create(); - } - - Profiler::AddReference(); - } - - //========================================================================= - // Stop - // [5/24/2013] - //========================================================================= - void ProfilerDriller::Stop() - { - Profiler::ReleaseReference(); - ProfilerDrillerBus::Handler::BusDisconnect(); - } - - //========================================================================= - // OnError - // [2/8/2013] - //========================================================================= - void ProfilerDriller::Update() - { - // \note We could add thread_id in addition to the System ID, but I can't foresee many cases where we would like to profile only a specific thread. - if (m_numberOfValidFilters) - { - for (int iFilter = 0; iFilter < m_numberOfValidFilters; ++iFilter) - { - AZ::u32 systemFilter = *reinterpret_cast(&m_systemFilters[iFilter].value); - Profiler::Instance().ReadRegisterValues(AZStd::bind(&ProfilerDriller::ReadProfilerRegisters, this, AZStd::placeholders::_1, AZStd::placeholders::_2), systemFilter); - } - } - else - { - Profiler::Instance().ReadRegisterValues(AZStd::bind(&ProfilerDriller::ReadProfilerRegisters, this, AZStd::placeholders::_1, AZStd::placeholders::_2), 0); - } - } - - //========================================================================= - // ReadProfilerRegisters - // [2/11/2013] - //========================================================================= - bool ProfilerDriller::ReadProfilerRegisters(const ProfilerRegister& reg, const AZStd::thread_id& id) - { - (void)id; - m_output->BeginTag(AZ_CRC("ProfilerDriller", 0x172c5268)); - m_output->BeginTag(AZ_CRC("UpdateRegister", 0x6c00b890)); - m_output->Write(AZ_CRC("Id", 0xbf396750), ®); - // Send only the data which is changing - switch (reg.m_type) - { - case ProfilerRegister::PRT_TIME: - { - m_output->Write(AZ_CRC("Time", 0x6f949845), reg.m_timeData.m_time); - m_output->Write(AZ_CRC("ChildrenTime", 0x46162d3f), reg.m_timeData.m_childrenTime); - m_output->Write(AZ_CRC("Calls", 0xdaa35c8f), reg.m_timeData.m_calls); - m_output->Write(AZ_CRC("ChildrenCalls", 0x6a5a4618), reg.m_timeData.m_childrenCalls); - m_output->Write(AZ_CRC("ParentId", 0x856a684c), reg.m_timeData.m_lastParent); - } break; - case ProfilerRegister::PRT_VALUE: - { - m_output->Write(AZ_CRC("Value1", 0xa2756c5a), reg.m_userValues.m_value1); - m_output->Write(AZ_CRC("Value2", 0x3b7c3de0), reg.m_userValues.m_value2); - m_output->Write(AZ_CRC("Value3", 0x4c7b0d76), reg.m_userValues.m_value3); - m_output->Write(AZ_CRC("Value4", 0xd21f98d5), reg.m_userValues.m_value4); - m_output->Write(AZ_CRC("Value5", 0xa518a843), reg.m_userValues.m_value5); - } break; - } - m_output->EndTag(AZ_CRC("UpdateRegister", 0x6c00b890)); - m_output->EndTag(AZ_CRC("ProfilerDriller", 0x172c5268)); - - return true; - } - - //========================================================================= - // OnThreadEnter - // [5/31/2013] - //========================================================================= - void ProfilerDriller::OnThreadEnter(const AZStd::thread_id& id, const AZStd::thread_desc* desc) - { - m_threads.push_back(); - ThreadInfo& info = m_threads.back(); - info.m_id = (size_t)id.m_id; - if (desc) - { - info.m_name = desc->m_name; - info.m_cpuId = desc->m_cpuId; - info.m_priority = desc->m_priority; - info.m_stackSize = desc->m_stackSize; - } - else - { - info.m_name = nullptr; - info.m_cpuId = -1; - info.m_priority = -100000; - info.m_stackSize = 0; - } - - if (m_output) - { - OutputThreadEnter(info); - } - } - - //========================================================================= - // OnThreadExit - // [5/31/2013] - //========================================================================= - void ProfilerDriller::OnThreadExit(const AZStd::thread_id& id) - { - ThreadArrayType::iterator it = m_threads.begin(); - while (it != m_threads.end()) - { - if (it->m_id == (size_t)id.m_id) - { - break; - } - ++it; - } - - if (it != m_threads.end()) - { - if (m_output) - { - OutputThreadExit(*it); - } - - m_threads.erase(it); - } - } - - //========================================================================= - // OutputThreadEnter - // [7/9/2013] - //========================================================================= - void ProfilerDriller::OutputThreadEnter(const ThreadInfo& threadInfo) - { - m_output->BeginTag(AZ_CRC("ProfilerDriller", 0x172c5268)); - m_output->BeginTag(AZ_CRC("ThreadEnter", 0x60e4acfb)); - m_output->Write(AZ_CRC("Id", 0xbf396750), threadInfo.m_id); - if (threadInfo.m_name) - { - m_output->Write(AZ_CRC("Name", 0x5e237e06), threadInfo.m_name); - } - m_output->Write(AZ_CRC("CpuId", 0xdf558508), threadInfo.m_cpuId); - m_output->Write(AZ_CRC("Priority", 0x62a6dc27), threadInfo.m_priority); - m_output->Write(AZ_CRC("StackSize", 0x9cfaf35b), threadInfo.m_stackSize); - m_output->EndTag(AZ_CRC("ThreadEnter", 0x60e4acfb)); - m_output->EndTag(AZ_CRC("ProfilerDriller", 0x172c5268)); - } - - //========================================================================= - // OutputThreadExit - // [7/9/2013] - //========================================================================= - void ProfilerDriller::OutputThreadExit(const ThreadInfo& threadInfo) - { - m_output->BeginTag(AZ_CRC("ProfilerDriller", 0x172c5268)); - m_output->BeginTag(AZ_CRC("OnThreadExit", 0x16042db9)); - m_output->Write(AZ_CRC("Id", 0xbf396750), threadInfo.m_id); - m_output->EndTag(AZ_CRC("OnThreadExit", 0x16042db9)); - m_output->EndTag(AZ_CRC("ProfilerDriller", 0x172c5268)); - } - - //========================================================================= - // OnRegisterSystem - // [5/31/2013] - //========================================================================= - void ProfilerDriller::OnRegisterSystem(AZ::u32 id, const char* name) - { - m_output->BeginTag(AZ_CRC("ProfilerDriller", 0x172c5268)); - m_output->BeginTag(AZ_CRC("RegisterSystem", 0x957739ef)); - m_output->Write(AZ_CRC("Id", 0xbf396750), id); - m_output->Write(AZ_CRC("Name", 0x5e237e06), name); - m_output->EndTag(AZ_CRC("RegisterSystem", 0x957739ef)); - m_output->EndTag(AZ_CRC("ProfilerDriller", 0x172c5268)); - } - - //========================================================================= - // OnUnregisterSystem - // [5/31/2013] - //========================================================================= - void ProfilerDriller::OnUnregisterSystem(AZ::u32 id) - { - m_output->BeginTag(AZ_CRC("ProfilerDriller", 0x172c5268)); - m_output->BeginTag(AZ_CRC("UnregisterSystem", 0xa20538e4)); - m_output->Write(AZ_CRC("Id", 0xbf396750), id); - m_output->EndTag(AZ_CRC("UnregisterSystem", 0xa20538e4)); - m_output->EndTag(AZ_CRC("ProfilerDriller", 0x172c5268)); - } - - //========================================================================= - // OnNewRegister - // [5/31/2013] - //========================================================================= - void ProfilerDriller::OnNewRegister(const ProfilerRegister& reg, const AZStd::thread_id& threadId) - { - m_output->BeginTag(AZ_CRC("ProfilerDriller", 0x172c5268)); - m_output->BeginTag(AZ_CRC("NewRegister", 0xf0f2f287)); - m_output->Write(AZ_CRC("Id", 0xbf396750), ®); - m_output->Write(AZ_CRC("ThreadId", 0xd0fd9043), threadId.m_id); - if (reg.m_name) - { - m_output->Write(AZ_CRC("Name", 0x5e237e06), reg.m_name); - } - if (reg.m_function) - { - m_output->Write(AZ_CRC("Function", 0xcaae163d), reg.m_function); - } - m_output->Write(AZ_CRC("Line", 0xd114b4f6), reg.m_line); - m_output->Write(AZ_CRC("SystemId", 0x0dfecf6f), reg.m_systemId); - m_output->Write(AZ_CRC("Type", 0x8cde5729), reg.m_type); - - switch (reg.m_type) - { - case ProfilerRegister::PRT_TIME: - { - m_output->Write(AZ_CRC("Time", 0x6f949845), reg.m_timeData.m_time); - m_output->Write(AZ_CRC("ChildrenTime", 0x46162d3f), reg.m_timeData.m_childrenTime); - m_output->Write(AZ_CRC("Calls", 0xdaa35c8f), reg.m_timeData.m_calls); - m_output->Write(AZ_CRC("ChildrenCalls", 0x6a5a4618), reg.m_timeData.m_childrenCalls); - m_output->Write(AZ_CRC("ParentId", 0x856a684c), reg.m_timeData.m_lastParent); - } break; - case ProfilerRegister::PRT_VALUE: - { - m_output->Write(AZ_CRC("Value1", 0xa2756c5a), reg.m_userValues.m_value1); - m_output->Write(AZ_CRC("Value2", 0x3b7c3de0), reg.m_userValues.m_value2); - m_output->Write(AZ_CRC("Value3", 0x4c7b0d76), reg.m_userValues.m_value3); - m_output->Write(AZ_CRC("Value4", 0xd21f98d5), reg.m_userValues.m_value4); - m_output->Write(AZ_CRC("Value5", 0xa518a843), reg.m_userValues.m_value5); - } break; - } - m_output->EndTag(AZ_CRC("NewRegister", 0xf0f2f287)); - m_output->EndTag(AZ_CRC("ProfilerDriller", 0x172c5268)); - } - } // namespace Debug -} // namespace AZ diff --git a/Code/Framework/AzCore/AzCore/Debug/ProfilerDriller.h b/Code/Framework/AzCore/AzCore/Debug/ProfilerDriller.h deleted file mode 100644 index abcf3f08e7..0000000000 --- a/Code/Framework/AzCore/AzCore/Debug/ProfilerDriller.h +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ -#ifndef AZCORE_PROFILER_DRILLER_H -#define AZCORE_PROFILER_DRILLER_H 1 - -#include -#include -#include - -namespace AZStd -{ - struct thread_id; - struct thread_desc; -} - -namespace AZ -{ - namespace Debug - { - struct ProfilerSystemData; - class ProfilerRegister; - - /** - * ProfilerDriller or we can just make a Profiler driller and read the registers ourself. - */ - class ProfilerDriller - : public Driller - , public ProfilerDrillerBus::Handler - , public AZStd::ThreadDrillerEventBus::Handler - { - struct ThreadInfo - { - AZ::u64 m_id; - AZ::u32 m_stackSize; - AZ::s32 m_priority; - AZ::s32 m_cpuId; - const char* m_name; - }; - typedef vector::type ThreadArrayType; - - public: - - AZ_CLASS_ALLOCATOR(ProfilerDriller, OSAllocator, 0) - - ProfilerDriller(); - virtual ~ProfilerDriller(); - - protected: - ////////////////////////////////////////////////////////////////////////// - // Driller - virtual const char* GroupName() const { return "SystemDrillers"; } - virtual const char* GetName() const { return "ProfilerDriller"; } - virtual const char* GetDescription() const { return "Collects data from all available profile registers."; } - virtual int GetNumParams() const { return m_numberOfSystemFilters; } - virtual const Param* GetParam(int index) const { AZ_Assert(index >= 0 && index < m_numberOfSystemFilters, "Invalid index"); return &m_systemFilters[index]; } - virtual void Start(const Param* params = NULL, int numParams = 0); - virtual void Stop(); - virtual void Update(); - ////////////////////////////////////////////////////////////////////////// - - ////////////////////////////////////////////////////////////////////////// - // Thread driller event bus - /// Called when we enter a thread, optional thread_desc is provided when the use provides one. - virtual void OnThreadEnter(const AZStd::thread_id& id, const AZStd::thread_desc* desc); - /// Called when we exit a thread. - virtual void OnThreadExit(const AZStd::thread_id& id); - - /// Output thread enter to stream. - void OutputThreadEnter(const ThreadInfo& threadInfo); - /// Output thread exit to stream. - void OutputThreadExit(const ThreadInfo& threadInfo); - ////////////////////////////////////////////////////////////////////////// - - ////////////////////////////////////////////////////////////////////////// - // Profiler Driller bus - virtual void OnRegisterSystem(AZ::u32 id, const char* name); - - virtual void OnUnregisterSystem(AZ::u32 id); - - virtual void OnNewRegister(const ProfilerRegister& reg, const AZStd::thread_id& threadId); - ////////////////////////////////////////////////////////////////////////// - - /// Read profile registers callback. - bool ReadProfilerRegisters(const ProfilerRegister& reg, const AZStd::thread_id& id); - - - - static const int m_numberOfSystemFilters = 16; - int m_numberOfValidFilters = 0 ; ///< Number of valid filter set when the driller was created. - Param m_systemFilters[m_numberOfSystemFilters]; ///< If != 0, it's a ID of specific System we would like to drill. - ThreadArrayType m_threads; - }; - } -} // namespace AZ - -#endif // AZCORE_PROFILER_DRILLER_H -#pragma once diff --git a/Code/Framework/AzCore/AzCore/Debug/ProfilerDrillerBus.h b/Code/Framework/AzCore/AzCore/Debug/ProfilerDrillerBus.h deleted file mode 100644 index 835c06a2ac..0000000000 --- a/Code/Framework/AzCore/AzCore/Debug/ProfilerDrillerBus.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ -#ifndef AZCORE_PROFILER_DRILLER_BUS_H -#define AZCORE_PROFILER_DRILLER_BUS_H - -#include - -namespace AZStd -{ - struct thread_id; -} - -namespace AZ -{ - namespace Debug - { - class ProfilerRegister; - - /** - * ProfilerDrillerInterface driller profiler event interface, that records events from the profiler system. - */ - class ProfilerDrillerInterface - : public DrillerEBusTraits - { - public: - virtual ~ProfilerDrillerInterface() {} - - virtual void OnRegisterSystem(AZ::u32 id, const char* name) = 0; - - virtual void OnUnregisterSystem(AZ::u32 id) = 0; - - virtual void OnNewRegister(const ProfilerRegister& reg, const AZStd::thread_id& threadId) = 0; - }; - - typedef AZ::EBus ProfilerDrillerBus; - } -} - -#endif // AZCORE_PROFILER_DRILLER_BUS_H -#pragma once diff --git a/Code/Framework/AzCore/AzCore/IO/FileIO.cpp b/Code/Framework/AzCore/AzCore/IO/FileIO.cpp index a6ce8cf101..837aca8d84 100644 --- a/Code/Framework/AzCore/AzCore/IO/FileIO.cpp +++ b/Code/Framework/AzCore/AzCore/IO/FileIO.cpp @@ -426,7 +426,6 @@ namespace AZ void FileIOStream::Seek(OffsetType bytes, SeekMode mode) { - AZ_PROFILE_SCOPE(AzCore, "FileIO Seek: %s", m_filename.c_str()); AZ_Assert(FileIOBase::GetInstance(), "FileIO is not initialized."); AZ_Assert(IsOpen(), "Cannot seek on a FileIOStream that is not open."); @@ -454,7 +453,6 @@ namespace AZ SizeType FileIOStream::Read(SizeType bytes, void* oBuffer) { - AZ_PROFILE_SCOPE(AzCore, "FileIO Read: %s", m_filename.c_str()); AZ_Assert(FileIOBase::GetInstance(), "FileIO is not initialized."); AZ_Assert(IsOpen(), "Cannot read from a FileIOStream that is not open."); diff --git a/Code/Framework/AzCore/AzCore/azcore_files.cmake b/Code/Framework/AzCore/AzCore/azcore_files.cmake index 1a3acb2982..85b15b3e3d 100644 --- a/Code/Framework/AzCore/AzCore/azcore_files.cmake +++ b/Code/Framework/AzCore/AzCore/azcore_files.cmake @@ -93,20 +93,17 @@ set(FILES Debug/AssetTracking.h Debug/AssetTrackingTypesImpl.h Debug/AssetTrackingTypes.h + Debug/Budget.h + Debug/Budget.cpp + Debug/BudgetsComponent.h + Debug/BudgetsComponent.cpp Debug/LocalFileEventLogger.h Debug/LocalFileEventLogger.cpp - Debug/FrameProfiler.h - Debug/FrameProfilerBus.h - Debug/FrameProfilerComponent.cpp - Debug/FrameProfilerComponent.h Debug/IEventLogger.h Debug/MemoryProfiler.h Debug/Profiler.cpp Debug/Profiler.h Debug/ProfilerBus.h - Debug/ProfilerDriller.cpp - Debug/ProfilerDriller.h - Debug/ProfilerDrillerBus.h Debug/StackTracer.h Debug/EventTrace.h Debug/EventTrace.cpp @@ -572,8 +569,6 @@ set(FILES Statistics/StatisticalProfilerProxySystemComponent.cpp Statistics/StatisticalProfilerProxySystemComponent.h Statistics/StatisticsManager.h - Statistics/TimeDataStatisticsManager.cpp - Statistics/TimeDataStatisticsManager.h StringFunc/StringFunc.cpp StringFunc/StringFunc.h UserSettings/UserSettings.cpp diff --git a/Code/Framework/AzCore/Tests/Components.cpp b/Code/Framework/AzCore/Tests/Components.cpp index 77524dabc9..55b1c193b3 100644 --- a/Code/Framework/AzCore/Tests/Components.cpp +++ b/Code/Framework/AzCore/Tests/Components.cpp @@ -22,8 +22,6 @@ #include #include -#include -#include #include #include diff --git a/Code/Framework/AzCore/Tests/TimeDataStatistics.cpp b/Code/Framework/AzCore/Tests/TimeDataStatistics.cpp deleted file mode 100644 index 21b42fc451..0000000000 --- a/Code/Framework/AzCore/Tests/TimeDataStatistics.cpp +++ /dev/null @@ -1,208 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ -#include -#include -#include - -#include -#include - -#include - -#include -#include -#include -#include -#include -#include - -using namespace AZ; -using namespace Debug; - -namespace UnitTest -{ - /** - * Validate functionality of the convenience class TimeDataStatisticsManager. - * It is a specialized version of RunningStatisticsManager that works with Timer type - * of registers that can be captured with the FrameProfilerBus::OnFrameProfilerData() - */ - class TimeDataStatisticsManagerTest - : public AllocatorsFixture - , public FrameProfilerBus::Handler - { - static constexpr const char* PARENT_TIMER_STAT = "ParentStat"; - static constexpr const char* CHILD_TIMER_STAT0 = "ChildStat0"; - static constexpr const char* CHILD_TIMER_STAT1 = "ChildStat1"; - - public: - TimeDataStatisticsManagerTest() - : AllocatorsFixture() - { - } - - void SetUp() override - { - AllocatorsFixture::SetUp(); - m_statsManager = AZStd::make_unique(); - } - - void TearDown() override - { - m_statsManager = nullptr; - AllocatorsFixture::TearDown(); - } - - ////////////////////////////////////////////////////////////////////////// - // FrameProfilerBus - virtual void OnFrameProfilerData(const FrameProfiler::ThreadDataArray& data) - { - for (size_t iThread = 0; iThread < data.size(); ++iThread) - { - const FrameProfiler::ThreadData& td = data[iThread]; - FrameProfiler::ThreadData::RegistersMap::const_iterator regIt = td.m_registers.begin(); - for (; regIt != td.m_registers.end(); ++regIt) - { - const FrameProfiler::RegisterData& rd = regIt->second; - u32 unitTestCrc = AZ_CRC("UnitTest", 0x8089cea8); - if (unitTestCrc != rd.m_systemId) - { - continue; //Not for us. - } - ASSERT_EQ(ProfilerRegister::PRT_TIME, rd.m_type); - const FrameProfiler::FrameData& fd = rd.m_frames.back(); - m_statsManager->PushTimeDataSample(rd.m_name, fd.m_timeData); - } - } - } - ////////////////////////////////////////////////////////////////////////// - - int ChildFunction0(int numIterations, int sleepTimeMilliseconds) - { - AZ_PROFILE_SCOPE(UnitTest, CHILD_TIMER_STAT0); - AZStd::this_thread::sleep_for(AZStd::chrono::milliseconds(sleepTimeMilliseconds)); - int result = 5; - for (int i = 0; i < numIterations; ++i) - { - result += i % 3; - } - return result; - } - - int ChildFunction1(int numIterations, int sleepTimeMilliseconds) - { - AZ_PROFILE_SCOPE(UnitTest, CHILD_TIMER_STAT1); - AZStd::this_thread::sleep_for(AZStd::chrono::milliseconds(sleepTimeMilliseconds)); - int result = 5; - for (int i = 0; i < numIterations; ++i) - { - result += i % 3; - } - return result; - } - - int ParentFunction(int numIterations, int sleepTimeMilliseconds) - { - AZ_PROFILE_SCOPE(UnitTest, PARENT_TIMER_STAT); - AZStd::this_thread::sleep_for(AZStd::chrono::milliseconds(sleepTimeMilliseconds)); - int result = 0; - result += ChildFunction0(numIterations, sleepTimeMilliseconds); - result += ChildFunction1(numIterations, sleepTimeMilliseconds); - return result; - } - - void run() - { - Debug::FrameProfilerBus::Handler::BusConnect(); - - ComponentApplication app; - ComponentApplication::Descriptor desc; - desc.m_useExistingAllocator = true; - desc.m_enableDrilling = false; // we already created a memory driller for the test (AllocatorsFixture) - ComponentApplication::StartupParameters startupParams; - startupParams.m_allocator = &AllocatorInstance::Get(); - Entity* systemEntity = app.Create(desc, startupParams); - systemEntity->CreateComponent(); - - systemEntity->Init(); - systemEntity->Activate(); // start frame component - - const int sleepTimeAllFuncsMillis = 1; - const int numIterations = 10; - for (int iterationCounter = 0; iterationCounter < numIterations; ++iterationCounter) - { - ParentFunction(numIterations, sleepTimeAllFuncsMillis); - //Collect all samples. - app.Tick(); - } - - //Verify we have three running stats. - { - AZStd::vector allStats; - m_statsManager->GetAllStatistics(allStats); - EXPECT_EQ(allStats.size(), 3); - } - - AZStd::string parentStatName(PARENT_TIMER_STAT); - AZStd::string child0StatName(CHILD_TIMER_STAT0); - AZStd::string child1StatName(CHILD_TIMER_STAT1); - ASSERT_TRUE(m_statsManager->GetStatistic(parentStatName) != nullptr); - ASSERT_TRUE(m_statsManager->GetStatistic(child0StatName) != nullptr); - ASSERT_TRUE(m_statsManager->GetStatistic(child1StatName) != nullptr); - - EXPECT_EQ(m_statsManager->GetStatistic(parentStatName)->GetNumSamples(), numIterations); - EXPECT_EQ(m_statsManager->GetStatistic(child0StatName)->GetNumSamples(), numIterations); - EXPECT_EQ(m_statsManager->GetStatistic(child1StatName)->GetNumSamples(), numIterations); - - const double minimumExpectDurationOfChildFunctionMicros = 1; - const double minimumExpectDurationOfParentFunctionMicros = 1; - - EXPECT_GE(m_statsManager->GetStatistic(parentStatName)->GetMinimum(), minimumExpectDurationOfParentFunctionMicros); - EXPECT_GE(m_statsManager->GetStatistic(parentStatName)->GetAverage(), minimumExpectDurationOfParentFunctionMicros); - EXPECT_GE(m_statsManager->GetStatistic(parentStatName)->GetMaximum(), minimumExpectDurationOfParentFunctionMicros); - - EXPECT_GE(m_statsManager->GetStatistic(child0StatName)->GetMinimum(), minimumExpectDurationOfChildFunctionMicros); - EXPECT_GE(m_statsManager->GetStatistic(child0StatName)->GetAverage(), minimumExpectDurationOfChildFunctionMicros); - EXPECT_GE(m_statsManager->GetStatistic(child0StatName)->GetMaximum(), minimumExpectDurationOfChildFunctionMicros); - - EXPECT_GE(m_statsManager->GetStatistic(child1StatName)->GetMinimum(), minimumExpectDurationOfChildFunctionMicros); - EXPECT_GE(m_statsManager->GetStatistic(child1StatName)->GetAverage(), minimumExpectDurationOfChildFunctionMicros); - EXPECT_GE(m_statsManager->GetStatistic(child1StatName)->GetMaximum(), minimumExpectDurationOfChildFunctionMicros); - - //Let's validate TimeDataStatisticsManager::RemoveStatistics() - m_statsManager->RemoveStatistic(child1StatName); - ASSERT_TRUE(m_statsManager->GetStatistic(parentStatName) != nullptr); - ASSERT_TRUE(m_statsManager->GetStatistic(child0StatName) != nullptr); - EXPECT_EQ(m_statsManager->GetStatistic(child1StatName), nullptr); - - //Let's store the sample count for both parentStatName and child0StatName. - const AZ::u64 numSamplesParent = m_statsManager->GetStatistic(parentStatName)->GetNumSamples(); - const AZ::u64 numSamplesChild0 = m_statsManager->GetStatistic(child0StatName)->GetNumSamples(); - - //Let's call child1 function again and call app.Tick(). child1StatName should be readded to m_statsManager. - ChildFunction1(numIterations, sleepTimeAllFuncsMillis); - app.Tick(); - ASSERT_TRUE(m_statsManager->GetStatistic(child1StatName) != nullptr); - EXPECT_EQ(m_statsManager->GetStatistic(parentStatName)->GetNumSamples(), numSamplesParent); - EXPECT_EQ(m_statsManager->GetStatistic(child0StatName)->GetNumSamples(), numSamplesChild0); - EXPECT_EQ(m_statsManager->GetStatistic(child1StatName)->GetNumSamples(), 1); - - Debug::FrameProfilerBus::Handler::BusDisconnect(); - app.Destroy(); - } - - AZStd::unique_ptr m_statsManager; - };//class TimeDataStatisticsManagerTest - - // TODO:BUDGETS disabled until profiler budgets system comes online - // TEST_F(TimeDataStatisticsManagerTest, Test) - // { - // run(); - // } - //End of all Tests of TimeDataStatisticsManagerTest - -}//namespace UnitTest diff --git a/Code/Framework/AzCore/Tests/azcoretests_files.cmake b/Code/Framework/AzCore/Tests/azcoretests_files.cmake index 63d447e9e4..b43f3b35a0 100644 --- a/Code/Framework/AzCore/Tests/azcoretests_files.cmake +++ b/Code/Framework/AzCore/Tests/azcoretests_files.cmake @@ -66,7 +66,6 @@ set(FILES SystemFile.cpp TaskTests.cpp TickBusTest.cpp - TimeDataStatistics.cpp UUIDTests.cpp XML.cpp Debug/AssetTracking.cpp diff --git a/Code/Framework/AzFramework/AzFramework/Application/Application.cpp b/Code/Framework/AzFramework/AzFramework/Application/Application.cpp index abd97aee0d..27ce2e7ccb 100644 --- a/Code/Framework/AzFramework/AzFramework/Application/Application.cpp +++ b/Code/Framework/AzFramework/AzFramework/Application/Application.cpp @@ -25,7 +25,6 @@ #include #include #include -#include #include #include #include @@ -296,7 +295,6 @@ namespace AzFramework azrtti_typeid(), azrtti_typeid(), azrtti_typeid(), - azrtti_typeid(), azrtti_typeid(), azrtti_typeid(), diff --git a/Code/Framework/AzFramework/AzFramework/Application/Application.h b/Code/Framework/AzFramework/AzFramework/Application/Application.h index 9c98bd7e45..c6b1dfeaae 100644 --- a/Code/Framework/AzFramework/AzFramework/Application/Application.h +++ b/Code/Framework/AzFramework/AzFramework/Application/Application.h @@ -191,3 +191,5 @@ namespace AzFramework }; } // namespace AzFramework +AZ_DECLARE_BUDGET(AzFramework); + diff --git a/Code/Framework/AzFramework/AzFramework/AzFrameworkModule.cpp b/Code/Framework/AzFramework/AzFramework/AzFrameworkModule.cpp index 4927dadc44..912e85b8bc 100644 --- a/Code/Framework/AzFramework/AzFramework/AzFrameworkModule.cpp +++ b/Code/Framework/AzFramework/AzFramework/AzFrameworkModule.cpp @@ -27,6 +27,8 @@ #include #include +AZ_DEFINE_BUDGET(AzFramework); + namespace AzFramework { AzFrameworkModule::AzFrameworkModule() diff --git a/Code/Framework/AzFramework/AzFramework/Entity/EntityOwnershipService.h b/Code/Framework/AzFramework/AzFramework/Entity/EntityOwnershipService.h index 7e33c29025..083d5b4785 100644 --- a/Code/Framework/AzFramework/AzFramework/Entity/EntityOwnershipService.h +++ b/Code/Framework/AzFramework/AzFramework/Entity/EntityOwnershipService.h @@ -10,6 +10,7 @@ #include #include +#include #include #include @@ -18,6 +19,8 @@ namespace AZ class Entity; } +AZ_DECLARE_BUDGET(AzFramework); + namespace AzFramework { // Types diff --git a/Code/Framework/AzFramework/AzFramework/Script/ScriptComponent.cpp b/Code/Framework/AzFramework/AzFramework/Script/ScriptComponent.cpp index 292cce29ec..4aa2e6c9e3 100644 --- a/Code/Framework/AzFramework/AzFramework/Script/ScriptComponent.cpp +++ b/Code/Framework/AzFramework/AzFramework/Script/ScriptComponent.cpp @@ -33,6 +33,8 @@ extern "C" { # include } +AZ_DEFINE_BUDGET(Script); + namespace ScriptComponentCpp { template diff --git a/Code/Framework/AzFramework/AzFramework/TargetManagement/TargetManagementAPI.h b/Code/Framework/AzFramework/AzFramework/TargetManagement/TargetManagementAPI.h index 35e8b45859..6582e145cb 100644 --- a/Code/Framework/AzFramework/AzFramework/TargetManagement/TargetManagementAPI.h +++ b/Code/Framework/AzFramework/AzFramework/TargetManagement/TargetManagementAPI.h @@ -10,6 +10,7 @@ #define AZFRAMEWORK_TARGETMANAGEMENTAPI_H #include +#include #include #include #include @@ -21,6 +22,8 @@ #include #include +AZ_DECLARE_BUDGET(AzFramework); + namespace AZ { class ReflectContext; diff --git a/Code/Framework/AzFramework/AzFramework/Visibility/EntityVisibilityBoundsUnionSystem.cpp b/Code/Framework/AzFramework/AzFramework/Visibility/EntityVisibilityBoundsUnionSystem.cpp index bfa9dfcf9e..520667d90c 100644 --- a/Code/Framework/AzFramework/AzFramework/Visibility/EntityVisibilityBoundsUnionSystem.cpp +++ b/Code/Framework/AzFramework/AzFramework/Visibility/EntityVisibilityBoundsUnionSystem.cpp @@ -12,6 +12,8 @@ #include #include +AZ_DECLARE_BUDGET(AzFramework); + namespace AzFramework { EntityVisibilityBoundsUnionSystem::EntityVisibilityBoundsUnionSystem() diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/API/ToolsApplicationAPI.h b/Code/Framework/AzToolsFramework/AzToolsFramework/API/ToolsApplicationAPI.h index 9e5db5b5b7..d4707a3e8c 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/API/ToolsApplicationAPI.h +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/API/ToolsApplicationAPI.h @@ -5,14 +5,10 @@ * SPDX-License-Identifier: Apache-2.0 OR MIT * */ - -#ifndef AZTOOLSFRAMEWORK_TOOLSAPPLICATIONAPI_H -#define AZTOOLSFRAMEWORK_TOOLSAPPLICATIONAPI_H - -#include - #pragma once +#include +#include #include #include #include @@ -1089,4 +1085,5 @@ namespace AzToolsFramework } } // namespace AzToolsFramework -#endif // AZTOOLSFRAMEWORK_TOOLSAPPLICATIONAPI_H +AZ_DECLARE_BUDGET(AzToolsFramework); + diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/AzToolsFrameworkModule.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/AzToolsFrameworkModule.cpp index 2d687db00f..97f52e253b 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/AzToolsFrameworkModule.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/AzToolsFrameworkModule.cpp @@ -52,6 +52,8 @@ #include #include +AZ_DEFINE_BUDGET(AzToolsFramework); + namespace AzToolsFramework { AzToolsFrameworkModule::AzToolsFrameworkModule() diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/LegacyFramework/Core/EditorFrameworkApplication.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/LegacyFramework/Core/EditorFrameworkApplication.cpp index 503cbc1d65..8df5dd93ad 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/LegacyFramework/Core/EditorFrameworkApplication.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/LegacyFramework/Core/EditorFrameworkApplication.cpp @@ -38,7 +38,6 @@ #include #include -#include #ifdef AZ_PLATFORM_WINDOWS #include "shlobj.h" diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyEditorAPI.h b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyEditorAPI.h index 415a87f984..6f5183edaf 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyEditorAPI.h +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyEditorAPI.h @@ -5,7 +5,10 @@ * SPDX-License-Identifier: Apache-2.0 OR MIT * */ +#pragma once + #include +#include #include #include #include @@ -14,7 +17,7 @@ #include #include "PropertyEditorAPI_Internals.h" -#pragma once +AZ_DECLARE_BUDGET(AzToolsFramework); class QWidget; class QCheckBox; diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Undo/UndoCacheInterface.h b/Code/Framework/AzToolsFramework/AzToolsFramework/Undo/UndoCacheInterface.h index 39b23bc449..ef3d6c191d 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Undo/UndoCacheInterface.h +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Undo/UndoCacheInterface.h @@ -9,8 +9,11 @@ #pragma once #include +#include #include +AZ_DECLARE_BUDGET(AzToolsFramework); + namespace AzToolsFramework { namespace UndoSystem diff --git a/Code/Framework/GridMate/GridMate/GridMate.cpp b/Code/Framework/GridMate/GridMate/GridMate.cpp index 538dc6d853..356f7ad16b 100644 --- a/Code/Framework/GridMate/GridMate/GridMate.cpp +++ b/Code/Framework/GridMate/GridMate/GridMate.cpp @@ -6,6 +6,7 @@ * */ +#include #include #include @@ -14,6 +15,8 @@ #include #include +AZ_DEFINE_BUDGET(GridMate); + namespace GridMate { class GridMateImpl diff --git a/Code/Framework/GridMate/GridMate/Replica/ReplicaDefs.h b/Code/Framework/GridMate/GridMate/Replica/ReplicaDefs.h index 737b121d03..e2fee41228 100644 --- a/Code/Framework/GridMate/GridMate/Replica/ReplicaDefs.h +++ b/Code/Framework/GridMate/GridMate/Replica/ReplicaDefs.h @@ -5,11 +5,9 @@ * SPDX-License-Identifier: Apache-2.0 OR MIT * */ -#ifndef GM_REPLICADEFS_H -#define GM_REPLICADEFS_H - -/// \file ReplicaChunk.h +#pragma once +#include #include namespace GridMate @@ -80,4 +78,5 @@ namespace GridMate static const ZoneMask ZoneMask_All = (ZoneMask) - 1; } // namespace Gridmate -#endif // GM_REPLICADEFS_H +AZ_DECLARE_BUDGET(GridMate); + diff --git a/Code/Framework/GridMate/GridMate/Replica/Tasks/ReplicaMarshalTasks.cpp b/Code/Framework/GridMate/GridMate/Replica/Tasks/ReplicaMarshalTasks.cpp index f5e6e0f5a6..c1d6905e14 100644 --- a/Code/Framework/GridMate/GridMate/Replica/Tasks/ReplicaMarshalTasks.cpp +++ b/Code/Framework/GridMate/GridMate/Replica/Tasks/ReplicaMarshalTasks.cpp @@ -6,8 +6,6 @@ * */ -#include - #include #include #include diff --git a/Code/Legacy/CryCommon/FrameProfiler.h b/Code/Legacy/CryCommon/FrameProfiler.h deleted file mode 100644 index ac6d3a52a1..0000000000 --- a/Code/Legacy/CryCommon/FrameProfiler.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - - -#pragma once - -#include - -#define SUBSYSTEM_DEFINES \ - X(PROFILE_ANY, "Any") \ - X(PROFILE_RENDERER, "Renderer") \ - X(PROFILE_3DENGINE, "3DEngine") \ - X(PROFILE_PARTICLE, "Particle") \ - X(PROFILE_AI, "AI") \ - X(PROFILE_ANIMATION, "Animation") \ - X(PROFILE_MOVIE, "Movie") \ - X(PROFILE_ENTITY, "Entity") \ - X(PROFILE_UI, "UI") \ - X(PROFILE_NETWORK, "Network") \ - X(PROFILE_PHYSICS, "Physics") \ - X(PROFILE_SCRIPT, "Script") \ - X(PROFILE_SCRIPT_CFUNC, "Script C Functions") \ - X(PROFILE_AUDIO, "Audio") \ - X(PROFILE_EDITOR, "Editor") \ - X(PROFILE_SYSTEM, "System") \ - X(PROFILE_ACTION, "Action") \ - X(PROFILE_GAME, "Game") \ - X(PROFILE_INPUT, "Input") \ - X(PROFILE_SYNC, "Sync") \ - X(PROFILE_NETWORK_TRAFFIC, "Network Traffic") \ - X(PROFILE_DEVICE, "Device") - -#define X(Subsystem, SubsystemName) Subsystem, -enum EProfiledSubsystem -{ - SUBSYSTEM_DEFINES - PROFILE_LAST_SUBSYSTEM -}; -#undef X - -#include - - - -#define FUNCTION_PROFILER_LEGACYONLY(pISystem, subsystem) - -#define FUNCTION_PROFILER(pISystem, subsystem) - -#define FUNCTION_PROFILER_FAST(pISystem, subsystem, bProfileEnabled) - -#define FUNCTION_PROFILER_ALWAYS(pISystem, subsystem) - -#define FRAME_PROFILER_LEGACYONLY(szProfilerName, pISystem, subsystem) - -#define FRAME_PROFILER(szProfilerName, pISystem, subsystem) - -#define FRAME_PROFILER_FAST(szProfilerName, pISystem, subsystem, bProfileEnabled) - -#define FUNCTION_PROFILER_SYS(subsystem) - -#define STALL_PROFILER(cause) - diff --git a/Code/Legacy/CryCommon/ISystem.h b/Code/Legacy/CryCommon/ISystem.h index 74153eb39b..3c13ac04d8 100644 --- a/Code/Legacy/CryCommon/ISystem.h +++ b/Code/Legacy/CryCommon/ISystem.h @@ -1654,11 +1654,4 @@ inline void CryLogAlways(const char* format, ...) } #endif // EXCLUDE_NORMAL_LOG - -////////////////////////////////////////////////////////////////////////// -// Additional headers. -////////////////////////////////////////////////////////////////////////// -#include - #endif // CRYINCLUDE_CRYCOMMON_ISYSTEM_H - diff --git a/Code/Legacy/CryCommon/crycommon_files.cmake b/Code/Legacy/CryCommon/crycommon_files.cmake index ba11de0215..8b8df7856e 100644 --- a/Code/Legacy/CryCommon/crycommon_files.cmake +++ b/Code/Legacy/CryCommon/crycommon_files.cmake @@ -87,7 +87,6 @@ set(FILES CrySystemBus.h CryTypeInfo.h CryVersion.h - FrameProfiler.h HeapAllocator.h LegacyAllocator.cpp LegacyAllocator.h diff --git a/Code/Legacy/CrySystem/LocalizedStringManager.cpp b/Code/Legacy/CrySystem/LocalizedStringManager.cpp index db77eda3e8..8b09667f13 100644 --- a/Code/Legacy/CrySystem/LocalizedStringManager.cpp +++ b/Code/Legacy/CrySystem/LocalizedStringManager.cpp @@ -1899,7 +1899,6 @@ static void LogDecompTimer(__int64 nTotalTicks, __int64 nDecompTicks, __int64 nA AZStd::string CLocalizedStringsManager::SLocalizedStringEntry::GetTranslatedText(const SLanguage* pLanguage) const { - FUNCTION_PROFILER_FAST(GetISystem(), PROFILE_SYSTEM, g_bProfilerEnabled); if ((flags & IS_COMPRESSED) != 0) { #if defined(LOG_DECOMP_TIMES) diff --git a/Code/Legacy/CrySystem/Log.cpp b/Code/Legacy/CrySystem/Log.cpp index be2816c890..b671748920 100644 --- a/Code/Legacy/CrySystem/Log.cpp +++ b/Code/Legacy/CrySystem/Log.cpp @@ -396,7 +396,6 @@ void CLog::LogV(const ELogType type, [[maybe_unused]]int flags, const char* szFo } } - FUNCTION_PROFILER(GetISystem(), PROFILE_SYSTEM); LOADING_TIME_PROFILE_SECTION(GetISystem()); bool bfile = false, bconsole = false; @@ -1445,8 +1444,6 @@ void CLog::RemoveCallback(ILogCallback* pCallback) ////////////////////////////////////////////////////////////////////////// void CLog::Update() { - FUNCTION_PROFILER_FAST(m_pSystem, PROFILE_SYSTEM, g_bProfilerEnabled); - if (CryGetCurrentThreadId() == m_nMainThreadId) { if (!m_threadSafeMsgQueue.empty()) diff --git a/Code/Legacy/CrySystem/System.cpp b/Code/Legacy/CrySystem/System.cpp index d848160b3e..5c03b06a48 100644 --- a/Code/Legacy/CrySystem/System.cpp +++ b/Code/Legacy/CrySystem/System.cpp @@ -659,8 +659,6 @@ ISystem* CSystem::GetCrySystem() ////////////////////////////////////////////////////////////////////////// void CSystem::SleepIfNeeded() { - FUNCTION_PROFILER_FAST(this, PROFILE_SYSTEM, g_bProfilerEnabled); - ITimer* const pTimer = gEnv->pTimer; static bool firstCall = true; @@ -738,7 +736,6 @@ bool CSystem::UpdatePreTickBus(int updateFlags, int nPauseMode) _mm_setcsr(_mm_getcsr() & ~0x280 | (g_cvars.sys_float_exceptions > 0 ? 0 : 0x280)); #endif //WIN32 - FUNCTION_PROFILER_LEGACYONLY(GetISystem(), PROFILE_SYSTEM); AZ_TRACE_METHOD(); m_nUpdateCounter++; @@ -832,8 +829,6 @@ bool CSystem::UpdatePreTickBus(int updateFlags, int nPauseMode) //limit frame rate if vsync is turned off //for consoles this is done inside renderthread to be vsync dependent { - FRAME_PROFILER_LEGACYONLY("FRAME_CAP", gEnv->pSystem, PROFILE_SYSTEM); - AZ_TRACE_METHOD_NAME("FrameLimiter"); static ICVar* pSysMaxFPS = NULL; static ICVar* pVSync = NULL; @@ -882,7 +877,6 @@ bool CSystem::UpdatePreTickBus(int updateFlags, int nPauseMode) //update console system if (m_env.pConsole) { - FRAME_PROFILER("SysUpdate:Console", this, PROFILE_SYSTEM); m_env.pConsole->Update(); } @@ -898,7 +892,6 @@ bool CSystem::UpdatePreTickBus(int updateFlags, int nPauseMode) // Run movie system pre-update if (!bNoUpdate) { - FRAME_PROFILER("SysUpdate:UpdateMovieSystem", this, PROFILE_SYSTEM); UpdateMovieSystem(updateFlags, fMovieFrameTime, true); } @@ -914,7 +907,6 @@ bool CSystem::UpdatePostTickBus(int updateFlags, int /*nPauseMode*/) if (!m_bNoUpdate) { const float fMovieFrameTime = m_Time.GetFrameTime(ITimer::ETIMER_UI); - FRAME_PROFILER("SysUpdate:UpdateMovieSystem", this, PROFILE_SYSTEM); UpdateMovieSystem(updateFlags, fMovieFrameTime, false); } @@ -922,7 +914,6 @@ bool CSystem::UpdatePostTickBus(int updateFlags, int /*nPauseMode*/) // Update sound system if (!m_bNoUpdate) { - FRAME_PROFILER("SysUpdate:UpdateAudioSystems", this, PROFILE_SYSTEM); UpdateAudioSystems(); } @@ -949,10 +940,7 @@ bool CSystem::UpdatePostTickBus(int updateFlags, int /*nPauseMode*/) m_updateTimes.push_back(std::make_pair(cur_time, updateTime)); } - { - FRAME_PROFILER("SysUpdate - SystemEventDispatcher::Update", this, PROFILE_SYSTEM); - m_pSystemEventDispatcher->Update(); - } + m_pSystemEventDispatcher->Update(); if (!gEnv->IsEditing() && m_eRuntimeState == ESYSTEM_EVENT_LEVEL_GAMEPLAY_START) { @@ -973,8 +961,6 @@ bool CSystem::UpdateLoadtime() void CSystem::UpdateAudioSystems() { - AZ_TRACE_METHOD(); - FRAME_PROFILER_LEGACYONLY("SysUpdate:Audio", this, PROFILE_SYSTEM); Audio::AudioSystemRequestBus::Broadcast(&Audio::AudioSystemRequestBus::Events::ExternalUpdate); } diff --git a/Code/Legacy/CrySystem/ViewSystem/ViewSystem.cpp b/Code/Legacy/CrySystem/ViewSystem/ViewSystem.cpp index 7cdb62d45a..01c7340919 100644 --- a/Code/Legacy/CrySystem/ViewSystem/ViewSystem.cpp +++ b/Code/Legacy/CrySystem/ViewSystem/ViewSystem.cpp @@ -172,8 +172,6 @@ CViewSystem::~CViewSystem() //------------------------------------------------------------------------ void CViewSystem::Update(float frameTime) { - FUNCTION_PROFILER(GetISystem(), PROFILE_ACTION); - if (gEnv->IsDedicated()) { return; diff --git a/Code/Tools/Standalone/CMakeLists.txt b/Code/Tools/Standalone/CMakeLists.txt index a8242022a8..78047dd6cf 100644 --- a/Code/Tools/Standalone/CMakeLists.txt +++ b/Code/Tools/Standalone/CMakeLists.txt @@ -38,34 +38,3 @@ ly_add_target( PRIVATE STANDALONETOOLS_ENABLE_LUA_IDE ) - -ly_add_target( - NAME Profiler APPLICATION - NAMESPACE AZ - AUTOMOC - AUTOUIC - AUTORCC - FILES_CMAKE - standalone_tools_files.cmake - profiler_files.cmake - Platform/${PAL_PLATFORM_NAME}/profiler_${PAL_PLATFORM_NAME_LOWERCASE}_files.cmake - INCLUDE_DIRECTORIES - PRIVATE - . - Source/Editor - Source/Driller - Source/Driller/Carrier - Source/Driller/Profiler - Source/Driller/IO - BUILD_DEPENDENCIES - PRIVATE - Legacy::CryCommon - AZ::AzCore - AZ::AzFramework - AZ::AzToolsFramework - AZ::GridMate - ${additional_dependencies} - COMPILE_DEFINITIONS - PRIVATE - STANDALONETOOLS_ENABLE_PROFILER -) diff --git a/Code/Tools/Standalone/Source/Driller/Annotations/AnnotationHeaderView.cpp b/Code/Tools/Standalone/Source/Driller/Annotations/AnnotationHeaderView.cpp deleted file mode 100644 index 3152862d80..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Annotations/AnnotationHeaderView.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "AnnotationHeaderView.hxx" -#include "AnnotationsDataView.hxx" -#include "Annotations.hxx" -#include - -namespace Driller -{ - static const int k_contractedSize = 20; - static const int k_textWidth = 153; - - AnnotationHeaderView::AnnotationHeaderView(AnnotationsProvider* ptrAnnotations, QWidget* parent, Qt::WindowFlags flags) - : QWidget(parent, flags) - , m_ptrAnnotations(ptrAnnotations) - { - setupUi(this); - - m_State.m_EndFrame = -1; - m_State.m_FramesInView = 10; - m_State.m_FrameOffset = 0; - - annotationDataView->RegisterAnnotationHeaderView(this, m_ptrAnnotations); - annotationDataView->setAutoFillBackground(true); - - connect(configureAnnotations, SIGNAL(pressed()), this, SIGNAL(OnOptionsClick())); - connect(annotationDataView, SIGNAL(InformOfMouseOverAnnotation(const Annotation&)), this, SIGNAL(InformOfMouseOverAnnotation(const Annotation&))); - connect(annotationDataView, SIGNAL(InformOfClickAnnotation(const Annotation&)), this, SIGNAL(InformOfClickAnnotation(const Annotation&))); - connect(m_ptrAnnotations, SIGNAL(AnnotationDataInvalidated()), this, SLOT(RefreshView())); - - annotationDataView->update(); - - QSize size = annotationDataView->size(); - int nextHeight = size.height(); - - (void)nextHeight; - } - - QSize AnnotationHeaderView::sizeHint() const - { - return QSize(0, k_contractedSize); - } - - - AnnotationHeaderView::~AnnotationHeaderView() - { - } - - void AnnotationHeaderView::RefreshView() - { - annotationDataView->update(); - } - - void AnnotationHeaderView::SetEndFrame(FrameNumberType frameNum) - { - QSize size = annotationDataView->size(); - int nextHeight = size.height(); - - (void)nextHeight; - - m_State.m_EndFrame = frameNum; - annotationDataView->update(); - } - - void AnnotationHeaderView::SetSliderOffset(FrameNumberType frameNum) - { - m_State.m_FrameOffset = frameNum; - annotationDataView->update(); - } - - void AnnotationHeaderView::SetDataPointsInView(int count) - { - m_State.m_FramesInView = count; - annotationDataView->update(); - } -} - -#include diff --git a/Code/Tools/Standalone/Source/Driller/Annotations/AnnotationHeaderView.hxx b/Code/Tools/Standalone/Source/Driller/Annotations/AnnotationHeaderView.hxx deleted file mode 100644 index 41f40b93ce..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Annotations/AnnotationHeaderView.hxx +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef ANNOTATION_HEADER_VIEW_HXX -#define ANNOTATION_HEADER_VIEW_HXX - -#if !defined(Q_MOC_RUN) -#include -#include - -#include - -#include -#include -#include -#endif - - -namespace Driller -{ - class AnnotationsProvider; - class AnnotationsDataView; - class Annotation; - - /** The annotation header view runs along the top of the channels, and shows annotation blips that can be hovered over. - * this gives nice hit boxes for clicking that are not a sliver thick. - */ - - class AnnotationHeaderView : public QWidget, private Ui::AnnotationHeaderView - { - Q_OBJECT; - public: - AZ_CLASS_ALLOCATOR(AnnotationHeaderView,AZ::SystemAllocator,0); - AnnotationHeaderView(AnnotationsProvider* ptrAnnotations, QWidget* parent = NULL, Qt::WindowFlags flags = Qt::WindowFlags()); - virtual ~AnnotationHeaderView(void); - - struct HeaderViewState - { - int m_EndFrame; - int m_FramesInView; - int m_FrameOffset; - }; - - const HeaderViewState& GetState() { return m_State; } - - void SetDataPointsInView( int count ); - void SetEndFrame( FrameNumberType frame ); - void SetSliderOffset( FrameNumberType frame ); - -signals: - void OnOptionsClick(); - void InformOfMouseOverAnnotation(const Annotation& annotation); - void InformOfClickAnnotation(const Annotation& annotation); - public slots: - void RefreshView(); - - private: - HeaderViewState m_State; - - AnnotationsProvider *m_ptrAnnotations; - - virtual QSize sizeHint() const; - - }; - -} - - -#endif // ANNOTATION_HEADER_VIEW_HXX diff --git a/Code/Tools/Standalone/Source/Driller/Annotations/AnnotationHeaderView.ui b/Code/Tools/Standalone/Source/Driller/Annotations/AnnotationHeaderView.ui deleted file mode 100644 index a8f10135e8..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Annotations/AnnotationHeaderView.ui +++ /dev/null @@ -1,178 +0,0 @@ - - - AnnotationHeaderView - - - - 0 - 0 - 1023 - 38 - - - - - 0 - 0 - - - - Form - - - true - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - - - - QFrame::NoFrame - - - QFrame::Plain - - - 0 - - - - 0 - - - 0 - - - 3 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - - 250 - 0 - - - - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - 0 - - - 8 - - - 0 - - - 8 - - - 3 - - - - - - 0 - 0 - - - - - 0 - 0 - - - - Configure which messages are annotated on the display - - - Qt::LeftToRight - - - Configure Annotations - - - - :/driller/settings_icon:/driller/settings_icon - - - - - - - - - - - 0 - 0 - - - - true - - - - - - - - - - - Driller::AnnotationsDataView - QWidget -
Source/Driller/Annotations/AnnotationsDataView.hxx
- 1 -
-
- - - - -
diff --git a/Code/Tools/Standalone/Source/Driller/Annotations/Annotations.cpp b/Code/Tools/Standalone/Source/Driller/Annotations/Annotations.cpp deleted file mode 100644 index c59a956670..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Annotations/Annotations.cpp +++ /dev/null @@ -1,405 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "Annotations.hxx" -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -namespace Driller -{ - // stores the settings that are saved into the file and transported from user to user to accompany drill files. - // as always, this is just a dumb container and does not need encapsulation - class AnnotationWorkspaceSettings - : public AZ::UserSettings - { - public: - AZ_RTTI(AnnotationWorkspaceSettings, "{431EFFCF-C3C5-4BB3-8246-E452E11D4FF8}", AZ::UserSettings); - AZ_CLASS_ALLOCATOR(AnnotationWorkspaceSettings, AZ::SystemAllocator, 0); - - ChannelContainer m_ActiveAnnotationChannels; - ChannelCRCContainer m_ActiveAnnotationChannelCRCs; - - static void Reflect(AZ::ReflectContext* context) - { - AZ::SerializeContext* serialize = azrtti_cast(context); - if (serialize) - { - serialize->Class() - ->Version(2) - ->Field("m_ActiveAnnotationChannels", &AnnotationWorkspaceSettings::m_ActiveAnnotationChannels) - ->Field("m_ActiveAnnotationChannelCRCs", &AnnotationWorkspaceSettings::m_ActiveAnnotationChannelCRCs); - } - } - }; - - // stores the data that goes with the user preferences, even without a workspace file - // mainly gui stuff... - // as always, this is just a dumb container and does not need encapsulation - class AnnotationUserSettings - : public AZ::UserSettings - { - public: - AZ_RTTI(AnnotationUserSettings, "{D3584846-0574-4B63-9693-4F3265CDE16D}", AZ::UserSettings); - AZ_CLASS_ALLOCATOR(AnnotationUserSettings, AZ::SystemAllocator, 0); - - ChannelContainer m_KnownAnnotationChannels; // keeps track of all annotation channels ever seen - AZStd::unordered_map m_customizedColors; - - AZ::u32 GetRGBAColorForChannel(AZ::u32 channelNameCRC) - { - auto found = m_customizedColors.find(channelNameCRC); - if (found != m_customizedColors.end()) - { - return found->second; - } - - AZ::u32 num_different_colors = 7; - QColor col; - float sat = .9f; - float val = .9f; - col.setHsvF((float)(channelNameCRC % num_different_colors) / (float(num_different_colors)), sat, val); - QRgb rgbColor = col.rgba(); - return rgbColor; - } - - void SetRGBAColorForChannel(AZ::u32 channelNameCRC, AZ::u32 rgbaColor) - { - m_customizedColors[channelNameCRC] = rgbaColor; - } - - void ResetColorForChannel(AZ::u32 channelNameCRC) - { - m_customizedColors.erase(channelNameCRC); - } - - static void Reflect(AZ::ReflectContext* context) - { - AZ::SerializeContext* serialize = azrtti_cast(context); - if (serialize) - { - serialize->Class() - ->Version(1) - ->Field("m_KnownAnnotationChannels", &AnnotationUserSettings::m_KnownAnnotationChannels) - ->Field("m_customizedColors", &AnnotationUserSettings::m_customizedColors); - } - } - }; - - void AnnotationsProvider::Reflect(AZ::ReflectContext* context) - { - AnnotationWorkspaceSettings::Reflect(context); - AnnotationUserSettings::Reflect(context); - } - - Annotation::Annotation() - { - m_ChannelCRC = 0; - m_eventIndex = 0; - m_frameIndex = 0; - } - - Annotation::Annotation(AZ::s64 eventID, FrameNumberType frame, const char* text, const char* channel) - { - m_eventIndex = eventID; - m_frameIndex = frame; - m_text = text; - m_channel = channel; - m_ChannelCRC = AZ::Crc32(m_channel.c_str()); - } - - Annotation::Annotation(const Annotation& other) - { - *this = other; - } - - Annotation::Annotation(Annotation&& other) - { - *this = AZStd::move(other); - } - - Annotation& Annotation::operator=(Annotation&& other) - { - if (this != &other) - { - m_eventIndex = other.m_eventIndex; - m_frameIndex = other.m_frameIndex; - m_text = AZStd::move(other.m_text); - m_channel = AZStd::move(other.m_channel); - m_ChannelCRC = other.m_ChannelCRC; - } - return *this; - } - - Annotation& Annotation::operator=(const Annotation& other) - { - if (this != &other) - { - m_eventIndex = other.m_eventIndex; - m_frameIndex = other.m_frameIndex; - m_text = other.m_text; - m_channel = other.m_channel; - m_ChannelCRC = other.m_ChannelCRC; - } - return *this; - } - - AnnotationsProvider::AnnotationsProvider(QObject* pParent) - : QObject(pParent) - { - m_bVectorDirty = false; - - /// load user settings and workspace settings from usersettings component to persist state - - m_ptrUserSettings = AZ::UserSettings::CreateFind(AZ_CRC("ANNOT_USERSETTINGS", 0x3ddaa4f1), AZ::UserSettings::CT_GLOBAL); - m_ptrWorkspaceSettings = AZ::UserSettings::CreateFind(AZ_CRC("ANNOT_WORKSPACESETTINGS", 0xf7ca8dd3), AZ::UserSettings::CT_GLOBAL); - } - - AnnotationsProvider::~AnnotationsProvider() - { - AZ::UserSettings::Release(m_ptrUserSettings); - AZ::UserSettings::Release(m_ptrWorkspaceSettings); - } - - - void AnnotationsProvider::LoadSettingsFromWorkspace(WorkspaceSettingsProvider* ptrProvider) - { - AnnotationWorkspaceSettings* rawPtr = ptrProvider->FindSetting(AZ_CRC("ANNOTATIONWORKSPACE", 0x28319f66)); - if (rawPtr) - { - m_ptrWorkspaceSettings->m_ActiveAnnotationChannels = rawPtr->m_ActiveAnnotationChannels; - m_ptrWorkspaceSettings->m_ActiveAnnotationChannelCRCs = rawPtr->m_ActiveAnnotationChannelCRCs; - - // aggregate missing channels: - for (auto it = m_ptrWorkspaceSettings->m_ActiveAnnotationChannels.begin(); it != m_ptrWorkspaceSettings->m_ActiveAnnotationChannels.end(); ++it) - { - NotifyOfChannelExistence(it->c_str()); - } - } - } - - void AnnotationsProvider::SaveSettingsToWorkspace(WorkspaceSettingsProvider* ptrProvider) - { - AnnotationWorkspaceSettings* rawPtr = ptrProvider->CreateSetting(AZ_CRC("ANNOTATIONWORKSPACE", 0x28319f66)); - rawPtr->m_ActiveAnnotationChannels = m_ptrWorkspaceSettings->m_ActiveAnnotationChannels; - rawPtr->m_ActiveAnnotationChannelCRCs = m_ptrWorkspaceSettings->m_ActiveAnnotationChannelCRCs; - } - - // returns the end of the vector (ie, the invalid iterator) - AnnotationsProvider::ConstAnnotationIterator AnnotationsProvider::GetEnd() const - { - AZ_Assert(!m_bVectorDirty, "You may not interrogate the annotations provider before it is finalized"); - - return m_currentAnnotations.end(); - } - - // returns iterator to the first annotation thats on the frame given (or the end iterator) - AnnotationsProvider::ConstAnnotationIterator AnnotationsProvider::GetFirstAnnotationForFrame(FrameNumberType frameIndex) const - { - AZ_Assert(!m_bVectorDirty, "You may not interrogate the annotations provider before it is finalized"); - - // do we have annotations for that framE? - FrameIndexToCurrentMap::const_iterator it = m_frameToIndex.find(frameIndex); - if (it == m_frameToIndex.end()) - { - return GetEnd(); - } - - return m_currentAnnotations.begin() + it->second; - } - - // returns iterator to the first annotation that is foer that event # (or the end iterator) - AnnotationsProvider::ConstAnnotationIterator AnnotationsProvider::GetAnnotationForEvent(EventNumberType eventIndex) const - { - AZ_Assert(!m_bVectorDirty, "You may not interrogate the annotations provider before it is finalized"); - - // do we have annotations for that event index? - EventIndexToCurrentMap::const_iterator it = m_eventToIndex.find(eventIndex); - if (it == m_eventToIndex.end()) - { - return GetEnd(); - } - - return m_currentAnnotations.begin() + it->second; - } - - // note:: claims ownership of the data in annotation. - void AnnotationsProvider::AddAnnotation(Annotation&& target) - { - if (m_eventToIndex.find(target.GetEventIndex()) != m_eventToIndex.end()) - { - return; - } - - // can we do this quickly and easily? - if ( - (!m_bVectorDirty) && // if we're not already going to need to sort, and... - ( - (m_currentAnnotations.empty()) || // we either have no annotations or... - (m_currentAnnotations.back().GetEventIndex() < target.GetEventIndex()) // the fresh annotation belongs at the end anyway and we will not need to re-sort. - ) - ) - { - // we're adding annotations onto the end, so we will not have to sort, we can just accumulate the data. - - m_eventToIndex[target.GetEventIndex()] = m_currentAnnotations.size(); - - // if its the first annotation for this frame, we can also add it: - if (m_frameToIndex.find(target.GetFrameIndex()) == m_frameToIndex.end()) - { - m_frameToIndex[target.GetFrameIndex()] = m_currentAnnotations.size(); - } - - m_currentAnnotations.push_back(target); - } - else - { - // we're adding annotations out of order, we have to re-sort: - m_currentAnnotations.push_back(target); - m_bVectorDirty = true; - } - } - - - // called by the main controller to sort and build the map cache. - void AnnotationsProvider::Finalize() - { - /* - // temp: add some fake annots - AddAnnotation(Annotation(5, 10, "Test annotation", "tracker")); - AddAnnotation(Annotation(15, 110, "Test annotation2", "tracker1")); - AddAnnotation(Annotation(25, 210, "Test annotatio3n", "tracker2")); - AddAnnotation(Annotation(35, 310, "Test annotation4", "tracker3")); - */ - - if (!m_bVectorDirty) - { - emit AnnotationDataInvalidated(); - - return; - } - - m_frameToIndex.clear(); - m_eventToIndex.clear(); - - // sort them so they are in order from beginning to end: - AZStd::sort( - m_currentAnnotations.begin(), - m_currentAnnotations.end(), - [](const Annotation& a, const Annotation& b) -> bool - { - return a.GetEventIndex() < b.GetEventIndex(); - } - ); - - // now build the lookup tables: - FrameNumberType lastFrameIndex = -1; - for (AZStd::size_t idx = 0, endIdx = m_currentAnnotations.size(); idx < endIdx; ++idx) - { - const Annotation& current = m_currentAnnotations[idx]; - m_eventToIndex[current.GetEventIndex()] = idx; - if (lastFrameIndex != current.GetFrameIndex()) - { - m_frameToIndex[current.GetFrameIndex()] = idx; - lastFrameIndex = current.GetFrameIndex(); - } - } - - emit AnnotationDataInvalidated(); - - m_bVectorDirty = false; - } - - const ChannelContainer& AnnotationsProvider::GetAllKnownChannels() const - { - return m_ptrUserSettings->m_KnownAnnotationChannels; - } - - void AnnotationsProvider::GetCurrentlyEnabledChannelCRCs(ChannelCRCContainer& target) const - { - target.insert(m_ptrWorkspaceSettings->m_ActiveAnnotationChannelCRCs.begin(), m_ptrWorkspaceSettings->m_ActiveAnnotationChannelCRCs.end()); - } - - // let us know that a channel exists: - void AnnotationsProvider::NotifyOfChannelExistence(const char* name) - { - if (m_ptrUserSettings->m_KnownAnnotationChannels.insert(name).second) - { - emit KnownAnnotationsChanged(); - } - } - - void AnnotationsProvider::SetChannelEnabled(const char* channelName, bool enabled) - { - if (enabled) - { - if (m_ptrWorkspaceSettings->m_ActiveAnnotationChannels.insert(channelName).second) - { - m_ptrWorkspaceSettings->m_ActiveAnnotationChannelCRCs.insert(AZ::Crc32(channelName)); - NotifyOfChannelExistence(channelName); - emit SelectedAnnotationsChanged(); - } - } - else - { - AZ::u32 channelCRC = AZ::Crc32(channelName); - if (IsChannelEnabled(channelCRC)) - { - m_ptrWorkspaceSettings->m_ActiveAnnotationChannels.erase(channelName); - m_ptrWorkspaceSettings->m_ActiveAnnotationChannelCRCs.erase(channelCRC); - emit SelectedAnnotationsChanged(); - } - } - } - - QColor AnnotationsProvider::GetColorForChannel(AZ::u32 channelNameCRC) const - { - QRgb rgbaValue = m_ptrUserSettings->GetRGBAColorForChannel(channelNameCRC); - return QColor(rgbaValue); - } - - void AnnotationsProvider::SetColorForChannel(AZ::u32 channelNameCRC, QColor newColor) - { - QRgb rgbaValue = newColor.rgba(); - m_ptrUserSettings->SetRGBAColorForChannel(channelNameCRC, rgbaValue); - - if (IsChannelEnabled(channelNameCRC)) - { - // update displays - emit SelectedAnnotationsChanged(); - } - } - - void AnnotationsProvider::ResetColorForChannel(AZ::u32 channelNameCRC) - { - m_ptrUserSettings->ResetColorForChannel(channelNameCRC); - } - - bool AnnotationsProvider::IsChannelEnabled(AZ::u32 channelNameCRC) const - { - return (m_ptrWorkspaceSettings->m_ActiveAnnotationChannelCRCs.find(channelNameCRC) != m_ptrWorkspaceSettings->m_ActiveAnnotationChannelCRCs.end()); - } - - void AnnotationsProvider::Clear() - { - m_frameToIndex.clear(); - m_eventToIndex.clear(); - m_currentAnnotations.clear(); - m_bVectorDirty = false; - } -} - -#include diff --git a/Code/Tools/Standalone/Source/Driller/Annotations/Annotations.hxx b/Code/Tools/Standalone/Source/Driller/Annotations/Annotations.hxx deleted file mode 100644 index d87e8d61e4..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Annotations/Annotations.hxx +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef DRILLER_ANNOTATIONS_H -#define DRILLER_ANNOTATIONS_H - -#if !defined(Q_MOC_RUN) -#include -#include -#include -#include -#include -#include -#include - -#include -#endif - -#pragma once - -namespace AZ { class ReflectContext; } - -namespace Driller -{ - // ------------------------------------------------------------------------------------------------------------ - // Annotation - // represents one annotation returned or fed into the annotations interface. - class Annotation - { - public: - AZ_CLASS_ALLOCATOR(Annotation, AZ::SystemAllocator, 0); - Annotation(); - Annotation(AZ::s64 eventID, FrameNumberType frame, const char* text, const char* channel); - Annotation(const Annotation& other); - Annotation(Annotation&& other); - Annotation& operator=(Annotation&& other); - Annotation& operator=(const Annotation& other); - - AZ::s64 GetEventIndex() const { return m_eventIndex; } - FrameNumberType GetFrameIndex() const { return m_frameIndex; } - const AZStd::string& GetText() const { return m_text; } - const AZStd::string& GetChannel() const { return m_channel; } - const AZ::u32 GetChannelCRC() const { return m_ChannelCRC; } - - private: - AZ::s64 m_eventIndex; - FrameNumberType m_frameIndex; - AZStd::string m_text; - AZStd::string m_channel; - AZ::u32 m_ChannelCRC; - }; - - // ------------------------------------------------------------------------------------------------------------ - // AnnotationsProviderInterface - // a class which provides annotation information to the parts of the system that care about annotations. - // other parts of the system that want to know what annotations occur where will be given a pointer to this guy - // and they will ask him what they need to know. - // PLEASE NOTE: This is essentially a live cache of what's currently in the view range and is for rendering only. - // its essentially destroyed and recreated every frame. - - class AnnotationWorkspaceSettings; - class AnnotationUserSettings; - class WorkspaceSettingsProvider; - - // contains a set of channel names - typedef AZStd::unordered_set ChannelContainer; - typedef AZStd::unordered_set ChannelCRCContainer; - - class AnnotationsProvider - : public QObject - { - Q_OBJECT - public: - AZ_CLASS_ALLOCATOR(AnnotationsProvider, AZ::SystemAllocator, 0); - - typedef AZStd::vector AnnotationContainer; - typedef AnnotationContainer::const_iterator ConstAnnotationIterator; - - // graph renderers need to know what color to draw annotations, and what annotations exist given a particular event or frame: - ConstAnnotationIterator GetEnd() const; // returns the end of the vector (ie, the invalid iterator) - ConstAnnotationIterator GetFirstAnnotationForFrame(FrameNumberType frameIndex) const; // returns iterator to the first annotation thats on the frame given (or the end iterator) - ConstAnnotationIterator GetAnnotationForEvent(EventNumberType eventIndex) const; // returns iterator to the first annotation that is for that event # (or the end iterator) - - // claims ownership of the given annotation, via r-value ref. This is used during populate. - void AddAnnotation(Annotation&& target); - - // configure a channel - void ConfigureChannel(const char* channel, QColor color); - - AnnotationsProvider(QObject* pParent = NULL); - ~AnnotationsProvider(); - - // called by the main controller to sort and build the map cache. - void Finalize(); - void Clear(); - static void Reflect(AZ::ReflectContext* context); - - // --- channel management --- - const ChannelContainer& GetAllKnownChannels() const; - void GetCurrentlyEnabledChannelCRCs(ChannelCRCContainer& target) const; - void NotifyOfChannelExistence(const char* name); - void SetChannelEnabled(const char* channelName, bool enabled); - bool IsChannelEnabled(AZ::u32 channelNameCRC) const; - QColor GetColorForChannel(AZ::u32 channelNameCRC) const; // each channel has a color, this is configured externally. - void SetColorForChannel(AZ::u32 channelNameCRC, QColor newColor); // each channel has a color, this is configured externally. - void ResetColorForChannel(AZ::u32 channelNameCRC); // each channel has a color, this is configured externally. - - void LoadSettingsFromWorkspace(WorkspaceSettingsProvider* ptrProvider); - void SaveSettingsToWorkspace(WorkspaceSettingsProvider* ptrProvider); - signals: - void KnownAnnotationsChanged(); - void SelectedAnnotationsChanged(); - void AnnotationDataInvalidated(); - - protected: - AnnotationContainer m_currentAnnotations; - typedef AZStd::unordered_map EventIndexToCurrentMap; // maps from event index to index in our vector. - typedef AZStd::unordered_map FrameIndexToCurrentMap; // maps from frame index to index in our vector. - EventIndexToCurrentMap m_eventToIndex; - FrameIndexToCurrentMap m_frameToIndex; - - // housekeeping - bool m_bVectorDirty; - - AZStd::intrusive_ptr m_ptrWorkspaceSettings; // loaded from workspace and user settings. // crc(somethingelse) - AZStd::intrusive_ptr m_ptrUserSettings; // loaded only from user settings / CRC(whatever) - }; -} - -#endif//DRILLER_ANNOTATIONS_H diff --git a/Code/Tools/Standalone/Source/Driller/Annotations/AnnotationsDataView.cpp b/Code/Tools/Standalone/Source/Driller/Annotations/AnnotationsDataView.cpp deleted file mode 100644 index a928abd564..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Annotations/AnnotationsDataView.cpp +++ /dev/null @@ -1,211 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "AnnotationsDataView.hxx" -#include "AnnotationHeaderView.hxx" -#include "Annotations.hxx" - -#include -#include -#include -#include - -namespace Driller -{ - static const float adv_arrow_width = 8.0f; - - AnnotationsDataView::AnnotationsDataView(QWidget* parent) - : QWidget(parent) - , m_ptrHeaderView(nullptr) - , m_ptrAnnotations(nullptr) - { - setAttribute(Qt::WA_OpaquePaintEvent, true); - setMouseTracking(true); - } - - AnnotationsDataView::~AnnotationsDataView() - { - } - - void AnnotationsDataView::RegisterAnnotationHeaderView(AnnotationHeaderView* header, AnnotationsProvider* annotations) - { - m_ptrHeaderView = header; - m_ptrAnnotations = annotations; - } - - int AnnotationsDataView::PositionToFrame(const QPoint& pt) - { - QRect wrect = rect(); - - int frame = m_ptrHeaderView->GetState().m_FrameOffset + m_ptrHeaderView->GetState().m_FramesInView - 1; - frame = frame <= m_ptrHeaderView->GetState().m_EndFrame ? frame : m_ptrHeaderView->GetState().m_EndFrame; - - int rOffset = wrect.width() - pt.x(); - int rCell = (int)((float)rOffset / GetBarWidth()); - int retFrame = frame - rCell; - - //AZ_TracePrintf("Driller","Click Frame Raw Input = %d\n", retFrame); - - return retFrame; - } - - float AnnotationsDataView::GetBarWidth() - { - return ((float)(rect().width()) / (float)(m_ptrHeaderView->GetState().m_FramesInView)); - } - - void AnnotationsDataView::paintEvent(QPaintEvent* event) - { - (void)event; - - m_ClickableAreas.clear(); - - QPen pen; - pen.setWidth(1); - QBrush brush; - brush.setStyle(Qt::SolidPattern); - pen.setBrush(brush); - - QPainter painter(this); - painter.setRenderHint(QPainter::Antialiasing, true); - painter.setRenderHint(QPainter::TextAntialiasing, true); - - painter.setPen(pen); - painter.fillRect(rect(), Qt::black); - - int frame = m_ptrHeaderView->GetState().m_FrameOffset + m_ptrHeaderView->GetState().m_FramesInView - 1; - frame = frame <= m_ptrHeaderView->GetState().m_EndFrame ? frame : m_ptrHeaderView->GetState().m_EndFrame; - - QRect wrect = rect(); - - float barWidth = GetBarWidth(); - int barWidthHalf = (int)(barWidth / 2.0f); - - QPen fatPen(QColor(255, 255, 255, 255)); - fatPen.setWidth(2); - fatPen.setCapStyle(Qt::FlatCap); - - if (m_ptrHeaderView->GetState().m_EndFrame) - { - float rightEdgeOfBar = (float)wrect.right(); - float leftEdgeOfBar = rightEdgeOfBar - barWidth; - - while (frame >= 0 && rightEdgeOfBar >= wrect.left()) - { - int actualLeftEdge = (int)floorf(leftEdgeOfBar); - - float center = (float)(actualLeftEdge + barWidthHalf) + 0.5f; - - // annotations? - AnnotationsProvider::ConstAnnotationIterator it = m_ptrAnnotations->GetFirstAnnotationForFrame(frame); - AnnotationsProvider::ConstAnnotationIterator endIt = m_ptrAnnotations->GetEnd(); - - while ((it != endIt) && (it->GetFrameIndex() == frame)) - { - QPainterPath newPath; - QPolygonF newPolygon; - newPolygon << QPointF(center - adv_arrow_width, 1.0f) << QPointF(center, wrect.height() - 1.0f) << QPointF(center + adv_arrow_width, 1.0f); - newPath.addPolygon(newPolygon); - newPath.closeSubpath(); - - if (m_eventsToHighlight.find(it->GetEventIndex()) != m_eventsToHighlight.end()) - { - painter.setPen(fatPen); - painter.setBrush(m_ptrAnnotations->GetColorForChannel(it->GetChannelCRC())); - } - else - { - painter.setPen(QColor(0, 0, 0, 0)); - painter.setBrush(m_ptrAnnotations->GetColorForChannel(it->GetChannelCRC())); - } - painter.drawPath(newPath); - m_ClickableAreas[it->GetEventIndex()] = newPath; - ++it; - } - - --frame; - rightEdgeOfBar -= barWidth; - leftEdgeOfBar -= barWidth; - } - } - } - - void AnnotationsDataView::mouseMoveEvent(QMouseEvent* event) - { - AZStd::unordered_set newEventsToHighlight; - - for (auto it = m_ClickableAreas.begin(); it != m_ClickableAreas.end(); ++it) - { - if (it->second.contains(event->pos())) - { - auto annot = m_ptrAnnotations->GetAnnotationForEvent(it->first); - if (annot != m_ptrAnnotations->GetEnd()) - { - newEventsToHighlight.insert(annot->GetEventIndex()); - emit InformOfMouseOverAnnotation(*annot); - } - } - } - - bool doUpdate = false; - // did our highlight change? - for (auto it = newEventsToHighlight.begin(); it != newEventsToHighlight.end(); ++it) - { - if (m_eventsToHighlight.find(*it) == m_eventsToHighlight.end()) - { - doUpdate = true; - break; - } - } - - // did our highlight change? - if (!doUpdate) - { - for (auto it = m_eventsToHighlight.begin(); it != m_eventsToHighlight.end(); ++it) - { - if (newEventsToHighlight.find(*it) == newEventsToHighlight.end()) - { - doUpdate = true; - break; - } - } - } - - if (doUpdate) - { - newEventsToHighlight.swap(m_eventsToHighlight); - update(); - } - - // find the first annotation within a margin: - event->ignore(); - } - - void AnnotationsDataView::mousePressEvent(QMouseEvent* event) - { - for (auto it = m_ClickableAreas.begin(); it != m_ClickableAreas.end(); ++it) - { - if (it->second.contains(event->pos())) - { - auto annot = m_ptrAnnotations->GetAnnotationForEvent(it->first); - if (annot != m_ptrAnnotations->GetEnd()) - { - emit InformOfClickAnnotation(*annot); - } - } - } - event->ignore(); - } - - void AnnotationsDataView::mouseReleaseEvent(QMouseEvent* event) - { - event->ignore(); - } -} - -#include diff --git a/Code/Tools/Standalone/Source/Driller/Annotations/AnnotationsDataView.hxx b/Code/Tools/Standalone/Source/Driller/Annotations/AnnotationsDataView.hxx deleted file mode 100644 index d6da50e0c0..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Annotations/AnnotationsDataView.hxx +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef ANNOTATIONS_DATA_VIEW -#define ANNOTATIONS_DATA_VIEW - -#if !defined(Q_MOC_RUN) -#include -#include -#include -#include - -#include -#endif - -namespace Driller -{ - class AnnotationsProvider; - class Annotation; - class AnnotationHeaderView; - /** Annotations Data View just shows the annotations that are available in a horizontal strip with indicators for easy clickability. - */ - - class AnnotationsDataView : public QWidget - { - Q_OBJECT; - public: - AZ_CLASS_ALLOCATOR(AnnotationsDataView, AZ::SystemAllocator, 0); - AnnotationsDataView(QWidget* parent = nullptr); - virtual ~AnnotationsDataView(); - - void RegisterAnnotationHeaderView(AnnotationHeaderView* header, AnnotationsProvider* annotations); - - int PositionToFrame( const QPoint &pt ); - - float GetBarWidth(); - - virtual void paintEvent( QPaintEvent *event ); - virtual void mouseMoveEvent( QMouseEvent *event ); - virtual void mousePressEvent( QMouseEvent *event ); - virtual void mouseReleaseEvent( QMouseEvent *event ); - -signals: - void InformOfMouseOverAnnotation(const Annotation& annotation); - void InformOfClickAnnotation(const Annotation& annotation); - private: - typedef AZStd::unordered_map EventIndexToClickablePath; - EventIndexToClickablePath m_ClickableAreas; - AZStd::unordered_set m_eventsToHighlight; - - AnnotationsProvider *m_ptrAnnotations; - AnnotationHeaderView *m_ptrHeaderView; - }; -} - -#endif // ANNOTATIONS_DATA_VIEW diff --git a/Code/Tools/Standalone/Source/Driller/Annotations/AnnotationsDataView_Events.cpp b/Code/Tools/Standalone/Source/Driller/Annotations/AnnotationsDataView_Events.cpp deleted file mode 100644 index b107e6be23..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Annotations/AnnotationsDataView_Events.cpp +++ /dev/null @@ -1,250 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "AnnotationsDataView_Events.hxx" -#include "AnnotationsHeaderView_Events.hxx" -#include "Annotations.hxx" -#include - -#include -#include -#include -#include - -namespace Driller -{ - static const float adv_events_arrow_width = 8.0f; - - AnnotationsDataView_Events::AnnotationsDataView_Events(AnnotationHeaderView_Events* header, AnnotationsProvider* annotations) - : QWidget(header) - , m_ptrHeaderView(header) - , m_ptrAnnotations(annotations) - , m_ptrAxis(NULL) - { - setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); - setFixedHeight(18); - setAutoFillBackground(false); - setAttribute(Qt::WA_OpaquePaintEvent, true); - setMouseTracking(true); - m_CurrentFrameNumber = 0; - } - - void AnnotationsDataView_Events::AttachToAxis(Charts::Axis* pAxis) - { - if (m_ptrAxis) - { - disconnect(m_ptrAxis, SIGNAL(destroyed(QObject*)), this, SLOT(OnAxisDestroyed())); - disconnect(m_ptrAxis, SIGNAL(Invalidated()), this, SLOT(OnAxisInvalidated())); - } - - m_ptrAxis = pAxis; - if (pAxis) - { - connect(m_ptrAxis, SIGNAL(destroyed(QObject*)), this, SLOT(OnAxisDestroyed())); - connect(m_ptrAxis, SIGNAL(Invalidated()), this, SLOT(OnAxisInvalidated())); - } - } - - void AnnotationsDataView_Events::OnAxisDestroyed() - { - m_ptrAxis = NULL; - update(); - } - - void AnnotationsDataView_Events::OnAxisInvalidated() - { - update(); - } - - AnnotationsDataView_Events::~AnnotationsDataView_Events() - { - } - - void AnnotationsDataView_Events::paintEvent(QPaintEvent* event) - { - (void)event; - - m_ClickableAreas.clear(); - - // scan for annotations - - - - // fill with black - QPainter painter(this); - painter.fillRect(rect(), Qt::black); - - if (!m_ptrAxis) - { - return; - } - - if (!m_ptrAxis->GetValid()) - { - return; - } - - QRectF drawRange = rect(); - // adjust for inset: - - drawRange.adjust(2.0f, 0.0f, -4.0f, 0.0f); - float leftEdge = (float)drawRange.left(); - float drawRangeWidth = (float)drawRange.width(); - - AZ::s64 eventIndexStart = (AZ::s64)m_ptrAxis->GetWindowMin(); - AZ::s64 eventIndexEnd = (AZ::s64)m_ptrAxis->GetWindowMax() + 1; - float eventIndexRange = ((float)m_ptrAxis->GetWindowMax() - (float)m_ptrAxis->GetWindowMin()); // this is the domain range - - - if (eventIndexRange <= 0.0f) - { - return; - } - - float oneEventWidthInPixels = drawRangeWidth / eventIndexRange; - float halfEventWidth = oneEventWidthInPixels * 0.5f; - - // find the first event within that range: - QPen fatPen(QColor(255, 255, 255, 255)); - fatPen.setWidth(2); - fatPen.setCapStyle(Qt::FlatCap); - - AnnotationsProvider::ConstAnnotationIterator it = m_ptrAnnotations->GetFirstAnnotationForFrame(m_CurrentFrameNumber); - AnnotationsProvider::ConstAnnotationIterator endIt = m_ptrAnnotations->GetEnd(); - - // now keep going until we hit the end of the range: - while (it != endIt) - { - if (it->GetEventIndex() >= eventIndexEnd) - { - break; - } - - if (it->GetEventIndex() < eventIndexStart) - { - ++it; - continue; // we're within the zoom - } - - // transform that event ID into the window domain: - - - float eventRatio = ((float)it->GetEventIndex() - m_ptrAxis->GetWindowMin()) / eventIndexRange; - - float center = floorf(leftEdge + (drawRangeWidth * eventRatio)); - - center += (float)drawRange.left(); - center += halfEventWidth; - - QPainterPath newPath; - QPolygonF newPolygon; - newPolygon << QPointF(center - adv_events_arrow_width, 1.0f) << QPointF(center, drawRange.height() - 1.0f) << QPointF(center + adv_events_arrow_width, 1.0f); - newPath.addPolygon(newPolygon); - newPath.closeSubpath(); - - if (m_eventsToHighlight.find(it->GetEventIndex()) != m_eventsToHighlight.end()) - { - painter.setPen(fatPen); - painter.setBrush(m_ptrAnnotations->GetColorForChannel(it->GetChannelCRC())); - } - else - { - painter.setPen(QColor(0, 0, 0, 0)); - painter.setBrush(m_ptrAnnotations->GetColorForChannel(it->GetChannelCRC())); - } - painter.drawPath(newPath); - m_ClickableAreas[it->GetEventIndex()] = newPath; - ++it; - } - } - - void AnnotationsDataView_Events::mouseMoveEvent(QMouseEvent* event) - { - AZStd::unordered_set newEventsToHighlight; - - for (auto it = m_ClickableAreas.begin(); it != m_ClickableAreas.end(); ++it) - { - if (it->second.contains(event->pos())) - { - auto annot = m_ptrAnnotations->GetAnnotationForEvent(it->first); - if (annot != m_ptrAnnotations->GetEnd()) - { - newEventsToHighlight.insert(annot->GetEventIndex()); - emit InformOfMouseOverAnnotation(*annot); - } - } - } - - bool doUpdate = false; - // did our highlight change? - for (auto it = newEventsToHighlight.begin(); it != newEventsToHighlight.end(); ++it) - { - if (m_eventsToHighlight.find(*it) == m_eventsToHighlight.end()) - { - doUpdate = true; - break; - } - } - - // did our highlight change? - if (!doUpdate) - { - for (auto it = m_eventsToHighlight.begin(); it != m_eventsToHighlight.end(); ++it) - { - if (newEventsToHighlight.find(*it) == newEventsToHighlight.end()) - { - doUpdate = true; - break; - } - } - } - - if (doUpdate) - { - newEventsToHighlight.swap(m_eventsToHighlight); - update(); - } - - // find the first annotation within a margin: - event->ignore(); - } - - void AnnotationsDataView_Events::mousePressEvent(QMouseEvent* event) - { - for (auto it = m_ClickableAreas.begin(); it != m_ClickableAreas.end(); ++it) - { - if (it->second.contains(event->pos())) - { - auto annot = m_ptrAnnotations->GetAnnotationForEvent(it->first); - if (annot != m_ptrAnnotations->GetEnd()) - { - emit InformOfClickAnnotation(*annot); - } - } - } - event->ignore(); - } - - - void AnnotationsDataView_Events::mouseReleaseEvent(QMouseEvent* event) - { - event->ignore(); - } - - void AnnotationsDataView_Events::OnScrubberFrameUpdate(FrameNumberType newFramenumber) - { - if (newFramenumber != m_CurrentFrameNumber) - { - m_CurrentFrameNumber = newFramenumber; - // we don't update here because we wait for the new range to be set - //update(); - } - } -} - -#include diff --git a/Code/Tools/Standalone/Source/Driller/Annotations/AnnotationsDataView_Events.hxx b/Code/Tools/Standalone/Source/Driller/Annotations/AnnotationsDataView_Events.hxx deleted file mode 100644 index 4a9c8a7810..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Annotations/AnnotationsDataView_Events.hxx +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef ANNOTATIONS_DATA_VIEW_EVENTS_HXX -#define ANNOTATIONS_DATA_VIEW_EVENTS_HXX - -#if !defined(Q_MOC_RUN) -#include -#include -#include -#include - -#include - -#include "Source/Driller/DrillerDataTypes.h" -#endif - -namespace Charts -{ - class Axis; -} - -namespace Driller -{ - class AnnotationsProvider; - class Annotation; - class AnnotationHeaderView_Events; - /** Annotations Data View just shows the annotations that are available in a horizontal strip with indicators for easy clickability. - * This flavor of the view is supposed to operate on individual events instead of individual frames and is supposed to sit above the event driller track - * But it can actually work on any track thats willing to provide it with an axis. - */ - - class AnnotationsDataView_Events : public QWidget - { - Q_OBJECT; - public: - AZ_CLASS_ALLOCATOR(AnnotationsDataView_Events, AZ::SystemAllocator, 0); - AnnotationsDataView_Events( AnnotationHeaderView_Events* header, AnnotationsProvider *annotations ); - virtual ~AnnotationsDataView_Events(); - - void AttachToAxis(Charts::Axis *pAxis); - - virtual void paintEvent( QPaintEvent *event ); - virtual void mouseMoveEvent( QMouseEvent *event ); - virtual void mousePressEvent( QMouseEvent *event ); - virtual void mouseReleaseEvent( QMouseEvent *event ); - - signals: - void InformOfMouseOverAnnotation(const Annotation& annotation); - void InformOfClickAnnotation(const Annotation& annotation); - private: - typedef AZStd::unordered_map EventIndexToClickablePath; - - EventIndexToClickablePath m_ClickableAreas; - AZStd::unordered_set m_eventsToHighlight; - QPainter *m_Painter; - Charts::Axis *m_ptrAxis; - - AnnotationsProvider *m_ptrAnnotations; - AnnotationHeaderView_Events *m_ptrHeaderView; - FrameNumberType m_CurrentFrameNumber; - - const Annotation* GetNearestAnnotationToMousePoint(QPoint pos) const; - - public slots: - void OnAxisInvalidated(); - void OnAxisDestroyed(); - void OnScrubberFrameUpdate(FrameNumberType newFrameNumber); - }; -} - -#endif // ANNOTATIONS_DATA_VIEW diff --git a/Code/Tools/Standalone/Source/Driller/Annotations/AnnotationsHeaderView_Events.cpp b/Code/Tools/Standalone/Source/Driller/Annotations/AnnotationsHeaderView_Events.cpp deleted file mode 100644 index f8db607b51..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Annotations/AnnotationsHeaderView_Events.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "AnnotationsHeaderView_Events.hxx" -#include "AnnotationsDataView_Events.hxx" -#include "Annotations.hxx" -#include - -namespace Driller -{ - static const int k_eventContractedSize = 18; - - AnnotationHeaderView_Events::AnnotationHeaderView_Events(QWidget* parent, Qt::WindowFlags flags) - : QWidget(parent, flags) - , m_ptrAnnotations(NULL) - { - this->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); - this->setFixedHeight(k_eventContractedSize); - this->setAutoFillBackground(true); - - QHBoxLayout* mainLayout = new QHBoxLayout(this); - this->setLayout(mainLayout); - - mainLayout->setContentsMargins(0, 0, 0, 0); - mainLayout->setSpacing(0); - } - - void AnnotationHeaderView_Events::OnScrubberFrameUpdate(FrameNumberType newFrame) - { - if (m_ptrDataView) - { - m_ptrDataView->OnScrubberFrameUpdate(newFrame); - } - } - - QSize AnnotationHeaderView_Events::sizeHint() const - { - return QSize(0, k_eventContractedSize); - } - - void AnnotationHeaderView_Events::ControllerSizeChanged(QSize newSize) - { - (void)newSize; - } - - AnnotationHeaderView_Events::~AnnotationHeaderView_Events() - { - } - - void AnnotationHeaderView_Events::AttachToAxis(AnnotationsProvider* ptrAnnotations, Charts::Axis* target) - { - m_ptrAnnotations = ptrAnnotations; - m_ptrDataView = aznew AnnotationsDataView_Events(this, ptrAnnotations); - - connect(m_ptrDataView, SIGNAL(InformOfMouseOverAnnotation(const Annotation&)), this, SIGNAL(InformOfMouseOverAnnotation(const Annotation&))); - connect(m_ptrDataView, SIGNAL(InformOfClickAnnotation(const Annotation&)), this, SIGNAL(InformOfClickAnnotation(const Annotation&))); - connect(m_ptrAnnotations, SIGNAL(AnnotationDataInvalidated()), this, SLOT(RefreshView())); - - layout()->addWidget(m_ptrDataView); - m_ptrDataView->AttachToAxis(target); - } - - void AnnotationHeaderView_Events::RefreshView() - { - m_ptrDataView->update(); - } -} - -#include diff --git a/Code/Tools/Standalone/Source/Driller/Annotations/AnnotationsHeaderView_Events.hxx b/Code/Tools/Standalone/Source/Driller/Annotations/AnnotationsHeaderView_Events.hxx deleted file mode 100644 index 98eb6246d6..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Annotations/AnnotationsHeaderView_Events.hxx +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef ANNOTATION_HEADER_VIEW_EVENTS_HXX -#define ANNOTATION_HEADER_VIEW_EVENTS_HXX - -#if !defined(Q_MOC_RUN) -#include -#include -#include -#include - -#include "Source/Driller/DrillerDataTypes.h" -#endif - -namespace Charts -{ - class Axis; -} - -namespace Driller -{ - class AnnotationsProvider; - class AnnotationsDataView_Events; - class Annotation; - - /** This version of the annotations header view sits above the per-frame events widget (near the bottom of hte main view). - * Its job is to show annotations that happen within a single frame (on an event-by-event basis!) - * It can actually work on any track thats willing to provide it with an axis. - */ - - class AnnotationHeaderView_Events : public QWidget - { - Q_OBJECT; - public: - AZ_CLASS_ALLOCATOR(AnnotationHeaderView_Events,AZ::SystemAllocator,0); - AnnotationHeaderView_Events(QWidget* parent = NULL, Qt::WindowFlags flags = Qt::WindowFlags()); - virtual ~AnnotationHeaderView_Events(void); - - void AttachToAxis(AnnotationsProvider* ptrAnnotations, Charts::Axis *target); -signals: - void InformOfMouseOverAnnotation(const Annotation& annotation); - void InformOfClickAnnotation(const Annotation& annotation); - -public slots: - void RefreshView(); - void ControllerSizeChanged(QSize newSize); - void OnScrubberFrameUpdate(FrameNumberType newFrame); - private: - AnnotationsProvider *m_ptrAnnotations; - AnnotationsDataView_Events *m_ptrDataView; - - virtual QSize sizeHint() const; - - }; - -} - - -#endif // ANNOTATION_HEADER_VIEW_HXX diff --git a/Code/Tools/Standalone/Source/Driller/Annotations/ConfigureAnnotationsDialog.ui b/Code/Tools/Standalone/Source/Driller/Annotations/ConfigureAnnotationsDialog.ui deleted file mode 100644 index 185f7b9eba..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Annotations/ConfigureAnnotationsDialog.ui +++ /dev/null @@ -1,151 +0,0 @@ - - - configureAnnotationsDialog - - - - 0 - 0 - 446 - 168 - - - - Configure Annotations - - - true - - - false - - - - 2 - - - 4 - - - 4 - - - 4 - - - 4 - - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Display Annotations From the Selected Features - - - - - - - Qt::Horizontal - - - QSizePolicy::MinimumExpanding - - - - 5 - 0 - - - - - - - - - 0 - 0 - - - - - 200 - 0 - - - - - 16777215 - 16777215 - - - - Search Annotations - - - - - - - - - - false - - - true - - - false - - - false - - - true - - - 60 - - - true - - - true - - - false - - - 30 - - - - - - - - diff --git a/Code/Tools/Standalone/Source/Driller/Annotations/ConfigureAnnotationsWindow.cpp b/Code/Tools/Standalone/Source/Driller/Annotations/ConfigureAnnotationsWindow.cpp deleted file mode 100644 index b66ffa1047..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Annotations/ConfigureAnnotationsWindow.cpp +++ /dev/null @@ -1,248 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include -#include "ConfigureAnnotationsWindow.hxx" -#include -#include -#include -#include -#include - -#include -#include -#include - -namespace Driller -{ - ////////////////////////////// - // ConfigureAnnotationsModel - ////////////////////////////// - int ConfigureAnnotationsModel::rowCount(const QModelIndex& index) const - { - if (index == QModelIndex()) - { - return (int)m_cache.size(); - } - return 0; - } - - int ConfigureAnnotationsModel::columnCount(const QModelIndex& index) const - { - (void)index; - return 1; - } - - Qt::ItemFlags ConfigureAnnotationsModel::flags(const QModelIndex& index) const - { - if (index == QModelIndex()) - { - return Qt::ItemFlags(); - } - - if (index.column() == 0) - { - return Qt::ItemIsUserCheckable | Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable; - } - - return Qt::ItemIsSelectable | Qt::ItemIsEnabled; - } - - bool ConfigureAnnotationsModel::setData(const QModelIndex& index, const QVariant& value, int role) - { - if (role == Qt::CheckStateRole) - { - Qt::CheckState newState = (Qt::CheckState)value.toInt(); - if (index.column() == 0) - { - if (index.row() < (int)m_cache.size()) - { - Qt::CheckState oldEnabled = m_ptrProvider->IsChannelEnabled(AZ::Crc32(m_cache[index.row()].toUtf8().data())) ? Qt::Checked : Qt::Unchecked; - - if (newState != oldEnabled) - { - m_ptrProvider->SetChannelEnabled(m_cache[index.row()].toUtf8().data(), newState == Qt::Checked ? true : false); - return true; - } - } - } - } - else if (role == AzToolsFramework::ColorPickerDelegate::COLOR_PICKER_ROLE) - { - QColor newColor = qvariant_cast(value); - AZ::u32 crcOfChannel = AZ::Crc32(m_cache[index.row()].toUtf8().data()); - m_ptrProvider->SetColorForChannel(crcOfChannel, newColor); - m_cachedColorIcons[index.row()] = CreatePixmapForColor(newColor); - } - return false; - } - - QVariant ConfigureAnnotationsModel::data(const QModelIndex& index, int role) const - { - if (index == QModelIndex()) - { - return QVariant(); - } - - if (index.column() == 0) - { - switch (role) - { - case Qt::CheckStateRole: - { - AZ::u32 crcvalue = AZ::Crc32(m_cache[index.row()].toUtf8().data()); - return QVariant(m_ptrProvider->IsChannelEnabled(crcvalue) ? QVariant(Qt::Checked) : QVariant(Qt::Unchecked)); - } - case Qt::DecorationRole: - { - return m_cachedColorIcons[index.row()]; - } - case Qt::DisplayRole: - { - return m_cache[index.row()]; - } - case AzToolsFramework::ColorPickerDelegate::COLOR_PICKER_ROLE: - { - AZ::u32 crcvalue = AZ::Crc32(m_cache[index.row()].toUtf8().data()); - QColor channelColor = m_ptrProvider->GetColorForChannel(crcvalue); - return QVariant(channelColor); - } - } - } - - return QVariant(); - } - - QVariant ConfigureAnnotationsModel::headerData (int section, Qt::Orientation orientation, int role) const - { - (void)orientation; - - if (role == Qt::DisplayRole) - { - switch (section) - { - case 0: - return QVariant(tr("Annotation Type")); - break; - } - - return QVariant(); - } - else if (role == Qt::TextAlignmentRole) - { - if (section == 0) - { - return QVariant(Qt::AlignVCenter | Qt::AlignLeft); - } - } - - return QVariant(); - } - - QPixmap ConfigureAnnotationsModel::CreatePixmapForColor(QColor color) - { - QPixmap pixmap(16, 16); - { - QPainter painter(&pixmap); - painter.fillRect(0, 0, 16, 16, Qt::black); - painter.fillRect(1, 1, 15, 15, color); - } - return pixmap; - } - - - void ConfigureAnnotationsModel::Recache() - { - beginResetModel(); - m_cache.clear(); - m_cachedColorIcons.clear(); - AZStd::for_each(m_ptrProvider->GetAllKnownChannels().begin(), m_ptrProvider->GetAllKnownChannels().end(), - [this](const AZStd::string& value) - { - m_cache.push_back(QString::fromUtf8(value.c_str())); - QColor channelColor = m_ptrProvider->GetColorForChannel(AZ::Crc32(value.c_str())); - - m_cachedColorIcons.push_back(CreatePixmapForColor(channelColor)); - }); - endResetModel(); - } - - ConfigureAnnotationsModel::ConfigureAnnotationsModel(AnnotationsProvider* ptrProvider, QObject* pParent) - : QAbstractTableModel(pParent) - { - m_ptrProvider = ptrProvider; - connect(ptrProvider, &AnnotationsProvider::KnownAnnotationsChanged, this, &ConfigureAnnotationsModel::Recache); - Recache(); - } - - ConfigureAnnotationsModel::~ConfigureAnnotationsModel() - { - } - - /////////////////////////////// - // ConfigureAnnotationsWindow - /////////////////////////////// - - ConfigureAnnotationsWindow::ConfigureAnnotationsWindow(QWidget* pParent /* = NULL */) - : QDialog(pParent) - , m_proxyModel(nullptr) - { - m_ptrLoadedUI = azcreate(Ui::configureAnnotationsDialog, ()); - m_ptrLoadedUI->setupUi(this); - } - - ConfigureAnnotationsWindow::~ConfigureAnnotationsWindow() - { - AZStd::intrusive_ptr pState = AZ::UserSettings::CreateFind(AZ_CRC("CONFIGURE ANNOTATIONS WINDOW", 0x581c6568), AZ::UserSettings::CT_GLOBAL); - if (pState) - { - pState->CaptureGeometry(this); - } - - azdestroy(m_ptrLoadedUI); - } - - void ConfigureAnnotationsWindow::Initialize(AnnotationsProvider* ptrProvider) - { - m_ptrProvider = ptrProvider; - m_ptrModel = aznew ConfigureAnnotationsModel(ptrProvider, this); - - m_proxyModel = new QSortFilterProxyModel(this); - m_proxyModel->setDynamicSortFilter(false); - m_proxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive); - m_proxyModel->setSortCaseSensitivity(Qt::CaseInsensitive); - m_proxyModel->setSourceModel(m_ptrModel); - - m_ptrLoadedUI->statusTable->setSelectionBehavior(QAbstractItemView::SelectRows); - m_ptrLoadedUI->statusTable->setModel(m_proxyModel); - m_ptrLoadedUI->statusTable->setItemDelegate(aznew AzToolsFramework::ColorPickerDelegate(this)); - m_ptrLoadedUI->statusTable->horizontalHeader()->setSortIndicator(0, Qt::AscendingOrder); - - connect(m_ptrLoadedUI->searchField, SIGNAL(textChanged(const QString&)), this, SLOT(OnFilterChanged(const QString&))); - - AZStd::intrusive_ptr windowState = AZ::UserSettings::Find(AZ_CRC("CONFIGURE ANNOTATIONS WINDOW", 0x581c6568), AZ::UserSettings::CT_GLOBAL); - - if (windowState) - { - windowState->RestoreGeometry(this); - } - } - - void ConfigureAnnotationsWindow::OnFilterChanged(const QString& filter) - { - m_proxyModel->setFilterFixedString(filter); - } - - void ConfigureAnnotationsWindow::closeEvent (QCloseEvent* e) - { - e->accept(); - deleteLater(); - } -} - -#include diff --git a/Code/Tools/Standalone/Source/Driller/Annotations/ConfigureAnnotationsWindow.hxx b/Code/Tools/Standalone/Source/Driller/Annotations/ConfigureAnnotationsWindow.hxx deleted file mode 100644 index 7c9c91203f..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Annotations/ConfigureAnnotationsWindow.hxx +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef CONFIGURE_ANNOTATIONS_WINDOW_H -#define CONFIGURE_ANNOTATIONS_WINDOW_H - -#pragma once - -#if !defined(Q_MOC_RUN) -#include -#include -#include -#include -#endif - -class QSortFilterProxyModel; - -namespace Ui -{ - class configureAnnotationsDialog; -} - -namespace Driller -{ - class AnnotationsProvider; - class ConfigureAnnotationsModel; - - class ConfigureAnnotationsWindow : public QDialog - { - Q_OBJECT - public: - AZ_CLASS_ALLOCATOR(ConfigureAnnotationsWindow, AZ::SystemAllocator, 0); - - ConfigureAnnotationsWindow(QWidget *pParent = NULL); - virtual ~ConfigureAnnotationsWindow(); - - void Initialize(AnnotationsProvider* ptrProvider); - - public slots: - void OnFilterChanged(const QString&); - - protected: - Ui::configureAnnotationsDialog* m_ptrLoadedUI; - QSortFilterProxyModel* m_proxyModel; - ConfigureAnnotationsModel* m_ptrModel; - AnnotationsProvider* m_ptrProvider; - virtual void closeEvent ( QCloseEvent * e ); - }; - - - class ConfigureAnnotationsModel : public QAbstractTableModel - { - Q_OBJECT; - public: - AZ_CLASS_ALLOCATOR(ConfigureAnnotationsModel, AZ::SystemAllocator, 0); - - //////////////////////////////////////////////////////////////////////////////////////////////// - // QAbstractTableModel - int rowCount(const QModelIndex& index = QModelIndex()) const override; - int columnCount(const QModelIndex& index = QModelIndex()) const override; - Qt::ItemFlags flags(const QModelIndex &index) const override; - - QVariant data(const QModelIndex& index, int role) const override; - bool setData(const QModelIndex &index, const QVariant &value, int role) override; - QVariant headerData ( int section, Qt::Orientation orientation, int role ) const override; - //////////////////////////////////////////////////////////////////////////////////////////////// - - ConfigureAnnotationsModel(AnnotationsProvider* ptrProvider, QObject *pParent = NULL); - - virtual ~ConfigureAnnotationsModel(); - - private: - AnnotationsProvider* m_ptrProvider; - AZStd::vector m_cache; - AZStd::vector m_cachedColorIcons; - - QPixmap CreatePixmapForColor(QColor color); - - private slots: - void Recache(); - }; - - -} - -#endif //CONFIGURE_ANNOTATIONS_WINDOW_H diff --git a/Code/Tools/Standalone/Source/Driller/AreaChart.cpp b/Code/Tools/Standalone/Source/Driller/AreaChart.cpp deleted file mode 100644 index a0eccc7d45..0000000000 --- a/Code/Tools/Standalone/Source/Driller/AreaChart.cpp +++ /dev/null @@ -1,636 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ -#include -#include - -#include - -#include -#include - -#include -#include -#include - -namespace AreaChart -{ - /////////////// - // LineSeries - /////////////// - - LineSeries::LineSeries(AreaChart* owner, size_t seriesId, const QString& name, const QColor& color, size_t seriesSize) - : m_owner(owner) - , m_seriesId(seriesId) - , m_name(name) - , m_color(color) - , m_highlighted(false) - , m_enabled(true) - , m_hasData(false) - { - if (seriesSize > 0) - { - m_linePoints.reserve(seriesSize); - } - } - - LineSeries::~LineSeries() - { - } - - size_t LineSeries::GetSeriesId() const - { - return m_seriesId; - } - - void LineSeries::AddPoint(const LinePoint& linePoint) - { - // Handle simple case first - if (m_linePoints.empty() || m_linePoints.back().m_position < linePoint.m_position) - { - m_hasData |= linePoint.m_value > 0; - m_linePoints.push_back(linePoint); - } - else - { - // TODO: Handle the case of out of order insertion - AZ_Error("LineSeries",false,"Trying to add series point out of order. Unsupported behavior"); - } - } - - void LineSeries::Reset() - { - m_linePoints.clear(); - } - - bool LineSeries::IsHighlighted() const - { - return m_highlighted; - } - - bool LineSeries::IsEnabled() const - { - return m_enabled && m_hasData; - } - - const QColor& LineSeries::GetColor() const - { - return m_color; - } - - void LineSeries::ResetPainterPath() - { - // Kind of silly that QPainterPath doesn't have a clear. - m_painterPath = QPainterPath(); - } - - QPainterPath& LineSeries::GetPainterPath() - { - return m_painterPath; - } - - const QPainterPath& LineSeries::GetPainterPath() const - { - return m_painterPath; - } - - ////////////// - // AreaChart - ////////////// - - const size_t AreaChart::k_invalidSeriesId = static_cast(-1); - - AreaChart::AreaChart(QWidget* parent) - : QWidget(parent) - , m_inspectionSeries(k_invalidSeriesId) - , m_sizingDirty(true) - , m_regenGraph(true) - , m_axisMin(0) - , m_horizontalAxis(nullptr) - , m_verticalAxis(nullptr) - , m_insetTop(16) - , m_insetBottom(24) - , m_insetLeft(56) - , m_insetRight(16) - , m_widgetBackground(32,32,32,255) - , m_graphBackground(Qt::black) - { - setStyleSheet(QString("QToolTip { border: 1px solid white; padding: 1px; background: black; color: white; }")); - - m_axisMax = m_axisMin; - } - - AreaChart::~AreaChart() - { - delete m_horizontalAxis; - delete m_verticalAxis; - } - - bool AreaChart::IsMouseInspectionEnabled() const - { - return hasMouseTracking(); - } - - void AreaChart::EnableMouseInspection(bool enabled) - { - setMouseTracking(enabled); - } - - void AreaChart::SetMinimumValueRange(unsigned int value) - { - m_axisMin = value; - - m_axisMax = m_axisMin; - - for (auto& sizingPair : m_maxSizing) - { - if (sizingPair.second > m_axisMax) - { - m_axisMax = sizingPair.second; - } - } - - m_regenGraph = true; - update(); - } - - void AreaChart::ResetChart() - { - m_axisMax = m_axisMin; - m_maxSizing.clear(); - m_lineSeries.clear(); - m_markers.clear(); - - m_sizingDirty = true; - m_regenGraph = true; - - update(); - } - - void AreaChart::ConfigureVerticalAxis(QString label, unsigned int minimumHeight) - { - SetMinimumValueRange(minimumHeight); - - if (m_verticalAxis == nullptr) - { - m_verticalAxis = aznew Charts::Axis(); - } - - if (m_verticalAxis) - { - m_verticalAxis->SetLabel(label); - m_verticalAxis->SetAxisRange(0.0f, static_cast(m_axisMax)); - } - } - - void AreaChart::ConfigureHorizontalAxis(QString label, int minimum, int maximum) - { - if (m_horizontalAxis == nullptr) - { - m_horizontalAxis = aznew Charts::Axis(); - } - - if (m_horizontalAxis) - { - m_horizontalAxis->SetLabel(label); - m_horizontalAxis->SetAxisRange(static_cast(minimum), static_cast(maximum)); - } - } - - void AreaChart::ResetSeries(AZ::u32 seriesId) - { - if (!IsValidSeriesId(seriesId)) - { - return; - } - - m_lineSeries[seriesId].Reset(); - } - - size_t AreaChart::CreateSeries(const QString& name, const QColor& color, size_t size) - { - size_t seriesKey = m_lineSeries.size(); - AZ_Error("AreaChart", seriesKey != k_invalidSeriesId,"Trying to use invalid key for series Id. Too many Area Series created."); - - if (size <= 0) - { - size = m_maxSizing.size(); - } - - m_lineSeries.emplace_back(this, seriesKey, name, color, size); - - return seriesKey; - } - - void AreaChart::AddPoint(size_t seriesId, int position, unsigned int value) - { - AZ_PROFILE_FUNCTION(AzToolsFramework); - LinePoint linePoint(position,value); - AddPoint(seriesId,linePoint); - } - - void AreaChart::AddPoint(size_t seriesId, const LinePoint& linePoint) - { - AZ_PROFILE_FUNCTION(AzToolsFramework); - if (!IsValidSeriesId(seriesId)) - { - AZ_Error("AreaChart", false, "Invalid SeriesId given."); - return; - } - - LineSeries& lineSeries = m_lineSeries[seriesId]; - - lineSeries.AddPoint(linePoint); - - auto sizingIter = m_maxSizing.find(linePoint.m_position); - - if (sizingIter != m_maxSizing.end()) - { - sizingIter->second += linePoint.m_value; - - if (sizingIter->second > m_axisMax) - { - m_axisMax = sizingIter->second; - } - } - else - { - m_maxSizing[linePoint.m_position] = linePoint.m_value; - - if (linePoint.m_value > m_axisMax) - { - m_axisMax = linePoint.m_value; - } - } - - m_regenGraph = true; - update(); - } - - void AreaChart::SetSeriesHighlight(size_t seriesId, bool highlighted) - { - if (IsValidSeriesId(seriesId)) - { - LineSeries& lineSeries = m_lineSeries[seriesId]; - - lineSeries.m_highlighted = highlighted; - - update(); - } - } - - void AreaChart::SetSeriesEnabled(size_t seriesId, bool enabled) - { - if (IsValidSeriesId(seriesId)) - { - LineSeries& lineSeries = m_lineSeries[seriesId]; - - lineSeries.m_enabled = enabled; - - // Need to regen our graph data here, since we've removed one from the listing - m_regenGraph = true; - update(); - } - } - - void AreaChart::AddMarker(Charts::AxisType axis, int position, const QColor& color) - { - m_markers.emplace_back(axis, position, color); - } - - void AreaChart::mouseMoveEvent(QMouseEvent* mouseEvent) - { - if (IsMouseInspectionEnabled()) - { - QPoint mousePos = mouseEvent->pos(); - size_t hoveredArea = k_invalidSeriesId; - - if (m_graphRect.contains(mousePos) && m_hitAreas.size() > 0) - { - int offset = mousePos.x() - m_graphRect.left(); - - size_t counter = static_cast(static_cast(offset) / (static_cast(m_graphRect.width())/m_hitAreas.size())); - - bool escape = false; - - // Need to handle the areas right at the edge of the polygons - for (int i = -1; i <= 1; ++i) - { - if ((counter + i) >= m_hitAreas.size()) - { - continue; - } - - const AZStd::vector& hitAreas = m_hitAreas[counter + i]; - - for (const HitArea& hitArea : hitAreas) - { - QPolygon polygon = hitArea.m_polygon; - - if (hitArea.m_polygon.containsPoint(mousePos,Qt::OddEvenFill)) - { - hoveredArea = hitArea.m_seriesId; - escape = true; - break; - } - } - - if (escape) - { - break; - } - } - } - - if (hoveredArea != m_inspectionSeries) - { - m_inspectionSeries = hoveredArea; - update(); - - // Signal out which series we are inspecting - emit InspectedSeries(m_inspectionSeries); - } - } - } - - void AreaChart::leaveEvent(QEvent* event) - { - (void)event; - - if (m_inspectionSeries != k_invalidSeriesId) - { - m_inspectionSeries = k_invalidSeriesId; - update(); - - // Signal out which series we are inspecting - emit InspectedSeries(m_inspectionSeries); - } - - if (m_clicked) - { - m_clicked = false; - } - } - - void AreaChart::mousePressEvent(QMouseEvent* mouseEvent) - { - if (IsMouseInspectionEnabled()) - { - m_clicked = true; - m_mouseDownPoint = mouseEvent->pos(); - } - } - - void AreaChart::mouseReleaseEvent(QMouseEvent* mouseEvent) - { - if (IsMouseInspectionEnabled() && m_clicked) - { - QPoint upPoint = mouseEvent->pos(); - - // Want it to be roughly the same spot. - if ((m_mouseDownPoint - upPoint).manhattanLength() < 20) - { - int closestValue = 0; - if (m_horizontalAxis && m_graphRect.width() > 0) - { - float ratio = static_cast(upPoint.x() - m_graphRect.left()) / static_cast(m_graphRect.width()); - closestValue = static_cast(m_horizontalAxis->GetRangeMin()) + static_cast((m_horizontalAxis->GetRange() * ratio) + 0.5f); - } - - emit SelectedSeries(m_inspectionSeries, closestValue); - } - } - } - - void AreaChart::resizeEvent(QResizeEvent* event) - { - (void)event; - - m_sizingDirty = true; - update(); - } - - void AreaChart::paintEvent(QPaintEvent* event) - { - AZ_PROFILE_FUNCTION(AzToolsFramework); - (void)event; - - if (m_sizingDirty) - { - m_sizingDirty = false; - m_regenGraph = true; - - QPoint topLeft(rect().left() + m_insetLeft, rect().top() + m_insetTop); - QPoint bottomRight(rect().right() - m_insetRight, rect().bottom() - m_insetBottom); - - m_graphRect = QRect(topLeft,bottomRight); - } - - if (m_regenGraph) - { - AZ_PROFILE_FUNCTION(AzToolsFramework); - m_regenGraph = false; - - if (m_verticalAxis) - { - m_verticalAxis->SetAxisRange(0.0f, static_cast(m_axisMax)); - } - - m_hitAreas.clear(); - m_hitAreas.reserve(m_maxSizing.size()); - m_hitAreas.resize(m_maxSizing.size()); - - // Running tally of samples that we need to keep track of to manipulate our way through - AZStd::vector runningTotal(m_maxSizing.size(), 0); - - for (LineSeries& lineSeries : m_lineSeries) - { - unsigned int counter = 0; - - // Would have to special case out the single data point sample - if (lineSeries.IsEnabled() && lineSeries.m_linePoints.size() > 1) - { - unsigned int currentValue = lineSeries.m_linePoints[counter].m_value; - - unsigned int bottomLeft = runningTotal[counter]; - unsigned int topLeft = bottomLeft + currentValue; - - runningTotal[counter] = topLeft; - ++counter; - - lineSeries.ResetPainterPath(); - QPainterPath& painterPath = lineSeries.GetPainterPath(); - - AZ_Assert(runningTotal.size() == lineSeries.m_linePoints.size(), "Mismatched/missing sample values given to AreaChart"); - for (; counter < lineSeries.m_linePoints.size(); ++counter) - { - currentValue = lineSeries.m_linePoints[counter].m_value; - - unsigned int bottomRight = runningTotal[counter]; - unsigned int topRight = bottomRight + currentValue; - - runningTotal[counter] = topRight; - - QPolygon polygon; - polygon.append(ConvertToGraphPoint(counter - 1, bottomLeft)); - polygon.append(ConvertToGraphPoint(counter - 1, topLeft)); - polygon.append(ConvertToGraphPoint(counter, topRight)); - polygon.append(ConvertToGraphPoint(counter, bottomRight)); - - painterPath.addPolygon(polygon); - - m_hitAreas[counter].emplace_back(polygon, lineSeries.GetSeriesId()); - - bottomLeft = bottomRight; - topLeft = topRight; - } - } - } - } - - { - QPen pen; - QBrush brush; - QPainter p(this); - - p.fillRect(rect(),m_widgetBackground); - p.fillRect(m_graphRect, m_graphBackground); - - QRect widgetBounds = rect(); - - if (m_horizontalAxis) - { - m_horizontalAxis->PaintAxis(Charts::AxisType::Horizontal, &p, widgetBounds, m_graphRect, nullptr); - } - - if (m_verticalAxis) - { - m_verticalAxis->PaintAxis(Charts::AxisType::Vertical, &p, widgetBounds, m_graphRect, nullptr); - } - - p.setClipRect(m_graphRect.left(), m_graphRect.top() - 1, m_graphRect.width() + 2, m_graphRect.height() + 2); - - brush.setStyle(Qt::SolidPattern); - - pen.setStyle(Qt::SolidLine); - pen.setWidth(2); - - for (LineSeries& lineSeries : m_lineSeries) - { - if (!lineSeries.IsEnabled()) - { - continue; - } - - brush.setColor(lineSeries.GetColor()); - p.fillPath(lineSeries.GetPainterPath(), brush); - - if (lineSeries.IsHighlighted() - || lineSeries.GetSeriesId() == m_inspectionSeries) - { - // Then highlight it - pen.setColor(Qt::white); - p.setPen(pen); - - p.drawPath(lineSeries.GetPainterPath()); - } - } - - brush.setStyle(Qt::SolidPattern); - - pen.setStyle(Qt::SolidLine); - pen.setColor( m_graphBackground ); - pen.setWidth(2); - - p.setPen(pen); - - for (GraphMarker& marker : m_markers) - { - brush.setColor(marker.m_color); - switch (marker.m_axis) - { - case Charts::AxisType::Horizontal: - { - static const int k_barWidth = 4; - static const int k_halfWidth = k_barWidth / 2; - - if (!AZ::IsClose(m_horizontalAxis->GetRange(),0.0f,0.01f) ) - { - float minRange = m_horizontalAxis->GetRangeMin(); - - float ratio = (marker.m_position - minRange) / m_horizontalAxis->GetRange(); - ratio = AZStd::GetMin(1.0f, ratio); - - QPoint startPoint; - startPoint.setX(m_graphRect.left() + static_cast(m_graphRect.width() * ratio) - k_halfWidth); - startPoint.setY(m_graphRect.top()); - - p.fillRect(startPoint.x(), startPoint.y(), k_barWidth, m_graphRect.height(), brush); - p.drawRect(startPoint.x(), startPoint.y() + 1, k_barWidth, m_graphRect.height() - 1); - } - break; - } - case Charts::AxisType::Vertical: - { - QPoint startPoint = ConvertToGraphPoint(0, static_cast(marker.m_position)); - startPoint.setX(m_graphRect.right()); - - p.fillRect(startPoint.x(), startPoint.y(), m_graphRect.width(), 2, brush); - p.drawRect(startPoint.x(), startPoint.y(), m_graphRect.width(), 2); - break; - } - default: - AZ_Error("Standalone Tools", false, "Unknown axis type given to marker."); - }; - } - } - } - - Charts::Axis* AreaChart::GetAxis(Charts::AxisType axisType) - { - switch (axisType) - { - case Charts::AxisType::Horizontal: - return m_horizontalAxis; - case Charts::AxisType::Vertical: - return m_verticalAxis; - default: - AZ_Error("AreaChart", false, "Unknown AxisType."); - return nullptr; - } - } - - bool AreaChart::IsValidSeriesId(size_t seriesId) const - { - return seriesId < m_lineSeries.size(); - } - - QPoint AreaChart::ConvertToGraphPoint(int index, unsigned int value) - { - QPoint graphPoint(m_graphRect.bottomLeft()); - - int maxSizes = static_cast(m_maxSizing.size()); - - if (m_horizontalAxis) - { - maxSizes = AZStd::GetMax(maxSizes, static_cast(m_horizontalAxis->GetRange())); - } - - if (maxSizes >= 2) - { - // -1, since the index is 0 based. - graphPoint.setX(m_graphRect.left() + static_cast(m_graphRect.width() * (static_cast(index) / static_cast(maxSizes - 1)))); - } - - if (m_axisMax > 0) - { - graphPoint.setY(m_graphRect.bottom() - static_cast(m_graphRect.height() * (static_cast(value) / static_cast(m_axisMax)))); - } - - return graphPoint; - } -} diff --git a/Code/Tools/Standalone/Source/Driller/AreaChart.hxx b/Code/Tools/Standalone/Source/Driller/AreaChart.hxx deleted file mode 100644 index 6e41734d07..0000000000 --- a/Code/Tools/Standalone/Source/Driller/AreaChart.hxx +++ /dev/null @@ -1,212 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ -#pragma once -#ifndef PROFILER_AREACHART_H -#define PROFILER_AREACHART_H - -#if !defined(Q_MOC_RUN) -#include -#include -#include -#include -#include -#include - -#include -#endif - -namespace Charts -{ - class Axis; -} - -namespace AreaChart -{ - class AreaChart; - - struct LinePoint - { - public: - LinePoint(int position, unsigned int value) - : m_position(position) - , m_value(value) - { - } - - int m_position; - unsigned int m_value; - }; - - class LineSeries - { - private: - friend class AreaChart; - - typedef AZStd::vector< LinePoint > LinePoints; - - public: - LineSeries(AreaChart* owner, size_t seriesId, const QString& name, const QColor& color, size_t seriesSize = 0); - ~LineSeries(); - - size_t GetSeriesId() const; - void AddPoint(const LinePoint& linePoint); - void Reset(); - - bool IsHighlighted() const; - bool IsEnabled() const; - - const QColor& GetColor() const; - - void ResetPainterPath(); - - QPainterPath& GetPainterPath(); - const QPainterPath& GetPainterPath() const; - - private: - - AreaChart* m_owner; - LinePoints m_linePoints; - - size_t m_seriesId; - QString m_name; - QColor m_color; - - QPainterPath m_painterPath; - bool m_highlighted; - bool m_enabled; - bool m_hasData; - }; - - class AreaChart - : public QWidget - { - Q_OBJECT - Q_PROPERTY(int insetTop MEMBER m_insetTop) - Q_PROPERTY(int insetBottom MEMBER m_insetBottom) - Q_PROPERTY(int insetLeft MEMBER m_insetLeft) - Q_PROPERTY(int insetRight MEMBER m_insetRight) - Q_PROPERTY(QColor widgetBackground MEMBER m_widgetBackground) - Q_PROPERTY(QColor graphBackground MEMBER m_graphBackground) - - struct HitArea - { - HitArea(const QPolygon& polygon, size_t seriesId) - : m_polygon(polygon) - , m_seriesId(seriesId) - { - } - - QPolygon m_polygon; - size_t m_seriesId; - }; - - struct GraphMarker - { - GraphMarker(Charts::AxisType axis, int position, const QColor& color) - : m_axis(axis) - , m_position(position) - , m_color(color) - { - } - - Charts::AxisType m_axis; - int m_position; - QColor m_color; - }; - - public: - static const size_t k_invalidSeriesId; - - AreaChart(QWidget* parent = nullptr); - ~AreaChart(); - - bool IsMouseInspectionEnabled() const; - void EnableMouseInspection(bool enabled); - - void ResetChart(); - - void ConfigureVerticalAxis(QString label, unsigned int minimumHeight = -1); - void ConfigureHorizontalAxis(QString label, int minimum, int maximum); - - size_t CreateSeries(const QString& name, const QColor& color, size_t size = 0); - void ResetSeries(AZ::u32); - - // Methods of adding points - void AddPoint(size_t seriesId, int position, unsigned int value); - void AddPoint(size_t seriesId, const LinePoint& linePoint); - - // Methods of manipulating series - void SetSeriesHighlight(size_t seriesId, bool highlighted); - void SetSeriesEnabled(size_t seriesId, bool enabled); - - // Methods of adding markers - void AddMarker(Charts::AxisType axis, int position, const QColor& color); - - public slots: - - signals: - void InspectedSeries(size_t seriesId); - void SelectedSeries(size_t seriesId, int position); - - protected: - - // Mouse Inspection - void mouseMoveEvent(QMouseEvent* mouseEvent) override; - void leaveEvent(QEvent* mouseEvent) override; - - // Mouse clicks - void mousePressEvent(QMouseEvent* mouseEvent) override; - void mouseReleaseEvent(QMouseEvent* mouseEvent) override; - - void resizeEvent(QResizeEvent* resizeEvent) override; - void paintEvent(QPaintEvent* paintEvent) override; - - private: - - void SetMinimumValueRange(unsigned int value); - Charts::Axis* GetAxis(Charts::AxisType axisType); - - bool IsValidSeriesId(size_t seriesId) const; - - QPoint ConvertToGraphPoint(int index, unsigned int value); - - AZStd::vector< GraphMarker > m_markers; - AZStd::vector< LineSeries > m_lineSeries; - - AZStd::unordered_map m_maxSizing; - - size_t m_inspectionSeries; - - size_t m_mouseOverArea; - AZStd::vector< AZStd::vector > m_hitAreas; - - bool m_clicked; - QPoint m_mouseDownPoint; - - QRect m_graphRect; - bool m_sizingDirty; - bool m_regenGraph; - - unsigned int m_axisMin; - unsigned int m_axisMax; - - Charts::Axis* m_horizontalAxis; - Charts::Axis* m_verticalAxis; - - // Styling - int m_insetTop; - int m_insetBottom; - int m_insetLeft; - int m_insetRight; - QColor m_widgetBackground; - QColor m_graphBackground; - }; - -} - -#endif diff --git a/Code/Tools/Standalone/Source/Driller/Axis.cpp b/Code/Tools/Standalone/Source/Driller/Axis.cpp deleted file mode 100644 index 6c55f668da..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Axis.cpp +++ /dev/null @@ -1,648 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include -#include - -#include "Axis.hxx" - -namespace Charts -{ - ////////////////////////////////////////////////////////////////////////// - Axis::Axis(QObject* pParent) - : QObject(pParent) - , m_lockRange(true) - , m_lockZoom(true) - , m_lockRight(false) - , m_autoWindow(true) - , m_rangeMin(0) - , m_rangeMax(0) - , m_windowMax(0) - , m_windowMin(0) - , m_rangeMaxInitialized(false) - , m_rangeMinInitialized(false) - {} - Axis::~Axis() - { - } - - bool Axis::GetValid() const - { - return ((m_rangeMinInitialized) && (m_rangeMaxInitialized) && (m_rangeMin < m_rangeMax) && (m_windowMin < m_windowMax)); - } - - void Axis::Clear() - { - bool wasValid = GetValid(); - - m_rangeMinInitialized = false; - m_rangeMaxInitialized = false; - m_rangeMax = m_rangeMin = m_windowMax = m_windowMin = 0.0f; - - if (wasValid) - { - emit Invalidated(); - } - } - - void Axis::SetAxisRange(float minimum, float maximum) - { - float oldRangeMin = m_rangeMin; - float oldRangeMax = m_rangeMax; - float oldWindowMin = m_windowMin; - float oldWindowMax = m_windowMax; - - bool wasValid = GetValid(); - - if (m_lockRight) - { - m_windowMin += maximum - m_rangeMax; - m_windowMax = m_rangeMax; - } - m_rangeMin = minimum; - m_rangeMax = maximum; - - if (m_autoWindow && !m_lockRight) - { - m_windowMin = m_rangeMin; - m_windowMax = m_rangeMax; - } - - m_rangeMinInitialized = true; - m_rangeMaxInitialized = true; - - if ((oldRangeMax != m_rangeMax) || - (oldRangeMin != m_rangeMin) || - (oldWindowMin != m_windowMin) || - (oldWindowMax != m_windowMax) || - (wasValid != GetValid())) - { - emit Invalidated(); - } - } - - void Axis::AddAxisRange(float value) - { - bool updateValues = false; - float minRange = m_rangeMin; - float maxRange = m_rangeMax; - - if ((value < m_rangeMin) || !m_rangeMinInitialized) - { - updateValues = true; - minRange = value; - } - - if ((m_rangeMax < value) || !m_rangeMaxInitialized) - { - updateValues = true; - maxRange = value; - } - - if (updateValues) - { - SetAxisRange(minRange, maxRange); - } - } - - void Axis::SetRangeMax(float rangemax) - { - SetAxisRange(m_rangeMin, rangemax); - } - - void Axis::SetRangeMin(float rangemin) - { - SetAxisRange(rangemin, m_rangeMax); - } - - void Axis::UpdateWindowRange(float delta) - { - if (delta != 0.0f) - { - m_windowMax += delta; - m_windowMin += delta; - if (m_windowMax > m_rangeMax) - { - delta = m_windowMax - m_rangeMax; - m_windowMax -= delta; - m_windowMin -= delta; - } - - if (m_windowMin < m_rangeMin) - { - delta = m_rangeMin - m_windowMin; - m_windowMax += delta; - m_windowMin += delta; - } - - emit Invalidated(); - } - } - - void Axis::SetViewFull() - { - float oldWindowMin = m_windowMin; - float oldWindowMax = m_windowMax; - - m_autoWindow = true; - m_windowMin = m_rangeMin; - m_windowMax = m_rangeMax; - - if ( - (oldWindowMin != m_windowMin) || - (oldWindowMax != m_windowMax) - ) - { - emit Invalidated(); - } - } - - void Axis::SetLabel(QString newLabel) - { - if (m_label != newLabel) - { - m_label = newLabel; - emit Invalidated(); - } - } - - bool Axis::GetLockedRight() const - { - return m_lockRight; - } - - bool Axis::GetLockedRange() const - { - return m_lockRange; - } - - bool Axis::GetLockedZoom() const - { - return m_lockZoom; - } - - void Axis::SetLockedRange(bool newValue) - { - m_lockRange = newValue; - } - - void Axis::SetLockedZoom(bool newValue) - { - m_lockZoom = newValue; - } - - void Axis::SetLockedRight(bool newValue) - { - m_lockRight = newValue; - } - - void Axis::SetAutoWindow(bool autoWindow) - { - m_autoWindow = autoWindow; - } - - bool Axis::GetAutoWindow() const - { - return m_autoWindow; - } - - QString Axis::GetLabel() const - { - return m_label; - } - - float Axis::GetWindowMin() const - { - return m_windowMin; - } - - float Axis::GetWindowMax() const - { - return m_windowMax; - } - - float Axis::GetRangeMin() const - { - return m_rangeMin; - } - - float Axis::GetRangeMax() const - { - return m_rangeMax; - } - - void Axis::SetWindowMin(float newValue) - { - if (m_windowMin != newValue) - { - m_windowMin = newValue; - emit Invalidated(); - } - } - - void Axis::SetWindowMax(float newValue) - { - if (m_windowMax != newValue) - { - m_windowMax = newValue; - emit Invalidated(); - } - } - - float Axis::GetWindowRange() const - { - if (!GetValid()) - { - return 1.0f; - } - return m_windowMax - m_windowMin; - } - - float Axis::GetRange() const - { - if (!GetValid()) - { - return 1.0f; - } - return m_rangeMax - m_rangeMin; - } - - // focuspoint is a number from 0 to 1 that indicates how far along that axis the focal point is - // for example on a horizontal axis, 0 is the start, or GetwindowMin(), and 1 is the end, GetWindowMaX() - - void Axis::Drag(float delta) - { - if (!GetValid()) - { - return; - } - - if (GetLockedRange()) - { - return; - } - - UpdateWindowRange(delta); - } - - void Axis::ZoomToRange(float windowMin, float windowMax, bool clamp) - { - if (!GetValid()) - { - return; - } - - float oldmin = m_windowMin; - float oldmax = m_windowMax; - m_windowMin = windowMin; - m_windowMax = windowMax; - - if (clamp) - { - if (m_windowMin < m_rangeMin) - { - m_windowMin = m_rangeMin; - } - - if (m_windowMax > m_rangeMax) - { - m_windowMax = m_rangeMax; - } - } - - if ((m_windowMin != oldmin) || (m_windowMax != oldmax)) - { - emit Invalidated(); - } - } - - void Axis::Zoom(float ratio, float steps, float zoomLimit) - { - if (!GetValid()) - { - return; - } - - if (GetLockedRight()) - { - ratio = 1.0f; - } - if (!GetLockedZoom()) - { - SetAutoWindow(false); - - float testMin = GetWindowMin(); - float testMax = GetWindowMax(); - - testMin -= float(GetWindowRange()) * 0.05f * ratio * -steps; - testMax += float(GetWindowRange()) * 0.05f * (1.0f - ratio) * -steps; - - if ((testMax - testMin) > 0.0f) - { - if (testMax > GetRangeMax()) - { - float offset = GetRangeMax() - testMax; - testMax += offset; - testMin += offset; - } - if (testMin < GetRangeMin()) - { - float offset = testMin - GetRangeMin(); - testMax -= offset; - testMin -= offset; - } - if (testMax - testMin >= zoomLimit) - { - SetWindowMin(testMin); - SetWindowMax(testMax); - } - if ((testMax - testMin) > (GetRangeMax() - GetRangeMin())) - { - SetViewFull(); - } - } - } - } - - // given a width of a view in pixels, subdivide it and return a vector of domain units that - // satisfy a human outlook on domain values: - float Axis::ComputeAxisDivisions(float pixelWidth, AZStd::vector& domainPointsOut, float minPixels, float maxPixels, bool allowFractions) - { - if (!GetValid()) - { - return 1.0f; - } - - float divisor = 1.0f; - float windowRange = GetWindowRange(); - - // compute the divisor - float currentDivisionWidthInPixels = pixelWidth / (windowRange / divisor); - while (currentDivisionWidthInPixels > maxPixels) - { - // drop it down by 0.5 then by 0.1 - divisor /= 2.0f; - currentDivisionWidthInPixels = pixelWidth / (windowRange / divisor); - if (currentDivisionWidthInPixels <= maxPixels) - { - break; - } - - divisor *= 0.2f; // 0.5f * 0.2f = 0.1 - currentDivisionWidthInPixels = pixelWidth / (windowRange / divisor); - } - // the min pixels is an absolute requirement to prevent text from overlapping - // which is why we apply that constraint LAST. - // so for example, if window shows 100 units, and divisor is 2.0, then that would yield 50 pieces. - // 50 pieces over the span of 1000 pixels is 1000 / 50, 20 pixels each; - // 100 pieces would be (num pieces / pixel space to draw in) pixels - while (currentDivisionWidthInPixels < minPixels) - { - // the division width is too small, there are too many pieces. Make fewer pieces by choosing a larger - // divisor - // drop it down by 0.5 then by 0.1 - divisor *= 5.0f; - currentDivisionWidthInPixels = pixelWidth / (windowRange / divisor); - if (currentDivisionWidthInPixels >= minPixels) - { - break; - } - - divisor *= 2.0f; - currentDivisionWidthInPixels = pixelWidth / (windowRange / divisor); - } - - if ((divisor < 1.0f) && (!allowFractions)) - { - divisor = 1.0f; - } - - - // now lay out the domain starting with the first unit of that number: - float startingUnit = floorf(m_windowMin / divisor) * divisor; - - // to retain precision we are going to try to do the math around the origin. - startingUnit -= m_windowMin; - AZStd::size_t maximumAllowedUnitsBeforeSomethingTerribleHasOccurred = (AZStd::size_t)(pixelWidth / 4.0f); - - // so for example if we've decided that the divisor is 10 units, and the window min is 12.5, then it will go to 1.25, chop off the .25, and go back to 10 - while (startingUnit <= windowRange) - { - if (startingUnit >= 0.0f) - { - domainPointsOut.push_back(startingUnit + m_windowMin); - } - startingUnit += divisor; - - if (domainPointsOut.size() > maximumAllowedUnitsBeforeSomethingTerribleHasOccurred) - { - break; // you can put a break point here, but it usually means that we've lost enough precision. Change your axis range or numbering scheme! - } - } - - return divisor; - } - void Axis::PaintAxis(AxisType axisType, QPainter* painter, const QRect& widgetBounds, const QRect& graphBounds, QAbstractAxisFormatter* formatter) - { - switch (axisType) - { - case AxisType::Horizontal: - PaintAsHorizontalAxis(painter, widgetBounds, graphBounds, formatter); - break; - case AxisType::Vertical: - PaintAsVerticalAxis(painter, widgetBounds, graphBounds, formatter); - break; - default: - break; - } - } - - void Axis::PaintAsVerticalAxis(QPainter* painter, const QRect& widgetBounds, const QRect& graphBounds, QAbstractAxisFormatter* formatter) - { - (void)widgetBounds; - - const QColor axisBrush = QColor(255, 255, 0, 255); - const QColor axisPen = QColor(0, 255, 255, 255); - const QColor dottedColor(64, 64, 64, 255); - const QColor solidColor(0, 255, 255, 255); - - QBrush brush; - QPen pen; - - brush.setColor(axisBrush); - pen.setColor(axisPen); - painter->setPen(pen); - - QFont currentFont = painter->font(); - currentFont.setPointSize(currentFont.pointSize() - 1); - painter->setFont(currentFont); - - int w = painter->fontMetrics().horizontalAdvance(GetLabel()); - int h = painter->fontMetrics().height(); - - int centerHeight = graphBounds.top() + (graphBounds.height() / 2); - - DrawRotatedText(GetLabel(), painter, 270, h, centerHeight + w / 2, 1.25f); - - currentFont.setPointSize(currentFont.pointSize() + 1); - painter->setFont(currentFont); - - QPoint startPoint = graphBounds.topLeft(); - QPoint endPoint = graphBounds.bottomLeft(); - - int height = endPoint.y() - startPoint.y(); - int fontH = painter->fontMetrics().height(); - - if (height == 0) - { - height = 1; - } - - AZStd::vector divisions; - divisions.reserve(10); - - float divisionSize = ComputeAxisDivisions(static_cast(height), divisions, fontH * 2.0f, fontH * 2.0f); - - QPen dottedPen; - dottedPen.setStyle(Qt::DotLine); - dottedPen.setColor(dottedColor); - - QBrush solidBrush; - QPen solidPen; - solidPen.setStyle(Qt::SolidLine); - solidPen.setColor(solidColor); - solidPen.setWidth(1); - - float fullRange = fabs(GetWindowRange()); - - for (float division : divisions) - { - float ratio = static_cast(division - GetWindowMin()) / fullRange; - - QPoint lineStart; - lineStart.setX(endPoint.x()); - lineStart.setY(endPoint.y() - static_cast(height*ratio)); - - QPoint lineEnd(static_cast(lineStart.x() + graphBounds.width()), lineStart.y()); - - painter->setPen(dottedPen); - painter->drawLine(lineStart, lineEnd); - - QString text; - - if (formatter) - { - text = formatter->convertAxisValueToText(Charts::AxisType::Vertical, division, divisions.front(), divisions.back(), divisionSize); - } - else - { - text = QString("%1").arg((AZ::s64)division); - } - - int textW = painter->fontMetrics().horizontalAdvance(text); - painter->setPen(solidPen); - painter->drawText(lineStart.x() - textW - 2, (int)lineStart.y() + fontH / 2, text); - } - } - - void Axis::PaintAsHorizontalAxis(QPainter* painter, const QRect& widgetBounds, const QRect& graphBounds, QAbstractAxisFormatter* formatter) - { - const QColor axisBrush = QColor(255, 255, 0, 255); - const QColor axisPen = QColor(0, 255, 255, 255); - const QColor dottedColor(64, 64, 64,255); - const QColor solidColor(0, 255, 255, 255); - - QBrush brush; - QPen pen; - - brush.setColor(axisBrush); - pen.setColor(axisPen); - painter->setPen(pen); - - QFont currentFont = painter->font(); - currentFont.setPointSize(currentFont.pointSize() - 1); - painter->setFont(currentFont); - - painter->drawText(0, 0, widgetBounds.width(), widgetBounds.height(), Qt::AlignHCenter | Qt::AlignBottom, GetLabel()); - - currentFont.setPointSize(currentFont.pointSize() + 1); - painter->setFont(currentFont); - - QPoint startPoint = graphBounds.bottomLeft(); - QPoint endPoint = graphBounds.bottomRight(); - int width = endPoint.x() - startPoint.x(); - - if (width == 0) - { - width = 1; - } - - float textSpaceRequired = (float)painter->fontMetrics().horizontalAdvance("9,999,999.99"); - - int fontH = painter->fontMetrics().height(); - - AZStd::vector divisions; - divisions.reserve(10); - - float divisionSize = ComputeAxisDivisions(static_cast(width), divisions, textSpaceRequired, textSpaceRequired); - - QPen dottedPen; - dottedPen.setStyle(Qt::DotLine); - dottedPen.setColor(dottedColor); - - QBrush solidBrush; - QPen solidPen; - solidPen.setStyle(Qt::SolidLine); - solidPen.setColor(solidColor); - solidPen.setWidth(1); - - float fullRange = fabs(GetWindowRange()); - - for (float division : divisions) - { - float ratio = float(division - GetWindowMin()) / fullRange; - - QPoint lineStart; - lineStart.setX(startPoint.x() + static_cast(width*ratio)); - lineStart.setY(startPoint.y()); - - QPoint lineEnd(lineStart.x(), static_cast(startPoint.y() - graphBounds.height())); - - painter->setPen(dottedPen); - painter->drawLine(lineStart, lineEnd); - - QString text; - - if (formatter) - { - text = formatter->convertAxisValueToText(Charts::AxisType::Horizontal, division, divisions.front(), divisions.back(), divisionSize); - } - else - { - text = QString("%1").arg((AZ::s64)division); - } - - int textW = painter->fontMetrics().horizontalAdvance(text); - - painter->setPen(solidPen); - painter->drawText(lineStart.x() - textW / 2, startPoint.y() + fontH, text); - } - } - - void Axis::DrawRotatedText(QString text, QPainter *painter, float degrees, int x, int y, float scale) - { - painter->save(); - painter->translate(x, y); - painter->scale(scale, scale); - painter->rotate(degrees); - painter->drawText(0, 0, text); - painter->restore(); - } -} - -#include diff --git a/Code/Tools/Standalone/Source/Driller/Axis.hxx b/Code/Tools/Standalone/Source/Driller/Axis.hxx deleted file mode 100644 index a9231307b7..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Axis.hxx +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef CHART_AXIS_H -#define CHART_AXIS_H - -#if !defined(Q_MOC_RUN) -#include -#include -#include - -#include -#include -#endif - -class QPainter; - -#pragma once - -namespace Charts -{ - // the Axis represents one axis on a chart. its float-based - // it contains information about window range and domain range. - class Axis : public QObject - { - Q_OBJECT; - public: - AZ_CLASS_ALLOCATOR(Axis,AZ::SystemAllocator,0); - Axis(QObject* pParent = NULL); - ~Axis(); // not virtual - - public: - bool GetValid() const; - bool GetAutoWindow() const; - QString GetLabel() const; - float GetWindowMin() const; - float GetWindowMax() const; - float GetRangeMin() const; - float GetRangeMax() const; - float GetWindowRange() const; - float GetRange() const; - bool GetLockedZoom() const; - bool GetLockedRange() const; - bool GetLockedRight() const; - void Zoom(float focusPoint, float steps, float zoomLimit ); - void ZoomToRange(float windowMin, float windowMax, bool clamp); - - void PaintAxis(AxisType axisType, QPainter* painter, const QRect& widgetBounds, const QRect& graphBounds, QAbstractAxisFormatter* formatter); - - float ComputeAxisDivisions(float pixelWidth, AZStd::vector& domainPointsOut, float minPixels, float maxPixels, bool allowFractions = true); - -signals: - void Invalidated(); // something has happened which should cause anyone using this axis to update themselves. - -public slots: - void SetAxisRange( float minimum, float maximum ); - void AddAxisRange( float value ); - void SetViewFull(); - void SetLabel(QString newLabel); - void SetLockedRight(bool lockRight); - void SetLockedRange(bool locked); // cannot pan - void SetLockedZoom(bool locked); // cannot zoom. - void Clear(); - void SetAutoWindow( bool autoWindow ); - void SetWindowMin(float newValue); - void SetWindowMax(float newValue); - void UpdateWindowRange(float delta); - void SetRangeMax(float rangemax); - void SetRangeMin(float rangemin); - void Drag(float delta); - - private: - - void PaintAsVerticalAxis(QPainter* painter, const QRect& widgetBounds, const QRect& graphBounds, QAbstractAxisFormatter* formatter); - void PaintAsHorizontalAxis(QPainter* painter, const QRect& widgetBounds, const QRect& graphBounds, QAbstractAxisFormatter* formatter); - void DrawRotatedText(QString text, QPainter *painter, float degrees, int x, int y, float scale); - - QString m_label; - float m_rangeMin; - float m_rangeMax; - float m_windowMin; - float m_windowMax; - bool m_lockZoom; // zoom is always to the range - bool m_lockRange; // you may only pan - bool m_lockRight; - bool m_autoWindow; - bool m_rangeMinInitialized; - bool m_rangeMaxInitialized; // these are false until you init them, and the axis is invalid until such a time. - }; -} - - -#endif diff --git a/Code/Tools/Standalone/Source/Driller/CSVExportSettings.h b/Code/Tools/Standalone/Source/Driller/CSVExportSettings.h deleted file mode 100644 index c7fc45d25d..0000000000 --- a/Code/Tools/Standalone/Source/Driller/CSVExportSettings.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef DRILLER_CSVEXPORTSETTINGS_H -#define DRILLER_CSVEXPORTSETTINGS_H - -#include -#include - -#pragma once - -namespace Driller -{ - class CSVExportSettings - { - public: - AZ_CLASS_ALLOCATOR(CSVExportSettings, AZ::SystemAllocator, 0); - - CSVExportSettings() - : m_shouldExportColumnDescriptor(true) - { - } - - virtual ~CSVExportSettings() - { - } - - void SetShouldExportColumnDescriptors(bool shouldExport) - { - m_shouldExportColumnDescriptor = shouldExport; - } - - bool ShouldExportColumnDescriptors() const - { - return m_shouldExportColumnDescriptor; - } - - private: - bool m_shouldExportColumnDescriptor; - }; -} - -#endif diff --git a/Code/Tools/Standalone/Source/Driller/Carrier/CarrierDataAggregator.cpp b/Code/Tools/Standalone/Source/Driller/Carrier/CarrierDataAggregator.cpp deleted file mode 100644 index 6e943ae2c0..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Carrier/CarrierDataAggregator.cpp +++ /dev/null @@ -1,392 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include -#include - -#include "CarrierDataAggregator.hxx" -#include -#include "CarrierDataEvents.h" -#include "CarrierDataView.hxx" - -namespace Driller -{ - ///////////////////////////// - // CarrierCSVExportSettings - ///////////////////////////// - CarrierExportSettings::CarrierExportSettings() - { - m_columnDescriptors = - { - {ExportField::Data_Sent, "Data Sent(Bytes)"}, - {ExportField::Data_Received, "Data Received(Bytes)"}, - {ExportField::Data_Resent, "Data Resent(Bytes)"}, - {ExportField::Data_Acked, "Data Acked(Bytes)"}, - {ExportField::Packets_Sent, "Packets Sent"}, - {ExportField::Packets_Received, "Packets Received"}, - {ExportField::Packets_Lost, "Packets Lost"}, - {ExportField::Packets_Acked, "Packets Acked"}, - {ExportField::Packet_RTT, "Packet Round Trip Time"}, - {ExportField::Packet_Loss, "Packet Loss(%)"}, - {ExportField::Effective_Data_Sent, "Effective Data Sent(Bytes)"}, - {ExportField::Effective_Data_Received, "Effective Data Received(Bytes)"}, - {ExportField::Effective_Data_Resent, "Effective Data Resent(Bytes)"}, - {ExportField::Effective_Data_Acked, "Effective Data Acked(Bytes)"}, - {ExportField::Effective_Packets_Sent, "Effective Packets Sent"}, - {ExportField::Effective_Packets_Received, "Effective Packets Received"}, - {ExportField::Effective_Packets_Lost, "Effective Packets Lost"}, - {ExportField::Effective_Packets_Acked, "Effective Packets Acked"}, - {ExportField::Effective_Packet_RTT, "Effective Packet Round Trip Time"}, - {ExportField::Effective_Packet_Loss, "Effective Packet Loss(%)"} - }; - - m_exportOrdering = - { - ExportField::Data_Sent, - ExportField::Effective_Data_Sent, - ExportField::Data_Received, - ExportField::Effective_Data_Received, - ExportField::Data_Resent, - ExportField::Effective_Data_Resent, - ExportField::Data_Acked, - ExportField::Effective_Data_Acked, - ExportField::Packets_Sent, - ExportField::Effective_Packets_Sent, - ExportField::Packets_Received, - ExportField::Effective_Packets_Received, - ExportField::Packets_Lost, - ExportField::Effective_Packets_Lost, - ExportField::Packets_Acked, - ExportField::Effective_Packets_Acked, - ExportField::Packet_RTT, - ExportField::Effective_Packet_RTT, - ExportField::Packet_Loss, - ExportField::Effective_Packet_Loss - }; - - for (const AZStd::pair< ExportField, AZStd::string >& item : m_columnDescriptors) - { - m_stringToExportEnum[item.second] = item.first; - } - } - - void CarrierExportSettings::GetExportItems(QStringList& items) const - { - for (const AZStd::pair< CarrierExportField, AZStd::string>& item : m_columnDescriptors) - { - items.push_back(QString(item.second.c_str())); - } - } - - void CarrierExportSettings::GetActiveExportItems(QStringList& items) const - { - for (CarrierExportField currentField : m_exportOrdering) - { - if (currentField != CarrierExportField::UNKNOWN) - { - items.push_back(QString(FindColumnDescriptor(currentField).c_str())); - } - } - } - - void CarrierExportSettings::UpdateExportOrdering(const QStringList& activeItems) - { - m_exportOrdering.clear(); - - for (const QString& activeItem : activeItems) - { - ExportField field = FindExportFieldFromDescriptor(activeItem.toStdString().c_str()); - - AZ_Assert(field != ExportField::UNKNOWN, "Unknown descriptor %s", activeItem.toStdString().c_str()); - if (field != ExportField::UNKNOWN) - { - m_exportOrdering.push_back(field); - } - } - } - - const AZStd::vector< CarrierExportField >& CarrierExportSettings::GetExportOrder() const - { - return m_exportOrdering; - } - - const AZStd::string& CarrierExportSettings::FindColumnDescriptor(ExportField exportField) const - { - static const AZStd::string emptyDescriptor; - - AZStd::unordered_map::const_iterator descriptorIter = m_columnDescriptors.find(exportField); - - if (descriptorIter == m_columnDescriptors.end()) - { - AZ_Assert(false, "Unknown column descriptor in Carrier CSV Export"); - return emptyDescriptor; - } - else - { - return descriptorIter->second; - } - } - - CarrierExportField CarrierExportSettings::FindExportFieldFromDescriptor(const char* columnDescriptor) const - { - AZStd::unordered_map::const_iterator exportIter = m_stringToExportEnum.find(columnDescriptor); - - ExportField retVal = ExportField::UNKNOWN; - - if (exportIter != m_stringToExportEnum.end()) - { - retVal = exportIter->second; - } - - return retVal; - } - - ////////////////////////// - // CarrierDataAggregator - ////////////////////////// - float CarrierDataAggregator::GetTValueAtFrame(FrameNumberType frame, AZ::s64 maxValue) - { - float valueAtFrame = 0.0f; - - size_t numEventsAtFrame = NumOfEventsAtFrame(frame); - for (EventNumberType i = m_frameToEventIndex[frame]; i < static_cast(m_frameToEventIndex[frame] + numEventsAtFrame); i++) - { - CarrierDataEvent* event = static_cast(m_events[i]); - // Consider the aggregation a sum of all data send and received (i.e. total bandwidth used). - valueAtFrame += event->mLastSecond.mDataSend + event->mLastSecond.mDataReceived; - } - - if (valueAtFrame >= maxValue) - { - return 1.0f; - } - - if (valueAtFrame == 0.0f) - { - return -1.0f; - } - - float tValue = (valueAtFrame / (maxValue * 2)) - 1.0f; - return tValue; - } - - CarrierDataAggregator::CarrierDataAggregator(int identity) - : Aggregator(identity) - , m_parser(this) - { - } - - CustomizeCSVExportWidget* CarrierDataAggregator::CreateCSVExportCustomizationWidget() - { - return aznew GenericCustomizeCSVExportWidget(m_csvExportSettings); - } - - float CarrierDataAggregator::ValueAtFrame(FrameNumberType frame) - { - return GetTValueAtFrame(frame, (1024 * 20)); - } - - QColor CarrierDataAggregator::GetColor() const - { - return QColor(255, 0, 0); - } - - QString CarrierDataAggregator::GetName() const - { - return QString("Carrier"); - } - - QString CarrierDataAggregator::GetChannelName() const - { - return ChannelName(); - } - - QString CarrierDataAggregator::GetDescription() const - { - return QString("GridMate Carrier Data"); - } - - QString CarrierDataAggregator::GetToolTip() const - { - return QString("Information about overall bandwidth usage"); - } - - AZ::Uuid CarrierDataAggregator::GetID() const - { - return AZ::Uuid("{927B208C-28E8-4BE7-BF4E-629D98F7097F}"); - } - - QWidget* CarrierDataAggregator::DrillDownRequest(FrameNumberType frame) - { - (void)frame; - - // Always provide a full view of the driller data. - FrameNumberType lastFrame = static_cast(m_frameToEventIndex.size() - 1); - - // This pointer is cleaned up by qt when the window is closed. - return aznew CarrierDataView(0, lastFrame, this); - } - - void CarrierDataAggregator::OptionsRequest() - { - } - - void CarrierDataAggregator::ExportColumnDescriptorToCSV(AZ::IO::SystemFile& file, CSVExportSettings* exportSettings) - { - CarrierExportSettings* carrierExportSettings = static_cast(exportSettings); - const AZStd::vector< CarrierExportField >& exportOrdering = carrierExportSettings->GetExportOrder(); - - bool addComma = false; - - for (CarrierExportField currentField : exportOrdering) - { - if (addComma) - { - file.Write(",", 1); - } - - const AZStd::string& columnDescriptor = carrierExportSettings->FindColumnDescriptor(currentField); - file.Write(columnDescriptor.c_str(), columnDescriptor.size()); - addComma = true; - } - - file.Write("\n", 1); - } - - void CarrierDataAggregator::ExportEventToCSV(AZ::IO::SystemFile& file, const DrillerEvent* drillerEvent, CSVExportSettings* exportSettings) - { - const CarrierDataEvent* carrierEvent = static_cast(drillerEvent); - - CarrierExportSettings* carrierExportSettings = static_cast(exportSettings); - - const AZStd::vector< CarrierExportField >& exportOrdering = carrierExportSettings->GetExportOrder(); - bool addComma = false; - - AZStd::string number; - - for (CarrierExportField currentField : exportOrdering) - { - if (addComma) - { - file.Write(",", 1); - } - - switch (currentField) - { - case CarrierExportField::Data_Sent: - { - AZStd::to_string(number, carrierEvent->mLastSecond.mDataSend); - break; - } - case CarrierExportField::Data_Received: - { - AZStd::to_string(number, carrierEvent->mLastSecond.mDataReceived); - break; - } - case CarrierExportField::Data_Resent: - { - AZStd::to_string(number, carrierEvent->mLastSecond.mDataResent); - break; - } - case CarrierExportField::Data_Acked: - { - AZStd::to_string(number, carrierEvent->mLastSecond.mDataAcked); - break; - } - case CarrierExportField::Packets_Sent: - { - AZStd::to_string(number, carrierEvent->mLastSecond.mPacketSend); - break; - } - case CarrierExportField::Packets_Received: - { - AZStd::to_string(number, carrierEvent->mLastSecond.mPacketReceived); - break; - } - case CarrierExportField::Packets_Lost: - { - AZStd::to_string(number, carrierEvent->mLastSecond.mPacketLost); - break; - } - case CarrierExportField::Packets_Acked: - { - AZStd::to_string(number, carrierEvent->mLastSecond.mPacketAcked); - break; - } - case CarrierExportField::Packet_RTT: - { - AZStd::to_string(number, carrierEvent->mLastSecond.mRTT); - break; - } - case CarrierExportField::Packet_Loss: - { - AZStd::to_string(number, carrierEvent->mLastSecond.mPacketLoss); - break; - } - case CarrierExportField::Effective_Data_Sent: - { - AZStd::to_string(number, carrierEvent->mEffectiveLastSecond.mDataSend); - break; - } - case CarrierExportField::Effective_Data_Received: - { - AZStd::to_string(number, carrierEvent->mEffectiveLastSecond.mDataReceived); - break; - } - case CarrierExportField::Effective_Data_Resent: - { - AZStd::to_string(number, carrierEvent->mEffectiveLastSecond.mDataResent); - break; - } - case CarrierExportField::Effective_Data_Acked: - { - AZStd::to_string(number, carrierEvent->mEffectiveLastSecond.mDataAcked); - break; - } - case CarrierExportField::Effective_Packets_Sent: - { - AZStd::to_string(number, carrierEvent->mEffectiveLastSecond.mPacketSend); - break; - } - case CarrierExportField::Effective_Packets_Received: - { - AZStd::to_string(number, carrierEvent->mEffectiveLastSecond.mPacketReceived); - break; - } - case CarrierExportField::Effective_Packets_Lost: - { - AZStd::to_string(number, carrierEvent->mEffectiveLastSecond.mPacketLost); - break; - } - case CarrierExportField::Effective_Packets_Acked: - { - AZStd::to_string(number, carrierEvent->mEffectiveLastSecond.mPacketAcked); - break; - } - case CarrierExportField::Effective_Packet_RTT: - { - AZStd::to_string(number, carrierEvent->mEffectiveLastSecond.mRTT); - break; - } - case CarrierExportField::Effective_Packet_Loss: - { - AZStd::to_string(number, carrierEvent->mEffectiveLastSecond.mPacketLoss); - break; - } - default: - AZ_Assert(false, "Unknown CarrierExportField"); - break; - } - - file.Write(number.c_str(), number.size()); - addComma = true; - } - - file.Write("\n", 1); - } -} diff --git a/Code/Tools/Standalone/Source/Driller/Carrier/CarrierDataAggregator.hxx b/Code/Tools/Standalone/Source/Driller/Carrier/CarrierDataAggregator.hxx deleted file mode 100644 index 9981148135..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Carrier/CarrierDataAggregator.hxx +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef DRILLER_CARRIER_DATAAGGREGATOR_H -#define DRILLER_CARRIER_DATAAGGREGATOR_H - -#if !defined(Q_MOC_RUN) -#include "Source/Driller/DrillerAggregator.hxx" -#include "CarrierDataParser.h" - -#include "Source/Driller/GenericCustomizeCSVExportWidget.hxx" -#endif - -namespace Driller -{ - struct CarrierData; -} - -namespace Driller -{ - class CarrierDataView; - - class CarrierExportSettings - : public GenericCSVExportSettings - { - public: - enum class ExportField - { - Data_Sent, - Data_Received, - Data_Resent, - Data_Acked, - Packets_Sent, - Packets_Received, - Packets_Lost, - Packets_Acked, - Packet_RTT, - Packet_Loss, - Effective_Data_Sent, - Effective_Data_Received, - Effective_Data_Resent, - Effective_Data_Acked, - Effective_Packets_Sent, - Effective_Packets_Received, - Effective_Packets_Lost, - Effective_Packets_Acked, - Effective_Packet_RTT, - Effective_Packet_Loss, - - UNKNOWN - }; - - private: - AZStd::unordered_map m_columnDescriptors; - AZStd::unordered_map m_stringToExportEnum; - AZStd::vector< ExportField > m_exportOrdering; - - public: - AZ_CLASS_ALLOCATOR(CarrierExportSettings, AZ::SystemAllocator, 0); - - CarrierExportSettings(); - - void GetExportItems(QStringList& items) const override; - void GetActiveExportItems(QStringList& items) const override; - - const AZStd::vector< ExportField >& GetExportOrder() const; - const AZStd::string& FindColumnDescriptor(ExportField exportField) const; - - protected: - void UpdateExportOrdering(const QStringList& activeItems) override; - - private: - ExportField FindExportFieldFromDescriptor(const char* descriptor) const; - }; - - typedef CarrierExportSettings::ExportField CarrierExportField; - - class CarrierDataAggregator : public Aggregator - { - Q_OBJECT - public: - AZ_CLASS_ALLOCATOR(CarrierDataAggregator, AZ::SystemAllocator, 0); - - CarrierDataAggregator(int identity = 0); - - static AZ::u32 DrillerId() { return AZ_CRC("CarrierDriller"); } - - // Driller::Aggregator. - AZ::u32 GetDrillerId() const override - { - return DrillerId(); - } - - static const char* ChannelName() { return "GridMate"; } - - AZ::Crc32 GetChannelId() const override - { - return AZ::Crc32(ChannelName()); - } - - - AZ::Debug::DrillerHandlerParser* GetDrillerDataParser() override - { - return &m_parser; - } - - bool CanExportToCSV() const override - { - return true; - } - - CustomizeCSVExportWidget* CreateCSVExportCustomizationWidget() override; - - // Driller::Aggregator. - void ApplySettingsFromWorkspace(WorkspaceSettingsProvider*) override {} - void ActivateWorkspaceSettings(WorkspaceSettingsProvider*) override {} - void SaveSettingsToWorkspace(WorkspaceSettingsProvider*) override {} - - public slots: - // Driller::Aggregator. - float ValueAtFrame(FrameNumberType frame) override; - QColor GetColor() const override; - QString GetName() const override; - QString GetChannelName() const override; - QString GetDescription() const override; - QString GetToolTip() const override; - AZ::Uuid GetID() const override; - QWidget* DrillDownRequest(FrameNumberType frame) override; - void OptionsRequest() override; - - protected: - void ExportColumnDescriptorToCSV(AZ::IO::SystemFile& file, CSVExportSettings* exportSettings) override; - void ExportEventToCSV(AZ::IO::SystemFile& file, const DrillerEvent* drillerEvent, CSVExportSettings* exportSettings) override; - - private: - - // Aggregate all data events in a particular frame and return a normalized - // value in the range [-1,1] based on the min/max range [0,maxValue]. - float GetTValueAtFrame(FrameNumberType frame, AZ::s64 maxValue); - - CarrierExportSettings m_csvExportSettings; - - // A parser that will parse carrier driller XML data and add events back - // into this aggregator. - CarrierDataParser m_parser; - }; -} - -#endif diff --git a/Code/Tools/Standalone/Source/Driller/Carrier/CarrierDataEvents.h b/Code/Tools/Standalone/Source/Driller/Carrier/CarrierDataEvents.h deleted file mode 100644 index 3947d593c8..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Carrier/CarrierDataEvents.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef DRILLER_CARRIER_DATAEVENTS_H -#define DRILLER_CARRIER_DATAEVENTS_H - -#include -#include -#include -#include "Source/Driller/DrillerEvent.h" - -namespace Driller -{ - namespace Carrier - { - enum CarrierEventType - { - CET_INFO = 1 - }; - } - - struct CarrierData - { - AZ::s32 mDataSend; //< Data sent (bytes). - AZ::s32 mDataReceived; //< Data received (bytes). - AZ::s32 mDataResent; //< Data resent (bytes). - AZ::s32 mDataAcked; //< Data acknowledged (bytes). - AZ::s32 mPacketSend; //< Number of packets sent. - AZ::s32 mPacketReceived; //< Number of packets received. - AZ::s32 mPacketLost; //< Number of packets lost. - AZ::s32 mPacketAcked; //< Number of packets acknowledged. - float mRTT; //< Round-trip time. - float mPacketLoss; //< Packet loss percentage. - }; - - class CarrierDataEvent - : public DrillerEvent - { - public: - AZ_CLASS_ALLOCATOR(CarrierDataEvent, AZ::SystemAllocator, 0); - - CarrierDataEvent() - : DrillerEvent(Carrier::CET_INFO) - , mID("") - { - }; - - virtual void StepForward(Aggregator* data) { (void)data; }; - virtual void StepBackward(Aggregator* data) { (void)data; }; - - AZStd::string mID; - CarrierData mLastSecond; - CarrierData mEffectiveLastSecond; - }; -} - -#endif diff --git a/Code/Tools/Standalone/Source/Driller/Carrier/CarrierDataParser.cpp b/Code/Tools/Standalone/Source/Driller/Carrier/CarrierDataParser.cpp deleted file mode 100644 index 1595487994..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Carrier/CarrierDataParser.cpp +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "CarrierDataEvents.h" -#include "CarrierDataAggregator.hxx" -#include "CarrierDataParser.h" - -namespace Driller -{ - CarrierDataParser::CarrierDataParser(CarrierDataAggregator* m_aggregator) - : DrillerHandlerParser(false) - , m_currentType(CDT_NONE) - , m_aggregator(m_aggregator) - { - } - - CarrierDataParser::~CarrierDataParser() - { - } - - AZ::Debug::DrillerHandlerParser* CarrierDataParser::OnEnterTag(AZ::u32 tagName) - { - // Start of a new event. - if (tagName == AZ_CRC("Statistics")) - { - m_currentType = CDT_STATISTICS; - m_aggregator->AddEvent(aznew CarrierDataEvent); - return this; - } - else if (tagName == AZ_CRC("LastSecond")) - { - m_currentType = CDT_LAST_SECOND; - return this; - } - else if (tagName == AZ_CRC("EffectiveLastSecond")) - { - m_currentType = CDT_EFFECTIVE_LAST_SECOND; - return this; - } - else - { - return nullptr; - } - } - - void CarrierDataParser::OnExitTag(AZ::Debug::DrillerHandlerParser* handler, AZ::u32 tagName) - { - (void)handler; - - if (tagName == AZ_CRC("LastSecond") || tagName == AZ_CRC("EffectiveLastSecond")) - { - m_currentType = CDT_NONE; - } - } - - void CarrierDataParser::OnData(const AZ::Debug::DrillerSAXParser::Data& dataNode) - { - // Ignore unsupported tags. - if (m_currentType == CDT_NONE) - { - return; - } - - CarrierDataEvent* event = static_cast(m_aggregator->GetEvents().back()); - - if (m_currentType == CDT_STATISTICS) - { - dataNode.Read(event->mID); - return; - } - - CarrierData* eventData = nullptr; - switch (m_currentType) - { - case CDT_LAST_SECOND: - eventData = &event->mLastSecond; - break; - case CDT_EFFECTIVE_LAST_SECOND: - eventData = &event->mEffectiveLastSecond; - break; - default: - return; - } - - if (dataNode.m_name == AZ_CRC("DataSend")) - { - dataNode.Read(eventData->mDataSend); - } - else if (dataNode.m_name == AZ_CRC("DataReceived")) - { - dataNode.Read(eventData->mDataReceived); - } - else if (dataNode.m_name == AZ_CRC("DataResent")) - { - dataNode.Read(eventData->mDataResent); - } - else if (dataNode.m_name == AZ_CRC("DataAcked")) - { - dataNode.Read(eventData->mDataAcked); - } - else if (dataNode.m_name == AZ_CRC("PacketSend")) - { - dataNode.Read(eventData->mPacketSend); - } - else if (dataNode.m_name == AZ_CRC("PacketReceived")) - { - dataNode.Read(eventData->mPacketReceived); - } - else if (dataNode.m_name == AZ_CRC("PacketLost")) - { - dataNode.Read(eventData->mPacketLost); - } - else if (dataNode.m_name == AZ_CRC("PacketAcked")) - { - dataNode.Read(eventData->mPacketAcked); - } - else if (dataNode.m_name == AZ_CRC("PacketLoss")) - { - dataNode.Read(eventData->mPacketLoss); - } - else if (dataNode.m_name == AZ_CRC("rtt")) - { - dataNode.Read(eventData->mRTT); - } - } -} diff --git a/Code/Tools/Standalone/Source/Driller/Carrier/CarrierDataParser.h b/Code/Tools/Standalone/Source/Driller/Carrier/CarrierDataParser.h deleted file mode 100644 index 069065e03e..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Carrier/CarrierDataParser.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef DRILLER_CARRIER_DATAPARSER_H -#define DRILLER_CARRIER_DATAPARSER_H - -#include -#include "CarrierDataEvents.h" - -namespace Driller -{ - class CarrierDataAggregator; - - enum CarrierDataType - { - CDT_NONE, - CDT_STATISTICS, - CDT_LAST_SECOND, - CDT_EFFECTIVE_LAST_SECOND - }; - - class CarrierDataParser - : public AZ::Debug::DrillerHandlerParser - { - public: - // The parser will add events to a CarrierDataAggregator instance. - CarrierDataParser(CarrierDataAggregator* m_aggregator); - virtual ~CarrierDataParser(); - - // AZ::Debug::DrillerHandlerParser: Callbacks for entering, leaving and finding data - // while parsing the driller XML data. - AZ::Debug::DrillerHandlerParser* OnEnterTag(AZ::u32 tagName) override; - void OnExitTag(AZ::Debug::DrillerHandlerParser* handler, AZ::u32 tagName) override; - void OnData(const AZ::Debug::DrillerSAXParser::Data& dataNode) override; - - private: - // The current tag type while parsing the driller XML data. - CarrierDataType m_currentType; - - // The aggregator where events are added as a result of parsing the XML data. - CarrierDataAggregator* m_aggregator; - }; -} - -#endif diff --git a/Code/Tools/Standalone/Source/Driller/Carrier/CarrierDataView.cpp b/Code/Tools/Standalone/Source/Driller/Carrier/CarrierDataView.cpp deleted file mode 100644 index f7d456522a..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Carrier/CarrierDataView.cpp +++ /dev/null @@ -1,268 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include -#include "CarrierDataEvents.h" -#include "CarrierDataAggregator.hxx" -#include "CarrierDataView.hxx" -#include "CarrierOperationTelemetryEvent.h" - -#include "Source/Driller/DrillerOperationTelemetryEvent.h" - -#include -#include -#include - -namespace Driller -{ - static AZ::s64 GetLargestDataValue(const CarrierDataView::DataPointList& dataPointList) - { - AZ::s64 maxDataValue = 0; - for (auto dataPoint = dataPointList.begin(); dataPoint != dataPointList.end(); dataPoint++) - { - if (dataPoint->second > maxDataValue) - { - maxDataValue = static_cast(dataPoint->second); - } - } - return maxDataValue; - } - - static void BuildEventList(const CarrierDataAggregator* aggr, - FrameNumberType startFrame, - FrameNumberType endFrame, - AZStd::vector& eventIdxList) - { - eventIdxList.clear(); - for (FrameNumberType frame = startFrame; frame <= endFrame; frame++) - { - size_t numEvents = aggr->NumOfEventsAtFrame(frame); - if (numEvents == 0) - { - continue; - } - - EventNumberType firstEventIdx = aggr->GetFirstIndexAtFrame(frame); - for (EventNumberType eventIdx = firstEventIdx; eventIdx < static_cast(firstEventIdx + numEvents); eventIdx++) - { - eventIdxList.push_back(eventIdx); - } - } - } - - static void GetEventIds(const CarrierDataAggregator* aggr, - FrameNumberType startFrame, - FrameNumberType endFrameIdx, - AZStd::set& ids) - { - ids.clear(); - for (FrameNumberType frameId = startFrame; frameId <= endFrameIdx; frameId++) - { - size_t numEvents = aggr->NumOfEventsAtFrame(frameId); - EventNumberType firstEventIndex = aggr->GetFirstIndexAtFrame(frameId); - for (EventNumberType eventIndex = firstEventIndex; eventIndex < static_cast(firstEventIndex + numEvents); eventIndex++) - { - CarrierDataEvent* event = static_cast(aggr->GetEvents()[eventIndex]); - ids.insert(event->mID); - } - } - } - - CarrierDataView::CarrierDataView(FrameNumberType startFrame, FrameNumberType endFrame, const CarrierDataAggregator* aggregator) - : QDialog() - , mStartFrame(0) - , mEndFrame(0) - , m_lifespanTelemetry("CarrierDataView") - { - // Create a window defined in CarrierDataView.ui. - m_gui = azcreate(Ui::CarrierDataView, ()); - m_gui->setupUi(this); - - setAttribute(Qt::WA_DeleteOnClose, true); - setWindowFlags(windowFlags() | Qt::WindowMaximizeButtonHint); - - mStartFrame = startFrame; - mEndFrame = endFrame; - mAggregator = aggregator; - - // Prepare the dialog. - show(); - raise(); - activateWindow(); - setFocus(); - - setWindowTitle(aggregator->GetDialogTitle()); - - // Find all unique ids and add them to the drop down box. - AZStd::set ids; - GetEventIds(aggregator, startFrame, endFrame, ids); - - for (auto id = ids.begin(); id != ids.end(); id++) - { - m_gui->Filter->addItem((*id).c_str()); - } - - QObject::connect(m_gui->Filter, SIGNAL(currentIndexChanged(int)), this, SLOT(OnCurrentFilterChanged())); - - // Update the charts based on the current filter. - OnCurrentFilterChanged(); - } - - CarrierDataView::~CarrierDataView() - { - azdestroy(m_gui); - } - - void CarrierDataView::OnCurrentFilterChanged() - { - AZStd::string currentId = AZStd::string(m_gui->Filter->currentText().toUtf8().constData()); - SetupAllCharts(currentId, mAggregator, mStartFrame, mEndFrame); - - CarrierOperationTelemetryEvent filterChanged; - filterChanged.SetAttribute("IPFilterChanged", ""); - filterChanged.Log(); - } - - void CarrierDataView::SetupAllCharts(AZStd::string id, - const CarrierDataAggregator* aggr, - FrameNumberType startFrame, - FrameNumberType endFrame) - { - AZStd::vector eventIdxList; - BuildEventList(aggr, startFrame, endFrame, eventIdxList); - - DataPointList send; - DataPointList recv; - DataPointList effectiveSend; - DataPointList effectiveRecv; - DataPointList pktSend; - DataPointList pktRecv; - DataPointList rtt; - DataPointList loss; - - EventNumberType eventIndex = 0; - for (auto eventItr = eventIdxList.begin(); eventItr != eventIdxList.end(); eventItr++) - { - EventNumberType realEventIndex = *eventItr; - CarrierDataEvent* event = static_cast(aggr->GetEvents()[realEventIndex]); - - if (event->mID.compare(id) != 0) - { - continue; - } - - // Total bytes sent and received. - send.push_back(DataPoint(eventIndex, static_cast(event->mLastSecond.mDataSend))); - recv.push_back(DataPoint(eventIndex, static_cast(event->mLastSecond.mDataReceived))); - // Effective bytes sent and received ( - effectiveSend.push_back(DataPoint(eventIndex, static_cast(event->mEffectiveLastSecond.mDataSend))); - effectiveRecv.push_back(DataPoint(eventIndex, static_cast(event->mEffectiveLastSecond.mDataReceived))); - // Total packets send and received. - pktSend.push_back(DataPoint(eventIndex, static_cast(event->mLastSecond.mPacketSend))); - pktRecv.push_back(DataPoint(eventIndex, static_cast(event->mLastSecond.mPacketReceived))); - // RTT - rtt.push_back(DataPoint(eventIndex, event->mLastSecond.mRTT)); - // Loss - loss.push_back(DataPoint(eventIndex, event->mLastSecond.mPacketLoss)); - - eventIndex++; - } - - SetupDualBytesChart(m_gui->sendRecvDataStrip, send, recv); - SetupDualBytesChart(m_gui->effectiveSendRecvDataStrip, effectiveSend, effectiveRecv); - SetupDualPacketChart(m_gui->packetSendRecvDataStrip, pktSend, pktRecv); - SetupTimeChart(m_gui->rttDataStrip, rtt); - } - - void CarrierDataView::SetupDualBytesChart(StripChart::DataStrip* chart, const DataPointList& bytes0, const DataPointList& bytes1) - { - chart->Reset(); - AZ::s64 maxSend = GetLargestDataValue(bytes0); - AZ::s64 maxRecv = GetLargestDataValue(bytes1); - chart->AddAxis("Seconds", 0.0f, static_cast(bytes0.size() > bytes1.size() ? bytes0.size() : bytes1.size()), false); - chart->AddAxis("Bytes/second", 0.0f, (maxSend > maxRecv ? maxSend : maxRecv) * 1.2f, false); - - int sendChannel = chart->AddChannel("Bytes0"); - int recvChannel = chart->AddChannel("Bytes1"); - chart->SetChannelColor(sendChannel, QColor(0, 255, 0)); - chart->SetChannelStyle(sendChannel, StripChart::Channel::STYLE_CONNECTED_LINE); - chart->SetChannelColor(recvChannel, QColor(255, 0, 0)); - chart->SetChannelStyle(recvChannel, StripChart::Channel::STYLE_CONNECTED_LINE); - - for (auto dataPoint = bytes0.begin(); dataPoint != bytes0.end(); dataPoint++) - { - chart->AddData(sendChannel, 0, static_cast(dataPoint->first), dataPoint->second); - } - - for (auto dataPoint = bytes1.begin(); dataPoint != bytes1.end(); dataPoint++) - { - chart->AddData(recvChannel, 0, static_cast(dataPoint->first), dataPoint->second); - } - } - - void CarrierDataView::SetupDualPacketChart(StripChart::DataStrip* chart, const DataPointList& packets0, const DataPointList& packets1) - { - chart->Reset(); - AZ::s64 maxSend = GetLargestDataValue(packets0); - AZ::s64 maxRecv = GetLargestDataValue(packets1); - chart->AddAxis("Seconds", 0.0f, static_cast(packets0.size() > packets1.size() ? packets0.size() : packets1.size()), false); - chart->AddAxis("Packets/second", 0.0f, (maxSend > maxRecv ? maxSend : maxRecv) * 1.2f, false); - - int sendChannel = chart->AddChannel("Bytes0"); - int recvChannel = chart->AddChannel("Bytes1"); - chart->SetChannelColor(sendChannel, QColor(0, 255, 0)); - chart->SetChannelStyle(sendChannel, StripChart::Channel::STYLE_CONNECTED_LINE); - chart->SetChannelColor(recvChannel, QColor(255, 0, 0)); - chart->SetChannelStyle(recvChannel, StripChart::Channel::STYLE_CONNECTED_LINE); - - for (auto dataPoint = packets0.begin(); dataPoint != packets0.end(); dataPoint++) - { - chart->AddData(sendChannel, 0, static_cast(dataPoint->first), dataPoint->second); - } - - for (auto dataPoint = packets1.begin(); dataPoint != packets1.end(); dataPoint++) - { - chart->AddData(recvChannel, 0, static_cast(dataPoint->first), dataPoint->second); - } - } - - void CarrierDataView::SetupTimeChart(StripChart::DataStrip* chart, const DataPointList& time) - { - chart->Reset(); - - AZ::s64 maxRTT = GetLargestDataValue(time); - chart->AddAxis("Seconds", 0.0f, static_cast(time.size()), false); - chart->AddAxis("Milliseconds", 0.0f, maxRTT * 1.2f); - - int channel = chart->AddChannel("RTT"); - chart->SetChannelColor(channel, QColor(255, 0, 255)); - chart->SetChannelStyle(channel, StripChart::Channel::STYLE_CONNECTED_LINE); - - for (auto dataPoint = time.begin(); dataPoint != time.end(); dataPoint++) - { - chart->AddData(channel, 0, static_cast(dataPoint->first), dataPoint->second); - } - } - - void CarrierDataView::SetupPercentageChart(StripChart::DataStrip* chart, const DataPointList& percentage) - { - chart->Reset(); - - chart->AddAxis("Seconds", 0.0f, static_cast(percentage.size()), false); - chart->AddAxis("Percentage", 0.0f, 100.0f); - - int channel = chart->AddChannel("Loss"); - chart->SetChannelColor(channel, QColor(255, 255, 255)); - chart->SetChannelStyle(channel, StripChart::Channel::STYLE_CONNECTED_LINE); - - for (auto dataPoint = percentage.begin(); dataPoint != percentage.end(); dataPoint++) - { - chart->AddData(channel, 0, static_cast(dataPoint->first), dataPoint->second); - } - } -} diff --git a/Code/Tools/Standalone/Source/Driller/Carrier/CarrierDataView.hxx b/Code/Tools/Standalone/Source/Driller/Carrier/CarrierDataView.hxx deleted file mode 100644 index 114954a15a..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Carrier/CarrierDataView.hxx +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef CARRIER_DATAVIEW_H -#define CARRIER_DATAVIEW_H - -#if !defined(Q_MOC_RUN) -#include -#include -#include -#include - -#include "Source/Driller/StripChart.hxx" -#include "Source/Driller/DrillerOperationTelemetryEvent.h" -#include "Source/Driller/DrillerDataTypes.h" -#endif - -namespace Ui -{ - class CarrierDataView; -} - -namespace Driller -{ - class CarrierDataAggregator; - - class CarrierDataView - : public QDialog - { - Q_OBJECT - public: - AZ_CLASS_ALLOCATOR(CarrierDataView, AZ::SystemAllocator, 0); - CarrierDataView(FrameNumberType startFrame, FrameNumberType endFrame, const CarrierDataAggregator* aggr); - virtual ~CarrierDataView(); - - // A data point is made up of a x and y value (first and second respectively) - // which can be plotted onto a XY chart. - typedef AZStd::pair DataPoint; - typedef AZStd::vector DataPointList; - - public slots: - void OnCurrentFilterChanged(); - - private: - void SetupAllCharts(AZStd::string id, - const CarrierDataAggregator* aggr, - FrameNumberType startFrame, - FrameNumberType endFrame); - - void SetupDualBytesChart(StripChart::DataStrip* chart, const DataPointList& bytes0, const DataPointList& bytes1); - void SetupDualPacketChart(StripChart::DataStrip* chart, const DataPointList& packets1, const DataPointList& packets2); - void SetupTimeChart(StripChart::DataStrip* chart, const DataPointList& time); - void SetupPercentageChart(StripChart::DataStrip* chart, const DataPointList& percentage); - - const CarrierDataAggregator* mAggregator; - FrameNumberType mStartFrame, mEndFrame; - - DrillerWindowLifepsanTelemetry m_lifespanTelemetry; - - // A QT widget defined in CarrierDataView.ui and compiled into ui_CarrierDataView.hpp. - Ui::CarrierDataView* m_gui; - }; -} - -#endif diff --git a/Code/Tools/Standalone/Source/Driller/Carrier/CarrierDataView.ui b/Code/Tools/Standalone/Source/Driller/Carrier/CarrierDataView.ui deleted file mode 100644 index 915744e1a7..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Carrier/CarrierDataView.ui +++ /dev/null @@ -1,327 +0,0 @@ - - - CarrierDataView - - - - 0 - 0 - 1000 - 825 - - - - Carrier Data View - - - - - - - - - 0 - 32 - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - 2 - - - 1 - - - 1 - - - 1 - - - 1 - - - - - - - - - - - - 0 - 1 - - - - - 0 - 128 - - - - - - 70 - 20 - 111 - 20 - - - - - 10 - 75 - true - - - - false - - - QLabel { color : rgb(0, 255, 0); } - - - Total Send - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - 70 - 40 - 111 - 20 - - - - - 10 - 75 - true - - - - QLabel { color : rgb(255, 0, 0); } - - - Total Received - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - - - 0 - 1 - - - - - 0 - 128 - - - - - - 70 - 20 - 141 - 20 - - - - - 10 - 75 - true - - - - false - - - QLabel { color : rgb(0, 255, 0); } - - - User Data Send - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - 70 - 40 - 141 - 20 - - - - - 10 - 75 - true - - - - QLabel { color : rgb(255, 0, 0); } - - - User Data Received - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - - - 0 - 1 - - - - - 0 - 128 - - - - - - 70 - 20 - 141 - 20 - - - - - 10 - 75 - true - - - - false - - - QLabel { color : rgb(0, 255, 0); } - - - Packets Send - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - 70 - 40 - 141 - 20 - - - - - 10 - 75 - true - - - - QLabel { color : rgb(255, 0, 0); } - - - Packets Received - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - - - 0 - 1 - - - - - 0 - 128 - - - - - - 70 - 20 - 181 - 20 - - - - - 10 - 75 - true - - - - false - - - QLabel { color : rgb(255, 0, 255); } - - - Return Trip Time (Latency) - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - - - - - StripChart::DataStrip - QWidget -
../StripChart.hxx
- 1 -
-
- - -
diff --git a/Code/Tools/Standalone/Source/Driller/Carrier/CarrierOperationTelemetryEvent.h b/Code/Tools/Standalone/Source/Driller/Carrier/CarrierOperationTelemetryEvent.h deleted file mode 100644 index d4c7d004ef..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Carrier/CarrierOperationTelemetryEvent.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ -#ifndef DRILLER_CARRIER_CARRIEROPERATIONTELEMETRYEVENT_H -#define DRILLER_CARRIER_CARRIEROPERATIONTELEMETRYEVENT_H - -#include "Source/Telemetry/TelemetryEvent.h" - -namespace Driller -{ - class CarrierOperationTelemetryEvent - : public Telemetry::TelemetryEvent - { - public: - CarrierOperationTelemetryEvent() - : Telemetry::TelemetryEvent("CarrierDataViewOperation") - { - } - }; -} - -#endif diff --git a/Code/Tools/Standalone/Source/Driller/ChannelConfigurationDialog.cpp b/Code/Tools/Standalone/Source/Driller/ChannelConfigurationDialog.cpp deleted file mode 100644 index 95fb586500..0000000000 --- a/Code/Tools/Standalone/Source/Driller/ChannelConfigurationDialog.cpp +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ -#include "Source/Driller/ChannelConfigurationDialog.hxx" -#include - -namespace Driller -{ - ChannelConfigurationDialog::ChannelConfigurationDialog(QWidget* parent) - : QDialog(parent) - { - setAttribute(Qt::WA_DeleteOnClose, true); - setWindowFlags(windowFlags() | Qt::WindowMaximizeButtonHint | Qt::WindowMinimizeButtonHint); - - QMargins margins(0, 0, 0, 0); - setContentsMargins(margins); - } - - ChannelConfigurationDialog::~ChannelConfigurationDialog() - { - emit DialogClosed(this); - } -} diff --git a/Code/Tools/Standalone/Source/Driller/ChannelConfigurationDialog.hxx b/Code/Tools/Standalone/Source/Driller/ChannelConfigurationDialog.hxx deleted file mode 100644 index 1baf205077..0000000000 --- a/Code/Tools/Standalone/Source/Driller/ChannelConfigurationDialog.hxx +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ -#pragma once -#ifndef PROFILER_CHANNELCONFIGURATIONDIALOG_H -#define PROFILER_CHANNELCONFIGURATIONDIALOG_H - -#if !defined(Q_MOC_RUN) -#include -#include - -#include -#endif - -namespace Driller -{ - class ChannelConfigurationDialog - : public QDialog - { - Q_OBJECT; - - public: - AZ_CLASS_ALLOCATOR(ChannelConfigurationDialog,AZ::SystemAllocator,0); - - ChannelConfigurationDialog(QWidget* parent = nullptr); - ~ChannelConfigurationDialog(); - - signals: - - void DialogClosed(QDialog* dialog); - }; -} - -#endif diff --git a/Code/Tools/Standalone/Source/Driller/ChannelConfigurationWidget.cpp b/Code/Tools/Standalone/Source/Driller/ChannelConfigurationWidget.cpp deleted file mode 100644 index 689b87f2b2..0000000000 --- a/Code/Tools/Standalone/Source/Driller/ChannelConfigurationWidget.cpp +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ -#include -#include - -namespace Driller -{ - /////////////////////////////// - // ChannelConfigurationWidget - /////////////////////////////// - - ChannelConfigurationWidget::ChannelConfigurationWidget(QWidget* parent) - : QWidget(parent) - { - } -} diff --git a/Code/Tools/Standalone/Source/Driller/ChannelConfigurationWidget.hxx b/Code/Tools/Standalone/Source/Driller/ChannelConfigurationWidget.hxx deleted file mode 100644 index 3f64e1b52c..0000000000 --- a/Code/Tools/Standalone/Source/Driller/ChannelConfigurationWidget.hxx +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ -#pragma once -#ifndef PROFILER_CHANNELCONFIGURATIONWIDGET_H -#define PROFILER_CHANNELCONFIGURATIONWIDGET_H - -#if !defined(Q_MOC_RUN) -#include -#include - -#include -#endif - -namespace Driller -{ - class ChannelConfigurationWidget - : public QWidget - { - Q_OBJECT - public: - AZ_CLASS_ALLOCATOR(ChannelConfigurationWidget, AZ::SystemAllocator,0); - - ChannelConfigurationWidget(QWidget* parent = nullptr); - ~ChannelConfigurationWidget() = default; - - public slots: - signals: - void ConfigurationChanged(); - }; -} - -#endif diff --git a/Code/Tools/Standalone/Source/Driller/ChannelControl.cpp b/Code/Tools/Standalone/Source/Driller/ChannelControl.cpp deleted file mode 100644 index a98f93be98..0000000000 --- a/Code/Tools/Standalone/Source/Driller/ChannelControl.cpp +++ /dev/null @@ -1,484 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "ChannelControl.hxx" -#include - -#include "Annotations/Annotations.hxx" -#include "ChannelDataView.hxx" -#include "ChannelProfilerWidget.hxx" -#include "DrillerAggregator.hxx" -#include "DrillerMainWindowMessages.h" -#include "Source/Driller/ChannelConfigurationDialog.hxx" -#include "Source/Driller/ChannelConfigurationWidget.hxx" -#include "Source/Driller/CollapsiblePanel.hxx" -#include "Source/Driller/CustomizeCSVExportWidget.hxx" -#include "Source/Driller/DrillerOperationTelemetryEvent.h" - -namespace Driller -{ - ChannelControl::ChannelControl(const char* channelName, AnnotationsProvider* ptrAnnotations, QWidget* parent, Qt::WindowFlags flags) - : QWidget(parent, flags) - , m_isSetup(false) - , m_captureMode(CaptureMode::Unknown) - , m_channelId(channelName) - , m_configurationDialog(nullptr) - { - setupUi(this); - - m_State.m_EndFrame = -1; - m_State.m_FramesInView = 10; // magic numbers (this matches the default drop-down menu option) - m_State.m_ContractedHeight = false; - m_State.m_ScrubberFrame = 0; - m_State.m_FrameOffset = 0; - m_State.m_LoopBegin = 0; - m_State.m_LoopEnd = 0; - - this->channelName->setText(channelName ? channelName : "Channel Name Here"); - - channelDataView->RegisterToChannel(this, ptrAnnotations); - channelDataView->setAutoFillBackground(true); - - configChannel->setVisible(false); - - connect(channelDataView, SIGNAL(InformOfMouseClick(Qt::MouseButton, FrameNumberType, FrameNumberType, int)), SIGNAL(InformOfMouseClick(Qt::MouseButton, FrameNumberType, FrameNumberType, int))); - connect(channelDataView, SIGNAL(InformOfMouseMove(FrameNumberType, FrameNumberType, int)), SIGNAL(InformOfMouseMove(FrameNumberType, FrameNumberType, int))); - connect(channelDataView, SIGNAL(InformOfMouseRelease(Qt::MouseButton, FrameNumberType, FrameNumberType, int)), SIGNAL(InformOfMouseRelease(Qt::MouseButton, FrameNumberType, FrameNumberType, int))); - connect(channelDataView, SIGNAL(InformOfMouseWheel(FrameNumberType, int, FrameNumberType, int)), SIGNAL(InformOfMouseWheel(FrameNumberType, int, FrameNumberType, int))); - connect(configChannel, SIGNAL(clicked()), SLOT(OnConfigureChannel())); - - ConfigureUI(); - } - - ChannelControl::~ChannelControl() - { - if (m_configurationDialog) - { - m_configurationDialog->close(); - } - m_configurationDialog = nullptr; - - QList::iterator iter = m_OpenDrills.begin(); - while (iter != m_OpenDrills.end()) - { - delete *iter; - ++iter; - } - m_OpenDrills.clear(); - } - - bool ChannelControl::IsInCaptureMode(CaptureMode captureMode) const - { - return m_captureMode == captureMode; - } - - void ChannelControl::SetCaptureMode(CaptureMode captureMode) - { - if (captureMode != m_captureMode) - { - m_captureMode = captureMode; - - ConfigureUI(); - - emit OnCaptureModeChanged(m_captureMode); - } - } - - void ChannelControl::OnContractedToggled(bool toggleState) - { - (void)toggleState; - - // We're going to want to contract this eventually. So keeping the function - // to avoid unwiring all of the other methods, while we transition - /* - m_Contracted->setChecked(toggleState); - - if (toggleState) // MINIMIZED - { - m_State.m_ContractedHeight = true; - m_Info->hide(); - setFixedHeight(k_contractedSize); - QIcon eyecon(":/general/expand"); - m_Contracted->setIcon(eyecon); - } - else // NORMAL - { - m_State.m_ContractedHeight = false; - m_Info->show(); - this->setFixedHeight(k_expandedSize); - QIcon eyecon(":/general/contract"); - m_Contracted->setIcon(eyecon); - } - emit ExpandedContracted(); - */ - } - - void ChannelControl::OnSuccessfulDrillDown(QWidget* drillerWidget) - { - if (drillerWidget) - { - connect(drillerWidget, SIGNAL(destroyed(QObject*)), this, SLOT(OnDrillDestroyed(QObject*))); - m_OpenDrills.push_back(drillerWidget); - } - } - - void ChannelControl::OnDrillDestroyed(QObject* drill) - { - QWidget* qw = qobject_cast(drill); - m_OpenDrills.removeOne(qw); - } - - void ChannelControl::OnShowCommand() - { - //todo: phughes consider auto-hide toggle to control this behavior - - //QList::iterator ptiter = m_OpenDrillsPositions.begin(); - //QList::iterator iter = m_OpenDrills.begin(); - //while (iter != m_OpenDrills.end()) - //{ - // (*iter)->show(); - // (*iter)->move(*ptiter); - // ++iter; - // ++ptiter; - //} - } - - void ChannelControl::OnHideCommand() - { - //todo: phughes consider auto-hide toggle to control this behavior - - //m_OpenDrillsPositions.clear(); - //QList::iterator iter = m_OpenDrills.begin(); - //while (iter != m_OpenDrills.end()) - //{ - // if (*iter) - // { - // m_OpenDrillsPositions.push_back((*iter)->pos()); - // (*iter)->hide(); - // } - // ++iter; - //} - } - - bool ChannelControl::IsSetup() const - { - return m_isSetup; - } - - void ChannelControl::SignalSetup() - { - m_isSetup = true; - - ConfigureUI(); - } - - bool ChannelControl::IsActive() const - { - bool isActive = false; - - for (ChannelProfilerWidget* profiler : m_profilerWidgets) - { - if (profiler->IsActive()) - { - isActive = true; - break; - } - } - - return isActive; - } - - const AZStd::list< ChannelProfilerWidget* >& ChannelControl::GetProfilers() const - { - return m_profilerWidgets; - } - - ChannelProfilerWidget* ChannelControl::GetMainProfiler() const - { - ChannelProfilerWidget* retVal = nullptr; - - for (ChannelProfilerWidget* profiler : m_profilerWidgets) - { - if (profiler->IsActive()) - { - retVal = profiler; - break; - } - } - - return retVal; - } - - ChannelProfilerWidget* ChannelControl::AddAggregator(Aggregator* aggregator) - { - ChannelProfilerWidget* retVal = nullptr; - - for (ChannelProfilerWidget* profiler : m_profilerWidgets) - { - if (profiler->GetID() == aggregator->GetID()) - { - AZ_Warning("ChannelControl", false, "Trying to register two aggregators with the same ID"); - retVal = profiler; - break; - } - } - - if (retVal == nullptr) - { - retVal = aznew ChannelProfilerWidget(this, aggregator); - - if (retVal != nullptr) - { - ConnectProfilerWidget(retVal); - - profilerLayout->addWidget(retVal); - m_profilerWidgets.push_back(retVal); - - aggregator->AnnotateChannelView(channelDataView); - - if (aggregator->HasConfigurations()) - { - configChannel->setVisible(true); - } - - connect(aggregator, SIGNAL(NormalizedRangeChanged()), SLOT(OnNormalizedRangeChanged())); - } - } - - return retVal; - } - - bool ChannelControl::RemoveAggregator(Aggregator* aggregator) - { - bool removed = false; - - for (auto profilerIter = m_profilerWidgets.begin(); - profilerIter != m_profilerWidgets.end(); - ++profilerIter) - { - if ((*profilerIter)->GetID() == aggregator->GetID()) - { - removed = true; - m_profilerWidgets.erase(profilerIter); - break; - } - } - - AZ_Warning("ChannelControl", removed, "Trying to remove aggregator from the wrong Channel Control"); - return removed; - } - - void ChannelControl::SetAllProfilersEnabled(bool enabled) - { - for (ChannelProfilerWidget* profiler : m_profilerWidgets) - { - profiler->SetIsActive(enabled); - } - } - - AZ::Crc32 ChannelControl::GetChannelId() const - { - return m_channelId; - } - - void ChannelControl::SetEndFrame(FrameNumberType endFrame) - { - channelDataView->DirtyGraphData(); - m_State.m_EndFrame = endFrame; - channelDataView->update(); - } - - void ChannelControl::SetSliderOffset(FrameNumberType frameOffset) - { - channelDataView->DirtyGraphData(); - m_State.m_FrameOffset = frameOffset; - //AZ_TracePrintf("Driller"," SetSliderOffset %d = %d - %d\n", m_State.m_FrameOffset, m_State.m_EndFrame, frame); - channelDataView->update(); - } - - void ChannelControl::SetLoopBegin(FrameNumberType frameNum) - { - if (m_State.m_LoopBegin != frameNum) - { - m_State.m_LoopBegin = frameNum; - - FrameNumberType lastFrame = m_State.m_FrameOffset + m_State.m_FramesInView - 1; - - if (frameNum < m_State.m_FrameOffset) - { - emit RequestScrollToFrame(frameNum); - } - else if (frameNum > lastFrame) - { - emit RequestScrollToFrame(m_State.m_FrameOffset + (frameNum - lastFrame)); - } - - channelDataView->update(); - } - } - void ChannelControl::SetLoopEnd(FrameNumberType frameNum) - { - if (m_State.m_LoopEnd != frameNum) - { - m_State.m_LoopEnd = frameNum; - - FrameNumberType lastFrame = m_State.m_FrameOffset + m_State.m_FramesInView - 1; - - if (frameNum < m_State.m_FrameOffset) - { - emit RequestScrollToFrame(frameNum); - } - else if (frameNum > lastFrame) - { - emit RequestScrollToFrame(m_State.m_FrameOffset + (frameNum - lastFrame)); - } - - channelDataView->update(); - } - } - - void ChannelControl::SetScrubberFrame(FrameNumberType frameNum) - { - if (m_State.m_ScrubberFrame != frameNum) - { - m_State.m_ScrubberFrame = frameNum; - - FrameNumberType lastFrame = m_State.m_FrameOffset + m_State.m_FramesInView - 1; - - if (frameNum < m_State.m_FrameOffset) - { - emit RequestScrollToFrame(frameNum); - } - else if (frameNum > lastFrame) - { - emit RequestScrollToFrame(m_State.m_FrameOffset + (frameNum - lastFrame)); - } - - channelDataView->update(); - } - } - - void ChannelControl::SetDataPointsInView(FrameNumberType count) - { - m_State.m_FramesInView = count; - channelDataView->DirtyGraphData(); - channelDataView->update(); - } - - void ChannelControl::OnRefreshView() - { - channelDataView->update(); - } - - void ChannelControl::OnActivationChanged(ChannelProfilerWidget* profilerWidget, bool activated) - { - if (activated) - { - profilerWidget->GetAggregator()->AnnotateChannelView(channelDataView); - } - else - { - profilerWidget->GetAggregator()->RemoveChannelAnnotation(channelDataView); - } - - channelDataView->DirtyGraphData(); - channelDataView->update(); - } - - void ChannelControl::OnConfigureChannel() - { - if (m_configurationDialog == nullptr) - { - m_configurationDialog = aznew ChannelConfigurationDialog(); - QVBoxLayout* layout = new QVBoxLayout(); - - QMargins contentMargins(3,5,3,5); - layout->setContentsMargins(contentMargins); - layout->setSpacing(5); - - for (ChannelProfilerWidget* profilerWidget : m_profilerWidgets) - { - if (profilerWidget->IsActive()) - { - ChannelConfigurationWidget* configurationWidget = profilerWidget->CreateConfigurationWidget(); - - if (configurationWidget) - { - connect(configurationWidget, SIGNAL(ConfigurationChanged()), SLOT(OnConfigurationChanged())); - layout->addWidget(configurationWidget); - } - } - } - - m_configurationDialog->setLayout(layout); - m_configurationDialog->show(); - m_configurationDialog->setFocus(); - - connect(m_configurationDialog, SIGNAL(DialogClosed(QDialog*)), SLOT(OnDialogClosed(QDialog*))); - - m_configurationDialog->setWindowTitle(QString("%1's Channel Configurations.").arg(channelName->text())); - } - - if (m_configurationDialog->isMinimized()) - { - m_configurationDialog->showNormal(); - } - - m_configurationDialog->raise(); - m_configurationDialog->activateWindow(); - } - - void ChannelControl::OnDialogClosed(QDialog* dialog) - { - if (m_configurationDialog == dialog) - { - m_configurationDialog = nullptr; - } - } - - void ChannelControl::OnConfigurationChanged() - { - if (IsInCaptureMode(CaptureMode::Inspecting)) - { - for (ChannelProfilerWidget* profilerWidget : m_profilerWidgets) - { - profilerWidget->GetAggregator()->OnConfigurationChanged(); - } - - // Force the channel data view to regrab all of the aggregator data. - channelDataView->RefreshGraphData(); - } - } - - void ChannelControl::OnNormalizedRangeChanged() - { - // Only want to allow this while we are inspecting. - // Otherwise just too much noise with the incoming data. - if (IsInCaptureMode(CaptureMode::Inspecting)) - { - channelDataView->RefreshGraphData(); - } - } - - void ChannelControl::ConnectProfilerWidget(ChannelProfilerWidget* profilerWidget) - { - connect(this, SIGNAL(OnCaptureModeChanged(CaptureMode)), profilerWidget, SLOT(SetCaptureMode(CaptureMode))); - - connect(profilerWidget, SIGNAL(OnActivationChanged(ChannelProfilerWidget*, bool)), this, SLOT(OnActivationChanged(ChannelProfilerWidget*, bool))); - - profilerWidget->SetCaptureMode(m_captureMode); - } - - void ChannelControl::ConfigureUI() - { - if (IsSetup()) - { - configChannel->setEnabled(!IsInCaptureMode(CaptureMode::Capturing)); - } - } -} diff --git a/Code/Tools/Standalone/Source/Driller/ChannelControl.hxx b/Code/Tools/Standalone/Source/Driller/ChannelControl.hxx deleted file mode 100644 index 4da56bd5f4..0000000000 --- a/Code/Tools/Standalone/Source/Driller/ChannelControl.hxx +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef CHANNEL_CONTROL_H -#define CHANNEL_CONTROL_H - -#if !defined(Q_MOC_RUN) -#include -#include - -#include - -#include "DrillerNetworkMessages.h" - -#include "Source/Driller/DrillerDataTypes.h" - -// Generated Files -#include -#endif - -namespace Driller -{ - class AnnotationsProvider; - class ChannelConfigurationDialog; - - /* - Channel Control intermediates between one data Aggregator, the application's main window, and the renderer. - This maintains state used by the renderer and passes changes both up and down via signal/slot. - */ - - class ChannelControl - : public QWidget - , private Ui::ChannelControl - { - Q_OBJECT; - public: - AZ_CLASS_ALLOCATOR(ChannelControl,AZ::SystemAllocator,0); - ChannelControl( const char* channelName, AnnotationsProvider* ptrAnnotations, QWidget* parent = NULL, Qt::WindowFlags flags = Qt::WindowFlags()); - virtual ~ChannelControl(void); - - struct - { - FrameNumberType m_EndFrame; - FrameNumberType m_FramesInView; - int m_ContractedHeight; - FrameNumberType m_ScrubberFrame; - FrameNumberType m_FrameOffset; - FrameNumberType m_LoopBegin; - FrameNumberType m_LoopEnd; - } m_State; - - bool m_isLive; - - QList m_OpenDrills; - QList m_OpenDrillsPositions; - - bool IsSetup() const; - void SignalSetup(); - - bool IsActive() const; - const AZStd::list< ChannelProfilerWidget* >& GetProfilers() const; - - // Temporary solution, since eventually we'll want to display all of the information - // we have at once. For now, since we can only have one. Get a "main" window. - ChannelProfilerWidget* GetMainProfiler() const; - ChannelProfilerWidget* AddAggregator(Aggregator* aggregator); - bool RemoveAggregator(Aggregator* aggregator); - - void SetAllProfilersEnabled(bool enabled); - AZ::Crc32 GetChannelId() const; - - void SetDataPointsInView( FrameNumberType count ); - void SetEndFrame( FrameNumberType frame ); - void SetSliderOffset( FrameNumberType frame ); - void SetLoopBegin( FrameNumberType frame ); - void SetLoopEnd( FrameNumberType frame ); - - bool IsInCaptureMode(CaptureMode captureMode) const; - - public slots: - void SetCaptureMode(CaptureMode captureMode); - void OnContractedToggled( bool toggleState ); - void OnSuccessfulDrillDown(QWidget* drillerWidget); - void SetScrubberFrame( FrameNumberType frame ); - void OnDrillDestroyed(QObject *drill); - void OnShowCommand(); - void OnHideCommand(); - void OnRefreshView(); - void OnActivationChanged(ChannelProfilerWidget*,bool activated); - void OnConfigureChannel(); - void OnDialogClosed(QDialog* dialog); - - void OnConfigurationChanged(); - void OnNormalizedRangeChanged(); - - signals: - - void OnCaptureModeChanged(CaptureMode captureMode); - void RequestScrollToFrame( FrameNumberType frame ); - void InformOfMouseClick(Qt::MouseButton button, FrameNumberType frame, FrameNumberType range, int modifiers ); - void InformOfMouseMove( FrameNumberType frame, FrameNumberType range, int modifiers ); - void InformOfMouseRelease(Qt::MouseButton button, FrameNumberType frame, FrameNumberType range, int modifiers ); - void InformOfMouseWheel( FrameNumberType frame, int wheelAmount, FrameNumberType range, int modifiers ); - QWidget* DrillDownRequest(FrameNumberType atFrame); - void OptionsRequest(); - void ExpandedContracted(); - - void AddConfigurationWidgets(QLayout* configurationLayout); - - QString GetInspectionFileName() const; - - private: - - void ConnectProfilerWidget(ChannelProfilerWidget* profilerWidget); - void ConfigureUI(); - - bool m_isSetup; - - CaptureMode m_captureMode; - AZ::Crc32 m_channelId; - AZStd::list< ChannelProfilerWidget* > m_profilerWidgets; - - ChannelConfigurationDialog* m_configurationDialog; - }; -} - - -#endif // CHANNEL_CONTROL_H diff --git a/Code/Tools/Standalone/Source/Driller/ChannelControl.ui b/Code/Tools/Standalone/Source/Driller/ChannelControl.ui deleted file mode 100644 index 165e00e64b..0000000000 --- a/Code/Tools/Standalone/Source/Driller/ChannelControl.ui +++ /dev/null @@ -1,218 +0,0 @@ - - - ChannelControl - - - - 0 - 0 - 1023 - 74 - - - - - 0 - 0 - - - - Form - - - true - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - - 250 - 0 - - - - - - - QFrame::NoFrame - - - QFrame::Raised - - - 0 - - - - 0 - - - 3 - - - - - - 0 - 0 - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - 0 - - - 0 - - - 5 - - - 0 - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 14 - - - - - - - - - - - - 0 - 0 - - - - ... - - - - :/driller/settings_icon:/driller/settings_icon - - - - - - - - - - QFrame::NoFrame - - - QFrame::Raised - - - 0 - - - - 0 - - - 5 - - - 0 - - - 0 - - - 0 - - - - - 5 - - - 5 - - - 0 - - - - - - - - - - - - - - 0 - 0 - - - - - - - - - Driller::ChannelDataView - QWidget -
Source/Driller/ChannelDataView.hxx
- 1 -
-
- - - - -
diff --git a/Code/Tools/Standalone/Source/Driller/ChannelDataView.cpp b/Code/Tools/Standalone/Source/Driller/ChannelDataView.cpp deleted file mode 100644 index 27922f47a3..0000000000 --- a/Code/Tools/Standalone/Source/Driller/ChannelDataView.cpp +++ /dev/null @@ -1,875 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include - -#include "ChannelDataView.hxx" -#include - -#include "ChannelControl.hxx" -#include "ChannelProfilerWidget.hxx" -#include "DrillerAggregator.hxx" -#include "Annotations/Annotations.hxx" - -#include -#include -#include -#include -#include - -namespace Driller -{ - static const int k_contractedSize = 28; - static const int k_expandedSize = 64; - static const int k_textWidth = 128; - - static const int k_barHeight = 5; - - //////////////////////// - // AggregatorDataPoint - //////////////////////// - AggregatorDataPoint::AggregatorDataPoint() - : m_isActive(true) - , m_isShowingOverlay(false) - , m_shouldOutline(false) - { - } - - AggregatorDataPoint::AggregatorDataPoint(QRect rectangle, ChannelProfilerWidget* profilerWidget) - : m_visualBlock(rectangle) - , m_isActive(true) - , m_isShowingOverlay(false) - , m_shouldOutline(false) - - { - m_combinedProfilers.insert(profilerWidget); - } - - void AggregatorDataPoint::Draw(QPainter& painter, int leftEdge, float barWidth) - { - QColor drawColor; - QColor outlineColor; - - m_isActive = false; - - for (ChannelProfilerWidget* currentProfiler : m_combinedProfilers) - { - if (currentProfiler->IsActive()) - { - if (m_isActive) - { - drawColor = QColor(255, 255, 255); - outlineColor = QColor(255, 255, 0); - break; - } - else - { - m_isActive = true; - drawColor = currentProfiler->GetAggregator()->GetColor(); - - // right now this should never be used. If it eventually is used, we'll probably - // want to add a flow to the aggregators to pass along this color. For now - // some silly wrapping to do something noticeable. - outlineColor = QColor((drawColor.red() + 100) % 255, (drawColor.green() + 100) % 255, (drawColor.blue() + 100) % 255); - } - } - } - - if (m_isActive) - { - const int upAmount = static_cast(ceilf(k_barHeight * 0.5f)); - - int centerHeight = m_visualBlock.center().y(); - int topEdge = static_cast(centerHeight - upAmount); - - if (m_shouldOutline) - { - static const int k_outlineSize = 1; - - painter.fillRect( - leftEdge, - topEdge, - static_cast(barWidth), - k_barHeight, - outlineColor); - - painter.fillRect( - leftEdge + k_outlineSize, - (int)topEdge + k_outlineSize, - (int)barWidth - (2 * k_outlineSize), // overdraw on dense data > 1 event per pixel, optimize later - k_barHeight - (2 * k_outlineSize), - drawColor); - } - else - { - painter.fillRect( - leftEdge, - topEdge, - static_cast(barWidth), - k_barHeight, - drawColor); - } - } - } - - bool AggregatorDataPoint::IntersectsDataPoint(const AggregatorDataPoint& dataPoint) - { - return m_visualBlock.intersects(dataPoint.m_visualBlock); - } - - bool AggregatorDataPoint::ContainsPoint(const QPoint& point) - { - // Don't want to collide if we aren't visible. - if (m_isActive) - { - // Our Visual block's horizontal information is only valid when it is created. - // After that we lazily update information, so the only valid information that the block maintins is the vertical. - // So we're going to rely on the DataView to manage the horizontal collision, and we'll manage the vertical. - return (m_visualBlock.bottom() > point.y() && m_visualBlock.top() <= point.y()); - } - else - { - return false; - } - } - - void AggregatorDataPoint::AddAggregatorDataPoint(const AggregatorDataPoint& dataPoint) - { - m_drawColor = QColor(255, 255, 255); - - // dataPointBottomRight - QPoint dpBR = dataPoint.m_visualBlock.bottomRight(); - - // dataPointTopLeft - QPoint dpTL = dataPoint.m_visualBlock.topLeft(); - - // visualBlockBottomRight - QPoint vbBR = m_visualBlock.bottomRight(); - - // visualBlockTopLeft - QPoint vbTL = m_visualBlock.topLeft(); - - QPoint bottomRight(AZStd::GetMax(dpBR.x(), vbBR.x()), AZStd::GetMax(dpBR.y(), vbBR.y())); - QPoint topLeft(AZStd::GetMin(dpTL.x(), vbTL.x()), AZStd::GetMin(dpTL.y(), vbTL.y())); - - m_visualBlock = QRect(topLeft, bottomRight); - - m_combinedProfilers.insert(dataPoint.m_combinedProfilers.begin(), dataPoint.m_combinedProfilers.end()); - } - - bool AggregatorDataPoint::SetOverlayEnabled(bool enabled) - { - if (m_isShowingOverlay != enabled) - { - m_isShowingOverlay = enabled; - - if (m_isShowingOverlay) - { - int activeProfilers = 0; - QString toolTip = "Multiple Profiler(s)"; - - for (ChannelProfilerWidget* channelProfiler : m_combinedProfilers) - { - if (channelProfiler->IsActive()) - { - ++activeProfilers; - toolTip.append(QString("
- %1").arg(channelProfiler->GetName())); - } - } - - if (activeProfilers >= 2) - { - m_shouldOutline = true; - - // Since QToolTip::HideText doesn't seem to actually do anything, I'm trying to show - // a second tool tip while the first one is being displayed. However, - // if I use the same string for the tool tip, it doesn't actually update the position. - // But since the cursor has moved away from the original postion, it begins the countdown - // timer to hide the tool tip. Meaning, the new tool tip I was trying to generate hides. - // Going to alternatingly append a space to the end to force it to be different to - // avoid this nonsense. - { - static bool k_dumbToolTipHack = false; - if (k_dumbToolTipHack) - { - toolTip.append(" "); - } - - k_dumbToolTipHack = !k_dumbToolTipHack; - } - - QToolTip::showText(QCursor::pos(), toolTip); - } - else - { - m_shouldOutline = false; - } - } - else - { - m_shouldOutline = false; - QToolTip::hideText(); - } - - return true; - } - - return false; - } - - ///////////////// - // BudgetMarker - ///////////////// - - BudgetMarker::BudgetMarker(float value, QColor& drawColor) - : m_value(value) - , m_drawColor(drawColor) - { - } - - BudgetMarker::~BudgetMarker() - { - } - - float BudgetMarker::GetValue() const - { - return m_value; - } - - const QColor& BudgetMarker::GetColor() const - { - return m_drawColor; - } - - //////////////////// - // ChannelDataView - //////////////////// - ChannelDataView::ChannelDataView(QWidget* parent) - : QWidget(parent) - , m_Channel(nullptr) - , m_ptrAnnotations(nullptr) - , m_minFrame(-1) - , m_maxFrame(-1) - , m_highlightedFrame(-1) - , m_lastFrame(0) - , m_xOffset(0) - , m_initializeDrag(false) - , m_dragInitialized(false) - , m_shouldIgnorePoint(false) - , m_mouseGrabbed(false) - , m_dirtyGraph(true) - { - setAutoFillBackground(true); - setAttribute(Qt::WA_OpaquePaintEvent, true); - - setMouseTracking(true); - } - - ChannelDataView::~ChannelDataView() - { - } - - void ChannelDataView::RegisterToChannel(ChannelControl* channel, AnnotationsProvider* annotations) - { - m_Channel = channel; - m_ptrAnnotations = annotations; - } - - int ChannelDataView::FrameToPosition(FrameNumberType frameNumber) - { - int localOffset = 0; - FrameNumberType frameDifference = 0; - - if (frameNumber < m_Channel->m_State.m_FrameOffset) - { - frameDifference = frameNumber - m_Channel->m_State.m_FrameOffset; - } - else if (frameNumber >= (m_Channel->m_State.m_FrameOffset + (m_Channel->m_State.m_FramesInView - 1))) - { - frameDifference = frameNumber - (m_Channel->m_State.m_FrameOffset + (m_Channel->m_State.m_FramesInView - 1)); - localOffset = rect().width(); - } - - localOffset += static_cast(GetBarWidth() * frameDifference); - - return mapToGlobal(QPoint(localOffset, 0)).x(); - } - - FrameNumberType ChannelDataView::PositionToFrame(const QPoint& pt) - { - QRect wrect = rect(); - - FrameNumberType frame = m_Channel->m_State.m_FrameOffset + m_Channel->m_State.m_FramesInView - 1; - frame = frame <= m_Channel->m_State.m_EndFrame ? frame : m_Channel->m_State.m_EndFrame; - - float pct = (float)pt.x() / (float)wrect.width(); - FrameNumberType rCell = m_Channel->m_State.m_FramesInView - 1 - (int)((float)m_Channel->m_State.m_FramesInView * pct); - FrameNumberType retFrame = frame - rCell; - - return retFrame; - } - - FrameNumberType ChannelDataView::FramesPerPixel() - { - FrameNumberType range = PositionToFrame(QPoint(0, 0)) - PositionToFrame(QPoint(1, 0)); - return(range > 0 ? range : 1); - } - - float ChannelDataView::GetBarWidth() - { - return ((float)(rect().width()) / (float)(m_Channel->m_State.m_FramesInView)); - } - - void ChannelDataView::paintEvent(QPaintEvent* event) - { - (void)event; - - if (m_dirtyGraph) - { - m_dirtyGraph = false; - RecalculateGraphedPoints(); - } - - QPen pen; - pen.setWidth(1); - QBrush brush; - brush.setStyle(Qt::SolidPattern); - pen.setBrush(brush); - - QPainter painter(this); - - painter.setPen(pen); - painter.fillRect(rect(), Qt::black); - - FrameNumberType frame = m_Channel->m_State.m_FrameOffset + m_Channel->m_State.m_FramesInView - 1; - frame = frame <= m_Channel->m_State.m_EndFrame ? frame : m_Channel->m_State.m_EndFrame; - - QRect wrect = rect(); - - float barWidth = GetBarWidth(); - int barWidthHalf = (int)(barWidth / 2.0f); - float drawBarWidth = ((barWidth - 1.0f) < 1.0f ? 1.0f : (barWidth - 1.0f)); - - if (m_Channel->IsActive()) - { - // PLAYBACK LOOP MARKERS - if (m_Channel->m_State.m_LoopBegin >= frame - m_Channel->m_State.m_FramesInView) - { - float l = rect().right() - barWidth / 2.0f - 1 - barWidth * (frame - m_Channel->m_State.m_LoopBegin); - painter.fillRect((int)l, 0, 2, rect().height(), QColor(255, 255, 0, 255)); - } - if (m_Channel->m_State.m_LoopEnd >= frame - m_Channel->m_State.m_FramesInView) - { - float l = rect().right() - barWidth / 2.0f - 1 - barWidth * (frame - m_Channel->m_State.m_LoopEnd); - painter.fillRect((int)l, 0, 2, rect().height(), QColor(255, 255, 0, 255)); - } - } - - brush.setStyle(Qt::Dense2Pattern); - brush.setColor(Qt::red); - int wrectHeight = wrect.height() / (m_Channel->m_State.m_ContractedHeight ? 2 : 1); - - if (m_Channel->IsActive() && m_Channel->m_State.m_EndFrame) - { - // SCRUBBER - if (m_Channel->m_State.m_ScrubberFrame >= frame - m_Channel->m_State.m_FramesInView) - { - float l = rect().right()-GetBarWidth()/2.0f - 1 - GetBarWidth() * (frame - m_Channel->m_State.m_ScrubberFrame); - painter.fillRect( (int)l, 0, 2, rect().height(), brush ); - } - - float rightEdgeOfBar = (float)wrect.right(); - float leftEdgeOfBar = rightEdgeOfBar - barWidth; - - AZStd::list< ChannelProfilerWidget* > activeProfilers; - - for (ChannelProfilerWidget* profiler : m_Channel->GetProfilers()) - { - if (profiler->IsActive()) - { - activeProfilers.push_back(profiler); - } - } - - while (frame >= 0 && rightEdgeOfBar >= wrect.left()) - { - int actualLeftEdge = (int)floorf(leftEdgeOfBar); - - // Graph out precomputed points. - DataPointList& dataPointList = m_graphedPoints[frame]; - - for (AggregatorDataPoint& dataPoint : dataPointList) - { - dataPoint.Draw(painter, actualLeftEdge, drawBarWidth); - } - - // annotations? - AnnotationsProvider::ConstAnnotationIterator it = m_ptrAnnotations->GetFirstAnnotationForFrame(frame); - AnnotationsProvider::ConstAnnotationIterator endIt = m_ptrAnnotations->GetEnd(); - - if (it != endIt) - { - painter.fillRect(actualLeftEdge + barWidthHalf, 0, 1, wrectHeight, m_ptrAnnotations->GetColorForChannel(it->GetChannelCRC())); - //++it; - } - - --frame; - rightEdgeOfBar -= barWidth; - leftEdgeOfBar -= barWidth; - } - - // Styling the budget markers. - // Mildly ugly, but not a lot of pixels to work with - // to make it look better. - pen = QPen(Qt::black); - pen.setWidth(1); - - painter.setPen(pen); - brush.setStyle(Qt::BrushStyle::SolidPattern); - - // Budget Markers - for (BudgetMarkerMap::value_type& mapPair : m_budgetMarkers) - { - BudgetMarker& budgetMarker = mapPair.second; - - QColor drawColor = budgetMarker.GetColor(); - - QRect sizeRect = rect(); - int x = rect().left(); - float normalizedValue = ((budgetMarker.GetValue() + 1.0f) / 2.0f); - int y = static_cast(rect().bottom() - (rect().height() * normalizedValue)); - int width = rect().width(); - int height = 4; - brush.setColor(drawColor); - - // Want to make sure we always draw the entire box. - if (y > rect().bottom() - height) - { - y = rect().bottom() - height; - } - - painter.fillRect( - x, - y, - width, - height, - brush); - - painter.drawRect( - x, - y, - width, - height); - } - } - } - - void ChannelDataView::mouseMoveEvent(QMouseEvent* event) - { - if (m_Channel->IsInCaptureMode(CaptureMode::Capturing)) - { - return; - } - - if (m_Channel->IsActive()) - { - if (m_mouseGrabbed) - { - if (m_shouldIgnorePoint && event->globalPos() == m_centerPoint) - { - m_shouldIgnorePoint = false; - return; - } - - QPoint mousePoint = event->globalPos(); - int mouseDelta = (mousePoint.x() - m_centerPoint.x()); - - if (m_initializeDrag) - { - m_initializeDrag = false; - m_dragInitialized = true; - - QApplication::setOverrideCursor(QCursor(Qt::BlankCursor)); - - QRect screenGeometry = QApplication::primaryScreen()->geometry(); - m_centerPoint = screenGeometry.center(); - - mouseDelta = (mousePoint.x() - mapToGlobal(m_simulatedPoint).x()); - } - - m_simulatedPoint.setX(m_simulatedPoint.x() + mouseDelta); - - QPoint framePoint = m_simulatedPoint; - framePoint.setX(framePoint.x() + m_xOffset); - - FrameNumberType frame = PositionToFrame(framePoint); - FrameNumberType framesPerPixel = FramesPerPixel(); - - // raw frame, sanitized by the controller - emit InformOfMouseMove(frame, framesPerPixel, event->modifiers()); - event->ignore(); - - QRect boundingRect = rect(); - - m_shouldIgnorePoint = true; - QCursor::setPos(m_centerPoint); - m_xOffset += mouseDelta; - - if (!boundingRect.contains(m_simulatedPoint)) - { - m_simulatedPoint.setX(AZ::GetClamp(m_simulatedPoint.x(), boundingRect.left(), boundingRect.right())); - } - else - { - m_xOffset = 0; - } - - if (m_lastFrame != frame) - { - m_lastFrame = frame; - - if (framesPerPixel == 1) - { - int barWidth = static_cast(ceilf(GetBarWidth())); - m_xOffset %= barWidth; - } - else - { - m_xOffset = 0; - } - } - - // Can't scroll beyond the minimum frame. - if (m_lastFrame == 0 && m_xOffset < 0) - { - m_xOffset = 0; - } - // Can't scroll beyond the maximum frame. - else if (m_lastFrame == m_Channel->m_State.m_EndFrame && m_xOffset > 0) - { - m_xOffset = 0; - } - } - // If we aren't dragging, we need to deal with highlighting - else - { - QPoint pos = event->localPos().toPoint(); - - // This guy expects relative position to parent. Not local space. - FrameNumberType frameNumber = PositionToFrame(event->pos()); - - FramePointMapping::iterator dataPointIter = m_graphedPoints.find(frameNumber); - - if (dataPointIter != m_graphedPoints.end()) - { - if (frameNumber != m_highlightedFrame) - { - RemoveHighlight(); - } - - bool needsUpdate = false; - - DataPointList& dataPointList = dataPointIter->second; - AggregatorDataPoint* overlayPoint = nullptr; - - for (AggregatorDataPoint& dataPoint : dataPointList) - { - if (dataPoint.ContainsPoint(pos)) - { - m_highlightedFrame = frameNumber; - overlayPoint = &dataPoint; - } - else if (dataPoint.SetOverlayEnabled(false)) - { - needsUpdate = true; - } - } - - if (overlayPoint) - { - if (overlayPoint->SetOverlayEnabled(true)) - { - needsUpdate = true; - } - } - else - { - m_highlightedFrame = -1; - } - - if (needsUpdate) - { - update(); - } - } - else - { - RemoveHighlight(); - } - } - } - } - - void ChannelDataView::mousePressEvent(QMouseEvent* event) - { - if (!m_Channel->IsInCaptureMode(CaptureMode::Capturing) && m_Channel->IsActive()) - { - emit InformOfMouseClick(event->button(), PositionToFrame(event->pos()), FramesPerPixel(), event->modifiers()); - event->ignore(); - - // Only want to perform dragging actions on left clicks. - if (event->button() == Qt::LeftButton) - { - grabMouse(); - - m_initializeDrag = true; - m_simulatedPoint = event->pos(); - - m_mouseGrabbed = true; - m_xOffset = 0; - - m_lastFrame = m_Channel->m_State.m_ScrubberFrame; - } - } - } - - void ChannelDataView::mouseReleaseEvent(QMouseEvent* event) - { - if (!m_Channel->IsInCaptureMode(CaptureMode::Capturing) && m_Channel->IsActive()) - { - if (m_mouseGrabbed) - { - FrameNumberType frame = PositionToFrame(m_simulatedPoint); - emit InformOfMouseRelease(event->button(), frame, FramesPerPixel(), event->modifiers()); - event->ignore(); - - m_mouseGrabbed = false; - - if (m_dragInitialized) - { - m_shouldIgnorePoint = true; - - QCursor::setPos(mapToGlobal(m_simulatedPoint)); - QApplication::restoreOverrideCursor(); - } - - releaseMouse(); - } - } - } - - void ChannelDataView::wheelEvent(QWheelEvent* event) - { - if (event->angleDelta().y() == 0) - { - event->accept(); - return; - } - - emit InformOfMouseWheel(PositionToFrame(event->position().toPoint()), event->angleDelta().y(), FramesPerPixel(), event->modifiers()); - event->ignore(); - } - - void ChannelDataView::leaveEvent(QEvent* event) - { - (void)event; - RemoveHighlight(); - } - - void ChannelDataView::DirtyGraphData() - { - m_dirtyGraph = true; - } - - void ChannelDataView::RefreshGraphData() - { - for (ChannelProfilerWidget* profilerWidget : m_Channel->GetProfilers()) - { - profilerWidget->GetAggregator()->AnnotateChannelView(this); - } - - m_graphedPoints.clear(); - DirtyGraphData(); - update(); - } - - BudgetMarkerTicket ChannelDataView::AddBudgetMarker(float value, QColor color) - { - ++m_budgetMarkerCounter; - - if (m_budgetMarkerCounter == 0 || m_budgetMarkers.find(m_budgetMarkerCounter) != m_budgetMarkers.end()) - { - BudgetMarkerTicket startTicket = m_budgetMarkerCounter; - - do - { - ++m_budgetMarkerCounter; - } while ((m_budgetMarkerCounter == 0 || m_budgetMarkers.find(m_budgetMarkerCounter) != m_budgetMarkers.end()) && m_budgetMarkerCounter != startTicket); - - AZ_Assert(m_budgetMarkers.find(m_budgetMarkerCounter) == m_budgetMarkers.end(),"Ran out of tickets inside of budget marker creation."); - } - - m_budgetMarkers.insert(BudgetMarkerMap::value_type(m_budgetMarkerCounter, BudgetMarker(value, color))); - return m_budgetMarkerCounter; - } - - void ChannelDataView::RemoveBudgetMarker(BudgetMarkerTicket ticket) - { - m_budgetMarkers.erase(ticket); - } - - void ChannelDataView::resizeEvent(QResizeEvent* newSize) - { - QWidget::resizeEvent(newSize); - - // Graph data relies on the size of the graph, so we need to update it whenever we resize. - DirtyGraphData(); - } - - void ChannelDataView::RecalculateGraphedPoints() - { - FrameNumberType frame = m_Channel->m_State.m_FrameOffset + m_Channel->m_State.m_FramesInView - 1; - frame = AZ::GetMin(frame, m_Channel->m_State.m_EndFrame); - - QRect wrect = rect(); - int wrectHeight = wrect.height() / (m_Channel->m_State.m_ContractedHeight ? 2 : 1); - - float barWidth = GetBarWidth(); - - if (m_Channel->m_State.m_EndFrame) - { - float vRange = (float)(wrectHeight - k_barHeight); - float half = vRange / 2.0f; - - float rectBarWidth = (barWidth < 1.0f ? 1.0f : barWidth); - - float rightEdgeOfBar = (float)wrect.right(); - float leftEdgeOfBar = rightEdgeOfBar - barWidth; - - FrameNumberType newMax = frame; - - while (frame >= 0 && rightEdgeOfBar >= wrect.left()) - { - // If the frame is a new frame we need to parse it's data. - if (m_graphedPoints.find(frame) == m_graphedPoints.end()) - { - int actualLeftEdge = (int)floorf(leftEdgeOfBar); - int actualWidth = (int)floorf(rectBarWidth - 1.0f); - - if (actualWidth < 1) - { - actualWidth = 1; - } - - AZStd::list dataPoints; - - for (ChannelProfilerWidget* currentProfiler : m_Channel->GetProfilers()) - { - float vaf = currentProfiler->GetAggregator()->ValueAtFrame(frame); - int topOfBar = (int)(half - (vaf * half)); - - QRect drawRect(actualLeftEdge, topOfBar, actualWidth, k_barHeight); - - dataPoints.emplace_back(drawRect, currentProfiler); - } - - while (!dataPoints.empty()) - { - AggregatorDataPoint currentPoint = dataPoints.front(); - dataPoints.pop_front(); - - bool intersected = false; - AZStd::list::iterator aggregatorIter = dataPoints.begin(); - - do - { - intersected = false; - aggregatorIter = dataPoints.begin(); - - while (aggregatorIter != dataPoints.end()) - { - if (currentPoint.IntersectsDataPoint((*aggregatorIter))) - { - intersected = true; - currentPoint.AddAggregatorDataPoint((*aggregatorIter)); - aggregatorIter = dataPoints.erase(aggregatorIter); - } - else - { - ++aggregatorIter; - } - } - } while (intersected); - - m_graphedPoints[frame].push_back(currentPoint); - } - } - - --frame; - rightEdgeOfBar -= barWidth; - leftEdgeOfBar -= barWidth; - } - - FrameNumberType newMin = AZ::GetMax(0, frame + 1); - - if (m_minFrame >= 0) - { - while (m_minFrame < newMin) - { - m_graphedPoints.erase(m_minFrame); - ++m_minFrame; - } - } - - m_minFrame = newMin; - - if (m_maxFrame >= 0) - { - while (m_maxFrame >= 0 && m_maxFrame > newMax) - { - m_graphedPoints.erase(m_maxFrame); - --m_maxFrame; - } - } - - m_maxFrame = newMax; - } - else - { - m_minFrame = -1; - m_maxFrame = -1; - m_graphedPoints.clear(); - } - } - - void ChannelDataView::RemoveHighlight() - { - if (m_highlightedFrame >= 0) - { - FramePointMapping::iterator dataPointIter = m_graphedPoints.find(m_highlightedFrame); - - if (dataPointIter != m_graphedPoints.end()) - { - bool needsUpdate = false; - DataPointList& dataPointList = dataPointIter->second; - - for (AggregatorDataPoint& dataPoint : dataPointList) - { - needsUpdate = dataPoint.SetOverlayEnabled(false) || needsUpdate; - } - - if (needsUpdate) - { - update(); - } - } - - m_highlightedFrame = -1; - } - } -} diff --git a/Code/Tools/Standalone/Source/Driller/ChannelDataView.hxx b/Code/Tools/Standalone/Source/Driller/ChannelDataView.hxx deleted file mode 100644 index b12f9c021e..0000000000 --- a/Code/Tools/Standalone/Source/Driller/ChannelDataView.hxx +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef CHANNEL_DATA_VIEW_H -#define CHANNEL_DATA_VIEW_H - -#if !defined(Q_MOC_RUN) -#include -#include -#include -#include - -#include - -#include "Source/Driller/DrillerDataTypes.h" -#endif - -namespace Driller -{ - class AnnotationsProvider; - class ChannelControl; - class ChannelDataView; - class ChannelProfilerWidget; - class Aggregator; - - class AggregatorDataPoint - { - public: - AggregatorDataPoint(); - AggregatorDataPoint(QRect rectangle,ChannelProfilerWidget* profiler); - - void Draw(QPainter& painter, int leftEdge, float barWidth); - bool ContainsPoint(const QPoint& point); - - bool IntersectsDataPoint(const AggregatorDataPoint& dataPoint); - void AddAggregatorDataPoint(const AggregatorDataPoint& dataPoint); - - bool SetOverlayEnabled(bool enabled); - - private: - - bool m_isActive; - bool m_isShowingOverlay; - bool m_shouldOutline; - QColor m_drawColor; - QRect m_visualBlock; - - AZStd::unordered_set< ChannelProfilerWidget* > m_combinedProfilers; - }; - - class BudgetMarker - { - public: - BudgetMarker(float value, QColor& drawColor); - ~BudgetMarker(); - - float GetValue() const; - const QColor& GetColor() const; - - private: - - float m_value; - QColor m_drawColor; - }; - - typedef unsigned int BudgetMarkerTicket; - - /* - Channel Data View handles all rendering of the scrolling data graph. - To do this it caches pointer access to its owning Channel - and pulls state information directly from there. - - Mouse events are passed upwards to its owning Channel via signal/slot. - */ - - class ChannelDataView : public QWidget - { - Q_OBJECT; - public: - AZ_CLASS_ALLOCATOR(ChannelDataView, AZ::SystemAllocator, 0); - ChannelDataView( QWidget* parent = nullptr ); - - virtual ~ChannelDataView(); - - void RegisterToChannel(ChannelControl* channel, AnnotationsProvider* annotations); - - QPainter *m_Painter; - ChannelControl *m_Channel; - AnnotationsProvider *m_ptrAnnotations; - - int FrameToPosition(FrameNumberType frameNumber); - FrameNumberType PositionToFrame( const QPoint &pt ); - FrameNumberType FramesPerPixel(); - - float GetBarWidth(); - - virtual void paintEvent( QPaintEvent *event ); - virtual void mouseMoveEvent( QMouseEvent *event ); - virtual void mousePressEvent( QMouseEvent *event ); - virtual void mouseReleaseEvent( QMouseEvent *event ); - virtual void wheelEvent(QWheelEvent *event); - virtual void leaveEvent( QEvent* event ); - - void DirtyGraphData(); - void RefreshGraphData(); - - BudgetMarkerTicket AddBudgetMarker(float value, QColor color); - void RemoveBudgetMarker(BudgetMarkerTicket ticket); - -signals: - void InformOfMouseClick(Qt::MouseButton button, FrameNumberType frame, FrameNumberType range, int modifiers ); - void InformOfMouseMove( FrameNumberType frame, FrameNumberType range, int modifiers ); - void InformOfMouseRelease(Qt::MouseButton button, FrameNumberType frame, FrameNumberType range, int modifiers ); - void InformOfMouseWheel( FrameNumberType frame, int wheelAmount, FrameNumberType range, int modifiers ); - - protected: - void resizeEvent(QResizeEvent* event) override; - - private: - - void RecalculateGraphedPoints(); - void RemoveHighlight(); - - typedef AZStd::list< AggregatorDataPoint > DataPointList; - typedef AZStd::unordered_map FramePointMapping; - - typedef AZStd::unordered_map BudgetMarkerMap; - - BudgetMarkerTicket m_budgetMarkerCounter; - BudgetMarkerMap m_budgetMarkers; - - FramePointMapping m_graphedPoints; - AZStd::list< ChannelProfilerWidget* > m_profilerWidgets; - - FrameNumberType m_minFrame; - FrameNumberType m_maxFrame; - FrameNumberType m_highlightedFrame; - - FrameNumberType m_lastFrame; - int m_xOffset; - - bool m_initializeDrag; - bool m_dragInitialized; - - bool m_shouldIgnorePoint; - - QPoint m_simulatedPoint; - QPoint m_centerPoint; - - bool m_mouseGrabbed; - bool m_dirtyGraph; - }; - -} - - -#endif // CHANNEL_DATA_VIEW_H diff --git a/Code/Tools/Standalone/Source/Driller/ChannelProfilerWidget.cpp b/Code/Tools/Standalone/Source/Driller/ChannelProfilerWidget.cpp deleted file mode 100644 index b596fa023a..0000000000 --- a/Code/Tools/Standalone/Source/Driller/ChannelProfilerWidget.cpp +++ /dev/null @@ -1,292 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ -#include "Source/Driller/ChannelProfilerWidget.hxx" -#include - -#include "Source/Driller/DrillerAggregator.hxx" -#include "Source/Driller/ChannelControl.hxx" -#include "Source/Driller/CollapsiblePanel.hxx" -#include "Source/Driller/CustomizeCSVExportWidget.hxx" -#include "Source/Driller/DrillerOperationTelemetryEvent.h" - -#include -#include -#include - -namespace Driller -{ - void ColorizeIcon(QIcon& icon, const char* iconPath, Aggregator* aggregator) - { - QImage alphaImage(iconPath); - alphaImage = alphaImage.convertToFormat(QImage::Format_ARGB32_Premultiplied); - - QImage colorizedImage(alphaImage.width(), alphaImage.height(), QImage::Format_ARGB32_Premultiplied); - - QColor color = aggregator->GetColor(); - color.setAlphaF(1.0f); - - QPainter painter; - painter.begin(&colorizedImage); - painter.setCompositionMode(QPainter::CompositionMode_Source); - painter.fillRect(colorizedImage.rect(), color); - painter.end(); - - colorizedImage.setAlphaChannel(alphaImage); - - icon.addPixmap(QPixmap::fromImage(colorizedImage)); - } - - ChannelProfilerWidget::ChannelProfilerWidget(ChannelControl* channelControl, Aggregator* aggregator) - : QWidget(channelControl) - , m_channelControl(channelControl) - , m_drilledWidget(nullptr) - , m_aggregator(aggregator) - , m_captureMode(CaptureMode::Unknown) - , m_isActive(true) - , m_activeIcon() - , m_inactiveIcon() - { - setupUi(this); - - connect(this, SIGNAL(DrillDownRequest(FrameNumberType)), m_aggregator, SLOT(DrillDownRequest(FrameNumberType))); - connect(this, SIGNAL(ExportToCSVRequest(const char*, CSVExportSettings*)), m_aggregator, SLOT(ExportToCSVRequest(const char*, CSVExportSettings*))); - - connect(m_aggregator, SIGNAL(GetInspectionFileName()), m_channelControl, SIGNAL(GetInspectionFileName())); - - connect(profilerName, SIGNAL(clicked()), this, SLOT(OnActivationToggled())); - connect(enableChannel, SIGNAL(clicked()), this, SLOT(OnActivationToggled())); - //connect(channelOptions,SIGNAL(clicked()),this, SLOT(OnConfigureChannel())); - connect(drillDown, SIGNAL(clicked()), this, SLOT(OnDrillDown())); - connect(exportData, SIGNAL(clicked()), this, SLOT(OnExportToCSV())); - - ColorizeIcon(m_activeIcon, ":/driller/active_color_swatch", aggregator); - ColorizeIcon(m_inactiveIcon, ":/driller/inactive_color_swatch", aggregator); - - profilerName->setToolTip(aggregator->GetToolTip()); - profilerName->setText(GetName()); - - UpdateActivationIcon(); - ConfigureUI(); - } - - ChannelProfilerWidget::~ChannelProfilerWidget() - { - } - - Aggregator* ChannelProfilerWidget::GetAggregator() const - { - return m_aggregator; - } - - bool ChannelProfilerWidget::IsActive() const - { - return m_isActive; - } - - void ChannelProfilerWidget::SetIsActive(bool isActive) - { - if (m_isActive != isActive) - { - m_isActive = isActive; - UpdateActivationIcon(); - - if (m_aggregator && m_captureMode == Driller::CaptureMode::Configuration) - { - m_aggregator->EnableCapture(isActive); - } - - emit OnActivationChanged(this, m_isActive); - } - } - - QString ChannelProfilerWidget::GetName() const - { - return (m_aggregator ? m_aggregator->GetName() : "Unknown Profiler"); - } - - AZ::Uuid ChannelProfilerWidget::GetID() - { - return (m_aggregator ? m_aggregator->GetID() : AZ::Uuid::CreateNull()); - } - - ChannelConfigurationWidget* ChannelProfilerWidget::CreateConfigurationWidget() - { - ChannelConfigurationWidget* configurationWidget = nullptr; - - if (m_aggregator) - { - configurationWidget = m_aggregator->CreateConfigurationWidget(); - } - - return configurationWidget; - } - - void ChannelProfilerWidget::OnActivationToggled() - { - SetIsActive(!IsActive()); - } - - void ChannelProfilerWidget::SetCaptureMode(CaptureMode captureMode) - { - if (m_captureMode != captureMode) - { - m_captureMode = captureMode; - - ConfigureUI(); - } - } - - void ChannelProfilerWidget::OnDrillDown() - { - if (m_channelControl && IsInCaptureMode(CaptureMode::Inspecting)) - { - char traceStr[AZ::Uuid::MaxStringBuffer]; - m_aggregator->GetID().ToString(traceStr, AZ_ARRAY_SIZE(traceStr)); - AZ_TracePrintf("Driller", "Drill Down ID = %s\n", traceStr); - - if (m_drilledWidget == nullptr) - { - m_drilledWidget = emit DrillDownRequest(m_channelControl->m_State.m_ScrubberFrame); - if (m_drilledWidget) - { - connect(m_drilledWidget, SIGNAL(destroyed(QObject*)), this, SLOT(OnDrillDestroyed(QObject*))); - emit OnSuccessfulDrillDown(m_drilledWidget); - } - } - else - { - if (m_drilledWidget->isMinimized()) - { - m_drilledWidget->showNormal(); - } - - m_drilledWidget->raise(); - m_drilledWidget->activateWindow(); - } - } - } - - void ChannelProfilerWidget::OnDrillDestroyed(QObject* widget) - { - if (widget == m_drilledWidget) - { - m_drilledWidget = nullptr; - } - } - - void ChannelProfilerWidget::OnExportToCSV() - { - DrillerOperationTelemetryEvent exportToCSVEvent; - exportToCSVEvent.SetAttribute("ExportToCSV", m_aggregator->GetName().toStdString().c_str()); - exportToCSVEvent.Log(); - - char traceStr[AZ::Uuid::MaxStringBuffer]; - m_aggregator->GetID().ToString(traceStr, AZ_ARRAY_SIZE(traceStr)); - AZ_TracePrintf("Driller", "Export Request for ID = %s\n", traceStr); - - QFileDialog fileDialog; - - CustomizeCSVExportWidget* customizeWidget = m_aggregator->CreateCSVExportCustomizationWidget(); - - // Always use the Qt dialog for consistency - fileDialog.setOption(QFileDialog::DontUseNativeDialog, true); - fileDialog.setAcceptMode(QFileDialog::AcceptSave); - fileDialog.setWindowTitle(QString("Export %1 To CSV").arg(m_aggregator->GetName())); - fileDialog.setNameFilter("CSV (*.csv)"); - fileDialog.setDefaultSuffix("csv"); - - if (customizeWidget) - { - CollapsiblePanel* collapsiblePanel = aznew CollapsiblePanel(&fileDialog); - - collapsiblePanel->SetTitle("Customize"); - collapsiblePanel->SetContent(customizeWidget); - - // I don't know why the decided to use a GridLayout here instead of nested layouts. But whatever. - QGridLayout* gridLayout = static_cast(fileDialog.layout()); - int numRows = gridLayout->rowCount(); - - gridLayout->addWidget(collapsiblePanel, numRows, 0, 1, gridLayout->columnCount()); - } - - QString fileName; - if (fileDialog.exec()) - { - QStringList fileList = fileDialog.selectedFiles(); - - for (const QString& file : fileList) - { - if (!file.isEmpty()) - { - fileName = file; - break; - } - } - } - - if (!fileName.isEmpty()) - { - CSVExportSettings* exportSettings = nullptr; - - if (customizeWidget) - { - customizeWidget->FinalizeSettings(); - exportSettings = customizeWidget->GetExportSettings(); - } - - emit ExportToCSVRequest(fileName.toStdString().c_str(), exportSettings); - } - } - - bool ChannelProfilerWidget::AllowCSVExport() const - { - return (m_aggregator ? m_aggregator->CanExportToCSV() : false); - } - - void ChannelProfilerWidget::UpdateActivationIcon() - { - if (IsActive()) - { - enableChannel->setIcon(m_activeIcon); - } - else - { - enableChannel->setIcon(m_inactiveIcon); - } - } - - bool ChannelProfilerWidget::IsInCaptureMode(CaptureMode captureMode) const - { - return m_captureMode == captureMode; - } - - void ChannelProfilerWidget::ConfigureUI() - { - switch (m_captureMode) - { - case CaptureMode::Configuration: - enableChannel->setEnabled(true); - drillDown->setVisible(false); - exportData->setVisible(false); - break; - case CaptureMode::Capturing: - enableChannel->setEnabled(false); - drillDown->setVisible(false); - exportData->setVisible(false); - break; - case CaptureMode::Inspecting: - enableChannel->setEnabled(true); - drillDown->setVisible(true); - exportData->setVisible(AllowCSVExport()); - exportData->setEnabled(AllowCSVExport()); - break; - default: - break; - } - } -} diff --git a/Code/Tools/Standalone/Source/Driller/ChannelProfilerWidget.hxx b/Code/Tools/Standalone/Source/Driller/ChannelProfilerWidget.hxx deleted file mode 100644 index 307a3084df..0000000000 --- a/Code/Tools/Standalone/Source/Driller/ChannelProfilerWidget.hxx +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ -#pragma once - -#ifndef DRILLER_CHANNELPROFILERWIDGET_H -#define DRILLER_CHANNELPROFILERWIDGET_H - -#if !defined(Q_MOC_RUN) -#include -#include - -#include - -#include "Source/Driller/DrillerDataTypes.h" - -// Generated Files -#include -#endif - -namespace Driller -{ - class Aggregator; - class ChannelControl; - class CSVExportSettings; - class ChannelConfigurationWidget; - - class ChannelProfilerWidget - : public QWidget - , private Ui::ChannelProfilerWidget - { - Q_OBJECT; - public: - AZ_CLASS_ALLOCATOR(ChannelProfilerWidget, AZ::SystemAllocator,0); - - ChannelProfilerWidget(ChannelControl* channelControl, Aggregator* aggregator); - virtual ~ChannelProfilerWidget(); - - Aggregator* GetAggregator() const; - - bool IsActive() const; - void SetIsActive(bool isActive); - - QString GetName() const; - AZ::Uuid GetID(); - - ChannelConfigurationWidget* CreateConfigurationWidget(); - - public slots: - void OnActivationToggled(); - void SetCaptureMode(CaptureMode mode); - - void OnDrillDown(); - void OnDrillDestroyed(QObject* drill); - - void OnExportToCSV(); - - signals: - void OnActivationChanged(ChannelProfilerWidget*,bool activated); - - QWidget* DrillDownRequest(FrameNumberType atFrame); - void ExportToCSVRequest(const char* filename, CSVExportSettings* customizeWidget); - - void OnSuccessfulDrillDown(QWidget* widget); - - private: - - bool AllowCSVExport() const; - void UpdateActivationIcon(); - - bool IsInCaptureMode(CaptureMode captureMode) const; - void ConfigureUI(); - - ChannelControl* m_channelControl; - QWidget* m_drilledWidget; - Aggregator* m_aggregator; - - CaptureMode m_captureMode; - bool m_isActive; - - QImage m_inactiveImage; - QImage m_activeImage; - QIcon m_activeIcon; - QIcon m_inactiveIcon; - }; -} - -#endif diff --git a/Code/Tools/Standalone/Source/Driller/ChannelProfilerWidget.ui b/Code/Tools/Standalone/Source/Driller/ChannelProfilerWidget.ui deleted file mode 100644 index 67e117a20d..0000000000 --- a/Code/Tools/Standalone/Source/Driller/ChannelProfilerWidget.ui +++ /dev/null @@ -1,150 +0,0 @@ - - - ChannelProfilerWidget - - - - 0 - 0 - 374 - 28 - - - - ChannelProfilerWidget - - - - 3 - - - 9 - - - 0 - - - 0 - - - 0 - - - - - Toggle this Profiler On/Off - - - - - - - 12 - 12 - - - - - - - - - 13 - - - - - - - - - - - - 0 - 0 - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - 2 - - - 0 - - - 0 - - - 4 - - - 0 - - - - - Save to CSV - - - ... - - - - :/driller/export_button_enabled - :/driller/export_button_disabled - :/driller/export_button_disabled:/driller/export_button_enabled - - - - 20 - 20 - - - - - - - - Detailed Profiling Information - - - ... - - - - :/driller/drill_down_enabled - :/driller/drill_down_disabled - :/driller/drill_down_disabled:/driller/drill_down_enabled - - - - 20 - 20 - - - - - - - - - - - - AzToolsFramework::ClickableLabel - QLabel -
AzToolsFramework/UI/UICore/ClickableLabel.hxx
-
-
- - - - -
diff --git a/Code/Tools/Standalone/Source/Driller/ChartNumberFormats.cpp b/Code/Tools/Standalone/Source/Driller/ChartNumberFormats.cpp deleted file mode 100644 index 33c1dc66d4..0000000000 --- a/Code/Tools/Standalone/Source/Driller/ChartNumberFormats.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "ChartNumberFormats.h" - -namespace DrillerCharts -{ - QString FriendlyFormat(AZ::s64 n) - { - QString str; - - str = QString("%L1").arg(n); - - //if (n < 0) - //{ - // str = "-"; - //} - - //AZ::s64 b = n / 1000000000l; - //n %= 1000000000l; - - //AZ::s64 m = n / 1000000l; - //n %= 1000000l; - - //AZ::s64 k = n / 1000l; - //n %= 1000l; - - //if (b) - //{ - // str += QString("%0b").arg(abs(b)); - //} - //if (m) - //{ - // str += QString("%0m").arg(abs(m)); - //} - //if (k) - //{ - // str += QString("%0k").arg(abs(k)); - //} - //if (n) - //{ - // str += QString("%0").arg(abs(n)); - //} - - return str; - } -} diff --git a/Code/Tools/Standalone/Source/Driller/ChartNumberFormats.h b/Code/Tools/Standalone/Source/Driller/ChartNumberFormats.h deleted file mode 100644 index 6c20f1dfda..0000000000 --- a/Code/Tools/Standalone/Source/Driller/ChartNumberFormats.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef CHARTNUMBERFORMATS_H -#define CHARTNUMBERFORMATS_H - -#include -#include - -#pragma once - -namespace DrillerCharts -{ - QString FriendlyFormat(AZ::s64 n); -} - -#endif //CHARTNUMBERFORMATS_H diff --git a/Code/Tools/Standalone/Source/Driller/ChartTypes.cpp b/Code/Tools/Standalone/Source/Driller/ChartTypes.cpp deleted file mode 100644 index 3a01b80c41..0000000000 --- a/Code/Tools/Standalone/Source/Driller/ChartTypes.cpp +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ -#include "Source/Driller/ChartTypes.hxx" -#include - -namespace Charts -{ - QAbstractAxisFormatter::QAbstractAxisFormatter(QObject* parent) - : QObject(parent) - { - } -} diff --git a/Code/Tools/Standalone/Source/Driller/ChartTypes.hxx b/Code/Tools/Standalone/Source/Driller/ChartTypes.hxx deleted file mode 100644 index 897df65ff3..0000000000 --- a/Code/Tools/Standalone/Source/Driller/ChartTypes.hxx +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ -#pragma once -#ifndef PROFILER_CHARTTYPES_H -#define PROFILER_CHARTTYPES_H - -#if !defined(Q_MOC_RUN) -#include -#endif - -namespace Charts -{ - enum class AxisType - { - Horizontal, - Vertical - }; - - // Plug this guy into the chart if you wish to custom format axes - class QAbstractAxisFormatter : public QObject - { - Q_OBJECT - public: - QAbstractAxisFormatter(QObject *pParent); - - /** convertAxisValueToText - * Expects you to return a QString with the value for the axis. - * value : value it wants the label for. - * minDisplayedValue : what value is at the bottom of the axis in the display - * maxDisplayedValue : what value is at the top of this axis in the display - * divisionSize : what each tickmark is, in domain units. - * So for example, if the axis is from 938 to 2114 and its got a tickmark every 250, and it wants to know what you'd like it to draw for 1250 - * then you'll get Value = 1250, minDisplayedValue = 1000, maxDisplayedValue = 2000, divisionSize = 250. - */ - virtual QString convertAxisValueToText(AxisType axisType, float value, float minDisplayedValue, float maxDisplayedValue, float divisionSize) = 0; - }; -} - -#endif diff --git a/Code/Tools/Standalone/Source/Driller/CollapsiblePanel.cpp b/Code/Tools/Standalone/Source/Driller/CollapsiblePanel.cpp deleted file mode 100644 index 9ef3779849..0000000000 --- a/Code/Tools/Standalone/Source/Driller/CollapsiblePanel.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "CollapsiblePanel.hxx" -#include -#include - -namespace Driller -{ - CollapsiblePanel::CollapsiblePanel(QWidget* parent) - : QWidget(parent) - , m_isCollapsed(false) - , m_content(nullptr) - , m_gui(nullptr) - { - m_gui = azcreate(Ui::CollapsiblePanel, ()); - m_gui->setupUi(this); - - // Default to collapsed, need to initialize the variable to true to trigger the delta. - SetCollapsed(true); - - QObject::connect(m_gui->stateIcon, SIGNAL(clicked()), this, SLOT(OnClicked())); - } - - CollapsiblePanel::~CollapsiblePanel() - { - azdestroy(m_gui); - m_gui = nullptr; - } - - void CollapsiblePanel::SetTitle(const QString& title) - { - m_gui->description->setText(title); - } - - void CollapsiblePanel::SetContent(QWidget* content) - { - if (m_content) - { - m_gui->contentLayout->removeWidget(content); - m_content = nullptr; - } - - m_content = content; - - if (m_content) - { - m_gui->contentLayout->addWidget(m_content); - } - } - - void CollapsiblePanel::SetCollapsed(bool collapsed) - { - if (m_isCollapsed != collapsed) - { - m_isCollapsed = collapsed; - - m_gui->groupBox->setVisible(!m_isCollapsed); - - if (m_isCollapsed) - { - m_gui->stateIcon->setArrowType(Qt::RightArrow); - emit Collapsed(); - } - else - { - m_gui->stateIcon->setArrowType(Qt::DownArrow); - emit Expanded(); - } - } - } - - bool CollapsiblePanel::IsCollapsed() const - { - return m_isCollapsed; - } - - void CollapsiblePanel::OnClicked() - { - SetCollapsed(!m_isCollapsed); - } -} diff --git a/Code/Tools/Standalone/Source/Driller/CollapsiblePanel.hxx b/Code/Tools/Standalone/Source/Driller/CollapsiblePanel.hxx deleted file mode 100644 index df207b9247..0000000000 --- a/Code/Tools/Standalone/Source/Driller/CollapsiblePanel.hxx +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef DRILLER_COLLAPSIBLEPANEL_H -#define DRILLER_COLLAPSIBLEPANEL_H - -#if !defined(Q_MOC_RUN) -#include -#include - -#pragma once - -#include -#endif - -namespace Ui -{ - class CollapsiblePanel; -} - -namespace Driller -{ - class CollapsiblePanel - : public QWidget - { - Q_OBJECT - public: - AZ_CLASS_ALLOCATOR(CollapsiblePanel, AZ::SystemAllocator, 0); - - CollapsiblePanel(QWidget* parent = nullptr); - ~CollapsiblePanel(); - - void SetTitle(const QString& title); - void SetContent(QWidget* content); - - void SetCollapsed(bool collapsed); - bool IsCollapsed() const; - - public slots: - void OnClicked(); - - signals: - void Collapsed(); - void Expanded(); - - private: - - bool m_isCollapsed; - - QWidget* m_content; - Ui::CollapsiblePanel* m_gui; - }; -} - -#endif diff --git a/Code/Tools/Standalone/Source/Driller/CollapsiblePanel.ui b/Code/Tools/Standalone/Source/Driller/CollapsiblePanel.ui deleted file mode 100644 index 83f057ee94..0000000000 --- a/Code/Tools/Standalone/Source/Driller/CollapsiblePanel.ui +++ /dev/null @@ -1,125 +0,0 @@ - - - CollapsiblePanel - - - - 0 - 0 - 591 - 421 - - - - Form - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - 5 - - - 5 - - - 0 - - - 0 - - - 0 - - - - - ... - - - - - - - - 10 - - - - Panel Name ggggMMMWWWW - - - - - - - - - - - 0 - 0 - - - - - - - - 0 - - - 10 - - - 0 - - - 0 - - - 0 - - - - - 0 - - - - - - - - - - - diff --git a/Code/Tools/Standalone/Source/Driller/CombinedEventsControl.cpp b/Code/Tools/Standalone/Source/Driller/CombinedEventsControl.cpp deleted file mode 100644 index 72130b5300..0000000000 --- a/Code/Tools/Standalone/Source/Driller/CombinedEventsControl.cpp +++ /dev/null @@ -1,254 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ -#include - -#include "CombinedEventsControl.hxx" -#include - -#include "Annotations/AnnotationsHeaderView_Events.hxx" -#include "Axis.hxx" -#include "CollapsiblePanel.hxx" -#include "ChannelDataView.hxx" -#include "DrillerAggregator.hxx" -#include "DrillerEvent.h" -#include "DrillerMainWindowMessages.h" - -#include - -using namespace Racetrack; - -namespace Driller -{ - static const int k_raceTrackMinSize = 50; - static const int k_eventTrackSize = 20; - - CombinedEventsControl::CombinedEventsControl(QWidget* parent, Qt::WindowFlags flags) - : QDockWidget(parent, flags) - { - m_ScrubberIndex = 0; - - m_FirstIndex = 0; - m_LastIndex = 0; - - QWidget* nullBar = new QWidget(); - setTitleBarWidget(nullBar); - - setFeatures(QDockWidget::NoDockWidgetFeatures); - setAllowedAreas(Qt::BottomDockWidgetArea); - - m_collapsiblePanel = new CollapsiblePanel(this); - this->setWidget(m_collapsiblePanel); - - m_Contents = new QWidget(this); - m_Contents->setGeometry(0, 22, 542, 34); - m_Contents->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum); - QVBoxLayout* layout = new QVBoxLayout(); - - layout->setMargin(0); - layout->setSpacing(2); - - m_Contents->setLayout(layout); - m_collapsiblePanel->SetContent(m_Contents); - m_collapsiblePanel->SetTitle("Detailed Event View"); - - m_EventTrack = aznew CEQDataTrack(this); - m_EventTrack->SetupAxis("", 0.0f, 1.0f, false); - m_EventTrack->SetMarkerColor(Qt::darkMagenta); - m_EventTrack->setMinimumHeight(k_raceTrackMinSize); - - m_annotationHeaderView = aznew AnnotationHeaderView_Events(this); - - m_Contents->layout()->addWidget(m_annotationHeaderView); - m_Contents->layout()->addWidget(m_EventTrack); - - m_EventTrack->installEventFilter(this); - - connect(m_EventTrack, SIGNAL(EventRequestEventFocus(Driller::EventNumberType)), this, SLOT(OnEventTrackRequestEventFocus(Driller::EventNumberType))); - } - - void CombinedEventsControl::SetIdentity(int identity) - { - m_identity = identity; - DrillerEventWindowMessages::Handler::BusConnect(m_identity); - } - - bool CombinedEventsControl::eventFilter(QObject* obj, QEvent* event) - { - if (event->type() == QEvent::Resize) - { - if (obj == m_EventTrack) - { - QRect eventTrackGeometry = m_EventTrack->geometry(); - QSize actualSize = QSize(eventTrackGeometry.x(), eventTrackGeometry.height()); - emit InfoAreaGeometryChanged(actualSize); - } - } - - // hand it to the owner - return QObject::eventFilter(obj, event); - } - - Charts::Axis* CombinedEventsControl::GetAxis() const - { - return m_EventTrack->GetAxis(); - } - - - CombinedEventsControl::~CombinedEventsControl() - { - DrillerEventWindowMessages::Handler::BusDisconnect(m_identity); - - if (m_EventTrack) - { - delete m_EventTrack; - } - } - - void CombinedEventsControl::ClearAggregatorList() - { - m_Aggregators.clear(); - m_EventTrack->Clear(); - m_EventTrack->setMinimumHeight(k_raceTrackMinSize); - - m_ScrubberIndex = 0; - m_FirstIndex = 0; - m_LastIndex = 0; - } - - void CombinedEventsControl::AddAggregatorList(DrillerNetworkMessages::AggregatorList& theList) - { - // m_EventStrip clear all existing channels and the channel axis - m_EventTrack->Clear(); - for (DrillerNetworkMessages::AggregatorList::iterator iter = theList.begin(); iter != theList.end(); ++iter) - { - m_Aggregators.push_back(*iter); - - int channelID = m_EventTrack->AddChannel((*iter)->GetName()); - m_EventTrack->SetChannelColor(channelID, (*iter)->GetColor()); - } - - m_EventTrack->setMinimumHeight(k_raceTrackMinSize + static_cast(m_Aggregators.size()) * k_eventTrackSize); - } - void CombinedEventsControl::AddAggregator(Aggregator& theAggregator) - { - m_Aggregators.push_back(&theAggregator); - - int channelID = m_EventTrack->AddChannel(theAggregator.GetName()); - m_EventTrack->SetChannelColor(channelID, theAggregator.GetColor()); - - m_EventTrack->setMinimumHeight(k_raceTrackMinSize + static_cast(m_Aggregators.size()) * k_eventTrackSize); - } - - void CombinedEventsControl::SetAnnotationsProvider(AnnotationsProvider* ptrAnnotations) - { - m_annotationHeaderView->AttachToAxis(ptrAnnotations, GetAxis()); - } - - void CombinedEventsControl::SetEndFrame(FrameNumberType /*frame*/) - { - m_EventTrack->update(); - } - - void CombinedEventsControl::SetSliderOffset(FrameNumberType /*frame*/) - { - } - - void CombinedEventsControl::MouseClickInformed(int newValue) - { - emit InformOfMouseClick(newValue, 1, 0); - } - - void CombinedEventsControl::MouseMoveInformed(int newValue) - { - emit InformOfMouseMove(newValue, 1, 0); - } - - void CombinedEventsControl::OnEventScrubberboxChanged(int newValue) - { - emit EventRequestEventFocus(static_cast(newValue)); - } - - void CombinedEventsControl::SetScrubberFrame(FrameNumberType frame) - { - m_EventTrack->GetAxis()->Clear(); - - int temp_m_FirstIndex = 0x7fffffff; - int temp_m_LastIndex = 0; - - AZ::s64 highestCount = 0; - int channelIdx = 0; - for (AZStd::list::iterator iter = m_Aggregators.begin(); iter != m_Aggregators.end(); ++iter, ++channelIdx) - { - m_EventTrack->ClearData(channelIdx); - - size_t numEvents = (*iter)->NumOfEventsAtFrame(frame); - - if (numEvents) - { - highestCount += numEvents; - EventNumberType eventIndexOffset = (*iter)->GetFirstIndexAtFrame(frame); - - for (EventNumberType eventIndex = 0; eventIndex < static_cast(numEvents); ++eventIndex) - { - DrillerEvent* dep = (*iter)->GetEvents()[ eventIndex + eventIndexOffset ]; - AZ::s64 geid = dep->GetGlobalEventId(); - - temp_m_FirstIndex = (int)geid < temp_m_FirstIndex ? (int)geid : temp_m_FirstIndex; - temp_m_LastIndex = (int)geid > temp_m_LastIndex ? (int)geid : temp_m_LastIndex; - - //AZ_TracePrintf("LUA","First %d Last %d\n",temp_m_FirstIndex, temp_m_LastIndex); - - m_EventTrack->AddData(channelIdx, (float)geid, (float)channelIdx); - } - } - } - - m_FirstIndex = temp_m_FirstIndex; - m_LastIndex = temp_m_LastIndex; - - m_EventTrack->GetAxis()->SetAxisRange((float)m_FirstIndex, (float)m_LastIndex); - m_EventTrack->GetAxis()->SetViewFull(); - SanitizeScrubberIndex(); - emit EventRequestEventFocus(m_ScrubberIndex); - } - - void CombinedEventsControl::OnEventTrackRequestEventFocus(Driller::EventNumberType eventIndex) - { - emit EventRequestEventFocus(eventIndex); - } - - ////////////////////////////////////////////////////////////////////////// - // Event Window Messages - void CombinedEventsControl::EventFocusChanged(EventNumberType eventIdx) - { - m_ScrubberIndex = eventIdx; - SanitizeScrubberIndex(); - m_EventTrack->SetMarkerPosition((float)m_ScrubberIndex); - } - - void CombinedEventsControl::SanitizeScrubberIndex() - { - m_ScrubberIndex = m_ScrubberIndex < m_FirstIndex ? m_FirstIndex : m_ScrubberIndex; - m_ScrubberIndex = m_ScrubberIndex > m_LastIndex ? m_LastIndex : m_ScrubberIndex; - } - - - ////////////////////////////////////////////////////////////////////////// - CEQDataTrack::CEQDataTrack(QWidget* parent, Qt::WindowFlags flags) - : DataRacetrack(parent, flags) - { - m_InsetT = 4; - m_InsetB = 12; - SetZeroBasedAxisNumbering(true); - setAutoFillBackground(false); - setAttribute(Qt::WA_OpaquePaintEvent, true); - } - CEQDataTrack::~CEQDataTrack() - { - } -} diff --git a/Code/Tools/Standalone/Source/Driller/CombinedEventsControl.hxx b/Code/Tools/Standalone/Source/Driller/CombinedEventsControl.hxx deleted file mode 100644 index 3882d81356..0000000000 --- a/Code/Tools/Standalone/Source/Driller/CombinedEventsControl.hxx +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef COMBINEDEVENTS_CONTROL_H -#define COMBINEDEVENTS_CONTROL_H - -#if !defined(Q_MOC_RUN) -#include -#include - -#include -#include - -#include "DrillerNetworkMessages.h" -#include "DrillerMainWindowMessages.h" -#include "RacetrackChart.hxx" -#include "Annotations/AnnotationsHeaderView_Events.hxx" -#endif - -namespace Charts -{ - class Axis; -} - -namespace Driller -{ - class Aggregator; - class CEQDataTrack; - class CollapsiblePanel; - class AnnotationsProvider; - - /* - Channel Control intermediates between one data Aggregator, the application's main window, and the renderer. - This maintains state used by the renderer and passes changes both up and down via signal/slot. - */ - - class CombinedEventsControl - : public QDockWidget - , public Driller::DrillerEventWindowMessages::Bus::Handler - { - Q_OBJECT; - public: - AZ_CLASS_ALLOCATOR(CombinedEventsControl,AZ::SystemAllocator,0); - CombinedEventsControl( QWidget* parent = NULL, Qt::WindowFlags flags = Qt::WindowFlags()); - virtual ~CombinedEventsControl(void); - - void SetIdentity(int identity); - - void ClearAggregatorList(); - void AddAggregatorList(DrillerNetworkMessages::AggregatorList &theList); - void AddAggregator(Aggregator &theAggregator); - - void SetAnnotationsProvider(AnnotationsProvider* ptrAnnotations); - - AZStd::listm_Aggregators; - - int m_identity; - EventNumberType m_ScrubberIndex; - void SanitizeScrubberIndex(); - - QWidget *m_Contents; - - CollapsiblePanel* m_collapsiblePanel; - - AnnotationHeaderView_Events* m_annotationHeaderView; - CEQDataTrack* m_EventTrack; - - int m_FirstIndex; - int m_LastIndex; - int m_IndexCount; - - void SetActive( int active ); - void SetEndFrame( FrameNumberType frame ); - void SetSliderOffset( FrameNumberType frame ); - - Charts::Axis* GetAxis() const; - - virtual void EventFocusChanged(EventNumberType eventIdx); - - protected: - bool eventFilter(QObject *obj, QEvent *event); - - public slots: - void MouseClickInformed( int newValue ); - void MouseMoveInformed( int newValue ); - void OnEventScrubberboxChanged( int newValue ); - void SetScrubberFrame( FrameNumberType frame ); - void OnEventTrackRequestEventFocus(Driller::EventNumberType); - - signals: - void InformOfMouseClick( int newValue, int range, int modifiers ); - void InformOfMouseMove( int newValue, int range, int modifiers ); - void InfoAreaGeometryChanged ( QSize newSize); - void EventRequestEventFocus(EventNumberType); - }; - - class CEQDataTrack - : public Racetrack::DataRacetrack - { - Q_OBJECT; - public: - - AZ_CLASS_ALLOCATOR(CEQDataTrack,AZ::SystemAllocator,0); - CEQDataTrack( QWidget* parent = NULL, Qt::WindowFlags flags = Qt::WindowFlags()); - virtual ~CEQDataTrack(void); - }; - -} - - -#endif // COMBINEDEVENTS_CONTROL_H diff --git a/Code/Tools/Standalone/Source/Driller/CustomizeCSVExportWidget.cpp b/Code/Tools/Standalone/Source/Driller/CustomizeCSVExportWidget.cpp deleted file mode 100644 index 16650d0852..0000000000 --- a/Code/Tools/Standalone/Source/Driller/CustomizeCSVExportWidget.cpp +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "Source/Driller/CustomizeCSVExportWidget.hxx" -#include - -#include "Source/Driller/CSVExportSettings.h" - -namespace Driller -{ - ///////////////////////////// - // CustomizeCSVExportWidget - ///////////////////////////// - - CustomizeCSVExportWidget::CustomizeCSVExportWidget(CSVExportSettings& exportSettings, QWidget* parent) - : QWidget(parent) - , m_exportSettings(exportSettings) - { - } - - CustomizeCSVExportWidget::~CustomizeCSVExportWidget() - { - } - - CSVExportSettings* CustomizeCSVExportWidget::GetExportSettings() const - { - return (&m_exportSettings); - } - - void CustomizeCSVExportWidget::OnShouldExportStateDescriptorChecked(int state) - { - m_exportSettings.SetShouldExportColumnDescriptors(state == Qt::Checked); - } -} diff --git a/Code/Tools/Standalone/Source/Driller/CustomizeCSVExportWidget.hxx b/Code/Tools/Standalone/Source/Driller/CustomizeCSVExportWidget.hxx deleted file mode 100644 index 75ea714fcd..0000000000 --- a/Code/Tools/Standalone/Source/Driller/CustomizeCSVExportWidget.hxx +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef DRILLER_CUSTOMIZECSVEXPORTWIDGET_H -#define DRILLER_CUSTOMIZECSVEXPORTWIDGET_H - -#if !defined(Q_MOC_RUN) -#include -#include - -#pragma once - -#include -#endif - -namespace Driller -{ - class CSVExportSettings; - - class CustomizeCSVExportWidget : public QWidget - { - Q_OBJECT - public: - CustomizeCSVExportWidget(CSVExportSettings& customSettings, QWidget* parent); - virtual ~CustomizeCSVExportWidget(); - - virtual void FinalizeSettings() = 0; - CSVExportSettings* GetExportSettings() const; - - public slots: - void OnShouldExportStateDescriptorChecked(int); - - protected: - CSVExportSettings& m_exportSettings; - }; -} - -#endif diff --git a/Code/Tools/Standalone/Source/Driller/DoubleListSelector.cpp b/Code/Tools/Standalone/Source/Driller/DoubleListSelector.cpp deleted file mode 100644 index d352719e22..0000000000 --- a/Code/Tools/Standalone/Source/Driller/DoubleListSelector.cpp +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "DoubleListSelector.hxx" -#include -#include - -namespace Driller -{ - /////////////////////// - // DoubleListSelector - /////////////////////// - - DoubleListSelector::DoubleListSelector(QWidget* parent) - : QWidget(parent) - , m_gui(new Ui::DoubleListSelector()) - { - m_gui->setupUi(this); - - m_gui->activateButton->setAutoDefault(false); - m_gui->deactivateButton->setAutoDefault(false); - - QObject::connect(m_gui->activateButton, SIGNAL(clicked()), this, SLOT(activateSelected())); - QObject::connect(m_gui->deactivateButton, SIGNAL(clicked()), this, SLOT(deactivateSelected())); - } - - DoubleListSelector::~DoubleListSelector() - { - delete m_gui; - } - - void DoubleListSelector::setItemList(const QStringList& items, bool maintainActiveList) - { - if (maintainActiveList) - { - m_gui->inactiveList->clearItems(); - - const QStringList& activeItems = m_gui->activeList->getAllItems(); - - QStringList newActiveItems; - QStringList inactiveItems; - - for (const QString& currentItem : items) - { - if (activeItems.contains(currentItem)) - { - newActiveItems.push_back(currentItem); - } - else - { - inactiveItems.push_back(currentItem); - } - } - - m_gui->activeList->clearItems(); - - m_gui->inactiveList->addItems(inactiveItems); - m_gui->activeList->addItems(newActiveItems); - - emit ActiveItemsChanged(); - } - else - { - m_gui->inactiveList->clearItems(); - m_gui->inactiveList->addItems(items); - m_gui->activeList->clearItems(); - } - } - - void DoubleListSelector::setActiveItems(const QStringList& items) - { - QStringList inactiveItems = m_gui->inactiveList->getAllItems(); - const QStringList& activeItems = m_gui->activeList->getAllItems(); - - inactiveItems.append(activeItems); - - m_gui->inactiveList->clearItems(); - m_gui->activeList->clearItems(); - - for (const QString& currentItem : items) - { - QStringList::iterator itemIter = inactiveItems.begin(); - - while (itemIter != inactiveItems.end()) - { - if ((*itemIter).compare(currentItem) == 0) - { - inactiveItems.erase(itemIter); - break; - } - - ++itemIter; - } - } - - m_gui->inactiveList->addItems(inactiveItems); - m_gui->activeList->addItems(items); - - emit ActiveItemsChanged(); - } - - const QStringList& DoubleListSelector::getActiveItems() const - { - return m_gui->activeList->getAllItems(); - } - - void DoubleListSelector::setActiveTitle(const QString& title) - { - m_gui->activeGroupBox->setTitle(title); - } - - void DoubleListSelector::setInactiveTitle(const QString& title) - { - m_gui->inactiveGroupBox->setTitle(title); - } - - void DoubleListSelector::activateSelected() - { - QStringList activateItems; - - m_gui->inactiveList->getSelectedItems(activateItems); - m_gui->inactiveList->removeSelected(); - - m_gui->activeList->addItems(activateItems); - - emit ActiveItemsChanged(); - } - - void DoubleListSelector::deactivateSelected() - { - QStringList activateItems; - - m_gui->activeList->getSelectedItems(activateItems); - m_gui->activeList->removeSelected(); - - m_gui->inactiveList->addItems(activateItems); - - emit ActiveItemsChanged(); - } -} diff --git a/Code/Tools/Standalone/Source/Driller/DoubleListSelector.hxx b/Code/Tools/Standalone/Source/Driller/DoubleListSelector.hxx deleted file mode 100644 index ce733868e9..0000000000 --- a/Code/Tools/Standalone/Source/Driller/DoubleListSelector.hxx +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef AZTOOLSFRAMEWORK_UI_UICORE_DOUBLELISTSELECTOR_H -#define AZTOOLSFRAMEWORK_UI_UICORE_DOUBLELISTSELECTOR_H - -#if !defined(Q_MOC_RUN) -#include -#include - -#pragma once - -#include -#endif - -namespace Ui -{ - class DoubleListSelector; -} - -namespace Driller -{ - class DoubleListSelector - : public QWidget - { - Q_OBJECT - - public: - AZ_CLASS_ALLOCATOR(DoubleListSelector, AZ::SystemAllocator,0); - - explicit DoubleListSelector(QWidget* parent = nullptr); - ~DoubleListSelector(); - - void setItemList(const QStringList& items, bool maintainActiveList = true); - void setActiveItems(const QStringList& items); - - const QStringList& getActiveItems() const; - - void setActiveTitle(const QString& title); - void setInactiveTitle(const QString& title); - - public slots: - void activateSelected(); - void deactivateSelected(); - - signals: - void ActiveItemsChanged(); - - private: - - Ui::DoubleListSelector* m_gui; - }; -} - -#endif diff --git a/Code/Tools/Standalone/Source/Driller/DoubleListSelector.ui b/Code/Tools/Standalone/Source/Driller/DoubleListSelector.ui deleted file mode 100644 index c7d4d74483..0000000000 --- a/Code/Tools/Standalone/Source/Driller/DoubleListSelector.ui +++ /dev/null @@ -1,174 +0,0 @@ - - - DoubleListSelector - - - - 0 - 0 - 527 - 449 - - - - Form - - - - - - - 0 - 0 - - - - Inactive - - - - - - - - - - - - - 50 - 0 - - - - - 75 - 16777215 - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - 5 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Qt::Vertical - - - - 50 - 40 - - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - >> - - - false - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - << - - - false - - - - - - - Qt::Vertical - - - - 50 - 40 - - - - - - - - - - - - 0 - 0 - - - - Active - - - - - - - - - - - - - Driller::FilteredListView - QWidget -
Source/Driller/FilteredListView.hxx
- 1 -
-
- - -
diff --git a/Code/Tools/Standalone/Source/Driller/DrillerAggregator.cpp b/Code/Tools/Standalone/Source/Driller/DrillerAggregator.cpp deleted file mode 100644 index bd88e8afbb..0000000000 --- a/Code/Tools/Standalone/Source/Driller/DrillerAggregator.cpp +++ /dev/null @@ -1,223 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "DrillerAggregator.hxx" -#include - -#include "DrillerEvent.h" - -#include -#include -#include - -#include "Source/Driller/CSVExportSettings.h" - -#include - -namespace Driller -{ - class AggregatorSavedState - : public AZ::UserSettings - { - public: - AZ_RTTI(AggregatorSavedState, "{9AAB69CE-8061-4CB6-8387-DB60FD8DBB75}", AZ::UserSettings); - AZ_CLASS_ALLOCATOR(AggregatorSavedState, AZ::SystemAllocator, 0); - AggregatorSavedState() {} - - static void Reflect(AZ::ReflectContext* context) - { - AZ::SerializeContext* serialize = azrtti_cast(context); - if (serialize) - { - serialize->Class() - ->Version(1) - ; - } - } - }; - - ////////////////////////////////////////////////////////////////////////// - Aggregator::Aggregator(int identity) - : QObject() - , m_identity(identity) - , m_currentEvent(Driller::kInvalidEventIndex) - , m_isCaptureEnabled(true) - { - DrillerMainWindowMessages::Handler::BusConnect(m_identity); - DrillerWorkspaceWindowMessages::Handler::BusConnect(m_identity); - - // subclassed aggregators should work with settingsDocument at this point - // to retrieve state - } - Aggregator::~Aggregator() - { - // subclassed aggregators should work with settingsDocument at this point - // to store the current state so it can be retrieved when constructed again - - DrillerWorkspaceWindowMessages::Handler::BusDisconnect(m_identity); - DrillerMainWindowMessages::Handler::BusDisconnect(m_identity); - - for (EventListType::iterator it = m_events.begin(); it != m_events.end(); ++it) - { - delete *it; - } - } - - void Aggregator::Reset() - { - for (EventListType::iterator it = m_events.begin(); it != m_events.end(); ++it) - { - delete *it; - } - - m_events.clear(); - m_frameToEventIndex.clear(); - m_currentEvent = kInvalidEventIndex; - } - bool Aggregator::IsValid() - { - return m_events.size() > 0; - } - - void Aggregator::AddNewFrame() - { - m_frameToEventIndex.push_back(m_events.size()); - } - - bool Aggregator::DataAtFrame(FrameNumberType frame) - { - return NumOfEventsAtFrame(frame) > 0; - } - - void Aggregator::ExportToCSVRequest(const char* filename, CSVExportSettings* exportSettings) - { - AZ::IO::SystemFile exportFile; - - if (exportFile.Open(filename, AZ::IO::SystemFile::SF_OPEN_CREATE | AZ::IO::SystemFile::SF_OPEN_WRITE_ONLY)) - { - if (exportSettings == nullptr || exportSettings->ShouldExportColumnDescriptors()) - { - ExportColumnDescriptorToCSV(exportFile, exportSettings); - } - - for (DrillerEvent* drillerEvent : m_events) - { - ExportEventToCSV(exportFile, drillerEvent, exportSettings); - } - - exportFile.Close(); - } - else - { - QMessageBox::critical(nullptr, "Error Opening File", QString("Could not open file %1").arg(filename), QMessageBox::Ok); - } - } - - size_t Aggregator::NumOfEventsAtFrame(FrameNumberType frame) const - { - size_t numFrames = m_frameToEventIndex.size(); - if (numFrames == 1) - { - return m_events.size(); - } - - if (frame == numFrames - 1) - { - return m_events.size() - m_frameToEventIndex[frame]; // last frame - } - - if (numFrames >= 2) - { - EventNumberType ftei1 = m_frameToEventIndex[frame + 1]; - EventNumberType ftei0 = m_frameToEventIndex[frame]; - size_t fte = (ftei1 - ftei0); - return fte; - } - - return 0; - } - - QString Aggregator::GetDialogTitle() const - { - return QString("%1 - %2").arg(GetName()).arg(GetInspectionFileName()); - } - - void Aggregator::FrameChanged(FrameNumberType frame) - { - size_t numFrames = m_frameToEventIndex.size(); - if (numFrames) - { - EventNumberType targetEventIndex; - - if (frame == numFrames - 1) - { - targetEventIndex = m_events.size() - 1; - } - else - { - targetEventIndex = m_frameToEventIndex[frame + 1]; - - // the current targetEventIndex belongs to the next frame "frame+1" minus 1 - --targetEventIndex; - } - - EventChanged(targetEventIndex); - } - } - - void Aggregator::EventChanged(EventNumberType eventIndex) - { - if (eventIndex == m_currentEvent) - { - return; - } - - // TODO: If we are at the end and we click at the start, we can start from the START as it's a known state - if (eventIndex > m_currentEvent) - { - // forward (m_currentEvent has already been executed so start currentEvent+1) - for (EventNumberType i = m_currentEvent + 1; i <= eventIndex; ++i) - { - m_events[i]->StepForward(this); - } - } - else if (eventIndex < m_currentEvent) - { - // backward (current event has executed so revert it - for (EventNumberType i = m_currentEvent; i > eventIndex; --i) - { - m_events[i]->StepBackward(this); - } - } - - m_currentEvent = eventIndex; - emit OnDataCurrentEventChanged(); - } - - void Aggregator::ExportColumnDescriptorToCSV(AZ::IO::SystemFile& file, CSVExportSettings* exportSettings) - { - (void)file; - (void)exportSettings; - } - - void Aggregator::ExportEventToCSV(AZ::IO::SystemFile& file, const DrillerEvent* drillerEvent, CSVExportSettings* exportSettings) - { - (void)file; - (void)drillerEvent; - (void)exportSettings; - } - - void Aggregator::Reflect(AZ::ReflectContext* context) - { - AZ::SerializeContext* serialize = azrtti_cast(context); - if (serialize) - { - AggregatorSavedState::Reflect(context); - } - } -} diff --git a/Code/Tools/Standalone/Source/Driller/DrillerAggregator.hxx b/Code/Tools/Standalone/Source/Driller/DrillerAggregator.hxx deleted file mode 100644 index cf370a4571..0000000000 --- a/Code/Tools/Standalone/Source/Driller/DrillerAggregator.hxx +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef DRILLER_DRILLERAGGREGATOR_H -#define DRILLER_DRILLERAGGREGATOR_H - -#if !defined(Q_MOC_RUN) -#include -#include -#include - -#include "DrillerMainWindowMessages.h" -#include "DrillerDataTypes.h" - -#include -#include -#endif - -namespace AZ -{ - namespace IO - { - class SystemFile; - } - class ReflectContext; -} - -namespace Driller -{ - class DrillerEvent; - class AnnotationsProvider; - class CSVExportSettings; - class CustomizeCSVExportWidget; - - class ChannelDataView; - class ChannelConfigurationWidget; - - /* - Aggregator is a pure virtual data source that packages its data - into easily digestible, single frame chunks for external consumption. - It is a pull, not a push, source. - - Separately, aggregators are responsible for handling their own Options and Drill Down displays. - */ - - class Aggregator - : public QObject - , public Driller::DrillerMainWindowMessages::Bus::Handler - , public Driller::DrillerWorkspaceWindowMessages::Bus::Handler - { - Q_OBJECT; - public: - typedef AZStd::vector EventListType; - typedef AZStd::vector FrameToEventIndexType; - - Aggregator(int identity); - virtual ~Aggregator(); - // MainWindow Bus Commands - - virtual AZ::Crc32 GetChannelId() const { return 0; } - virtual AZ::u32 GetDrillerId() const { return 0; } - virtual AZ::Debug::DrillerHandlerParser* GetDrillerDataParser() { return nullptr; } - virtual void EnableCapture(bool enabled) { m_isCaptureEnabled = enabled; } - bool IsCaptureEnabled() const { return m_isCaptureEnabled; } - int GetIdentity() const { return m_identity; } - - virtual bool CanExportToCSV() const { return false; } - virtual CustomizeCSVExportWidget* CreateCSVExportCustomizationWidget() { return nullptr; } - - virtual bool HasConfigurations() const { return false; } - virtual ChannelConfigurationWidget* CreateConfigurationWidget() { return nullptr; } - virtual void OnConfigurationChanged() { } - - virtual void AnnotateChannelView(ChannelDataView* dataView) { (void)dataView; } - virtual void RemoveChannelAnnotation(ChannelDataView* dataView) { (void)dataView; } - - /// reset for another data run - virtual void Reset(); - virtual bool IsValid(); - - /// Make a game frame. - virtual void AddNewFrame(); - /// Adds new event. We can have many events (or none) for each game frame. - void AddEvent(DrillerEvent* event) { m_events.push_back(event); emit OnDataAddEvent();} - void FinalizeEvent() { emit OnEventFinalized(m_events.back()); } - EventListType& GetEvents() { return m_events; } - const EventListType& GetEvents() const { return m_events; } - size_t NumOfEventsAtFrame(FrameNumberType frame) const; - EventNumberType GetCurrentEvent() const { return m_currentEvent; } - - EventNumberType GetFirstIndexAtFrame(FrameNumberType frame ) const { return m_frameToEventIndex[frame]; } - - size_t GetFrameCount() const { return m_frameToEventIndex.size(); } - - // ----- annotation functionality ---- - - // emit all annotations that match the provider's filter, given the start and end frame: - virtual void EmitAllAnnotationsForFrameRange( FrameNumberType startFrameInclusive, FrameNumberType endFrameInclusive , AnnotationsProvider* ptrProvider) { (void)startFrameInclusive; (void)endFrameInclusive; (void)ptrProvider; } - - // emit all channels that you are aware of existing within that frame range (You may emit duplicate channels, they will be ignored) - virtual void EmitAnnotationChannelsForFrameRange( FrameNumberType startFrameInclusive, FrameNumberType endFrameInclusive , AnnotationsProvider* ptrProvider) { (void)startFrameInclusive; (void)endFrameInclusive; (void)ptrProvider; } - - QString GetDialogTitle() const; - - signals: - - void NormalizedRangeChanged(); - - void OnDataCurrentEventChanged(); - void OnDataAddEvent(); - void OnEventFinalized(DrillerEvent* event); - - QString GetInspectionFileName() const; - - public slots: - // Queries - virtual bool DataAtFrame(FrameNumberType frame ); - virtual float ValueAtFrame(FrameNumberType frame ) = 0; - virtual QColor GetColor() const = 0; - virtual QString GetChannelName() const = 0; - virtual QString GetName() const = 0; - virtual QString GetDescription() const = 0; - virtual QString GetToolTip() const = 0; - virtual QString GetDrillDownIcon() { return ":/general/callstack"; } - virtual AZ::Uuid GetID() const = 0; - virtual QWidget* DrillDownRequest(FrameNumberType atFrame) = 0; - virtual void OptionsRequest() = 0; - - void ExportToCSVRequest(const char* filename, CSVExportSettings* exportSettings); - - protected: - Aggregator(const Aggregator&) = delete; - virtual void FrameChanged(FrameNumberType frame); - virtual void EventChanged(EventNumberType eventIndex); - - virtual void ExportColumnDescriptorToCSV(AZ::IO::SystemFile& file, CSVExportSettings* exportSettings); - virtual void ExportEventToCSV(AZ::IO::SystemFile& file, const DrillerEvent* drillerEvent, CSVExportSettings* exportSettings); - - EventNumberType m_currentEvent; ///< Current event points last executed event - EventListType m_events; - FrameToEventIndexType m_frameToEventIndex; - bool m_isCaptureEnabled; - int m_identity; - - public: - static void Reflect(AZ::ReflectContext* context); - }; -} - -#endif //DRILLER_DRILLERAGGREGATOR_H diff --git a/Code/Tools/Standalone/Source/Driller/DrillerAggregatorOptions.hxx b/Code/Tools/Standalone/Source/Driller/DrillerAggregatorOptions.hxx deleted file mode 100644 index 966f0fbcd6..0000000000 --- a/Code/Tools/Standalone/Source/Driller/DrillerAggregatorOptions.hxx +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef DRILLER_DRILLERAGGREGATOR_OPTIONS_H -#define DRILLER_DRILLERAGGREGATOR_OPTIONS_H - -#include "QtGui/qcolor.h" - -namespace Driller -{ - class Aggregator; - - class AggregatorOptions - { - public: - - AggregatorOptions( Aggregator *owner ) - : m_Owner(owner) - { - } - virtual ~AggregatorOptions() - { - } - - Aggregator *m_Owner; - }; -} - -#endif //DRILLER_DRILLERAGGREGATOR_OPTIONS_H diff --git a/Code/Tools/Standalone/Source/Driller/DrillerCaptureWindow.cpp b/Code/Tools/Standalone/Source/Driller/DrillerCaptureWindow.cpp deleted file mode 100644 index 7f39136649..0000000000 --- a/Code/Tools/Standalone/Source/Driller/DrillerCaptureWindow.cpp +++ /dev/null @@ -1,1952 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "DrillerCaptureWindow.hxx" -#include - -#include "DrillerMainWindowMessages.h" -#include "DrillerAggregator.hxx" -#include "ChannelControl.hxx" -#include "ChannelProfilerWidget.hxx" -#include "CombinedEventsControl.hxx" -#include "DrillerDataContainer.h" -#include "DrillerMainWindow.hxx" -#include "DrillerOperationTelemetryEvent.h" -#include "Workspaces/Workspace.h" - -#include -#include - -#include -#include -#include -#include - -#include "QtGui/QPalette" -#include "Annotations/AnnotationHeaderView.hxx" -#include "Annotations/ConfigureAnnotationsWindow.hxx" - -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -void initSharedResources() -{ - Q_INIT_RESOURCE(sharedResources); -} - -namespace -{ - const char* drillerDebugName = "Driller"; - const char* drillerInfoName = "Driller"; - const char* baseTempFileName = "drillercapture.drl"; -} - -namespace Driller -{ - class DrillerCaptureWindowSavedState - : public AzToolsFramework::MainWindowSavedState - { - public: - AZ_RTTI(DrillerCaptureWindowSavedState, "{19721873-2FB0-4B5B-BCFC-C774FEC7687A}", AzToolsFramework::MainWindowSavedState); - AZ_CLASS_ALLOCATOR(DrillerCaptureWindowSavedState, AZ::SystemAllocator, 0); - - AZStd::list m_ChannelIDs; - int m_fpsValue; - FrameNumberType m_scrubberCurrentFrame; - EventNumberType m_scrubberCurrentEvent; - FrameNumberType m_playbackLoopBegin; - FrameNumberType m_playbackLoopEnd; - AZStd::string m_priorSaveFolder; - - DrillerCaptureWindowSavedState() - : m_fpsValue(60) - , m_scrubberCurrentFrame(0) - , m_scrubberCurrentEvent(0) - , m_playbackLoopBegin(0) - , m_playbackLoopEnd(0) - {} - - void Init(const QByteArray& windowState, const QByteArray& windowGeom) - { - AzToolsFramework::MainWindowSavedState::Init(windowState, windowGeom); - } - - static void Reflect(AZ::ReflectContext* context) - { - AZ::SerializeContext* serialize = azrtti_cast(context); - if (serialize) - { - serialize->Class() - ->Field("m_ChannelIDs", &DrillerCaptureWindowSavedState::m_ChannelIDs) - ->Field("m_fpsValue", &DrillerCaptureWindowSavedState::m_fpsValue) - ->Field("m_scrubberCurrentFrame", &DrillerCaptureWindowSavedState::m_scrubberCurrentFrame) - ->Field("m_scrubberCurrentEvent", &DrillerCaptureWindowSavedState::m_scrubberCurrentEvent) - ->Field("m_playbackLoopBegin", &DrillerCaptureWindowSavedState::m_playbackLoopBegin) - ->Field("m_playbackLoopEnd", &DrillerCaptureWindowSavedState::m_playbackLoopEnd) - ->Field("m_priorSaveFolder", &DrillerCaptureWindowSavedState::m_priorSaveFolder) - ->Version(8); - } - } - }; - - // WORKSPACES are files loaded and stored independent of the global application - // designed to be used for DRL data specific view settings and to pass around - class DrillerCaptureWindowWorkspace - : public AZ::UserSettings - { - public: - AZ_RTTI(DrillerCaptureWindowWorkspace, "{EB67D4B6-41F5-4CED-85F1-E98586036BC6}", AZ::UserSettings); - AZ_CLASS_ALLOCATOR(DrillerCaptureWindowWorkspace, AZ::SystemAllocator, 0); - - DrillerCaptureWindowWorkspace() {} - - AZStd::list m_ChannelIDs; - AZStd::string m_matchingDataFileName; - FrameNumberType m_scrubberCurrentFrame; - FrameNumberType m_frameRangeBegin; - FrameNumberType m_frameRangeEnd; - FrameNumberType m_visibleFrames; - int m_sliderPosition; - EventNumberType m_scrubberCurrentEvent; - - FrameNumberType m_playbackLoopBegin; - FrameNumberType m_playbackLoopEnd; - - static void Reflect(AZ::ReflectContext* context) - { - AZ::SerializeContext* serialize = azrtti_cast(context); - if (serialize) - { - serialize->Class() - ->Field("m_ChannelIDs", &DrillerCaptureWindowWorkspace::m_ChannelIDs) - ->Field("m_matchingDataFileName", &DrillerCaptureWindowWorkspace::m_matchingDataFileName) - ->Field("m_scrubberCurrentFrame", &DrillerCaptureWindowWorkspace::m_scrubberCurrentFrame) - ->Field("m_frameRangeBegin", &DrillerCaptureWindowWorkspace::m_frameRangeBegin) - ->Field("m_frameRangeEnd", &DrillerCaptureWindowWorkspace::m_frameRangeEnd) - ->Field("m_visibleFrames", &DrillerCaptureWindowWorkspace::m_visibleFrames) - ->Field("m_playbackLoopBegin", &DrillerCaptureWindowWorkspace::m_playbackLoopBegin) - ->Field("m_playbackLoopEnd", &DrillerCaptureWindowWorkspace::m_playbackLoopEnd) - ->Field("m_sliderPosition", &DrillerCaptureWindowWorkspace::m_sliderPosition) - ->Field("m_scrubberCurrentEvent", &DrillerCaptureWindowWorkspace::m_scrubberCurrentEvent) - ->Version(6); - } - } - }; -} - -namespace Driller -{ - extern AZ::Uuid ContextID; - - const int DrillerCaptureWindow::s_availableFrameQuantities[] = { 30, 60, 120, 240, 480, 960, 0 }; - - ////////////////////////////////////////////////////////////////////////// - //DrillerCaptureWindow - DrillerCaptureWindow::DrillerCaptureWindow(CaptureMode captureMode, int identity, QWidget* parent, Qt::WindowFlags flags) - : QDockWidget(parent, flags) - , m_captureMode(captureMode) - , m_identity(identity) - , m_windowStateCRC(0) - { - initSharedResources(); - - AZStd::string windowStateStr = AZStd::string::format("DRILLER CAPTURE WINDOW STATE %i", m_identity); - m_windowStateCRC = AZ::Crc32(windowStateStr.c_str()); - - m_captureIsDirty = false; - - m_playbackIsActive = false; - m_draggingPlaybackLoopBegin = false; - m_draggingPlaybackLoopEnd = false; - m_draggingAnything = false; - m_manipulatingScrollBar = false; - m_frameRangeEnd = 0; - m_frameRangeBegin = 0; - m_ptrConfigureAnnotationsWindow = NULL; - m_isLoadingFile = false; - m_TargetConnected = false; - m_captureIsDirty = false; - m_bForceNextScrub = true; - m_captureId = 0; - - m_gui = azcreate(Ui::DrillerCaptureWindow, ()); - m_gui->setupUi(this); - - if (IsInCaptureMode(CaptureMode::Inspecting)) - { - setFeatures(QDockWidget::DockWidgetClosable); - } - - m_gui->combinedEventsWidget->SetIdentity(m_identity); - - // Removing the title bar, since it's meaningless for us. - setTitleBarWidget(new QWidget()); - - connect(m_gui->playButton, SIGNAL(toggled(bool)), this, SLOT(OnPlayToggled(bool))); - - if (IsInLiveMode()) - { - connect(m_gui->captureButton, SIGNAL(toggled(bool)), this, SLOT(OnCaptureToggled(bool))); - } - else - { - m_gui->captureButton->setDisabled(true); - } - - connect(m_gui->frameScrubberBox, SIGNAL(valueChanged(int)), this, SLOT(OnFrameScrubberboxChanged(int))); - connect(m_gui->controlScrollBar, SIGNAL(sliderPressed()), this, SLOT(OnSliderPressed())); - connect(m_gui->controlScrollBar, SIGNAL(sliderMoved(int)), this, SLOT(OnNewSliderValue(int))); - connect(m_gui->controlScrollBar, SIGNAL(valueChanged(int)), this, SLOT(OnNewSliderValue(int))); - - QMenu* quantMenu = new QMenu(this); - - QSignalMapper* ptrMapper = new QSignalMapper(this); - int numQuantsAvailable = sizeof(s_availableFrameQuantities) / sizeof(int); - for (int idx = 0; idx < numQuantsAvailable; ++idx) - { - int thisQuant = s_availableFrameQuantities[idx]; - - QString label = thisQuant ? tr("%1 frames").arg(s_availableFrameQuantities[idx]) : tr("All frames"); - - // connect to mapper: - QAction* act = new QAction(label, this); - connect(act, SIGNAL(triggered()), ptrMapper, SLOT(map())); - ptrMapper->setMapping(act, thisQuant); - quantMenu->addAction(act); - } - connect(ptrMapper, SIGNAL(mapped(int)), this, SLOT(OnQuantMenuFinal(int))); - - m_gui->quantityButton->setText("120 frames"); - m_gui->quantityButton->setMenu(quantMenu); - - m_gui->scrollArea->setBackgroundRole(QPalette::Dark); - DrillerNetworkMessages::Handler::BusConnect(m_identity); - - m_visibleFrames = 120; - - QString tmpCapturePath = PrepTempFile(baseTempFileName); - m_data = aznew DrillerDataContainer(m_identity, tmpCapturePath.toUtf8().data()); - - connect(this, SIGNAL(ScrubberFrameUpdate(FrameNumberType)), m_gui->combinedEventsWidget, SLOT(SetScrubberFrame(FrameNumberType))); - - m_ptrAnnotationsHeaderView = aznew AnnotationHeaderView(&m_AnnotationProvider, this); - m_gui->channelLayout->addWidget(m_ptrAnnotationsHeaderView); - - connect(m_ptrAnnotationsHeaderView, SIGNAL(OnOptionsClick()), this, SLOT(OnAnnotationOptionsClick())); - connect(m_ptrAnnotationsHeaderView, SIGNAL(InformOfMouseOverAnnotation(const Annotation&)), this, SLOT(InformOfMouseOverAnnotation(const Annotation&))); - connect(m_ptrAnnotationsHeaderView, SIGNAL(InformOfClickAnnotation(const Annotation&)), this, SLOT(InformOfClickAnnotation(const Annotation&))); - connect(&m_AnnotationProvider, SIGNAL(SelectedAnnotationsChanged()), this, SLOT(OnSelectedAnnotationChannelsChanged())); - - // button state maintenance courtesy of the TargetManagerClient bus message(s) we handle - m_gui->captureButton->setEnabled(false); - - if (IsInLiveMode()) - { - AzFramework::TargetManagerClient::Bus::Handler::BusConnect(); - } - - StateReset(); - - m_gui->combinedEventsWidget->SetAnnotationsProvider(&m_AnnotationProvider); - - connect(m_gui->combinedEventsWidget->m_annotationHeaderView, SIGNAL(InformOfMouseOverAnnotation(const Annotation&)), this, SLOT(InformOfMouseOverAnnotation(const Annotation&))); - connect(m_gui->combinedEventsWidget->m_annotationHeaderView, SIGNAL(InformOfClickAnnotation(const Annotation&)), this, SLOT(InformOfClickAnnotation(const Annotation&))); - connect(this, SIGNAL(ScrubberFrameUpdate(FrameNumberType)), m_gui->combinedEventsWidget->m_annotationHeaderView, SLOT(OnScrubberFrameUpdate(FrameNumberType))); - connect(m_gui->actionClose, SIGNAL(triggered()), this, SLOT(OnCloseFile())); - - connect(m_gui->combinedEventsWidget, SIGNAL(EventRequestEventFocus(EventNumberType)), this, SLOT(EventRequestEventFocus(EventNumberType))); - - UpdateLiveControls(); - emit CaptureWindowSetToLive(IsInLiveMode()); - - RestoreWindowState(); - QTimer::singleShot(0, this, SLOT(OnUpdateScrollSize())); - - DrillerCaptureWindowRequestBus::Handler::BusConnect(m_identity); - } - - DrillerCaptureWindow::~DrillerCaptureWindow(void) - { - DrillerCaptureWindowRequestBus::Handler::BusDisconnect(m_identity); - DrillerNetworkMessages::Handler::BusDisconnect(m_identity); - AzFramework::TargetManagerClient::Bus::Handler::BusDisconnect(); - - delete m_data; - azdestroy(m_gui); - } - - bool DrillerCaptureWindow::event(QEvent* evt) - { - if (evt->type() == QEvent::WindowActivate) - { - emit CaptureWindowSetToLive(static_cast(IsInLiveMode())); - } - - // parent class - return QDockWidget::event(evt); - } - - ////////////////////////////////////////////////////////////////////////// - // internal workings - void DrillerCaptureWindow::StateReset() - { - if (m_visibleFrames == m_frameRangeEnd - m_frameRangeBegin + 1) - { - // full range was visible. - OnQuantMenuFinal(120); - } - - OnPlayToggled(false); - SetPlaybackLoopBegin(0); - SetPlaybackLoopEnd(0); - SetFrameRangeBegin(0); - SetFrameRangeEnd(0); - SetScrubberFrame(0); - m_bForceNextScrub = true; - - for (auto iter = m_channels.begin(); iter != m_channels.end(); ++iter) - { - (*iter)->SetEndFrame(0); - } - - m_ptrAnnotationsHeaderView->SetEndFrame(0); - } - - void DrillerCaptureWindow::UpdateLiveControls() - { - bool isViewingStoredData = IsInCaptureMode(CaptureMode::Inspecting); - - // these overlapping frames must be both hidden and then one made visible - // otherwise the containing window is forced wide enough to support both - // which overrides previous sizes and leaves a ton of dead space behind - m_gui->targetFrame->setVisible(!isViewingStoredData); - - m_gui->playButton->setVisible(isViewingStoredData); - m_gui->frameFPS->setVisible(isViewingStoredData); - m_gui->frameScrubberBox->setEnabled(isViewingStoredData); - - // For now, we're not sure if we want to keep this, or expand on it - // going ahead. So for now we'll just hide it. - m_gui->combinedEventsWidget->setVisible(false); - - if (IsInCaptureMode(CaptureMode::Configuration)) - { - m_gui->frame->setVisible(false); - m_gui->quantityButton->setVisible(false); - } - else - { - m_gui->frame->setVisible(true); - m_gui->quantityButton->setVisible(true); - } - - emit CaptureWindowSetToLive(!isViewingStoredData); - } - - void DrillerCaptureWindow::SetCaptureMode(CaptureMode captureMode) - { - if (m_captureMode != captureMode) - { - m_captureMode = captureMode; - emit OnCaptureModeChange(m_captureMode); - } - } - - void DrillerCaptureWindow::ResetCaptureControls() - { - // Reset the state of the UI Controls - m_currentDataFilename = ""; - SetCaptureMode(CaptureMode::Configuration); - OnCloseFile(); - m_data->CloseCaptureData(); - m_data->CreateAggregators(); - UpdateLiveControls(); - } - - bool DrillerCaptureWindow::IsInLiveMode() const - { - return IsInCaptureMode(CaptureMode::Capturing) || IsInCaptureMode(CaptureMode::Configuration); - } - - bool DrillerCaptureWindow::IsInCaptureMode(CaptureMode captureMode) const - { - return m_captureMode == captureMode; - } - - void DrillerCaptureWindow::ClearExistingChannels() - { - ClearChannelDisplay(true); - } - - void DrillerCaptureWindow::ClearChannelDisplay(bool withDeletion) - { - if (withDeletion) - { - m_gui->combinedEventsWidget->ClearAggregatorList(); - - for (auto iter = m_channels.begin(); iter != m_channels.end(); ++iter) - { - m_gui->channelLayout->removeWidget(*iter); - delete *iter; - } - m_channels.clear(); - } - else - { - for (auto iter = m_channels.begin(); iter != m_channels.end(); ++iter) - { - m_gui->channelLayout->removeWidget(*iter); - } - } - - // layouts take one message process to update their sizes, we need to queue a refresh of our scroll area at the end of the event queue - // so that the sizeHint() will be correct. - QTimer::singleShot(0, this, SLOT(OnUpdateScrollSize())); - } - - void DrillerCaptureWindow::SortChannels() - { - SortedChannels temp; - - // two passes, first pushes active channels and second pushes the remaining inactive channels - // this maintains the relative order of the list within categories to avoid surprises - for (ChannelControl* channelControl : m_channels) - { - if (channelControl->IsActive()) - { - temp.push_back(channelControl); - } - } - - for (ChannelControl* channelControl : m_channels) - { - if (!channelControl->IsActive()) - { - channelControl->OnContractedToggled(false); - temp.push_back(channelControl); - } - } - - m_channels.clear(); - m_channels = temp; - temp.clear(); - } - - void DrillerCaptureWindow::PopulateChannelDisplay() - { - for (auto iter = m_channels.begin(); iter != m_channels.end(); ++iter) - { - m_gui->channelLayout->addWidget(*iter); - (*iter)->SetDataPointsInView(m_visibleFrames); - } - // layouts take one message process to update their sizes, we need to queue a refresh of our scroll area at the end of the event queue - // so that the sizeHint() will be correct. - QTimer::singleShot(0, this, SLOT(OnUpdateScrollSize())); - } - - void DrillerCaptureWindow::OnUpdateScrollSize() - { - // this just tells the scroll area to tell its layout that it has a new sizehint - m_gui->scrollArea->updateGeometry(); - } - - ChannelControl* DrillerCaptureWindow::FindChannelControl(Aggregator* aggregator) - { - ChannelControl* retVal = nullptr; - - QString channelName = aggregator->GetChannelName(); - AZ::Crc32 groupCRC = AZ::Crc32(channelName.toStdString().c_str()); - - for (ChannelControl* channelControl : m_channels) - { - if (groupCRC == channelControl->GetChannelId()) - { - retVal = channelControl; - break; - } - } - - if (retVal == nullptr) - { - retVal = aznew ChannelControl(channelName.toStdString().c_str(), &m_AnnotationProvider); - - if (retVal) - { - m_channels.push_back(retVal); - } - } - - return retVal; - } - - void DrillerCaptureWindow::AddChannelDisplay(ChannelControl* cc) - { - m_gui->channelLayout->addWidget(cc); - - // layouts take one message process to update their sizes, we need to queue a refresh of our scroll area at the end of the event queue - // so that the sizeHint() will be correct. - QTimer::singleShot(0, this, SLOT(OnUpdateScrollSize())); - } - - ////////////////////////////////////////////////////////////////////////// - // Driller Network Messages - void DrillerCaptureWindow::ConnectedToNetwork() - { - if (m_isLoadingFile) - { - return; - } - - if (IsInCaptureMode(CaptureMode::Inspecting)) - { - return; - } - - StateReset(); - } - - void DrillerCaptureWindow::ConnectChannelControl(ChannelControl* dc) - { - if (!dc->IsSetup()) - { - connect(dc, SIGNAL(GetInspectionFileName()), this, SLOT(GetOpenFileName())); - connect(dc, SIGNAL(RequestScrollToFrame(FrameNumberType)), this, SLOT(HandleScrollToFrameRequest(FrameNumberType))); - connect(dc, SIGNAL(InformOfMouseClick(Qt::MouseButton, FrameNumberType, FrameNumberType, int)), this, SLOT(OnChannelControlMouseDown(Qt::MouseButton, FrameNumberType, FrameNumberType, int))); - connect(dc, SIGNAL(InformOfMouseMove(FrameNumberType, FrameNumberType, int)), this, SLOT(OnChannelControlMouseMove(FrameNumberType, FrameNumberType, int))); - connect(dc, SIGNAL(InformOfMouseRelease(Qt::MouseButton, FrameNumberType, FrameNumberType, int)), this, SLOT(OnChannelControlMouseUp(Qt::MouseButton, FrameNumberType, FrameNumberType, int))); - connect(dc, SIGNAL(InformOfMouseWheel(FrameNumberType, int, FrameNumberType, int)), this, SLOT(OnChannelControlMouseWheel(FrameNumberType, int, FrameNumberType, int))); - connect(dc, SIGNAL(ExpandedContracted()), this, SLOT(OnUpdateScrollSize())); - - connect(this, SIGNAL(ScrubberFrameUpdate(FrameNumberType)), dc, SLOT(SetScrubberFrame(FrameNumberType))); - connect(this, SIGNAL(ShowYourself()), dc, SLOT(OnShowCommand())); - connect(this, SIGNAL(HideYourself()), dc, SLOT(OnHideCommand())); - connect(this, SIGNAL(OnCaptureModeChange(CaptureMode)), dc, SLOT(SetCaptureMode(CaptureMode))); - - dc->SetCaptureMode(m_captureMode); - - dc->SignalSetup(); - } - } - - // target that you're connected to knows what aggregators are ready. - void DrillerCaptureWindow::NewAggregatorsAvailable() - { - if (m_isLoadingFile) - { - return; - } - - if (IsInCaptureMode(CaptureMode::Inspecting)) - { - return; - } - - // otherwise, make em, if we're live. - m_data->CreateAggregators(); - } - - // incoming driller bus message - void DrillerCaptureWindow::NewAggregatorList(AggregatorList& theList) - { - ClearExistingChannels(); - - if (theList.size()) - { - for (AggregatorList::iterator iter = theList.begin(); iter != theList.end(); ++iter) - { - ChannelControl* channelControl = FindChannelControl((*iter)); - ConnectChannelControl(channelControl); - - ChannelProfilerWidget* profilerWidget = channelControl->AddAggregator((*iter)); - - if (profilerWidget) - { - // defaults to active - // restore previous inactive state if GUIDs match - bool wasInactive = (m_inactiveChannels.find(profilerWidget->GetID()) != m_inactiveChannels.end()); - profilerWidget->SetIsActive(!wasInactive); - } - } - - PopulateChannelDisplay(); - - m_gui->combinedEventsWidget->AddAggregatorList(theList); - m_gui->captureButton->setEnabled(true); - } - } - - void DrillerCaptureWindow::AddAggregator(Aggregator& theAggregator) - { - ChannelControl* channelControl = FindChannelControl(&theAggregator); - - if (!channelControl->IsSetup()) - { - ConnectChannelControl(channelControl); - AddChannelDisplay(channelControl); - } - - ChannelProfilerWidget* profilerWidget = channelControl->AddAggregator(&theAggregator); - - if (profilerWidget) - { - // defaults to active - // restore previous inactive state if GUIDs match - int wasInactive = (m_inactiveChannels.find(profilerWidget->GetID()) != m_inactiveChannels.end()); - profilerWidget->SetIsActive(!wasInactive); - } - - m_gui->captureButton->setEnabled(true); - m_gui->combinedEventsWidget->AddAggregator(theAggregator); - } - - void DrillerCaptureWindow::DiscardAggregators() - { - ClearExistingChannels(); - m_gui->captureButton->setEnabled(false); - } - - // incoming driller bus message - void DrillerCaptureWindow::DisconnectedFromNetwork() - { - //todo: phughes message the user or something - } - - void DrillerCaptureWindow::UpdateEndFrameInControls() - { - if (!m_isLoadingFile) - { - for (auto iter = m_channels.begin(); iter != m_channels.end(); ++iter) - { - (*iter)->SetEndFrame(m_frameRangeEnd); - } - m_ptrAnnotationsHeaderView->SetEndFrame(m_frameRangeEnd); - } - } - - QString DrillerCaptureWindow::GetOpenFileName() const - { - AZ_Error("DrillerCaptureWindow", IsInCaptureMode(CaptureMode::Inspecting), "Trying to get file name in non-inspected case"); - return m_currentDataFilename; - } - - // incoming driller bus message - void DrillerCaptureWindow::EndFrame(FrameNumberType frame) - { - // if we're loading a file then we do not scrub these live: - SetFrameRangeEnd(frame); - UpdateEndFrameInControls(); - } - - // incoming driller bus message - void DrillerCaptureWindow::ScrubberFrame(FrameNumberType frame) - { - emit ScrubberFrameUpdate(frame); - m_gui->frameScrubberBox->setValue(static_cast(frame)); - } - - ////////////////////////////////////////////////////////////////////////// - // Data Viewer Request Messages - void DrillerCaptureWindow::EventRequestEventFocus(EventNumberType eventIdx) - { - m_scrubberCurrentEvent = eventIdx; - - EBUS_EVENT_ID(m_identity, Driller::DrillerEventWindowMessages::Bus, EventFocusChanged, eventIdx); - } - - void DrillerCaptureWindow::SetScrubberEvent(EventNumberType eventIdx) - { - EventRequestEventFocus(eventIdx); - } - - ////////////////////////////////////////////////////////////////////////// - // GUI Messages - void DrillerCaptureWindow::OnCaptureToggled(bool toggleState) - { - DrillerOperationTelemetryEvent captureEvent; - - if (toggleState) - { - captureEvent.SetAttribute("StartDataCapture", ""); - captureEvent.SetMetric("CaptureId", m_captureId); - - QString activeChannels; - - bool appendComma = false; - - for (ChannelControl* channel : m_channels) - { - const AZStd::list< ChannelProfilerWidget* >& profilers = channel->GetProfilers(); - - for (ChannelProfilerWidget* profiler : profilers) - { - if (profiler->IsActive()) - { - if (appendComma) - { - activeChannels.append(","); - } - - appendComma = true; - activeChannels.append(profiler->GetName()); - } - } - } - - captureEvent.SetAttribute("ActiveChannels", activeChannels.toStdString().c_str()); - - AZ_TracePrintf(drillerInfoName, "Capture ON, starting a new data session\n"); - OnPlayToggled(false); - m_gui->captureButton->setText(tr("Stop Capture")); - m_gui->captureButton->setToolTip(tr("Stop Capturing Driller Data")); - StateReset(); - - SetCaptureMode(CaptureMode::Capturing); - - m_AnnotationProvider.Clear(); - - ClearChannelDisplay(false); - SortChannels(); - PopulateChannelDisplay(); - - if (m_data) - { - m_data->StartDrilling(); - } - - SetCaptureDirty(true); - UpdateLiveControls(); - } - else - { - captureEvent.SetAttribute("StopDataCapture", ""); - captureEvent.SetMetric("CaptureId", m_captureId); - - ++m_captureId; - - AZ_TracePrintf(drillerInfoName, "Capture OFF, freezing data for analysis\n"); - m_gui->captureButton->setText(tr("Capture")); - m_gui->captureButton->setToolTip(tr("Begin Capturing Driller Data")); - - bool wascapturing = IsInCaptureMode(CaptureMode::Capturing); - - CaptureMode::Inspecting; - emit OnCaptureModeChange(m_captureMode); - - if (m_data) - { - m_data->StopDrilling(); - } - - if (wascapturing) - { - OnSaveDrillerFile(); - ScrubberToEnd(); - SetFrameRangeEnd(0); - // counting on the OnSave to recognize the TMP file from the capture and copy appropriately - // and setting it to our currently active data file - } - } - - captureEvent.Log(); - - update(); - } - - void DrillerCaptureWindow::SetCaptureDirty(bool isDirty) - { - m_captureIsDirty = isDirty; - } - - void DrillerCaptureWindow::OnMenuCloseCurrentWindow() - { - AZ_TracePrintf(drillerDebugName, "Close requested\n"); - - OnCaptureToggled(false); - OnCloseFile(); - - EBUS_EVENT(AzToolsFramework::FrameworkMessages::Bus, RequestMainWindowClose, ContextID); - } - - void DrillerCaptureWindow::OnOpen() - { - AZ_TracePrintf(drillerDebugName, "Open requested\n"); - - this->show(); - emit ShowYourself(); - } - - void DrillerCaptureWindow::OnClose() - { - OnCloseFile(); - } - - void DrillerCaptureWindow::OnCloseFile() - { - SaveWindowState(); - - if (IsInCaptureMode(CaptureMode::Inspecting)) - { - AZ_TracePrintf(drillerDebugName, "Close requested of file\n"); - m_data->CloseCaptureData(); - this->close(); - deleteLater(); - } - } - - void DrillerCaptureWindow::OnContractAllChannels() - { - for (auto iter = m_channels.begin(); iter != m_channels.end(); ++iter) - { - (*iter)->OnContractedToggled(true); - } - } - - void DrillerCaptureWindow::OnExpandAllChannels() - { - for (auto iter = m_channels.begin(); iter != m_channels.end(); ++iter) - { - (*iter)->OnContractedToggled(false); - } - } - - void DrillerCaptureWindow::OnDisableAllChannels() - { - for (ChannelControl* channelControl : m_channels) - { - channelControl->SetAllProfilersEnabled(false); - } - } - void DrillerCaptureWindow::OnEnableAllChannels() - { - for (ChannelControl* channelControl : m_channels) - { - channelControl->SetAllProfilersEnabled(true); - } - } - - void DrillerCaptureWindow::OnToBegin() - { - ScrubberToBegin(); - m_gui->controlScrollBar->setValue(m_frameRangeBegin); - } - - void DrillerCaptureWindow::OnToEnd() - { - // set the scroll view to scroll to the end: - ScrubberToEnd(); - } - - void DrillerCaptureWindow::OnPlayToggled(bool toggleState) - { - if (toggleState) - { - m_gui->playButton->setText(tr("Stop")); - m_gui->playButton->setToolTip(tr("Stop recorded session playback")); - m_playbackIsActive = true; - OnCaptureToggled(false); - int msec = 1000 / m_gui->fpsBox->value(); - QTimer::singleShot(msec, this, SLOT(PlaybackTick())); - } - else - { - m_gui->playButton->setText(tr("Play")); - m_gui->playButton->setToolTip(tr("Playback recorded session")); - m_gui->playButton->blockSignals(true); - m_gui->playButton->setChecked(false); - m_gui->playButton->blockSignals(false); - m_playbackIsActive = false; - } - } - - void DrillerCaptureWindow::PlaybackTick() - { - if (m_playbackIsActive) - { - if (m_scrubberCurrentFrame >= m_playbackLoopEnd) - { - SetScrubberFrame(m_playbackLoopBegin); - } - else if (m_scrubberCurrentFrame < m_playbackLoopBegin) - { - SetScrubberFrame(m_playbackLoopBegin); - } - else - { - SetScrubberFrame(m_scrubberCurrentFrame + 1); - } - - FocusScrollbar(m_scrubberCurrentFrame - (m_visibleFrames / 2)); - - int msec = 1000 / m_gui->fpsBox->value(); - QTimer::singleShot(msec, this, SLOT(PlaybackTick())); - } - } - - void DrillerCaptureWindow::OnSliderPressed() - { - if (m_playbackIsActive) - { - OnPlayToggled(false); - } - } - - void DrillerCaptureWindow::OnNewSliderValue(int newValue) - { - if (!m_manipulatingScrollBar && m_playbackIsActive) - { - OnPlayToggled(false); - } - - for (auto iter = m_channels.begin(); iter != m_channels.end(); ++iter) - { - (*iter)->SetSliderOffset(newValue); - } - - m_ptrAnnotationsHeaderView->SetSliderOffset(newValue); - } - - void DrillerCaptureWindow::OnFrameScrubberboxChanged(int newValue) - { - SetScrubberFrame(newValue); - } - - void DrillerCaptureWindow::OnQuantMenuFinal(int range) - { - FrameNumberType frameRange = static_cast(range); - - if (frameRange <= 1) - { - frameRange = m_frameRangeEnd - m_frameRangeBegin + 1; - } - m_visibleFrames = frameRange; - - m_gui->quantityButton->setText(QString("%1 frames").arg(frameRange)); - - for (auto iter = m_channels.begin(); iter != m_channels.end(); ++iter) - { - (*iter)->SetDataPointsInView(frameRange); - } - m_ptrAnnotationsHeaderView->SetDataPointsInView(frameRange); - } - - void DrillerCaptureWindow::FocusScrollbar(FrameNumberType focusFrame) - { - m_manipulatingScrollBar = true; - - // range of motion for the scrollbar covers the off-window area, not the total - FrameNumberType range = m_frameRangeEnd - m_visibleFrames + 1; - range = range >= m_frameRangeBegin ? range : m_frameRangeBegin; - - m_gui->controlScrollBar->setRange(m_frameRangeBegin, range); - - FrameNumberType curVal = focusFrame < 0 ? 0 : focusFrame; - curVal = focusFrame > range ? range : focusFrame; - m_gui->controlScrollBar->setValue(curVal); - - m_manipulatingScrollBar = false; - } - - ////////////////////////////////////////////////////////////////////////// - // State Control and Maintenance - void DrillerCaptureWindow::ScrubberToBegin() - { - SetScrubberFrame(GetFrameRangeBegin()); - } - - void DrillerCaptureWindow::ScrubberToEnd() - { - SetScrubberFrame(GetFrameRangeEnd()); - } - - void DrillerCaptureWindow::HandleScrollToFrameRequest(FrameNumberType frame) - { - FocusScrollbar(frame); - } - - void DrillerCaptureWindow::OnChannelControlMouseDown(Qt::MouseButton whichButton, FrameNumberType frame, FrameNumberType range, int modifiers) - { - // If we aren't inspecting data, we don't to mess around with anything. - if (!IsInCaptureMode(CaptureMode::Inspecting)) - { - return; - } - - if (modifiers & Qt::AltModifier) - { - if (whichButton == Qt::LeftButton) - { - SetPlaybackLoopBegin(frame); - } - if (whichButton == Qt::RightButton) - { - SetPlaybackLoopEnd(frame); - } - return; - } - - // Don't want to fight the user for control, relinquish our manipulation once they start doing stuff. - if (m_playbackIsActive) - { - OnPlayToggled(false); - } - - // we grab with the left button, pan with the right. - if (whichButton == Qt::LeftButton) - { - m_draggingAnything = true; - - if (abs(frame - m_playbackLoopBegin) <= range) - { - m_draggingPlaybackLoopBegin = true; - m_draggingPlaybackLoopEnd = false; - } - else if (abs(frame - m_playbackLoopEnd) <= range) - { - m_draggingPlaybackLoopBegin = false; - m_draggingPlaybackLoopEnd = true; - } - else - { - m_draggingPlaybackLoopBegin = false; - m_draggingPlaybackLoopEnd = false; - - SetScrubberFrame(frame); - } - } - } - - void DrillerCaptureWindow::OnChannelControlMouseMove(FrameNumberType frame, FrameNumberType range, int modifiers) - { - (void)range; - (void)modifiers; - - //ShowDrillerChannelTip(frame); - - if (m_draggingAnything) - { - if (m_draggingPlaybackLoopBegin) - { - SetPlaybackLoopBegin(frame); - } - else if (m_draggingPlaybackLoopEnd) - { - SetPlaybackLoopEnd(frame); - } - else - { - SetScrubberFrame(frame); - } - } - } - - void DrillerCaptureWindow::OnChannelControlMouseUp(Qt::MouseButton whichButton, FrameNumberType frame, FrameNumberType range, int modifiers) - { - (void)range; - (void)modifiers; - (void)frame; - - if (whichButton == Qt::LeftButton) - { - m_draggingAnything = false; - } - } - - void DrillerCaptureWindow::OnChannelControlMouseWheel(FrameNumberType frame, int wheelAmount, FrameNumberType range, int modifiers) - { - (void)range; - (void)modifiers; - - FrameNumberType currentVisibleFrames = m_visibleFrames; - bool zoomingIn = wheelAmount > 0; - if (zoomingIn) - { - // zooming in: - // find the next step DOWN from where we are and set our quant zoom to that - // since its from zoomed all the way in to out. The last element is assumed the special one. - - if (currentVisibleFrames == s_availableFrameQuantities[0]) - { - return; - } - - // before we zoom in, where is the given frame within our scroll area? - int leftSideOfScreen = m_gui->controlScrollBar->value(); - float fraction = (float)(frame - leftSideOfScreen) / (float)m_visibleFrames; - - int numQuantsAvailable = sizeof(s_availableFrameQuantities) / sizeof(int); - int quantChosen = -1; - for (int quantIndex = numQuantsAvailable - 2; quantIndex >= 0; --quantIndex) - { - if (currentVisibleFrames > s_availableFrameQuantities[quantIndex]) - { - quantChosen = s_availableFrameQuantities[quantIndex]; - break; - } - } - - if (quantChosen != -1) - { - OnQuantMenuFinal(quantChosen); - - // we want to focus the scrollbar at the same fraction as before - FocusScrollbar(frame - (int)((float)m_visibleFrames * fraction)); - } - } - else - { - // zooming out: - // find the next step DOWN from where we are and set our quant zoom to that - // since its from zoomed all the way in to out. The last element is assumed the special one. - - FrameNumberType fullRange = m_frameRangeEnd - m_frameRangeBegin + 1; - - if (currentVisibleFrames == fullRange) - { - return; - } - - int leftSideOfScreen = m_gui->controlScrollBar->value(); - float fraction = (float)(frame - leftSideOfScreen) / (float)m_visibleFrames; - - int numQuantsAvailable = sizeof(s_availableFrameQuantities) / sizeof(int); - - int quantChosen = -1; - for (int quantIndex = 0; quantIndex < numQuantsAvailable - 1; ++quantIndex) - { - if (currentVisibleFrames < s_availableFrameQuantities[quantIndex]) - { - quantChosen = s_availableFrameQuantities[quantIndex]; - break; - } - } - - if (quantChosen != -1) - { - OnQuantMenuFinal(quantChosen); - FocusScrollbar(frame - (int)((float)m_visibleFrames * fraction)); - } - } - } - - void DrillerCaptureWindow::SetScrubberFrame(FrameNumberType frame) - { - if ((!m_bForceNextScrub) && (frame == m_scrubberCurrentFrame)) - { - return; - } - - m_bForceNextScrub = false; - - m_scrubberCurrentFrame = frame >= m_frameRangeBegin ? frame : m_frameRangeBegin; - m_scrubberCurrentFrame = m_scrubberCurrentFrame <= m_frameRangeEnd ? m_scrubberCurrentFrame : m_frameRangeEnd; - - UpdateFrameScrubberbox(); - - ScrubberFrame(m_scrubberCurrentFrame); - - EBUS_EVENT_ID(m_identity, Driller::DrillerMainWindowMessages::Bus, FrameChanged, m_scrubberCurrentFrame); - m_AnnotationProvider.Finalize(); - } - - void DrillerCaptureWindow::SetPlaybackLoopBegin(FrameNumberType frame) - { - m_playbackLoopBegin = frame >= m_frameRangeBegin ? frame : m_frameRangeBegin; - m_playbackLoopBegin = m_playbackLoopBegin <= m_frameRangeEnd ? m_playbackLoopBegin : m_frameRangeEnd; - - m_playbackLoopEnd = m_playbackLoopEnd >= m_playbackLoopBegin ? m_playbackLoopEnd : m_playbackLoopBegin; - m_playbackLoopEnd = m_playbackLoopEnd <= m_frameRangeEnd ? m_playbackLoopEnd : m_frameRangeEnd; - - EBUS_EVENT_ID(m_identity, Driller::DrillerMainWindowMessages::Bus, PlaybackLoopBeginChanged, m_playbackLoopBegin); - - UpdatePlaybackLoopPoints(); - } - - void DrillerCaptureWindow::SetPlaybackLoopEnd(FrameNumberType frame) - { - m_playbackLoopEnd = frame >= m_frameRangeBegin ? frame : m_frameRangeBegin; - m_playbackLoopEnd = m_playbackLoopEnd <= m_frameRangeEnd ? m_playbackLoopEnd : m_frameRangeEnd; - - m_playbackLoopBegin = m_playbackLoopBegin >= m_playbackLoopEnd ? m_playbackLoopEnd : m_playbackLoopBegin; - m_playbackLoopBegin = m_playbackLoopBegin >= m_frameRangeBegin ? m_playbackLoopBegin : m_frameRangeBegin; - - EBUS_EVENT_ID(m_identity, Driller::DrillerMainWindowMessages::Bus, PlaybackLoopEndChanged, m_playbackLoopEnd); - - UpdatePlaybackLoopPoints(); - } - - void DrillerCaptureWindow::UpdatePlaybackLoopPoints() - { - for (auto iter = m_channels.begin(); iter != m_channels.end(); ++iter) - { - (*iter)->SetLoopBegin(m_playbackLoopBegin); - (*iter)->SetLoopEnd(m_playbackLoopEnd); - } - } - - void DrillerCaptureWindow::SetFrameRangeBegin(FrameNumberType frame) - { - m_frameRangeBegin = frame; - - SetPlaybackLoopBegin(m_playbackLoopBegin); - SetPlaybackLoopEnd(m_playbackLoopEnd); - SetScrubberFrame(m_scrubberCurrentFrame); - UpdateFrameScrubberbox(); - UpdateScrollbar(); - } - - void DrillerCaptureWindow::SetFrameRangeEnd(FrameNumberType frame) - { - // if the scrubber/loop is on the last frame we always advance it to the new end - bool setScrubberToo = m_scrubberCurrentFrame == m_frameRangeEnd; - bool setEndloopToo = m_playbackLoopEnd == m_frameRangeEnd; - - FrameNumberType range = m_frameRangeEnd - m_visibleFrames + 1; - range = range >= m_frameRangeBegin ? range : m_frameRangeBegin; - - FrameNumberType priorFrameRangeEnd = m_frameRangeEnd; - - int diff = static_cast(frame - m_frameRangeEnd); - m_frameRangeEnd = frame; - - if (priorFrameRangeEnd < m_frameRangeEnd) - { - for (ChannelControl* channelControl : m_channels) - { - for (ChannelProfilerWidget* channelProfiler : channelControl->GetProfilers()) - { - Aggregator* aggregator = channelProfiler->GetAggregator(); - if (aggregator != nullptr) - { - aggregator->EmitAnnotationChannelsForFrameRange(priorFrameRangeEnd, m_frameRangeEnd, &m_AnnotationProvider); - aggregator->EmitAllAnnotationsForFrameRange(priorFrameRangeEnd, m_frameRangeEnd, &m_AnnotationProvider); - } - } - } - } - - if (!m_isLoadingFile) - { - SetScrubberFrame(setScrubberToo ? m_frameRangeEnd : m_scrubberCurrentFrame); - - SetPlaybackLoopBegin(m_playbackLoopBegin); - SetPlaybackLoopEnd(setEndloopToo ? m_frameRangeEnd : m_playbackLoopEnd); - UpdateFrameScrubberbox(); - UpdateScrollbar(diff); - } - } - - void DrillerCaptureWindow::UpdateFrameScrubberbox() - { - m_gui->frameScrubberBox->setRange(m_frameRangeBegin, m_frameRangeEnd); - m_gui->frameScrubberBox->setValue(m_scrubberCurrentFrame); - } - - void DrillerCaptureWindow::UpdateScrollbar(int diff) - { - int curVal = m_gui->controlScrollBar->value(); - - // range of motion for the scrollbar covers the off-window area, not the total - FrameNumberType range = m_frameRangeEnd - m_visibleFrames + 1; - range = range >= m_frameRangeBegin ? range : m_frameRangeBegin; - - m_gui->controlScrollBar->setRange(m_frameRangeBegin, range); - if (m_gui->controlScrollBar->value() >= range - 1) - { - m_gui->controlScrollBar->setValue(static_cast(range)); - } - else if (diff) - { - m_gui->controlScrollBar->setValue(static_cast(curVal)); - } - } - - ////////////////////////////////////////////////////////////////////////// - // when the Editor Main window is requested to close, it is not destroyed. - ////////////////////////////////////////////////////////////////////////// - // Qt Events - void DrillerCaptureWindow::closeEvent(QCloseEvent* event) - { - OnCloseFile(); - event->ignore(); - } - - void DrillerCaptureWindow::showEvent(QShowEvent* /*event*/) - { - emit ShowYourself(); - } - void DrillerCaptureWindow::hideEvent(QHideEvent* /*event*/) - { - emit HideYourself(); - } - - bool DrillerCaptureWindow::OnGetPermissionToShutDown() - { - OnCaptureToggled(false); - - bool willShutDown = true; - - ClearChannelDisplay(true); - - AZ_TracePrintf(drillerDebugName, " willShutDown == %d\n", (int)willShutDown); - return willShutDown; - } - - void DrillerCaptureWindow::ScrubToFrameRequest(FrameNumberType frame) - { - if (m_playbackIsActive) - { - OnPlayToggled(false); - } - - SetScrubberFrame(frame); - } - - void DrillerCaptureWindow::SaveWindowState() - { - m_inactiveChannels.clear(); - - for (auto iter = m_channels.begin(); iter != m_channels.end(); ++iter) - { - const AZStd::list< ChannelProfilerWidget*>& profilers = (*iter)->GetProfilers(); - - for (ChannelProfilerWidget* profiler : profilers) - { - if (!profiler->IsActive()) - { - m_inactiveChannels.insert(profiler->GetID()); - } - } - } - - // build state and store it. - auto newState = AZ::UserSettings::CreateFind(m_windowStateCRC, AZ::UserSettings::CT_GLOBAL); - //newState->Init(saveState(), saveGeometry()); - newState->m_ChannelIDs.clear(); - for (AZStd::set::iterator iter = m_inactiveChannels.begin(); iter != m_inactiveChannels.end(); ++iter) - { - newState->m_ChannelIDs.push_back(*iter); - } - - newState->m_fpsValue = m_gui->fpsBox->value(); - - newState->m_scrubberCurrentFrame = m_scrubberCurrentFrame; - newState->m_playbackLoopBegin = m_playbackLoopBegin; - newState->m_playbackLoopEnd = m_playbackLoopEnd; - newState->m_scrubberCurrentEvent = m_scrubberCurrentEvent; - } - - void DrillerCaptureWindow::RestoreWindowState() // call this after you have rebuilt everything. - { - // load the state from our state block: - auto savedState = AZ::UserSettings::Find(m_windowStateCRC, AZ::UserSettings::CT_GLOBAL); - if (savedState) - { - QByteArray geomData((const char*)savedState->m_windowGeometry.data(), (int)savedState->m_windowGeometry.size()); - QByteArray stateData((const char*)savedState->GetWindowState().data(), (int)savedState->GetWindowState().size()); - - restoreGeometry(geomData); - if (this->isMaximized()) - { - this->showNormal(); - this->showMaximized(); - } - //restoreState(stateData); - - m_inactiveChannels.clear(); - for (auto iter = savedState->m_ChannelIDs.begin(); iter != savedState->m_ChannelIDs.end(); ++iter) - { - m_inactiveChannels.insert(*iter); - } - - m_gui->fpsBox->setValue(savedState->m_fpsValue); - - SetScrubberFrame(savedState->m_scrubberCurrentFrame); - SetPlaybackLoopBegin(savedState->m_playbackLoopBegin); - SetPlaybackLoopEnd(savedState->m_playbackLoopEnd); - SetScrubberEvent(savedState->m_scrubberCurrentEvent); - } - else - { - // default state! - } - } - - void DrillerCaptureWindow::OnOpenDrillerFile() - { - auto paths = QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation); - QString capturePath; - if (paths.isEmpty()) - { - paths = QStandardPaths::standardLocations(QStandardPaths::TempLocation); - } - if (!paths.isEmpty()) - { - capturePath = paths.first(); - } - - QString fileName = QFileDialog::getOpenFileName(this, "Open Driller File", capturePath, "Driller Files (*.drl)"); - if (!fileName.isNull()) - { - OnOpenDrillerFile(fileName); - } - } - - void DrillerCaptureWindow::OnOpenDrillerFile(QString fileName) - { - if (m_data) - { - QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); - m_AnnotationProvider.Clear(); - - SetCaptureDirty(false); - m_currentDataFilename = fileName; - - m_isLoadingFile = true; - m_data->LoadCaptureData(fileName.toUtf8().data()); - m_isLoadingFile = false; - - SetCaptureMode(CaptureMode::Inspecting); - - m_bForceNextScrub = true; - EndFrame(m_frameRangeEnd); - SetPlaybackLoopBegin(0); - SetPlaybackLoopEnd(m_frameRangeEnd); - - OnQuantMenuFinal(m_visibleFrames); - - UpdateLiveControls(); - m_bForceNextScrub = true; - - ScrubberToEnd(); - QApplication::restoreOverrideCursor(); - } - } - - void DrillerCaptureWindow::OnOpenDrillerFileForWorkspace(QString fileName, QString workspaceFileName) - { - if (m_data) - { - QString successFileName; - - // does a file local to our given Workspace DRW exist? It gets preference on load. - QString localFileName(workspaceFileName.left(workspaceFileName.size() - 3) + "drl"); - if (AZ::IO::SystemFile::Exists(localFileName.toUtf8().data())) - { - successFileName = localFileName; - } - // does the workspace's suggested file exist? - else if (AZ::IO::SystemFile::Exists(fileName.toUtf8().data())) - { - successFileName = fileName; - } - // fall through to prompting the user for a DRL to use - else - { - QString userFileName = QFileDialog::getOpenFileName(this, "Find Driller File", localFileName, "Driller Files (*.drl)"); - if (!userFileName.isNull()) - { - successFileName = userFileName; - } - } - - if (!successFileName.isEmpty() && !successFileName.isNull()) - { - SetCaptureDirty(false); - m_currentDataFilename = successFileName; - - m_isLoadingFile = true; - m_data->LoadCaptureData(m_currentDataFilename.toUtf8().data()); - m_isLoadingFile = false; - - SetCaptureMode(CaptureMode::Inspecting); - - m_bForceNextScrub = true; - EndFrame(m_frameRangeEnd); - - OnQuantMenuFinal(m_visibleFrames); - m_bForceNextScrub = true; - ScrubberToEnd(); - UpdateLiveControls(); - } - } - } - - void DrillerCaptureWindow::RepopulateAnnotations() - { - // re-query all the annotations now that you have your settings. - m_AnnotationProvider.Clear(); - - if (m_frameRangeEnd != 0) - { - for (ChannelControl* channelControl : m_channels) - { - for (ChannelProfilerWidget* profiler : channelControl->GetProfilers()) - { - Aggregator* aggregator = profiler->GetAggregator(); - - if (aggregator != nullptr) - { - aggregator->EmitAnnotationChannelsForFrameRange(0, m_frameRangeEnd, &m_AnnotationProvider); - aggregator->EmitAllAnnotationsForFrameRange(0, m_frameRangeEnd, &m_AnnotationProvider); - } - } - } - } - m_AnnotationProvider.Finalize(); - } - - void DrillerCaptureWindow::OnOpenWorkspaceFile(QString workspaceFileName, bool openDrillerFileAlso) - { - OnCaptureToggled(false); - - if (m_data) - { - m_AnnotationProvider.Clear(); - // 1: spawn a new local settings object using the DRW - if (!AZ::IO::SystemFile::Exists(workspaceFileName.toUtf8().data())) - { - QMessageBox::warning(this, tr("File not found"), tr("Unable to find the specified file '%1'").arg(workspaceFileName), QMessageBox::Ok, QMessageBox::Ok); - return; - } - - WorkspaceSettingsProvider* provider = WorkspaceSettingsProvider::CreateFromFile(workspaceFileName.toUtf8().data()); - if (!provider) - { - QMessageBox::warning(this, tr("Corrupted file?"), tr("Unable to parse the specified file '%1'").arg(workspaceFileName), QMessageBox::Ok, QMessageBox::Ok); - return; - } - - // 2: extract therefrom the associated DRL file - AZStd::string windowStateStr = AZStd::string::format("DRILLER CAPTURE WINDOW WORKSPACE"); - AZ::u32 workspaceCRC = AZ::Crc32(windowStateStr.c_str()); - - DrillerCaptureWindowWorkspace* workspace = provider->FindSetting(workspaceCRC); - if (!workspace) - { - QMessageBox::warning(this, tr("Corrupted file?"), tr("Specified file '%1' does not appear to contain a workspace.").arg(workspaceFileName), QMessageBox::Ok, QMessageBox::Ok); - return; - } - - m_inactiveChannels.clear(); - for (auto iter = workspace->m_ChannelIDs.begin(); iter != workspace->m_ChannelIDs.end(); ++iter) - { - m_inactiveChannels.insert(*iter); - } - - // 3: load that data, which in turn clears and re-instantiates all needed aggregators - // other side effects include changing the current filename and replacing any current data loaded - if (openDrillerFileAlso) - { - m_isLoadingFile = true; - OnOpenDrillerFileForWorkspace(QString(workspace->m_matchingDataFileName.c_str()), workspaceFileName); - m_isLoadingFile = false; - } - - SetCaptureMode(CaptureMode::Inspecting); - - // 4: extract from the DRW any settings that I have saved there - // 5: synchronous EBUS message that informs all the aggregators that new settings are available - EBUS_EVENT_ID(m_identity, Driller::DrillerWorkspaceWindowMessages::Bus, ApplySettingsFromWorkspace, provider); - m_AnnotationProvider.LoadSettingsFromWorkspace(provider); - - // 6: aggregators are responsible for checking if any of their data dialogs are required, and open them - - EBUS_EVENT_ID(m_identity, Driller::DrillerWorkspaceWindowMessages::Bus, ActivateWorkspaceSettings, provider); - - // 7: main window itself should load its settings, which will include the current scrubber frame - m_scrubberCurrentFrame = 0; - m_scrubberCurrentEvent = 0; - m_playbackLoopBegin = 0; - m_playbackLoopEnd = 0; - - SetFrameRangeBegin(workspace->m_frameRangeBegin); - SetFrameRangeEnd(workspace->m_frameRangeEnd); - m_bForceNextScrub = true; - SetScrubberFrame(workspace->m_scrubberCurrentFrame); - SetPlaybackLoopBegin(workspace->m_playbackLoopBegin); - SetPlaybackLoopEnd(workspace->m_playbackLoopEnd); - OnQuantMenuFinal(workspace->m_visibleFrames); - m_gui->controlScrollBar->setSliderPosition(workspace->m_sliderPosition); - - SetScrubberEvent(workspace->m_scrubberCurrentEvent); - - // 8: close the local settings DRW - delete provider; - - RepopulateAnnotations(); - } - } - - void DrillerCaptureWindow::OnApplyWorkspaceFile(QString fileName) - { - if (!fileName.isNull()) - { - if (m_data) - { - OnOpenWorkspaceFile(fileName, false); - } - } - } - - void DrillerCaptureWindow::OnSaveWorkspaceFile(QString fileName, bool automated) - { - if (!fileName.isNull()) - { - if (m_data) - { - // 1: spawn a new local settings object using the DRW - WorkspaceSettingsProvider provider; - - // 2: push my own settings into the DRW - // plus logic to copy/rename tmp DRL files - AZStd::string windowStateStr = AZStd::string::format("DRILLER CAPTURE WINDOW WORKSPACE"); - AZ::u32 workspaceCRC = AZ::Crc32(windowStateStr.c_str()); - - DrillerCaptureWindowWorkspace* workspace = provider.CreateSetting(workspaceCRC); - if (!automated) - { - m_currentDataFilename = PrepDataFileForSaving(m_currentDataFilename, fileName); - } - workspace->m_matchingDataFileName = m_currentDataFilename.toUtf8().data(); - - m_inactiveChannels.clear(); - for (ChannelControl* channelControl : m_channels) - { - for (ChannelProfilerWidget* profilerWidget : channelControl->GetProfilers()) - { - if (!profilerWidget->IsActive()) - { - m_inactiveChannels.insert(profilerWidget->GetID()); - } - } - } - - workspace->m_ChannelIDs.clear(); - for (AZStd::set::iterator iter = m_inactiveChannels.begin(); iter != m_inactiveChannels.end(); ++iter) - { - workspace->m_ChannelIDs.push_back(*iter); - } - workspace->m_scrubberCurrentFrame = m_scrubberCurrentFrame; - workspace->m_frameRangeBegin = m_frameRangeBegin; - workspace->m_frameRangeEnd = m_frameRangeEnd; - workspace->m_visibleFrames = m_visibleFrames; - workspace->m_scrubberCurrentEvent = m_scrubberCurrentEvent; - - workspace->m_playbackLoopBegin = m_playbackLoopBegin; - workspace->m_playbackLoopEnd = m_playbackLoopEnd; - workspace->m_sliderPosition = m_gui->controlScrollBar->sliderPosition(); - - // 3: synchronous EBUS message that informs all the aggregators to push their own settings into the DRW - // 4: aggregators are responsible for dealing with their display view dialogs internally - EBUS_EVENT_ID(m_identity, Driller::DrillerWorkspaceWindowMessages::Bus, SaveSettingsToWorkspace, &provider); - m_AnnotationProvider.SaveSettingsToWorkspace(&provider); - - if (!provider.WriteToFile(fileName.toUtf8().data())) - { - SetCaptureDirty(true); - QMessageBox::warning(this, tr("Could not save workspace"), tr("Unable to write data to the specified file '%1'").arg(fileName), QMessageBox::Ok, QMessageBox::Ok); - } - else - { - SetCaptureDirty(false); - } - UpdateLiveControls(); - } - } - } - - void DrillerCaptureWindow::OnSaveDrillerFile() - { - if (m_frameRangeEnd <= 0) - { - if (m_identity == 0) - { - ResetCaptureControls(); - } - return; - } - - QString saveCapturePath; - QString tempWorkspaceName; - - auto newState = AZ::UserSettings::CreateFind(m_windowStateCRC, AZ::UserSettings::CT_GLOBAL); - if (!newState->m_priorSaveFolder.empty()) - { - saveCapturePath = newState->m_priorSaveFolder.data(); - } - else - { - auto paths = QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation); - - if (paths.isEmpty()) - { - paths = QStandardPaths::standardLocations(QStandardPaths::TempLocation); - } - - if (!paths.isEmpty()) - { - saveCapturePath = paths.first(); - } - } - - bool success = false; - - while (!success) - { - QString sourcename = m_tmpCaptureFilename; - - if (!m_currentDataFilename.isEmpty()) - { - sourcename = m_currentDataFilename; - } - - QString fileName = QFileDialog::getSaveFileName(this, "Save Driller File As...", saveCapturePath, "Driller Files (*.drl)"); - if (!fileName.isNull()) - { - SetCaptureDirty(false); - if (sourcename == fileName) - { - QMessageBox::warning(this, tr("Unable to save"), tr("You can't save a data file over itself ( '%1' to '%2' )").arg(sourcename).arg(fileName)); - } - else - { - (void)QFile::remove(fileName); - success = QFile::copy(sourcename, fileName); - if (success) - { - m_currentDataFilename = fileName; - - { - QTemporaryFile f; - f.setAutoRemove(false); - if (f.open()) - { - tempWorkspaceName = f.fileName(); - } - } - if (!tempWorkspaceName.isEmpty()) - { - OnSaveWorkspaceFile(tempWorkspaceName, true); - } - - ResetCaptureControls(); - - EBUS_EVENT(Driller::DrillerDataViewMessages::Bus, EventRequestOpenWorkspace, tempWorkspaceName.toUtf8().data()); - auto deleteResult = QFile::remove(tempWorkspaceName); - if (!deleteResult) - { - QMessageBox::warning(this, tr("Can't delete temp file"), tr("File = ( %1 )").arg(tempWorkspaceName)); - } - - return; - } - else - { - QMessageBox::warning(this, tr("Unable to save"), tr("Could not copy '%1' to '%2'").arg(sourcename).arg(fileName)); - } - } - } - - if (fileName.isNull() || m_identity == 0) // close this window if no file named OR this is a LIVE channel - { - ResetCaptureControls(); - return; - } - } - } - - QString DrillerCaptureWindow::PrepDataFileForSaving(QString filename, QString workspaceName) - { - // is this a TMP file? - QString tempPath = QStandardPaths::writableLocation(QStandardPaths::TempLocation); - if (filename.contains(tempPath, Qt::CaseInsensitive)) - { - // yes := rename to match workspace - QString newFilename(workspaceName.left(workspaceName.size() - 3) + "drl"); - // and then copy - QFile::copy(filename, newFilename); - m_currentDataFilename = newFilename; - UpdateLiveControls(); - return newFilename; - } - - return filename; - } - - QString DrillerCaptureWindow::PrepTempFile(QString filename) - { - QString tmpCapturePath = QStandardPaths::writableLocation(QStandardPaths::TempLocation); - tmpCapturePath = QDir(tmpCapturePath).absoluteFilePath(filename); - m_tmpCaptureFilename = tmpCapturePath; - m_currentDataFilename = m_tmpCaptureFilename; - return tmpCapturePath; - } - - void DrillerCaptureWindow::OnAnnotationOptionsClick() - { - // show the annotations configure window: - if (m_ptrConfigureAnnotationsWindow) - { - m_ptrConfigureAnnotationsWindow->raise(); - } - else - { - m_ptrConfigureAnnotationsWindow = aznew ConfigureAnnotationsWindow(this); - m_ptrConfigureAnnotationsWindow->Initialize(&m_AnnotationProvider); - connect(m_ptrConfigureAnnotationsWindow, SIGNAL(destroyed(QObject*)), this, SLOT(OnAnnotationsDialogDestroyed())); - m_ptrConfigureAnnotationsWindow->show(); - } - } - - void DrillerCaptureWindow::OnSelectedAnnotationChannelsChanged() - { - // rebuild the annotations. - RepopulateAnnotations(); - // update the views. - } - - - void DrillerCaptureWindow::OnAnnotationsDialogDestroyed() - { - m_ptrConfigureAnnotationsWindow = NULL; - } - - void DrillerCaptureWindow::InformOfMouseOverAnnotation(const Annotation& annotation) - { - if (m_collectedAnnotations.empty()) - { - QTimer::singleShot(0, this, SLOT(CommitAnnotationsCollected())); - } - m_collectedAnnotations.push_back(annotation); - } - - void DrillerCaptureWindow::CommitAnnotationsCollected() - { - FrameNumberType frameCounter = -1; - QString finalText; - AZ::u32 priorCRC = 0; - - AZStd::sort(m_collectedAnnotations.begin(), m_collectedAnnotations.end(), - [](const Annotation& first, const Annotation& second) - { - return first.GetEventIndex() < second.GetEventIndex(); - } - ); - - int numConcated = 0; - for (auto iter = m_collectedAnnotations.begin(); iter != m_collectedAnnotations.end(); ++iter) - { - if (numConcated > 10) - { - int numRemaining = (int)m_collectedAnnotations.size() - numConcated; - finalText += QString("... and %1 other annotations").arg(numRemaining); - break; - } - ++numConcated; - - const Annotation& annot = *iter; - if ((annot.GetFrameIndex() == frameCounter) && (priorCRC == annot.GetChannelCRC())) - { - finalText += QString("Event %1: '%2'
").arg(annot.GetEventIndex()).arg(annot.GetText().c_str()); - } - else if (annot.GetFrameIndex() == frameCounter) - { - finalText += QString("%2
Event %3: '%4'
").arg(annot.GetChannel().c_str()).arg(annot.GetEventIndex()).arg(annot.GetText().c_str()); - } - else - { - finalText += QString("Frame %1
%2
Event %3: '%4'
").arg(annot.GetFrameIndex()).arg(annot.GetChannel().c_str()).arg(annot.GetEventIndex()).arg(annot.GetText().c_str()); - } - - frameCounter = annot.GetFrameIndex(); - priorCRC = annot.GetChannelCRC(); - } - - QToolTip::showText(QCursor::pos(), finalText); - m_collectedAnnotations.clear(); - } - - void DrillerCaptureWindow::InformOfClickAnnotation(const Annotation& annotation) - { - (void)annotation; - } - - ////////////////////////////////////////////////////////////////////////// - // Target Manager Messages - void DrillerCaptureWindow::DesiredTargetConnected(bool connected) - { - m_TargetConnected = connected; - - if (IsInCaptureMode(CaptureMode::Inspecting)) - { - return; - } - - // - have an existing capture? - // - - ask to save it - if (IsInCaptureMode(CaptureMode::Capturing)) - { - OnSaveDrillerFile(); - } - - QString tmpCapturePath; - - if (connected) - { - SetScrubberFrame(0); - SetFrameRangeBegin(0); - SetFrameRangeEnd(0); - SetCaptureDirty(false); - - tmpCapturePath = PrepTempFile(baseTempFileName); - } - else - { - SetScrubberFrame(0); - SetFrameRangeBegin(0); - SetFrameRangeEnd(0); - SetCaptureDirty(false); - - m_gui->captureButton->setEnabled(false); - m_gui->captureButton->setText(tr("Capture")); - m_gui->captureButton->setToolTip(tr("Begin Capturing Driller Data")); - - tmpCapturePath.clear(); - } - - UpdateLiveControls(); - } - - void DrillerCaptureWindow::Reflect(AZ::ReflectContext* context) - { - // data container is the one place that knows about all the aggregators - // and indeed is responsible for creating them - DrillerDataContainer::Reflect(context); - DrillerCaptureWindowWorkspace::Reflect(context); - DrillerCaptureWindowSavedState::Reflect(context); - AnnotationsProvider::Reflect(context); - - AZ::BehaviorContext* behaviorContext = azrtti_cast(context); - if (behaviorContext) - { - behaviorContext->Class("DrillerCaptureWindow")-> - Method("ShowWindow", &DrillerCaptureWindow::OnOpen)-> - Method("HideWindow", &DrillerCaptureWindow::OnClose); - } - } -}//namespace Driller diff --git a/Code/Tools/Standalone/Source/Driller/DrillerCaptureWindow.hxx b/Code/Tools/Standalone/Source/Driller/DrillerCaptureWindow.hxx deleted file mode 100644 index 91374c6ff2..0000000000 --- a/Code/Tools/Standalone/Source/Driller/DrillerCaptureWindow.hxx +++ /dev/null @@ -1,269 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef DRILLER_DrillerCaptureWindow_H -#define DRILLER_DrillerCaptureWindow_H - -#if !defined(Q_MOC_RUN) -#include -#include -#include -#include -#include - -#include "DrillerNetworkMessages.h" -#include "DrillerMainWindowMessages.h" -#include "AzFramework/TargetManagement/TargetManagementAPI.h" -#include -#include "Workspaces/Workspace.h" -#include "Annotations/Annotations.hxx" - - -#pragma once - -class QMenu; -class QAction; -class QToolbar; -class QSettings; - -#include -#include -#include -#endif - -namespace Ui -{ - class DrillerCaptureWindow; -} - -namespace Driller -{ - class ChannelControl; - class DrillerDataContainer; - class CombinedEventsControl; - class AnnotationHeaderView; - class ConfigureAnnotationsWindow; - - /* - This is the original guts of the singular Driller Main Window - - Home of the real commands, channels created from external aggregators when connected, and the floating control panel. - All inputs end up here where they are interpreted and passed downwards to all channels, to maintain consistency. - */ - - ////////////////////////////////////////////////////////////////////////// - //Main Window - class DrillerCaptureWindow - : public QDockWidget - , public Driller::DrillerNetworkMessages::Bus::Handler - , public Driller::DrillerCaptureWindowRequestBus::Handler - , private AzFramework::TargetManagerClient::Bus::Handler - { - Q_OBJECT; - public: - AZ_TYPE_INFO(DrillerCaptureWindow, "08AF3402-FCFA-4441-910D-9F994BD0D146"); - AZ_CLASS_ALLOCATOR(DrillerCaptureWindow,AZ::SystemAllocator,0); - DrillerCaptureWindow(CaptureMode captureMode, int identity, QWidget* parent = NULL, Qt::WindowFlags flags = Qt::WindowFlags()); - DrillerCaptureWindow(const DrillerCaptureWindow&) - : m_identity(0) - { - // TODO: Once AZ_NO_COPY macros is in the branch in use it! - AZ_Assert(false, "You can't copy this class!"); - } - virtual ~DrillerCaptureWindow(void); - - bool OnGetPermissionToShutDown(); - - // DrillerCaptureWindowRequestBus - void ScrubToFrameRequest(FrameNumberType frameType) override; - - public: - - // Driller network messages - virtual void ConnectedToNetwork(); - virtual void NewAggregatorList( AggregatorList &theList ); - virtual void AddAggregator( Aggregator &theAggregator ); - virtual void DiscardAggregators(); - virtual void DisconnectedFromNetwork(); - virtual void EndFrame(FrameNumberType frame); - virtual void NewAggregatorsAvailable(); - - // Data Viewer request messages - // implement AzFramework::TargetManagerClient::Bus::Handler - void DesiredTargetConnected(bool connected); - - public: - // MainWindow Messages and states. - void SaveWindowState(); - AZStd::set m_inactiveChannels; - - void OnContractAllChannels(); - void OnExpandAllChannels(); - void OnDisableAllChannels(); - void OnEnableAllChannels(); - QString GetDataFileName() { return m_currentDataFilename; } - - private: - // how the main window identifies us - const int m_identity; - CaptureMode m_captureMode; - - // internal workings - typedef QList SortedChannels; - SortedChannels m_channels; - - void SetCaptureMode(CaptureMode captureMode); - void ResetCaptureControls(); - bool IsInLiveMode() const; - bool IsInCaptureMode(CaptureMode captureMode) const; - - void ClearExistingChannels(); - void ClearChannelDisplay( bool withDeletion ); - void SortChannels(); - void PopulateChannelDisplay(); - ChannelControl* FindChannelControl(Aggregator* aggregator); - void AddChannelDisplay(ChannelControl *); - - protected: - // Qt Events - virtual void closeEvent(QCloseEvent* event); - virtual void showEvent( QShowEvent * event ); - virtual void hideEvent( QHideEvent * event ); - virtual bool event(QEvent *evt); - - ////////////////////////////////////////////////////////////////////////// - void StateReset(); - QString PrepDataFileForSaving( QString filename, QString workspaceName ); - QString PrepTempFile( QString filename ); - - void ScrubberToBegin(); - void ScrubberToEnd(); - void SetScrubberFrame( FrameNumberType frame ); - FrameNumberType GetScrubberFrame() { return m_scrubberCurrentFrame; } - void SetPlaybackLoopBegin( FrameNumberType frame ); - FrameNumberType GetPlaybackLoopBegin() { return m_playbackLoopBegin; } - void SetPlaybackLoopEnd( FrameNumberType frame ); - FrameNumberType GetPlaybackLoopEnd() { return m_playbackLoopEnd; } - void SetFrameRangeBegin( FrameNumberType frame ); - FrameNumberType GetFrameRangeBegin() { return m_frameRangeBegin; } - void SetFrameRangeEnd( FrameNumberType frame); - FrameNumberType GetFrameRangeEnd() { return m_frameRangeEnd; } - - void UpdateFrameScrubberbox(); - void ScrubberFrame(FrameNumberType frame); - - void UpdateEventScrubberbox(); - void SetScrubberEvent( EventNumberType eventIdx ); - - void UpdateScrollbar( int diff = 0 ); - void FocusScrollbar( FrameNumberType focusFrame ); - void UpdatePlaybackLoopPoints(); - - void ConnectChannelControl(ChannelControl *dc); - - void SetCaptureDirty( bool isDirty ); - - void UpdateLiveControls(); - - AZ::u32 m_windowStateCRC; - - FrameNumberType m_scrubberCurrentFrame; - FrameNumberType m_frameRangeBegin; - FrameNumberType m_frameRangeEnd; - FrameNumberType m_visibleFrames; - EventNumberType m_scrubberCurrentEvent; - bool m_captureIsDirty; - - int m_playbackIsActive; - FrameNumberType m_playbackLoopBegin; - FrameNumberType m_playbackLoopEnd; - bool m_draggingPlaybackLoopBegin; - bool m_draggingPlaybackLoopEnd; - bool m_draggingAnything; - bool m_manipulatingScrollBar; - DrillerDataContainer* m_data; ///< Pointer to driller data class. - QString m_tmpCaptureFilename; - QString m_currentDataFilename; - AnnotationsProvider m_AnnotationProvider; - - bool m_isLoadingFile; - - AnnotationHeaderView* m_ptrAnnotationsHeaderView; - ConfigureAnnotationsWindow *m_ptrConfigureAnnotationsWindow; - AZStd::vector m_collectedAnnotations; - bool m_bForceNextScrub; - - int m_captureId; - - // are we viewing stored data or are we live drilling? - bool m_TargetConnected; - ////////////////////////////////////////////////////////////////////////// - - static const int s_availableFrameQuantities[]; - - public slots: - void RepopulateAnnotations(); - void RestoreWindowState(); - void OnMenuCloseCurrentWindow(); - void OnOpen(); - void OnClose(); - void OnCloseFile(); - void OnToBegin(); - void OnToEnd(); - void OnPlayToggled(bool toggleState); - void OnCaptureToggled(bool toggleState); - void OnSliderPressed(); - void OnNewSliderValue(int newValue); - void OnFrameScrubberboxChanged(int newValue); - void OnQuantMenuFinal( int range ); - void HandleScrollToFrameRequest( FrameNumberType frame); - void OnChannelControlMouseDown( Qt::MouseButton whichButton, FrameNumberType frame, FrameNumberType range, int modifiers ); - void OnChannelControlMouseMove( FrameNumberType frame, FrameNumberType range, int modifiers ); - void OnChannelControlMouseUp( Qt::MouseButton whichButton, FrameNumberType frame, FrameNumberType range, int modifiers ); - void OnChannelControlMouseWheel( FrameNumberType frame, int wheelAmount, FrameNumberType range, int modifiers ); - void OnOpenDrillerFile(); - void OnOpenDrillerFile(QString fileName); - void OnOpenDrillerFileForWorkspace(QString fileName, QString workspaceFileName); - void OnOpenWorkspaceFile(QString fileName, bool openDrillerFileAlso); // just open it - void OnApplyWorkspaceFile(QString fileName); - void OnSaveDrillerFile(); - void OnSaveWorkspaceFile(QString fileName, bool automated = false); - - void PlaybackTick(); - void OnUpdateScrollSize(); - void EventRequestEventFocus(EventNumberType eventIdx); - - // --- annotations: - void OnSelectedAnnotationChannelsChanged(); - void OnAnnotationOptionsClick(); - void InformOfMouseOverAnnotation(const Annotation& annotation); - void InformOfClickAnnotation(const Annotation& annotation); - void OnAnnotationsDialogDestroyed(); - void CommitAnnotationsCollected(); - - void UpdateEndFrameInControls(); - - QString GetOpenFileName() const; - -signals: - void ScrubberFrameUpdate( FrameNumberType frame ); - void ShowYourself(); - void HideYourself(); - void OnCaptureModeChange(CaptureMode); - void CaptureWindowSetToLive(bool); - - public: - static void Reflect(AZ::ReflectContext* context); - - private: - - Ui::DrillerCaptureWindow* m_gui; - }; -} - -#endif //DRILLER_DrillerCaptureWindow_H diff --git a/Code/Tools/Standalone/Source/Driller/DrillerCaptureWindow.ui b/Code/Tools/Standalone/Source/Driller/DrillerCaptureWindow.ui deleted file mode 100644 index 5d53341e1c..0000000000 --- a/Code/Tools/Standalone/Source/Driller/DrillerCaptureWindow.ui +++ /dev/null @@ -1,610 +0,0 @@ - - - DrillerCaptureWindow - - - - 0 - 0 - 1046 - 497 - - - - - 0 - 0 - - - - - 677 - 177 - - - - - :/general/hex_profiler_icon:/general/hex_profiler_icon - - - true - - - - - - QDockWidget::NoDockWidgetFeatures - - - Qt::BottomDockWidgetArea|Qt::TopDockWidgetArea - - - Driller - - - - false - - - - - - - 0 - - - 2 - - - 2 - - - 2 - - - 2 - - - - - 2 - - - 2 - - - 2 - - - 2 - - - - - QFrame::NoFrame - - - QFrame::Plain - - - - 0 - - - 2 - - - 2 - - - 2 - - - - - - 0 - 0 - - - - - 128 - 0 - - - - Select the target Application to be profiled. - - - Target: None - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - - 60 - 16777215 - - - - Begin capturing Application data - - - Capture - - - C - - - true - - - - - - - - - - QFrame::NoFrame - - - QFrame::Plain - - - 0 - - - - 2 - - - 6 - - - 2 - - - 2 - - - 2 - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - Playback Speed - - - true - - - - - - - - 0 - 0 - - - - - 50 - 0 - - - - Playback FPS - - - 1 - - - 60 - - - 60 - - - - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - - 80 - 26 - - - - - - - Play - - - Space - - - true - - - - - - - Qt::Horizontal - - - - 0 - 30 - - - - - - - - QFrame::NoFrame - - - QFrame::Plain - - - - 1 - - - 2 - - - 3 - - - 2 - - - 2 - - - - - Frame - - - - - - - - 0 - 0 - - - - - 100 - 0 - - - - Scrubbed Frame - - - 0 - - - 100000 - - - 0 - - - - - - - - - - - 0 - 0 - - - - - 100 - 0 - - - - The number of frames visible in the graphs - - - Show: 1000 - - - - 72 - 32 - - - - QToolButton::MenuButtonPopup - - - Qt::ToolButtonTextOnly - - - - - - - - - - - - - 0 - 0 - - - - Qt::ScrollBarAsNeeded - - - Qt::ScrollBarAsNeeded - - - QAbstractScrollArea::AdjustIgnored - - - true - - - Qt::AlignJustify|Qt::AlignTop - - - - - 0 - 0 - 1040 - 16 - - - - - 0 - 0 - - - - - 3 - - - QLayout::SetNoConstraint - - - 0 - - - 0 - - - 0 - - - 3 - - - - - - - - - - 0 - 0 - - - - QFrame::NoFrame - - - QFrame::Raised - - - 0 - - - - 0 - - - 0 - - - 2 - - - 0 - - - 14 - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 250 - 20 - - - - - - - - - 0 - 0 - - - - Qt::Horizontal - - - - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - true - - - - - - - Qt::Vertical - - - QSizePolicy::MinimumExpanding - - - - 0 - 0 - - - - - - - - - Capture - - - Start Capturing Data From the Active Drills - - - C - - - - - Freeze - - - Stop Capturing From the Drills and Freeze the Data - - - S - - - - - Close Current File - - - Ctrl+F4 - - - - - - Driller::CombinedEventsControl - QWidget -
CombinedEventsControl.hxx
- 1 -
- - AzToolsFramework::AZAutoSizingScrollArea - QScrollArea -
AzToolsFramework/UI/UICore/AZAutoSizingScrollArea.hxx
- 1 -
- - AzToolsFramework::TargetSelectorButton - QPushButton -
AzToolsFramework/UI/UICore/TargetSelectorButton.hxx
-
-
- - fpsBox - frameScrubberBox - - - - - -
diff --git a/Code/Tools/Standalone/Source/Driller/DrillerContext.cpp b/Code/Tools/Standalone/Source/Driller/DrillerContext.cpp deleted file mode 100644 index ab69fe714c..0000000000 --- a/Code/Tools/Standalone/Source/Driller/DrillerContext.cpp +++ /dev/null @@ -1,299 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "DrillerContext.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace Driller -{ - const char* DrillerDebugName = "Profiler"; - const char* DrillerInfoName = "Profiler"; - - class DrillerSavedState - : public AZ::UserSettings - { - public: - AZ_RTTI(DrillerSavedState, "{CBA064FC-B144-4B9D-92B8-F696B0A15E4D}", AZ::UserSettings); - AZ_CLASS_ALLOCATOR(DrillerSavedState, AZ::SystemAllocator, 0); - - bool m_MainDrillerWindowIsVisible; - bool m_MainDrillerWindowIsOpen; - - DrillerSavedState() - : m_MainDrillerWindowIsVisible(true) - , m_MainDrillerWindowIsOpen(true) {} - - static void Reflect(AZ::ReflectContext* context) - { - AZ::SerializeContext* serialize = azrtti_cast(context); - if (serialize) - { - serialize->Class() - ->Version(1) - ->Field("m_MainDrillerWindowIsVisible", &DrillerSavedState::m_MainDrillerWindowIsVisible) - ->Field("m_MainDrillerWindowIsOpen", &DrillerSavedState::m_MainDrillerWindowIsOpen); - } - } - }; - - AZ::Uuid ContextID("FB8B7094-63FF-4CD1-9857-3AEFA8E2CFDC"); - - - ////////////////////////////////////////////////////////////////////////// - //Context - Context::Context() - : m_pDrillerMainWindow(NULL) - { - } - - Context::~Context() - { - } - - ////////////////////////////////////////////////////////////////////////// - // AZ::Component - void Context::Init() - { - } - - void Context::Activate() - { - ContextInterface::Handler::BusConnect(ContextID); - LegacyFramework::CoreMessageBus::Handler::BusConnect(); - - AzToolsFramework::MainWindowDescription desc; - desc.name = "Profiler"; - desc.ContextID = ContextID; - desc.hotkeyDesc = AzToolsFramework::HotkeyDescription(AZ_CRC("DrillerOpen", 0x1cbbd497), "Ctrl+Shift+D", "Open Profiler", "General", 1, AzToolsFramework::HotkeyDescription::SCOPE_WINDOW); - EBUS_EVENT(AzToolsFramework::FrameworkMessages::Bus, AddComponentInfo, desc); - - bool connectedToAssetProcessor = false; - - // When the AssetProcessor is already launched it should take less than a second to perform a connection - // but when the AssetProcessor needs to be launch it could take up to 15 seconds to have the AssetProcessor initialize - // and able to negotiate a connection when running a debug build - // and to negotiate a connection - - AzFramework::AssetSystem::ConnectionSettings connectionSettings; - AzFramework::AssetSystem::ReadConnectionSettingsFromSettingsRegistry(connectionSettings); - connectionSettings.m_connectionDirection = AzFramework::AssetSystem::ConnectionSettings::ConnectionDirection::ConnectToAssetProcessor; - connectionSettings.m_connectionIdentifier = desc.name; - AzFramework::AssetSystemRequestBus::BroadcastResult(connectedToAssetProcessor, - &AzFramework::AssetSystemRequestBus::Events::EstablishAssetProcessorConnection, connectionSettings); - } - - void Context::Deactivate() - { - LegacyFramework::CoreMessageBus::Handler::BusDisconnect(); - ContextInterface::Handler::BusDisconnect(ContextID); - } - - void Context::Reflect(AZ::ReflectContext* context) - { - AZ::SerializeContext* serialize = azrtti_cast(context); - if (serialize) - { - DrillerMainWindow::Reflect(context); - DrillerSavedState::Reflect(context); - - serialize->Class() - ->Version(1) - ; - } - } - - void Context::ApplicationDeactivated() - { - } - - void Context::ApplicationActivated() - { - } - - void Context::ApplicationShow(AZ::Uuid id) - { - if (ContextID == id) - { - ProvisionalShowAndFocus(true); - } - } - void Context::ApplicationHide(AZ::Uuid id) - { - if (ContextID == id) - { - m_pDrillerMainWindow->hide(); - AZStd::intrusive_ptr newState = AZ::UserSettings::CreateFind(AZ_CRC("LUA DRILLER CONTEXT STATE", 0x95052376), AZ::UserSettings::CT_GLOBAL); - newState->m_MainDrillerWindowIsVisible = false; - } - } - - void Context::ApplicationCensus() - { - AZStd::intrusive_ptr newState = AZ::UserSettings::CreateFind(AZ_CRC("LUA DRILLER CONTEXT STATE", 0x95052376), AZ::UserSettings::CT_GLOBAL); - EBUS_EVENT(AzToolsFramework::FrameworkMessages::Bus, ApplicationCensusReply, newState->m_MainDrillerWindowIsVisible); - } - - - ////////////////////////////////////////////////////////////////////////// - // EditorFramework CoreMessages - void Context::OnRestoreState() - { - const AZStd::string k_launchString = "launch"; - const AZStd::string k_drillerString = "driller"; - - bool GUIMode = true; - EBUS_EVENT_RESULT(GUIMode, LegacyFramework::FrameworkApplicationMessages::Bus, IsRunningInGUIMode); - if (!GUIMode) - { - return; - } - - const AzFramework::CommandLine* commandLine = nullptr; - - EBUS_EVENT_RESULT(commandLine, LegacyFramework::FrameworkApplicationMessages::Bus, GetCommandLineParser); - - bool forceShow = false; - bool forceHide = false; - - if (commandLine->HasSwitch(k_launchString)) - { - forceHide = true; - - size_t numSwitchValues = commandLine->GetNumSwitchValues(k_launchString); - - for (size_t i = 0; i < numSwitchValues; ++i) - { - AZStd::string inputValue = commandLine->GetSwitchValue(k_launchString, i); - - if (inputValue.compare(k_drillerString) == 0) - { - forceShow = true; - forceHide = false; - } - } - } - - ProvisionalShowAndFocus(forceShow, forceHide); - } - - bool Context::OnGetPermissionToShutDown() // until everyone returns true, we can't shut down. - { - AZ_TracePrintf(DrillerDebugName, "Context::OnGetPermissionToShutDown()\n"); - - if (m_pDrillerMainWindow) - { - if (!m_pDrillerMainWindow->OnGetPermissionToShutDown()) - { - return false; - } - } - - return true; - } - - // until everyone returns true, we can't shut down. - bool Context::CheckOkayToShutDown() - { - if (m_pDrillerMainWindow) - { - // confirmation that we're quitting. - if (m_pDrillerMainWindow->isVisible()) - { - m_pDrillerMainWindow->setEnabled(false); - m_pDrillerMainWindow->hide(); - } - } - - return true; - } - - void Context::OnSaveState() - { - // notify main view to persist? - if (m_pDrillerMainWindow) - { - m_pDrillerMainWindow->SaveWindowState(); - } - } - - void Context::OnDestroyState() - { - if (m_pDrillerMainWindow) - { - delete m_pDrillerMainWindow; - } - m_pDrillerMainWindow = NULL; - } - - ////////////////////////////////////////////////////////////////////////// - // Utility - void Context::ProvisionalShowAndFocus(bool forcedShow, bool forcedHide) - { - AZStd::intrusive_ptr newState = AZ::UserSettings::CreateFind(AZ_CRC("LUA DRILLER CONTEXT STATE", 0x95052376), AZ::UserSettings::CT_GLOBAL); - - if (forcedShow) - { - newState->m_MainDrillerWindowIsOpen = true; - newState->m_MainDrillerWindowIsVisible = true; - } - else if (forcedHide) - { - newState->m_MainDrillerWindowIsOpen = false; - newState->m_MainDrillerWindowIsVisible = false; - } - - if (newState->m_MainDrillerWindowIsOpen) - { - if (newState->m_MainDrillerWindowIsVisible) - { - if (!m_pDrillerMainWindow) - { - m_pDrillerMainWindow = aznew DrillerMainWindow(); - } - - m_pDrillerMainWindow->show(); - m_pDrillerMainWindow->raise(); - m_pDrillerMainWindow->activateWindow(); - m_pDrillerMainWindow->setFocus(); - } - else - { - if (m_pDrillerMainWindow) - { - m_pDrillerMainWindow->hide(); - } - } - } - } - - - ////////////////////////////////////////////////////////////////////////// - //ContextInterface - - ////////////////////////////////////////////////////////////////////////// - - ////////////////////////////////////////////////////////////////////////// - - ////////////////////////////////////////////////////////////////////////// - - void Context::ShowDrillerView() - { - ProvisionalShowAndFocus(true); - } -} diff --git a/Code/Tools/Standalone/Source/Driller/DrillerContext.h b/Code/Tools/Standalone/Source/Driller/DrillerContext.h deleted file mode 100644 index 018c1f58b5..0000000000 --- a/Code/Tools/Standalone/Source/Driller/DrillerContext.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include -#include -#include -#include -#include -#include -#include "DrillerContextInterface.h" -#include "DrillerMainWindow.hxx" - -#include - -#pragma once - - -namespace Driller -{ - ////////////////////////////////////////////////////////////////////////// - // Context - // all editor components are responsible for maintaining the list of documents they are responsible for - // and setting up editing facilities on those asset types in that "space". - // editor contexts are components and have component ID's because we will communicate to them via buses. - - // this is the data side of drilling. - // for example, data flow, discovery, that sort of thing. - - class Context - : public AZ::Component - , private LegacyFramework::CoreMessageBus::Handler - , private ContextInterface::Handler - { - friend class ContextFactory; - public: - AZ_COMPONENT(Driller::Context, "{60EC92BD-1D96-4E37-AB46-DF89A5497617}") - - Context(); - virtual ~Context(); - - ////////////////////////////////////////////////////////////////////////// - // AZ::Component - virtual void Init(); - virtual void Activate(); - virtual void Deactivate(); - static void Reflect(AZ::ReflectContext* context); - ////////////////////////////////////////////////////////////////////////// - - ////////////////////////////////////////////////////////////////////////// - // EditorFramework CoreMessages - virtual void OnRestoreState(); // sent when everything is registered up and ready to go, this is what bootstraps stuff to get going. - virtual bool OnGetPermissionToShutDown(); - virtual bool CheckOkayToShutDown(); - virtual void OnSaveState(); // sent to everything when the app is about to shut down - do what you need to do. - virtual void OnDestroyState(); - virtual void ApplicationDeactivated(); - virtual void ApplicationActivated(); - virtual void ApplicationShow(AZ::Uuid id); - virtual void ApplicationHide(AZ::Uuid id); - virtual void ApplicationCensus(); - ////////////////////////////////////////////////////////////////////////// - - ////////////////////////////////////////////////////////////////////////// - // EditorFramework::AssetManagementMessages - //virtual bool RawFileOpenRequested(const EditorFramework::RegisteredAssetType& registeredTypeID, const char *fullPathName); - ////////////////////////////////////////////////////////////////////////// - - virtual void ShowDrillerView(); - - ////////////////////////////////////////////////////////////////////////// - // internal data structure for the class/member/property reference panel - // this is what we serialize and work with - DrillerMainWindow* m_pDrillerMainWindow; - - private: - - // utility - void ProvisionalShowAndFocus(bool forceShow = false, bool forceHide = false); - }; - - class ClassReferenceItem - : public QStandardItem - { - public: - AZ_CLASS_ALLOCATOR(ClassReferenceItem, AZ::SystemAllocator, 0); - - ClassReferenceItem(const QIcon& icon, const QString& text, size_t id); - ClassReferenceItem(const QString& text, size_t id); - ~ClassReferenceItem() {} - - size_t GetTypeID() {return m_ID; } - protected: - size_t m_ID; - }; -}; - diff --git a/Code/Tools/Standalone/Source/Driller/DrillerContextInterface.h b/Code/Tools/Standalone/Source/Driller/DrillerContextInterface.h deleted file mode 100644 index 4fe88e83e5..0000000000 --- a/Code/Tools/Standalone/Source/Driller/DrillerContextInterface.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef DRILLERCONTEXTINTERFACE_H -#define DRILLERCONTEXTINTERFACE_H - -#include -#include -#include - -namespace Driller -{ - class ContextInterface - : public LegacyFramework::EditorContextMessages - { - public: - typedef AZ::EBus Bus; - typedef Bus::Handler Handler; - - virtual void ShowDrillerView() = 0; - }; -} - -#endif //DRILLERCONTEXTINTERFACE_H diff --git a/Code/Tools/Standalone/Source/Driller/DrillerDataContainer.cpp b/Code/Tools/Standalone/Source/Driller/DrillerDataContainer.cpp deleted file mode 100644 index 061ead6b03..0000000000 --- a/Code/Tools/Standalone/Source/Driller/DrillerDataContainer.cpp +++ /dev/null @@ -1,283 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "DrillerDataContainer.h" - -#include -#include -#include - -#include // temp for DebugHackProcessFile - -#include // metadata is stored this way - -#include "Unsupported/UnsupportedDataAggregator.hxx" -#include "Memory/MemoryDataAggregator.hxx" -#include "Trace/TraceMessageDataAggregator.hxx" -#include "Profiler/ProfilerDataAggregator.hxx" -#include "Carrier/CarrierDataAggregator.hxx" -#include "Replica/ReplicaDataAggregator.hxx" -#include "Rendering/VRAM/VRAMDataAggregator.hxx" -#include "EventTrace/EventTraceDataAggregator.h" -// IMPORTANT: include new aggregators above - - -namespace Driller -{ - class DrillerDataHandler : public AZ::Debug::DrillerHandlerParser - { - public: - AZ_CLASS_ALLOCATOR(DrillerDataHandler,AZ::SystemAllocator,0) - - DrillerDataHandler(int identity, DrillerDataContainer* container) - : AZ::Debug::DrillerHandlerParser(/*true*/false) - , m_identity(identity) - , m_currentFrame(-1) - , m_dataContainer(container) - , m_dataParser(nullptr) - { - m_drillerSessionInfo.m_platform = static_cast(AZ::g_currentPlatform); /// Init with current platform so no endian swapping till we read all the initial settings. - m_inputStream.SetStringPool(&m_stringPool); - m_dataParser = aznew AZ::Debug::DrillerSAXParserHandler(this); - } - - ~DrillerDataHandler() - { - delete m_dataParser; - } - - virtual AZ::Debug::DrillerHandlerParser* OnEnterTag(AZ::u32 tagName) - { - if( tagName == AZ_CRC("StartData", 0xecf3f53f) ) - return &m_drillerSessionInfo; - if( tagName == AZ_CRC("Frame", 0xb5f83ccd) ) - return this; - for(DrillerNetworkMessages::AggregatorList::iterator it = m_dataContainer->m_aggregators.begin(); it != m_dataContainer->m_aggregators.end(); ++it) - { - if( (*it)->GetDrillerId() == tagName ) - return (*it)->GetDrillerDataParser(); - } - - AZ_TracePrintf("Driller", "We should never get here as we should have added 'Unsupported driller(s)' in OnExitTag('StartData')"); - return nullptr; - } - - virtual void OnExitTag(DrillerHandlerParser* handler, AZ::u32 tagName) - { - (void)handler; - if( tagName == AZ_CRC("StartData", 0xecf3f53f) ) - { - // create all drillers that were in the session data - for(AZ::Debug::DrillerManager::DrillerListType::iterator itDriller = m_drillerSessionInfo.m_drillers.begin(); itDriller != m_drillerSessionInfo.m_drillers.end(); ++itDriller ) - { - AZ::u32 drillerId = itDriller->id; - bool isCreated = false; - for(DrillerNetworkMessages::AggregatorList::iterator it = m_dataContainer->m_aggregators.begin(); it != m_dataContainer->m_aggregators.end(); ++it) - { - if( (*it)->GetDrillerId() == drillerId ) - { - isCreated = true; - break; - } - } - - if( !isCreated ) - { - // Create the aggregator, if the driller is missing add UnsupportedAggregator - Aggregator* aggr = m_dataContainer->CreateAggregator(drillerId, true); - if( aggr ) - m_dataContainer->m_aggregators.push_back(aggr); - - // two ways to add aggregators: - // 1) "NewAggregatorList" send an entire list which replaces the current setup, which is most efficient - // 2) "AddAggregator" send a single aggregator which gets appended - EBUS_EVENT_ID(m_identity, DrillerNetworkMessages::Bus,AddAggregator, *m_dataContainer->m_aggregators.back()); - } - } - } - } - - virtual void OnData(const AZ::Debug::DrillerSAXParser::Data& dataNode) - { - if( dataNode.m_name == AZ_CRC("FrameNum", 0x85a1a919) ) - { - // Send event that previous frame has finished - if( m_currentFrame != -1 ) - { - EBUS_EVENT_ID(m_identity, DrillerNetworkMessages::Bus,EndFrame, m_currentFrame); - } - dataNode.Read(m_currentFrame); - for(DrillerNetworkMessages::AggregatorList::iterator it = m_dataContainer->m_aggregators.begin(); it != m_dataContainer->m_aggregators.end(); ++it) - { - (*it)->AddNewFrame(); - } - } - } - - void ProcessStream(const char* streamIdentifier, const void* data, unsigned int dataSize) - { - m_inputStream.SetData(streamIdentifier, data, dataSize); - m_dataParser->ProcessStream(m_inputStream); - } - - AZ::Debug::DrillerStartdataHandler m_drillerSessionInfo; - int m_currentFrame; - DrillerDataContainer* m_dataContainer; - AZ::Debug::DrillerSAXParserHandler* m_dataParser; - AZ::Debug::DrillerInputMemoryStream m_inputStream; - AZ::Debug::DrillerDefaultStringPool m_stringPool; - int m_identity; - }; - - DrillerDataContainer::DrillerDataContainer(int identity, const char* tmpCaptureFilename) - : m_dataHandler(nullptr) - , m_identity(identity) - , m_tmpCaptureFilename(tmpCaptureFilename) - { - AzFramework::DrillerNetworkConsoleEventBus::Handler::BusConnect(); - EBUS_EVENT(AzFramework::DrillerNetworkConsoleCommandBus, EnumerateAvailableDrillers); - } - - DrillerDataContainer::~DrillerDataContainer() - { - AzFramework::DrillerNetworkConsoleEventBus::Handler::BusDisconnect(); - DestroyAggregators(); - - delete m_dataHandler; - } - - void DrillerDataContainer::OnReceivedDrillerEnumeration(const AzFramework::DrillerInfoListType& availableDrillers) - { - // TODO: Decide how the available driller list should influence the behavior of the driller - // display. For now we will display whatever is available. - m_availableDrillers = availableDrillers; - EBUS_EVENT_ID(m_identity, DrillerNetworkMessages::Bus, NewAggregatorsAvailable); - } - - void DrillerDataContainer::CreateAggregators() - { - DestroyAggregators(); - - if (m_availableDrillers.size()) - { - for (size_t i = 0; i < m_availableDrillers.size(); ++i) - { - Aggregator* aggr = CreateAggregator(m_availableDrillers[i].m_id, true); - if( aggr ) - m_aggregators.push_back(aggr); - } - } - EBUS_EVENT_ID(m_identity, DrillerNetworkMessages::Bus, NewAggregatorList,m_aggregators); - } - - void DrillerDataContainer::DestroyAggregators() - { - EBUS_EVENT_ID(m_identity, DrillerNetworkMessages::Bus, DiscardAggregators); - - for(DrillerNetworkMessages::AggregatorList::iterator it = m_aggregators.begin(); it != m_aggregators.end(); ++it ) - delete *it; - m_aggregators.clear(); - } - - Aggregator* DrillerDataContainer::CreateAggregator(AZ::u32 id, bool createUnsupported) - { - if( id == MemoryDataAggregator::DrillerId() ) - { - return aznew MemoryDataAggregator(m_identity); - } - else if( id == TraceMessageDataAggregator::DrillerId() ) - { - return aznew TraceMessageDataAggregator(m_identity); - } - else if (id == ProfilerDataAggregator::DrillerId() ) - { - return aznew ProfilerDataAggregator(m_identity); - } - else if(id == CarrierDataAggregator::DrillerId()) - { - return aznew CarrierDataAggregator(m_identity); - } - else if(id == ReplicaDataAggregator::DrillerId()) - { - return aznew ReplicaDataAggregator(m_identity); - } - else if(id == VRAM::VRAMDataAggregator::DrillerId()) - { - return aznew VRAM::VRAMDataAggregator(m_identity); - } - else if (id == EventTraceDataAggregator::DrillerId()) - { - return aznew EventTraceDataAggregator(m_identity); - } - // IMPORTANT: Add new aggregators here - - return createUnsupported ? aznew UnsupportedDataAggregator(id) : nullptr; - } - - void DrillerDataContainer::ProcessIncomingDrillerData(const char* streamIdentifier, const void* data, size_t dataSize) - { - AZ_Assert(m_dataHandler,"You must have a valid data handler parser to parse the data!"); - m_dataHandler->ProcessStream(streamIdentifier, data, static_cast(dataSize)); - } - - void DrillerDataContainer::OnDrillerConnectionLost() - { - StopDrilling(); - } - - void DrillerDataContainer::StartDrilling() - { - DrillerEvent::ResetGlobalEventId(); - - AzFramework::DrillerListType drillersToStart; - for(DrillerNetworkMessages::AggregatorList::iterator it = m_aggregators.begin(); it != m_aggregators.end(); ++it) - { - (*it)->Reset(); - - if ((*it)->IsCaptureEnabled()) - { - drillersToStart.push_back((*it)->GetDrillerId()); - } - } - if (drillersToStart.size()) - { - delete m_dataHandler; - m_dataHandler = aznew DrillerDataHandler(m_identity, this); - - AzFramework::DrillerRemoteSession::StartDrilling(drillersToStart, m_tmpCaptureFilename.c_str()); - } - } - - void DrillerDataContainer::LoadCaptureData(const char* fileName) - { - DrillerEvent::ResetGlobalEventId(); - // Reset data - DestroyAggregators(); - - AZStd::string baseFilename( fileName ); - - delete m_dataHandler; - m_dataHandler = aznew DrillerDataHandler(m_identity, this); - AzFramework::DrillerRemoteSession::LoadCaptureData(fileName); - } - - void DrillerDataContainer::CloseCaptureData() - { - StopDrilling(); - DestroyAggregators(); - } - - void DrillerDataContainer::Reflect(AZ::ReflectContext* context) - { - MemoryDataAggregator::Reflect(context); - TraceMessageDataAggregator::Reflect(context); - ProfilerDataAggregator::Reflect(context); - ReplicaDataAggregator::Reflect(context); - } - -}//namespace Driller diff --git a/Code/Tools/Standalone/Source/Driller/DrillerDataContainer.h b/Code/Tools/Standalone/Source/Driller/DrillerDataContainer.h deleted file mode 100644 index 4aebfe2edc..0000000000 --- a/Code/Tools/Standalone/Source/Driller/DrillerDataContainer.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef DRILLER_DRILLER_DATA_CONTAINER -#define DRILLER_DRILLER_DATA_CONTAINER - -#include - -#include "DrillerNetworkMessages.h" - -#include "AzFramework/Driller/RemoteDrillerInterface.h" - -namespace DH -{ - namespace Debug - { - class DrillerInputMemoryStream; - } -} - -namespace Driller -{ - class DrillerDataHandler; - - /** - * Driller data container. Contains all the data (aggregators) - * for a driller session. It interfaces with with DrillerSession - * for local file caching (TODO) and remote data transfer. - */ - class DrillerDataContainer - : public AzFramework::DrillerRemoteSession - , public AzFramework::DrillerNetworkConsoleEventBus::Handler - { - friend class DrillerDataHandler; - - public: - AZ_CLASS_ALLOCATOR(DrillerDataContainer, AZ::SystemAllocator, 0) - - DrillerDataContainer(int identity, const char* tmpCaptureFilename); - ~DrillerDataContainer(); - - ////////////////////////////////////////////////////////////////////////// - // DrillerRemoteSession - virtual void ProcessIncomingDrillerData(const char* streamIdentifier, const void* data, size_t dataSize); - virtual void OnDrillerConnectionLost(); - ////////////////////////////////////////////////////////////////////////// - - ////////////////////////////////////////////////////////////////////////// - // DrillerNetworkConsoleEvents - virtual void OnReceivedDrillerEnumeration(const AzFramework::DrillerInfoListType& availableDrillers); - ////////////////////////////////////////////////////////////////////////// - - void StartDrilling(); - void LoadCaptureData(const char* fileName); - void CloseCaptureData(); - void CreateAggregators(); - - protected: - void DestroyAggregators(); - Aggregator* CreateAggregator(AZ::u32 id, bool createUnsupported = false); - - DrillerNetworkMessages::AggregatorList m_aggregators; - DrillerDataHandler* m_dataHandler; - AzFramework::DrillerInfoListType m_availableDrillers; - AZStd::string m_tmpCaptureFilename; - int m_identity; - - public: - // data container is the one place that knows about all the aggregators - // and indeed is responsible for creating them - // and thus the best place to centralize their reflection - static void Reflect(AZ::ReflectContext* context); - }; -} - -#endif //DRILLER_DRILLER_DATA_CONTAINER -#pragma once diff --git a/Code/Tools/Standalone/Source/Driller/DrillerDataTypes.h b/Code/Tools/Standalone/Source/Driller/DrillerDataTypes.h deleted file mode 100644 index 128b2f381a..0000000000 --- a/Code/Tools/Standalone/Source/Driller/DrillerDataTypes.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef DRILLER_DATATYPES_H -#define DRILLER_DATATYPES_H - -#include - -namespace Driller -{ - typedef AZ::s32 FrameNumberType; - typedef AZ::s64 EventNumberType; - - static const EventNumberType kInvalidEventIndex = -1; - - enum class CaptureMode - { - Unknown, - Configuration, - Capturing, - Inspecting - }; -} - -#endif diff --git a/Code/Tools/Standalone/Source/Driller/DrillerEvent.cpp b/Code/Tools/Standalone/Source/Driller/DrillerEvent.cpp deleted file mode 100644 index e16d6ee8d4..0000000000 --- a/Code/Tools/Standalone/Source/Driller/DrillerEvent.cpp +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "DrillerEvent.h" - -namespace Driller -{ - ////////////////////////////////////////////////////////////////////////// - // Globals - unsigned int DrillerEvent::s_globalEventId = 0; -} // namespace Driller diff --git a/Code/Tools/Standalone/Source/Driller/DrillerEvent.h b/Code/Tools/Standalone/Source/Driller/DrillerEvent.h deleted file mode 100644 index 619a82de60..0000000000 --- a/Code/Tools/Standalone/Source/Driller/DrillerEvent.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef DRILLER_DRILLER_EVENT_H -#define DRILLER_DRILLER_EVENT_H - -#include - -namespace Driller -{ - class Aggregator; - - /** - * Base class for a driller events. All events collected in aggregators should use this class as a base. - * - * IMPORTANT: It's very important to note that DrillerEvents will NEVER be removed during a driller session - * this allows you to RELY on the fact that data which the event contains will be present at all times. This is important - * because it's heavily used to support StepBackward/StepForward in sequential driller events (almost all driller events are deltas - * and in that sense they are sequential - we can't just jump to a state directly). - */ - class DrillerEvent - { - public: - AZ_RTTI(DrillerEvent, "{3B0B15CF-A359-47AA-B8D3-DCEFA39BD097}"); - DrillerEvent(unsigned int eventType) - : m_eventType(eventType) - , m_globalEventId(s_globalEventId++) {} - virtual ~DrillerEvent() {} - - virtual void StepForward(Aggregator* data) = 0; - virtual void StepBackward(Aggregator* data) = 0; - - static inline unsigned int GetNumGlobalEvents() { return s_globalEventId; } - static inline void ResetGlobalEventId() { s_globalEventId = 0; } - - unsigned int GetGlobalEventId() const { return m_globalEventId; } - unsigned int GetEventType() const { return m_eventType; } - - protected: - unsigned int m_eventType; - unsigned int m_globalEventId; ///< Event unique ID, which is the global event index (in order) too. - - private: - static unsigned int s_globalEventId; ///< Current number of events used in all aggregators. - }; -} - -#endif diff --git a/Code/Tools/Standalone/Source/Driller/DrillerMainChannelsView.ui b/Code/Tools/Standalone/Source/Driller/DrillerMainChannelsView.ui deleted file mode 100644 index f3fec8d95e..0000000000 --- a/Code/Tools/Standalone/Source/Driller/DrillerMainChannelsView.ui +++ /dev/null @@ -1,147 +0,0 @@ - - - channelsViewWidget - - - - 0 - 0 - 1041 - 777 - - - - Channels View - - - - 0 - - - 2 - - - 2 - - - 2 - - - 2 - - - - - - 0 - 0 - - - - Qt::ScrollBarAlwaysOn - - - Qt::ScrollBarAlwaysOff - - - true - - - Qt::AlignJustify|Qt::AlignTop - - - - - 0 - 0 - 1018 - 591 - - - - - 2 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - - - - Qt::Horizontal - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 25 - - - - - - - - - - - - 0 - 0 - - - - - 0 - 128 - - - - - - - - - Driller::CombinedEventsControl - QWidget -
combinedeventscontrol.hxx
- 1 -
- - Driller::AnnotationHeaderView_Events - QWidget -
Source/riller/Annotations/annotationsheaderview_events.hxx
- 1 -
- - UIFramework::DHAutoSizingScrollArea - QScrollArea -
UICore/DHAutoSizingScrollArea.hxx
- 1 -
-
- - -
diff --git a/Code/Tools/Standalone/Source/Driller/DrillerMainWindow.cpp b/Code/Tools/Standalone/Source/Driller/DrillerMainWindow.cpp deleted file mode 100644 index 4fa06ecdc0..0000000000 --- a/Code/Tools/Standalone/Source/Driller/DrillerMainWindow.cpp +++ /dev/null @@ -1,509 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "DrillerMainWindow.hxx" -#include - -#include "DrillerCaptureWindow.hxx" - -#include "DrillerMainWindowMessages.h" -#include "DrillerAggregator.hxx" -#include "ChannelControl.hxx" -#include "CombinedEventsControl.hxx" -#include "DrillerDataContainer.h" -#include "Workspaces/Workspace.h" - -#include -#include -#include -#include -#include -#include - -#include - -#include - -#include - -#include -#include -#include -#include -#include -#include - -namespace Driller::MainWindow -{ - const char* drillerDebugName = "Driller"; -} - -namespace Driller -{ - class DrillerMainWindowSavedState - : public AzToolsFramework::MainWindowSavedState - { - public: - AZ_RTTI(DrillerMainWindowSavedState, "{77A8D5DB-38EB-4F9B-BEA2-F42D725A8177}", AzToolsFramework::MainWindowSavedState); - AZ_CLASS_ALLOCATOR(DrillerMainWindowSavedState, AZ::SystemAllocator, 0); - - AZStd::string m_priorSaveFolder; - AZStd::string m_priorOpenFolder; - - DrillerMainWindowSavedState() {} - - void Init(const QByteArray& windowState, const QByteArray& windowGeom) - { - AzToolsFramework::MainWindowSavedState::Init(windowState, windowGeom); - } - - static void Reflect(AZ::ReflectContext* context) - { - AZ::SerializeContext* serialize = azrtti_cast(context); - if (serialize) - { - serialize->Class() - ->Field("m_priorSaveFolder", &DrillerMainWindowSavedState::m_priorSaveFolder) - ->Field("m_priorOpenFolder", &DrillerMainWindowSavedState::m_priorOpenFolder) - ->Version(8); - } - } - }; - - // WORKSPACES are files loaded and stored independent of the global application - // designed to be used for DRL data specific view settings and to pass around - class DrillerMainWindowWorkspace - : public AZ::UserSettings - { - public: - AZ_RTTI(DrillerMainWindowWorkspace, "{E7DAC981-84E9-490E-AF1B-DADC116B3B10}", AZ::UserSettings); - AZ_CLASS_ALLOCATOR(DrillerMainWindowWorkspace, AZ::SystemAllocator, 0); - - AZStd::vector m_openDataFileNames; - - DrillerMainWindowWorkspace() {} - - static void Reflect(AZ::ReflectContext* context) - { - AZ::SerializeContext* serialize = azrtti_cast(context); - if (serialize) - { - serialize->Class() - ->Field("m_openDataFileNames", &DrillerMainWindowWorkspace::m_openDataFileNames) - ->Version(8); - } - } - }; -} - -namespace Driller -{ - extern AZ::Uuid ContextID; - - Driller::DrillerMainWindow* s_drillerMainWindowScriptPtr = NULL; // for script access - - int DrillerMainWindow::m_ascendingIdentity = 0; - - ////////////////////////////////////////////////////////////////////////// - //DrillerMainWindow - DrillerMainWindow::DrillerMainWindow(QWidget* parent, Qt::WindowFlags flags) - : QMainWindow(parent, flags) - { - s_drillerMainWindowScriptPtr = this; - - m_isLoadingFile = false; - m_panningMainView = false; - m_panningMainViewStartPoint = 0; - - m_gui = azcreate(Ui::DrillerMainWindow, ()); - m_gui->setupUi(this); - - QMenu* theMenu = new QMenu(this); - (void)theMenu->addAction( - "Close Profiler App", - this, - SLOT(OnMenuCloseCurrentWindow()), - QKeySequence("Alt+F4") - ); - - EBUS_EVENT(AzToolsFramework::FrameworkMessages::Bus, PopulateApplicationMenu, theMenu); - menuBar()->insertMenu(m_gui->menuDriller->menuAction(), theMenu); - - connect(m_gui->actionContract, SIGNAL(triggered()), this, SLOT(OnContractAllChannels())); - connect(m_gui->actionExpand, SIGNAL(triggered()), this, SLOT(OnExpandAllChannels())); - connect(m_gui->actionDisable, SIGNAL(triggered()), this, SLOT(OnDisableAllChannels())); - connect(m_gui->actionEnable, SIGNAL(triggered()), this, SLOT(OnEnableAllChannels())); - - DrillerDataViewMessages::Handler::BusConnect(); - - QTimer::singleShot(0, this, SLOT(RestoreWindowState())); - - AzFramework::TargetManagerClient::Bus::Handler::BusConnect(); - - m_gui->actionSave->setEnabled(false); - m_gui->actionSaveWorkspace->setEnabled(true); - - // default identity == 0 Live tab - auto captureWindow = aznew DrillerCaptureWindow(CaptureMode::Configuration, m_ascendingIdentity, this); - captureWindow->setAttribute(Qt::WA_DeleteOnClose, true); - - m_captureWindows.insert(AZStd::make_pair(captureWindow, m_ascendingIdentity)); - ++m_ascendingIdentity; - - m_gui->tabbedContents->addTab(captureWindow, QString("LIVE")); - - // Enabling close buttons on our widgets, and hiding the close button on the live - // tab for now. - m_gui->tabbedContents->setTabsClosable(true); - m_gui->tabbedContents->tabBar()->setTabButton(0, QTabBar::ButtonPosition::RightSide, nullptr); - m_gui->tabbedContents->tabBar()->setTabButton(0, QTabBar::ButtonPosition::LeftSide, nullptr); - - connect(m_gui->tabbedContents, SIGNAL(currentChanged(int)), this, SLOT(OnTabChanged(int))); - connect(m_gui->tabbedContents, SIGNAL(tabCloseRequested(int)), this, SLOT(CloseTab(int))); - - connect(captureWindow, SIGNAL(destroyed(QObject*)), this, SLOT(OnCaptureWindowDestroyed(QObject*))); - - EBUS_EVENT(LegacyFramework::CustomMenusMessages::Bus, RegisterMenu, LegacyFramework::CustomMenusCommon::Driller::Application, theMenu); - EBUS_EVENT(LegacyFramework::CustomMenusMessages::Bus, RegisterMenu, LegacyFramework::CustomMenusCommon::Driller::DrillerMenu, m_gui->menuDriller); - EBUS_EVENT(LegacyFramework::CustomMenusMessages::Bus, RegisterMenu, LegacyFramework::CustomMenusCommon::Driller::Channels, m_gui->menuChannels); - - UpdateTabBarDisplay(); - } - - DrillerMainWindow::~DrillerMainWindow(void) - { - AzFramework::TargetManagerClient::Bus::Handler::BusDisconnect(); - - s_drillerMainWindowScriptPtr = NULL; - DrillerDataViewMessages::Handler::BusDisconnect(); - - azdestroy(m_gui); - } - - void DrillerMainWindow::OnTabChanged(int toWhich) - { - // first tab is always Live - if (toWhich) - { - m_gui->actionSave->setEnabled(true); - } - else - { - m_gui->actionSave->setEnabled(false); - } - } - - void DrillerMainWindow::CloseTab(int closeTab) - { - // We never want to close the live tab. - if (closeTab != 0) - { - DrillerCaptureWindow* captureWindow = static_cast(m_gui->tabbedContents->widget(closeTab)); - - if (captureWindow) - { - captureWindow->OnClose(); - } - } - } - - void DrillerMainWindow::OnCaptureWindowDestroyed(QObject* cWindow) - { - auto captureWindow = static_cast(cWindow); - m_gui->tabbedContents->removeTab(m_gui->tabbedContents->indexOf(captureWindow)); - m_captureWindows.erase(captureWindow); - - UpdateTabBarDisplay(); - } - - ////////////////////////////////////////////////////////////////////////// - // Data Viewer Request Messages - void DrillerMainWindow::EventRequestOpenFile(AZStd::string fileName) - { - OnOpenDrillerFile(fileName.c_str()); - } - void DrillerMainWindow::EventRequestOpenWorkspace(AZStd::string fileName) - { - OnOpenWorkspaceFile(fileName.c_str(), true); - } - - ////////////////////////////////////////////////////////////////////////// - // GUI Messages - void DrillerMainWindow::OnMenuCloseCurrentWindow() - { - AZ_TracePrintf(Driller::MainWindow::drillerDebugName, "Close requested\n"); - - SaveWindowState(); - - EBUS_EVENT(AzToolsFramework::FrameworkMessages::Bus, RequestMainWindowClose, ContextID); - } - - void DrillerMainWindow::OnOpen() - { - AZ_TracePrintf(Driller::MainWindow::drillerDebugName, "Open requested\n"); - - this->show(); - emit ShowYourself(); - } - - void DrillerMainWindow::OnClose() - { - AZ_TracePrintf(Driller::MainWindow::drillerDebugName, "Close requested of window (not file)\n"); - } - - void DrillerMainWindow::OnContractAllChannels() - { - static_cast(m_gui->tabbedContents->currentWidget())->OnContractAllChannels(); - } - void DrillerMainWindow::OnExpandAllChannels() - { - static_cast(m_gui->tabbedContents->currentWidget())->OnExpandAllChannels(); - } - void DrillerMainWindow::OnDisableAllChannels() - { - static_cast(m_gui->tabbedContents->currentWidget())->OnDisableAllChannels(); - } - void DrillerMainWindow::OnEnableAllChannels() - { - static_cast(m_gui->tabbedContents->currentWidget())->OnEnableAllChannels(); - } - - ////////////////////////////////////////////////////////////////////////// - // when the Editor Main window is requested to close, it is not destroyed. - ////////////////////////////////////////////////////////////////////////// - // Qt Events - void DrillerMainWindow::closeEvent(QCloseEvent* event) - { - OnMenuCloseCurrentWindow(); - event->ignore(); - } - - void DrillerMainWindow::showEvent(QShowEvent* /*event*/) - { - emit ShowYourself(); - } - void DrillerMainWindow::hideEvent(QHideEvent* /*event*/) - { - emit HideYourself(); - } - - bool DrillerMainWindow::OnGetPermissionToShutDown() - { - for (auto idx = 0; idx < m_gui->tabbedContents->count(); ++idx) - { - bool willShutDown = static_cast(m_gui->tabbedContents->widget(idx))->OnGetPermissionToShutDown(); - if (!willShutDown) - { - AZ_TracePrintf(Driller::MainWindow::drillerDebugName, " ShutDown Denied\n"); - return false; - } - } - - AZ_TracePrintf(Driller::MainWindow::drillerDebugName, " willShutDown == 1\n"); - return true; - } - - void DrillerMainWindow::SaveWindowState() - { - // build state and store it. - auto newState = AZ::UserSettings::CreateFind(AZ_CRC("DRILLER MAIN WINDOW STATE", 0x9c98b7f6), AZ::UserSettings::CT_GLOBAL); - newState->Init(saveState(), saveGeometry()); - - for (auto iter = m_captureWindows.begin(); iter != m_captureWindows.end(); ++iter) - { - iter->first->SaveWindowState(); - } - } - - void DrillerMainWindow::UpdateTabBarDisplay() - { - // We will always have one window open(live), and we don't want to show - // the tab bar unless we have more then one. - m_gui->tabbedContents->tabBar()->setVisible(m_captureWindows.size() > 1); - } - - void DrillerMainWindow::RestoreWindowState() // call this after you have rebuilt everything. - { - // load the state from our state block: - auto savedState = AZ::UserSettings::Find(AZ_CRC("DRILLER MAIN WINDOW STATE", 0x9c98b7f6), AZ::UserSettings::CT_GLOBAL); - if (savedState) - { - QByteArray geomData((const char*)savedState->m_windowGeometry.data(), (int)savedState->m_windowGeometry.size()); - QByteArray stateData((const char*)savedState->GetWindowState().data(), (int)savedState->GetWindowState().size()); - - restoreGeometry(geomData); - if (this->isMaximized()) - { - this->showNormal(); - this->showMaximized(); - } - restoreState(stateData); - } - else - { - // default state! - } - } - - void DrillerMainWindow::OnOpenDrillerFile() - { - QString capturePath; - - auto newState = AZ::UserSettings::CreateFind(AZ_CRC("DRILLER MAIN WINDOW STATE", 0x9c98b7f6), AZ::UserSettings::CT_GLOBAL); - if (!newState->m_priorOpenFolder.empty()) - { - capturePath = newState->m_priorOpenFolder.data(); - } - else - { - capturePath = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation); - - if (capturePath.isEmpty()) - { - capturePath = QStandardPaths::writableLocation(QStandardPaths::TempLocation); - } - } - - QString fileName = QFileDialog::getOpenFileName(this, "Open Driller File", capturePath, "Driller Files (*.drl)"); - if (!fileName.isNull()) - { - OnOpenDrillerFile(fileName); - newState->m_priorOpenFolder = QFileInfo(fileName).dir().canonicalPath().toUtf8().data(); - } - } - - void DrillerMainWindow::OnOpenDrillerFile(QString fileName) - { - auto captureWindow = aznew DrillerCaptureWindow(CaptureMode::Inspecting, m_ascendingIdentity, this); - if (captureWindow) - { - m_captureWindows.insert(AZStd::make_pair(captureWindow, m_ascendingIdentity)); - ++m_ascendingIdentity; - - captureWindow->OnOpenDrillerFile(fileName); - connect(captureWindow, SIGNAL(destroyed(QObject*)), this, SLOT(OnCaptureWindowDestroyed(QObject*))); - - m_gui->tabbedContents->setCurrentIndex(m_gui->tabbedContents->addTab(captureWindow, fileName)); - UpdateTabBarDisplay(); - } - } - - void DrillerMainWindow::OnOpenWorkspaceFile() - { - QString capturePath; - - auto newState = AZ::UserSettings::CreateFind(AZ_CRC("DRILLER MAIN WINDOW STATE", 0x9c98b7f6), AZ::UserSettings::CT_GLOBAL); - if (!newState->m_priorOpenFolder.empty()) - { - capturePath = newState->m_priorOpenFolder.data(); - } - else - { - capturePath = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation); - if (capturePath.isEmpty()) - { - capturePath = QStandardPaths::writableLocation(QStandardPaths::TempLocation); - } - } - - QString workspaceFileName = QFileDialog::getOpenFileName(this, tr("Open Workspace File"), capturePath, tr("Workspace Files (*.drw)")); - if (!workspaceFileName.isNull()) - { - OnOpenWorkspaceFile(workspaceFileName, true); - } - } - - void DrillerMainWindow::OnOpenWorkspaceFile(QString workspaceFileName, bool openDrillerFileAlso) - { - auto captureWindow = aznew DrillerCaptureWindow(CaptureMode::Inspecting, m_ascendingIdentity, this); - if (captureWindow) - { - m_captureWindows.insert(AZStd::make_pair(captureWindow, m_ascendingIdentity)); - ++m_ascendingIdentity; - - captureWindow->OnOpenWorkspaceFile(workspaceFileName, openDrillerFileAlso); - connect(captureWindow, SIGNAL(destroyed(QObject*)), this, SLOT(OnCaptureWindowDestroyed(QObject*))); - - m_gui->tabbedContents->setCurrentIndex(m_gui->tabbedContents->addTab(captureWindow, captureWindow->GetDataFileName())); - UpdateTabBarDisplay(); - } - } - - void DrillerMainWindow::OnApplyWorkspaceFile() - { - QString capturePath; - - auto newState = AZ::UserSettings::CreateFind(AZ_CRC("DRILLER MAIN WINDOW STATE", 0x9c98b7f6), AZ::UserSettings::CT_GLOBAL); - if (!newState->m_priorOpenFolder.empty()) - { - capturePath = newState->m_priorOpenFolder.data(); - } - else - { - capturePath = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation); - if (capturePath.isEmpty()) - { - capturePath = QStandardPaths::writableLocation(QStandardPaths::TempLocation); - } - } - - QString fileName = QFileDialog::getOpenFileName(this, "Apply Workspace", capturePath, "Workspace Files (*.drw)"); - if (!fileName.isNull()) - { - static_cast(m_gui->tabbedContents->currentWidget())->OnApplyWorkspaceFile(fileName); - } - } - - void DrillerMainWindow::OnSaveWorkspaceFile() - { - QString capturePath; - - auto newState = AZ::UserSettings::CreateFind(AZ_CRC("DRILLER MAIN WINDOW STATE", 0x9c98b7f6), AZ::UserSettings::CT_GLOBAL); - if (!newState->m_priorOpenFolder.empty()) - { - capturePath = newState->m_priorOpenFolder.data(); - } - else - { - capturePath = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation); - if (capturePath.isEmpty()) - { - capturePath = QStandardPaths::writableLocation(QStandardPaths::TempLocation); - } - } - - QString fileName = QFileDialog::getSaveFileName(this, "Save Workspace", capturePath, "Workspace Files (*.drw)"); - if (!fileName.isNull()) - { - static_cast(m_gui->tabbedContents->currentWidget())->OnSaveWorkspaceFile(fileName); - } - } - - ////////////////////////////////////////////////////////////////////////// - // Target Manager Messages - void DrillerMainWindow::Reflect(AZ::ReflectContext* context) - { - // data container is the one place that knows about all the aggregators - // and indeed is responsible for creating them - Driller::WorkspaceSettingsProvider::Reflect(context); - DrillerMainWindowWorkspace::Reflect(context); - DrillerMainWindowSavedState::Reflect(context); - DrillerCaptureWindow::Reflect(context); - - // reflect data for script, serialization, editing... - AZ::BehaviorContext* behaviorContext = azrtti_cast(context); - if (behaviorContext) - { - behaviorContext->Class("DrillerMainWindow")-> - Method("ShowWindow", &DrillerMainWindow::OnOpen)-> - Method("HideWindow", &DrillerMainWindow::OnClose); - - behaviorContext->Property("DrillerMainWindow", BehaviorValueGetter(&s_drillerMainWindowScriptPtr), nullptr); - } - } -}//namespace Driller diff --git a/Code/Tools/Standalone/Source/Driller/DrillerMainWindow.hxx b/Code/Tools/Standalone/Source/Driller/DrillerMainWindow.hxx deleted file mode 100644 index f8d5cfa233..0000000000 --- a/Code/Tools/Standalone/Source/Driller/DrillerMainWindow.hxx +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef DRILLER_DRILLERMAINWINDOW_H -#define DRILLER_DRILLERMAINWINDOW_H - -#if !defined(Q_MOC_RUN) -#include -#include -#include -#include -#include -#include -#include "Workspaces/Workspace.h" -#include "DrillerNetworkMessages.h" -#include "DrillerMainWindowMessages.h" - -#pragma once - -class QMenu; -class QAction; -class QToolbar; -class QDockWidget; -class QSettings; - -#include -#endif - -namespace Ui -{ - class DrillerMainWindow; -} - -namespace Driller -{ - class ChannelControl; - class DrillerDataContainer; - class CombinedEventsControl; - class DrillerCaptureWindow; - - /* - Driller Main Window : Now with simultaneous data sets - - Home of the real commands, channels created from external aggregators when connected, and the floating control panel. - All inputs end up here where they are interpreted and passed downwards to all channels, to maintain consistency. - */ - - ////////////////////////////////////////////////////////////////////////// - //Main Window - class DrillerMainWindow - : public QMainWindow - , public Driller::DrillerDataViewMessages::Bus::Handler - , private AzFramework::TargetManagerClient::Bus::Handler - { - Q_OBJECT; - public: - AZ_TYPE_INFO(DrillerMainWindow, "{91E48678-AEF8-474F-BB20-DDC51ACAA43A}"); - AZ_CLASS_ALLOCATOR(DrillerMainWindow,AZ::SystemAllocator,0); - DrillerMainWindow(QWidget* parent = NULL, Qt::WindowFlags flags = Qt::WindowFlags()); - virtual ~DrillerMainWindow(void); - DrillerMainWindow(const DrillerMainWindow&) - { - // TODO: Once AZ_NO_COPY macros is in the branch in use it! - AZ_Assert(false, "You can't copy this class!"); - } - - bool OnGetPermissionToShutDown(); - - public: - - // Data Viewer request messages - void EventRequestOpenFile(AZStd::string fileName) override; - void EventRequestOpenWorkspace(AZStd::string fileName) override; - - public: - // MainWindow Messages and states. - void SaveWindowState(); - - private: - // internal workings - void UpdateTabBarDisplay(); - - protected: - static int m_ascendingIdentity; - AZStd::map m_captureWindows; - - // Qt Events - virtual void closeEvent(QCloseEvent* event); - virtual void showEvent( QShowEvent * event ); - virtual void hideEvent( QHideEvent * event ); - - bool m_panningMainView; - int m_panningMainViewStartPoint; - - QString m_tmpCaptureFilename; - QString m_currentDataFilename; - - bool m_isLoadingFile; - bool m_bForceNextScrub; - - public slots: - void RestoreWindowState(); - void OnMenuCloseCurrentWindow(); - void OnOpen(); - void OnClose(); - void OnContractAllChannels(); - void OnExpandAllChannels(); - void OnDisableAllChannels(); - void OnEnableAllChannels(); - void OnOpenDrillerFile(); - void OnOpenDrillerFile(QString fileName); - void OnOpenWorkspaceFile(); // prompt user - void OnOpenWorkspaceFile(QString fileName, bool openDrillerFileAlso); // just open it - void OnApplyWorkspaceFile(); - void OnSaveWorkspaceFile(); - void OnCaptureWindowDestroyed(QObject*); - void OnTabChanged(int toWhich); - void CloseTab(int closeTab); - -signals: - void ScrubberFrameUpdate( int frame ); - void ShowYourself(); - void HideYourself(); - - public: - static void Reflect(AZ::ReflectContext* context); - - private: - - Ui::DrillerMainWindow* m_gui; - }; -} - -#endif //DRILLER_DRILLERMAINWINDOW_H diff --git a/Code/Tools/Standalone/Source/Driller/DrillerMainWindow.ui b/Code/Tools/Standalone/Source/Driller/DrillerMainWindow.ui deleted file mode 100644 index 4352c3dba1..0000000000 --- a/Code/Tools/Standalone/Source/Driller/DrillerMainWindow.ui +++ /dev/null @@ -1,245 +0,0 @@ - - - DrillerMainWindow - - - - 0 - 0 - 704 - 595 - - - - - 0 - 0 - - - - Profiler (PREVIEW) - - - - :/general/hex_profiler_icon:/general/hex_profiler_icon - - - QMainWindow::AllowNestedDocks|QMainWindow::AnimatedDocks - - - - - 0 - - - 2 - - - 2 - - - 2 - - - 2 - - - - - -1 - - - - - - - - - 0 - 0 - 704 - 21 - - - - - File - - - - - - - - - - Channels - - - - - - - - - - Capture - - - Start Capturing Data From the Active Drills - - - C - - - - - Freeze - - - Stop Capturing From the Drills and Freeze the Data - - - S - - - - - Contract All - - - - - Expand All - - - - - Disable All - - - Do not record any drill data - - - - - Enable All - - - Record incoming drill data - - - - - Open Data - - - Ctrl+O - - - - - Open Workspace - - - Replace your current environment with both DRL data and a matching Workspace setup - - - - - Apply Workspace - - - Apply this Workspace setup but leave the current DRL data untouched - - - - - Save Data - - - Ctrl+S - - - - - Save Workspace - - - - - - - - - actionOpen - triggered() - DrillerMainWindow - OnOpenDrillerFile() - - - -1 - -1 - - - 387 - 302 - - - - - actionOpenWorkspace - triggered() - DrillerMainWindow - OnOpenWorkspaceFile() - - - -1 - -1 - - - 387 - 302 - - - - - actionApplyWorkspace - triggered() - DrillerMainWindow - OnApplyWorkspaceFile() - - - -1 - -1 - - - 387 - 302 - - - - - actionSaveWorkspace - triggered() - DrillerMainWindow - OnSaveWorkspaceFile() - - - -1 - -1 - - - 387 - 302 - - - - - - OnOpenDrillerFile() - OnOpenWorkspaceFile() - OnApplyWorkspaceFile() - OnSaveWorkspaceFile() - - diff --git a/Code/Tools/Standalone/Source/Driller/DrillerMainWindowMessages.cpp b/Code/Tools/Standalone/Source/Driller/DrillerMainWindowMessages.cpp deleted file mode 100644 index 9c2d19c9de..0000000000 --- a/Code/Tools/Standalone/Source/Driller/DrillerMainWindowMessages.cpp +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include -#include "DrillerMainWindowMessages.h" - - -namespace Driller -{ -} diff --git a/Code/Tools/Standalone/Source/Driller/DrillerMainWindowMessages.h b/Code/Tools/Standalone/Source/Driller/DrillerMainWindowMessages.h deleted file mode 100644 index b90ccce66d..0000000000 --- a/Code/Tools/Standalone/Source/Driller/DrillerMainWindowMessages.h +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef DRILLER_DRILLERMAINWINDOWMESSAGES_H -#define DRILLER_DRILLERMAINWINDOWMESSAGES_H - -#include -#include - -#include -#include - -#pragma once - -namespace Driller -{ - // messages going FROM the Driller Main Window Context TO anyone interested in frame scrubber control - class DrillerMainWindowMessages - : public AZ::EBusTraits - { - public: - ////////////////////////////////////////////////////////////////////////// - // Bus configuration - static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::ById; // components have an actual ID that they report back on - static const AZ::EBusHandlerPolicy HandlerPolicy = AZ:: EBusHandlerPolicy::Multiple; // we can have multiple listeners - ////////////////////////////////////////////////////////////////////////// - typedef int BusIdType; - typedef AZ::EBus Bus; - typedef Bus::Handler Handler; - - virtual void FrameChanged(FrameNumberType frame) = 0; - virtual void PlaybackLoopBeginChanged(FrameNumberType frame){(void)frame; } - virtual void PlaybackLoopEndChanged(FrameNumberType frame){(void)frame; } - /// Important: eventIndex is the event index for the aggregator, NOT global event id. - virtual void EventChanged(EventNumberType eventIndex) = 0; - - virtual ~DrillerMainWindowMessages() {} - }; - - // messages going FROM the main window TO (data viewers) anyone interested in event actions - class DrillerEventWindowMessages - : public AZ::EBusTraits - { - public: - ////////////////////////////////////////////////////////////////////////// - // Bus configuration - static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::ById; // components have an actual ID that they report back on - static const AZ::EBusHandlerPolicy HandlerPolicy = AZ:: EBusHandlerPolicy::Multiple; // we can have multiple listeners - ////////////////////////////////////////////////////////////////////////// - typedef int BusIdType; - typedef AZ::EBus Bus; - typedef Bus::Handler Handler; - - virtual void EventFocusChanged(EventNumberType eventIdx) = 0; - - virtual ~DrillerEventWindowMessages() {} - }; - - // messages going FROM the main window TO (aggregators and their data viewers) anyone using Driller Workspace files - class WorkspaceSettingsProvider; - class DrillerWorkspaceWindowMessages - : public AZ::EBusTraits - { - public: - - ////////////////////////////////////////////////////////////////////////// - // Bus configuration - static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::ById; // components have an actual ID that they report back on - static const AZ::EBusHandlerPolicy HandlerPolicy = AZ:: EBusHandlerPolicy::Multiple; // we can have multiple listeners - ////////////////////////////////////////////////////////////////////////// - typedef int BusIdType; - typedef AZ::EBus Bus; - typedef Bus::Handler Handler; - - // overlay anything you want from the provider into your internal state. - virtual void ApplySettingsFromWorkspace(WorkspaceSettingsProvider*) = 0; - - // now open windows / etc that are specified in your internal saved state. - virtual void ActivateWorkspaceSettings(WorkspaceSettingsProvider*) = 0; - virtual void SaveSettingsToWorkspace(WorkspaceSettingsProvider*) = 0; - - virtual ~DrillerWorkspaceWindowMessages() {} - }; - - // messages going FROM any data viewers TO the global window to request action - class DrillerDataViewMessages - : public AZ::EBusTraits - { - public: - ////////////////////////////////////////////////////////////////////////// - // Bus configuration - static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single; // we have one bus that we always broadcast to - static const AZ::EBusHandlerPolicy HandlerPolicy = AZ:: EBusHandlerPolicy::Multiple; // we can have multiple listeners - ////////////////////////////////////////////////////////////////////////// - typedef AZ::EBus Bus; - typedef Bus::Handler Handler; - - //virtual void EventRequestEventFocus(AZ::s64 eventIdx) = 0; - virtual void EventRequestOpenFile(AZStd::string fileName) = 0; - virtual void EventRequestOpenWorkspace(AZStd::string fileName) = 0; - - virtual ~DrillerDataViewMessages() {} - }; - - // messages going FROM any data viewers TO the capture window - class DrillerCaptureWindowInterface : public AZ::EBusTraits - { - public: - ////////////////////////////////////////////////////////////////////////// - // Bus configuration - static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::ById; // components have an actual ID that they report back on - static const AZ::EBusHandlerPolicy HandlerPolicy = AZ:: EBusHandlerPolicy::Multiple; // we can have multiple listeners - ////////////////////////////////////////////////////////////////////////// - typedef int BusIdType; - - virtual void ScrubToFrameRequest(FrameNumberType frameType) = 0; - }; - - typedef AZ::EBus DrillerCaptureWindowRequestBus; - -} - -#endif//DRILLER_DRILLERMAINWINDOWMESSAGES_H diff --git a/Code/Tools/Standalone/Source/Driller/DrillerNetworkMessages.h b/Code/Tools/Standalone/Source/Driller/DrillerNetworkMessages.h deleted file mode 100644 index ca39689278..0000000000 --- a/Code/Tools/Standalone/Source/Driller/DrillerNetworkMessages.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef DRILLER_DRILLERNETWORKMESSAGES_H -#define DRILLER_DRILLERNETWORKMESSAGES_H - -#include -#include - -#include - -#pragma once - -namespace Driller -{ - // forward declarations - class Aggregator; - - // messages going FROM the Driller Network TO anyone interested in watching data (ie. driller main window) - - class DrillerNetworkMessages - : public AZ::EBusTraits - { - public: - ////////////////////////////////////////////////////////////////////////// - // Bus configuration - static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::ById; // components have an actual ID that they report back on - static const AZ::EBusHandlerPolicy HandlerPolicy = AZ:: EBusHandlerPolicy::Multiple; // we can have multiple listeners - ////////////////////////////////////////////////////////////////////////// - typedef int BusIdType; - typedef AZ::EBus Bus; - typedef Bus::Handler Handler; - - typedef AZStd::vector AggregatorList; - - virtual void ConnectedToNetwork() = 0; - virtual void NewAggregatorList(AggregatorList& theList) = 0; - virtual void AddAggregator(Aggregator& theAggregator) = 0; - virtual void DiscardAggregators() = 0; - virtual void DisconnectedFromNetwork() = 0; - virtual void EndFrame(int frame) = 0; - virtual void NewAggregatorsAvailable() = 0; - - virtual ~DrillerNetworkMessages() {} - }; -} - -#endif//DRILLER_DRILLERNETWORKMESSAGES_H diff --git a/Code/Tools/Standalone/Source/Driller/DrillerOperationTelemetryEvent.cpp b/Code/Tools/Standalone/Source/Driller/DrillerOperationTelemetryEvent.cpp deleted file mode 100644 index 25bc2871a9..0000000000 --- a/Code/Tools/Standalone/Source/Driller/DrillerOperationTelemetryEvent.cpp +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ -#include "DrillerOperationTelemetryEvent.h" - -namespace Driller -{ - static int k_windowId = 0; - - DrillerWindowLifepsanTelemetry::DrillerWindowLifepsanTelemetry(const char* windowName) - : m_windowId(k_windowId++) - , m_windowName(windowName) - { - m_telemetryEvent.SetAttribute("WindowOpen", m_windowName); - m_telemetryEvent.SetMetric("WindowId", m_windowId); - m_telemetryEvent.Log(); - m_telemetryEvent.ResetEvent(); - } - - DrillerWindowLifepsanTelemetry::~DrillerWindowLifepsanTelemetry() - { - m_telemetryEvent.SetAttribute("WindowClose", m_windowName); - m_telemetryEvent.SetMetric("WindowId", m_windowId); - m_telemetryEvent.Log(); - } -} diff --git a/Code/Tools/Standalone/Source/Driller/DrillerOperationTelemetryEvent.h b/Code/Tools/Standalone/Source/Driller/DrillerOperationTelemetryEvent.h deleted file mode 100644 index 8df7806ba3..0000000000 --- a/Code/Tools/Standalone/Source/Driller/DrillerOperationTelemetryEvent.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef DRILLER_DRILLEROPERATIONTELEMETRYEVENT_H -#define DRILLER_DRILLEROPERATIONTELEMETRYEVENT_H - -#include - -#include "Source/Telemetry/TelemetryEvent.h" - -namespace Driller -{ - // A class for any general Driller Operations(i.e. something which doesn't strictly related - // to a specific window, for those a localized window operation should be used). - class DrillerOperationTelemetryEvent - : public Telemetry::TelemetryEvent - { - public: - DrillerOperationTelemetryEvent() - : Telemetry::TelemetryEvent("DrillerOperation") - { - } - }; - - class DrillerWindowLifepsanTelemetry - { - public: - DrillerWindowLifepsanTelemetry(const char* windowName); - virtual ~DrillerWindowLifepsanTelemetry(); - - private: - int m_windowId; - AZStd::string m_windowName; - DrillerOperationTelemetryEvent m_telemetryEvent; - }; -} - -#endif diff --git a/Code/Tools/Standalone/Source/Driller/EventTrace/EventTraceDataAggregator.cpp b/Code/Tools/Standalone/Source/Driller/EventTrace/EventTraceDataAggregator.cpp deleted file mode 100644 index 1d90140dd4..0000000000 --- a/Code/Tools/Standalone/Source/Driller/EventTrace/EventTraceDataAggregator.cpp +++ /dev/null @@ -1,224 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include -#include -#include - -#include -#include - -#include "EventTraceDataAggregator.h" -#include "EventTraceEvents.h" - -#include - -#include -#include -#include -#include - -namespace Driller -{ - namespace Platform - { - void LaunchExplorerSelect(const QString& filePath); - } - - namespace - { - const QString ExportFolder = "EventTrace"; - } - - EventTraceDataAggregator::EventTraceDataAggregator(int identity) - : Aggregator(identity) - { - m_parser.SetAggregator(this); - } - - EventTraceDataAggregator::~EventTraceDataAggregator() - { - } - - float EventTraceDataAggregator::ValueAtFrame(FrameNumberType frame) - { - const float maxEventsPerFrame = 1000.0f; // just a scale number - float numEventsPerFrame = static_cast(NumOfEventsAtFrame(frame)); - return AZStd::GetMin(numEventsPerFrame / maxEventsPerFrame, 1.0f) * 2.0f - 1.0f; - } - - QColor EventTraceDataAggregator::GetColor() const - { - return QColor(0, 255, 255); - } - - QString EventTraceDataAggregator::GetName() const - { - return "Chrome Tracing"; - } - - QString EventTraceDataAggregator::GetChannelName() const - { - return ChannelName(); - } - - QString EventTraceDataAggregator::GetDescription() const - { - return "Timed scope driller"; - } - - QString EventTraceDataAggregator::GetToolTip() const - { - return "Timed scope event profiler which exports to Chrome Tracing"; - } - - AZ::Uuid EventTraceDataAggregator::GetID() const - { - return AZ::Uuid("{3E47A533-55A4-4E36-B420-063270E4D5DF}"); - } - - rapidjson::Document EventTraceDataAggregator::MakeJsonRepresentation( - FrameNumberType frameBegin, - FrameNumberType frameEnd) const - { - AZ_Assert(frameBegin >= 0 && frameEnd < GetFrameCount() && frameBegin <= frameEnd, "Invalid frame range for chrome trace export"); - - rapidjson::Document rootObj(rapidjson::kObjectType); - auto& allocator = rootObj.GetAllocator(); - - rapidjson::Value traceEvents(rapidjson::kArrayType); - - auto addMemberStr = [&allocator](rapidjson::Value& obj, const char* key, const char* str) - { - rapidjson::Value k(rapidjson::StringRef(key), allocator); - rapidjson::Value v(rapidjson::StringRef(str), allocator); - obj.AddMember(k.Move(), v.Move(), allocator); - }; - - auto addMemberU64 = [&allocator](rapidjson::Value& obj, const char* key, AZ::u64 value) - { - rapidjson::Value k(rapidjson::StringRef(key), allocator); - rapidjson::Value v(static_cast(value)); - obj.AddMember(k.Move(), v.Move(), allocator); - }; - - auto addMemberObj = [&allocator](rapidjson::Value& obj, const char* key, rapidjson::Value& value) - { - rapidjson::Value k(rapidjson::StringRef(key), allocator); - obj.AddMember(k.Move(), value.Move(), allocator); - }; - - const EventNumberType FrameBeginIndex = GetFirstIndexAtFrame(frameBegin); - const EventNumberType FrameEndIndex = GetFirstIndexAtFrame(frameEnd) + NumOfEventsAtFrame(frameEnd); - - for (EventNumberType index = FrameBeginIndex; index < FrameEndIndex; ++index) - { - const DrillerEvent& event = static_cast(*GetEvents()[index]); - - switch (event.GetEventType()) - { - case EventTrace::ET_SLICE: - { - const EventTrace::SliceEvent& slice = static_cast(event); - rapidjson::Value obj(rapidjson::kObjectType); - addMemberStr(obj, "name", slice.m_Name); - addMemberStr(obj, "cat", slice.m_Category); - addMemberStr(obj, "ph", "X"); - addMemberU64(obj, "ts", slice.m_Timestamp); - addMemberU64(obj, "dur", slice.m_Duration); - addMemberU64(obj, "tid", slice.m_ThreadId); - addMemberU64(obj, "pid", 0); - - traceEvents.PushBack(obj, allocator); - } break; - - case EventTrace::ET_INSTANT: - { - const EventTrace::InstantEvent& instant = static_cast(event); - - rapidjson::Value obj(rapidjson::kObjectType); - addMemberStr(obj, "name", instant.m_Name); - addMemberStr(obj, "cat", instant.m_Category); - addMemberStr(obj, "ph", "i"); - addMemberU64(obj, "ts", instant.m_Timestamp); - addMemberStr(obj, "s", instant.GetScopeName()); - addMemberU64(obj, "tid", instant.m_ThreadId); - addMemberU64(obj, "pid", 0); - - traceEvents.PushBack(obj, allocator); - - } break; - - case EventTrace::ET_THREAD_INFO: - { - const EventTrace::ThreadInfoEvent& threadInfo = static_cast(event); - rapidjson::Value obj(rapidjson::kObjectType); - - rapidjson::Value args(rapidjson::kObjectType); - addMemberStr(args, "name", threadInfo.m_Name); - - addMemberStr(obj, "name", "thread_name"); - addMemberStr(obj, "ph", "M"); - addMemberU64(obj, "pid", 0); - addMemberU64(obj, "tid", threadInfo.m_ThreadId); - addMemberObj(obj, "args", args); - - traceEvents.PushBack(obj, allocator); - } break; - } - } - - addMemberObj(rootObj, "traceEvents", traceEvents); - return rootObj; - } - - QWidget* EventTraceDataAggregator::DrillDownRequest(FrameNumberType atFrame) - { - const FrameNumberType FrameCountToExport = 10; - const FrameNumberType FrameCountToExportDiv2 = FrameCountToExport / 2; - - QString filename = "Frame_" + QString::number(atFrame) + ".chrometrace"; - QFileInfo fileInfo(QCoreApplication::applicationDirPath() + "/" + ExportFolder, filename); - ExportChromeTrace(fileInfo.absoluteFilePath(), atFrame - FrameCountToExportDiv2, atFrame + FrameCountToExportDiv2); - Platform::LaunchExplorerSelect(fileInfo.absoluteFilePath()); - return nullptr; - } - - void EventTraceDataAggregator::ExportChromeTrace(const QString& filename, FrameNumberType frameStart, FrameNumberType frameEnd) const - { - AZ::IO::SystemFile exportFile; - if (exportFile.Open(filename.toStdString().c_str(), AZ::IO::SystemFile::SF_OPEN_CREATE | AZ::IO::SystemFile::SF_OPEN_CREATE_PATH | AZ::IO::SystemFile::SF_OPEN_WRITE_ONLY)) - { - ExportChromeTrace(exportFile, frameStart, frameEnd); - } - exportFile.Close(); - } - - void EventTraceDataAggregator::ExportChromeTrace(AZ::IO::SystemFile& file, FrameNumberType frameStart, FrameNumberType frameEnd) const - { - frameStart = AZStd::max(frameStart, 0); - frameEnd = AZStd::min(frameEnd, (FrameNumberType)GetFrameCount() - 1); - - if (frameStart <= frameEnd) - { - rapidjson::Document jsonRep = MakeJsonRepresentation(frameStart, frameEnd); - - rapidjson::StringBuffer buffer; - rapidjson::Writer writer(buffer); - jsonRep.Accept(writer); - - file.Write(buffer.GetString(), buffer.GetSize()); - } - } - - void EventTraceDataAggregator::ExportColumnDescriptorToCSV(AZ::IO::SystemFile& file, CSVExportSettings* exportSettings) - { - (void)exportSettings; - ExportChromeTrace(file, 0, (FrameNumberType)GetFrameCount() - 1); - } -} diff --git a/Code/Tools/Standalone/Source/Driller/EventTrace/EventTraceDataAggregator.h b/Code/Tools/Standalone/Source/Driller/EventTrace/EventTraceDataAggregator.h deleted file mode 100644 index 0437e04017..0000000000 --- a/Code/Tools/Standalone/Source/Driller/EventTrace/EventTraceDataAggregator.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#pragma once - -#if !defined(Q_MOC_RUN) -#include -#include -#include -#include "EventTraceDataParser.h" - -#include -#include - -#include -#endif - -namespace Driller -{ - class EventTraceDataAggregator - : public Aggregator - { - Q_OBJECT; - public: - AZ_RTTI(EventTraceDataAggregator, "{D82CC9CF-5477-4A3E-8809-C064D19963F8}"); - AZ_CLASS_ALLOCATOR(EventTraceDataAggregator, AZ::SystemAllocator, 0); - - EventTraceDataAggregator(int identity = 0); - virtual ~EventTraceDataAggregator(); - - static AZ::u32 DrillerId() - { - return EventTraceDataParser::GetDrillerId(); - } - - AZ::u32 GetDrillerId() const override - { - return DrillerId(); - } - - static const char* ChannelName() - { - return "ChromeTracing"; - } - - AZ::Crc32 GetChannelId() const override - { - return AZ::Crc32(ChannelName()); - } - - AZ::Debug::DrillerHandlerParser* GetDrillerDataParser() override - { - return &m_parser; - } - - bool CanExportToCSV() const override - { - return true; - } - - void ExportColumnDescriptorToCSV(AZ::IO::SystemFile& file, CSVExportSettings* exportSettings) override; - - void ApplySettingsFromWorkspace(WorkspaceSettingsProvider*) override {} - void ActivateWorkspaceSettings(WorkspaceSettingsProvider*) override {} - void SaveSettingsToWorkspace(WorkspaceSettingsProvider*) override {} - - public slots: - float ValueAtFrame(FrameNumberType frame) override; - QColor GetColor() const override; - QString GetChannelName() const override; - QString GetName() const override; - QString GetDescription() const override; - QString GetToolTip() const override; - AZ::Uuid GetID() const override; - void OptionsRequest() override {} - - QWidget* DrillDownRequest(FrameNumberType frame) override; - - private: - rapidjson::Document MakeJsonRepresentation(FrameNumberType frameStart, FrameNumberType frameEnd) const; - void ExportChromeTrace(AZ::IO::SystemFile& file, FrameNumberType frameStart, FrameNumberType frameEnd) const; - void ExportChromeTrace(const QString& filename, FrameNumberType frameStart, FrameNumberType frameEnd) const; - - EventTraceDataParser m_parser; - }; -} diff --git a/Code/Tools/Standalone/Source/Driller/EventTrace/EventTraceDataParser.cpp b/Code/Tools/Standalone/Source/Driller/EventTrace/EventTraceDataParser.cpp deleted file mode 100644 index 73f2452212..0000000000 --- a/Code/Tools/Standalone/Source/Driller/EventTrace/EventTraceDataParser.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "EventTraceDataParser.h" -#include "EventTraceDataAggregator.h" -#include "EventTraceEvents.h" - -namespace Driller -{ - AZ::Debug::DrillerHandlerParser* EventTraceDataParser::OnEnterTag(AZ::u32 tagName) - { - AZ_Assert(m_data, "You must set a valid aggregator before we can process the data!"); - if (tagName == AZ_CRC("Slice")) - { - m_data->AddEvent(aznew EventTrace::SliceEvent()); - return this; - } - else if (tagName == AZ_CRC("Instant")) - { - m_data->AddEvent(aznew EventTrace::InstantEvent()); - return this; - } - else if (tagName == AZ_CRC("ThreadInfo")) - { - m_data->AddEvent(aznew EventTrace::ThreadInfoEvent()); - return this; - } - return nullptr; - } - - void EventTraceDataParser::OnData(const AZ::Debug::DrillerSAXParser::Data& dataNode) - { - AZ_Assert(m_data, "You must set a valid aggregator before we can process the data!"); - - DrillerEvent& drillerEvent = static_cast(*m_data->GetEvents().back()); - - switch (drillerEvent.GetEventType()) - { - case EventTrace::ET_SLICE: - { - EventTrace::SliceEvent& slice = static_cast(drillerEvent); - if (dataNode.m_name == AZ_CRC("Name")) - { - slice.m_Name = dataNode.ReadPooledString(); - } - if (dataNode.m_name == AZ_CRC("Category")) - { - slice.m_Category = dataNode.ReadPooledString(); - } - else if (dataNode.m_name == AZ_CRC("ThreadId")) - { - dataNode.Read(slice.m_ThreadId); - } - else if (dataNode.m_name == AZ_CRC("Timestamp")) - { - dataNode.Read(slice.m_Timestamp); - } - else if (dataNode.m_name == AZ_CRC("Duration")) - { - dataNode.Read(slice.m_Duration); - } - } break; - - case EventTrace::ET_INSTANT: - { - EventTrace::InstantEvent& instant = static_cast(drillerEvent); - if (dataNode.m_name == AZ_CRC("Name")) - { - instant.m_Name = dataNode.ReadPooledString(); - } - if (dataNode.m_name == AZ_CRC("Category")) - { - instant.m_Category = dataNode.ReadPooledString(); - } - else if (dataNode.m_name == AZ_CRC("ThreadId")) - { - dataNode.Read(instant.m_ThreadId); - } - else if (dataNode.m_name == AZ_CRC("Timestamp")) - { - dataNode.Read(instant.m_Timestamp); - } - - } break; - - case EventTrace::ET_THREAD_INFO: - { - EventTrace::ThreadInfoEvent& threadInfo = static_cast(drillerEvent); - if (dataNode.m_name == AZ_CRC("Name")) - { - threadInfo.m_Name = dataNode.ReadPooledString(); - } - else if (dataNode.m_name == AZ_CRC("ThreadId")) - { - dataNode.Read(threadInfo.m_ThreadId); - } - - } break; - } - } -} // namespace Driller diff --git a/Code/Tools/Standalone/Source/Driller/EventTrace/EventTraceDataParser.h b/Code/Tools/Standalone/Source/Driller/EventTrace/EventTraceDataParser.h deleted file mode 100644 index b41dd1ee01..0000000000 --- a/Code/Tools/Standalone/Source/Driller/EventTrace/EventTraceDataParser.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#pragma once - -#include - -namespace Driller -{ - class EventTraceDataAggregator; - - class EventTraceDataParser - : public AZ::Debug::DrillerHandlerParser - { - public: - EventTraceDataParser() - : m_data(NULL) - {} - - static AZ::u32 GetDrillerId() - { - return AZ_CRC("EventTraceDriller"); - } - - void SetAggregator(EventTraceDataAggregator* data) - { - m_data = data; - } - - virtual AZ::Debug::DrillerHandlerParser* OnEnterTag(AZ::u32 tagName); - virtual void OnData(const AZ::Debug::DrillerSAXParser::Data& dataNode); - - protected: - EventTraceDataAggregator* m_data; - }; -} diff --git a/Code/Tools/Standalone/Source/Driller/EventTrace/EventTraceEvents.h b/Code/Tools/Standalone/Source/Driller/EventTrace/EventTraceEvents.h deleted file mode 100644 index 6458a6729b..0000000000 --- a/Code/Tools/Standalone/Source/Driller/EventTrace/EventTraceEvents.h +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#pragma once - -#include -#include - -namespace Driller -{ - namespace EventTrace - { - enum EventType - { - ET_SLICE, - ET_INSTANT, - ET_THREAD_INFO - }; - - class SliceEvent : public DrillerEvent - { - public: - AZ_CLASS_ALLOCATOR(SliceEvent, AZ::SystemAllocator, 0) - - SliceEvent() - : DrillerEvent(ET_SLICE) - , m_Name{ "" } - , m_Category{ "" } - , m_ThreadId{} - , m_Timestamp{} - , m_Duration{} - {} - - // no stepping as we can just traverse the list of events - virtual void StepForward(Aggregator* data) { (void)data; } - virtual void StepBackward(Aggregator* data) { (void)data; } - - const char* m_Name; - const char* m_Category; - size_t m_ThreadId; - AZStd::sys_time_t m_Timestamp; - AZStd::sys_time_t m_Duration; - }; - - class InstantEvent : public DrillerEvent - { - public: - AZ_CLASS_ALLOCATOR(InstantEvent, AZ::SystemAllocator, 0) - - InstantEvent() - : DrillerEvent(ET_INSTANT) - , m_Name{ "" } - , m_Category{ "" } - , m_ThreadId{} - , m_Timestamp{} - {} - - // no stepping as we can just traverse the list of events - virtual void StepForward(Aggregator* data) { (void)data; } - virtual void StepBackward(Aggregator* data) { (void)data; } - - const char* GetScopeName() const - { - return (m_ThreadId == 0) ? "g" : "t"; - } - - const char* m_Name; - const char* m_Category; - size_t m_ThreadId; - AZStd::sys_time_t m_Timestamp; - }; - - class ThreadInfoEvent : public DrillerEvent - { - public: - AZ_CLASS_ALLOCATOR(ThreadInfoEvent, AZ::SystemAllocator, 0) - - ThreadInfoEvent() - : DrillerEvent(ET_THREAD_INFO) - , m_ThreadId{} - , m_Name{ "" } - {} - - // no stepping as we can just traverse the list of events - virtual void StepForward(Aggregator* data) { (void)data; } - virtual void StepBackward(Aggregator* data) { (void)data; } - - size_t m_ThreadId; - const char* m_Name; - }; - } - -} // namespace Driller diff --git a/Code/Tools/Standalone/Source/Driller/FilteredListView.cpp b/Code/Tools/Standalone/Source/Driller/FilteredListView.cpp deleted file mode 100644 index 66e32e7d05..0000000000 --- a/Code/Tools/Standalone/Source/Driller/FilteredListView.cpp +++ /dev/null @@ -1,212 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "Source/Driller/FilteredListView.hxx" -#include -#include - -#include -#include - -#include - -namespace Driller -{ - ///////////////////// - // FilteredListView - ///////////////////// - - FilteredListView::FilteredListView(QWidget* parent) - : QWidget(parent) - , m_gui(new Ui::FilteredListView()) - , m_enableCustomOrdering(true) - { - m_gui->setupUi(this); - - m_stringListModel.setStringList(m_stringList); - m_filteredModel.setSourceModel(&m_stringListModel); - - m_gui->listView->setModel(&m_filteredModel); - m_gui->listView->setEditTriggers(QAbstractItemView::NoEditTriggers); - - QObject::connect(m_gui->filter, SIGNAL(textChanged(const QString&)), this, SLOT(filterEdited(const QString&))); - QObject::connect(m_gui->moveUp, SIGNAL(clicked()), this, SLOT(moveSelectionUp())); - QObject::connect(m_gui->moveDown, SIGNAL(clicked()), this, SLOT(moveSelectionDown())); - - m_gui->moveUp->setAutoDefault(false); - m_gui->moveDown->setAutoDefault(false); - } - - FilteredListView::~FilteredListView() - { - delete m_gui; - } - - void FilteredListView::addItem(const char* item) - { - m_stringList.push_back(QString(item)); - m_stringListModel.setStringList(m_stringList); - } - - void FilteredListView::addItems(const QStringList& items) - { - m_stringList.append(items); - m_stringListModel.setStringList(m_stringList); - } - - void FilteredListView::removeItem(const char* item) - { - m_stringList.removeOne(QString(item)); - m_stringListModel.setStringList(m_stringList); - } - - void FilteredListView::removeItems(const QStringList& items) - { - for (const QString& item : items) - { - m_stringList.removeOne(item); - } - - m_stringListModel.setStringList(m_stringList); - } - - void FilteredListView::clearItems() - { - m_stringList.clear(); - m_stringListModel.setStringList(m_stringList); - } - - void FilteredListView::removeSelected() - { - const QModelIndexList& selectedIndexes = m_gui->listView->selectionModel()->selectedIndexes(); - - for (const QModelIndex& modelIndex : selectedIndexes) - { - QString item = modelIndex.data(Qt::DisplayRole).toString(); - - m_stringList.removeOne(item); - } - - m_gui->listView->selectionModel()->clearSelection(); - m_stringListModel.setStringList(m_stringList); - } - - const QStringList& FilteredListView::getAllItems() const - { - return m_stringList; - } - - void FilteredListView::getSelectedItems(QStringList& selectedItems) const - { - const QModelIndexList& selectedIndexes = m_gui->listView->selectionModel()->selectedIndexes(); - - for (const QModelIndex& modelIndex : selectedIndexes) - { - QString item = modelIndex.data(Qt::DisplayRole).toString(); - selectedItems.push_back(item); - } - } - - void FilteredListView::enableCustomOrdering(bool enabled) - { - m_enableCustomOrdering = enabled; - - setButtonsEnabled(m_enableCustomOrdering); - } - - void FilteredListView::filterEdited(const QString& eventFilter) - { - m_gui->listView->selectionModel()->clearSelection(); - m_filteredModel.setFilterRegExp(eventFilter); - setButtonsEnabled(eventFilter.isEmpty() && m_enableCustomOrdering); - } - - void FilteredListView::moveSelectionUp() - { - const QModelIndexList& selectedIndexes = m_gui->listView->selectionModel()->selectedIndexes(); - - AZStd::set sortedIndexes; - - for (const QModelIndex& index : selectedIndexes) - { - sortedIndexes.insert(index.row()); - } - - int lastSelectedRow = -1; - AZStd::unordered_set selectedRows; - - for (int row : sortedIndexes) - { - if (row > 0 && row > lastSelectedRow + 1) - { - m_stringList.swapItemsAt(row, row - 1); - - // Update the row to reflect it's new position. - row = row - 1; - } - - lastSelectedRow = row; - selectedRows.insert(row); - } - - m_gui->listView->selectionModel()->clear(); - - m_stringListModel.setStringList(m_stringList); - - for (int row : selectedRows) - { - m_gui->listView->selectionModel()->select(m_stringListModel.index(row, 0), QItemSelectionModel::Select); - } - } - - void FilteredListView::moveSelectionDown() - { - const QModelIndexList& selectedIndexes = m_gui->listView->selectionModel()->selectedIndexes(); - - AZStd::set sortedIndexes; - - for (const QModelIndex& index : selectedIndexes) - { - sortedIndexes.insert(index.row()); - } - - int lastSelectedRow = m_stringList.size(); - AZStd::unordered_set selectedRows; - - for (AZStd::set::reverse_iterator iter = sortedIndexes.rbegin(); - iter != sortedIndexes.rend(); - ++iter) - { - int row = (*iter); - - if (row < m_stringList.size() - 1 && row < lastSelectedRow - 1) - { - m_stringList.swapItemsAt(row, row + 1); - row = row + 1; - } - - lastSelectedRow = row; - selectedRows.insert(row); - } - - m_gui->listView->selectionModel()->clear(); - - m_stringListModel.setStringList(m_stringList); - - for (int row : selectedRows) - { - m_gui->listView->selectionModel()->select(m_stringListModel.index(row, 0), QItemSelectionModel::Select); - } - } - - void FilteredListView::setButtonsEnabled(bool enabled) - { - m_gui->moveDown->setEnabled(enabled); - m_gui->moveUp->setEnabled(enabled); - } -} diff --git a/Code/Tools/Standalone/Source/Driller/FilteredListView.hxx b/Code/Tools/Standalone/Source/Driller/FilteredListView.hxx deleted file mode 100644 index 3c2531157d..0000000000 --- a/Code/Tools/Standalone/Source/Driller/FilteredListView.hxx +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef AZTOOLSFRAMEWORK_UI_UICORE_FILTEREDLISTVIEW_H -#define AZTOOLSFRAMEWORK_UI_UICORE_FILTEREDLISTVIEW_H - -#if !defined(Q_MOC_RUN) -#include -#include - -#pragma once - -#include -#include -#include -#include -#include -#endif - -namespace Ui -{ - class FilteredListView; -} - -namespace Driller -{ - // This widget allows for easy access to a filtered list view that can also be rearranged by the user. - // Useful for things like determining column order, or export fields. - class FilteredListView - : public QWidget - { - Q_OBJECT - - // Apparently we can't just have a non-sorted model... - class FilteredProxyModel : public QSortFilterProxyModel - { - void sort(int column, Qt::SortOrder order) - { - (void) column; (void)order; - } - }; - - public: - AZ_CLASS_ALLOCATOR(FilteredListView, AZ::SystemAllocator,0); - - explicit FilteredListView(QWidget* parent = nullptr); - ~FilteredListView(); - - void addItem(const char* item); - void addItems(const QStringList& items); - - void removeItem(const char* item); - void removeItems(const QStringList& items); - - void clearItems(); - - void removeSelected(); - - void setFilterString(const char* filterString); - const char* getFilterString() const; - - const QStringList& getAllItems() const; - void getSelectedItems(QStringList& selectedItems) const; - - void enableCustomOrdering(bool enabled); - - public slots: - void filterEdited(const QString& eventFilter); - void moveSelectionUp(); - void moveSelectionDown(); - - private: - - void setButtonsEnabled(bool enabled); - - Ui::FilteredListView* m_gui; - bool m_enableCustomOrdering; - FilteredProxyModel m_filteredModel; - QStringListModel m_stringListModel; - QStringList m_stringList; - }; -} - -#endif diff --git a/Code/Tools/Standalone/Source/Driller/FilteredListView.ui b/Code/Tools/Standalone/Source/Driller/FilteredListView.ui deleted file mode 100644 index 5b182f766f..0000000000 --- a/Code/Tools/Standalone/Source/Driller/FilteredListView.ui +++ /dev/null @@ -1,124 +0,0 @@ - - - FilteredListView - - - - 0 - 0 - 320 - 463 - - - - Form - - - - 5 - - - 5 - - - 5 - - - 5 - - - 5 - - - - - - - - false - - - false - - - QAbstractItemView::ExtendedSelection - - - QAbstractItemView::SelectRows - - - false - - - - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - ^ - - - false - - - false - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 50 - 20 - - - - - - - - V - - - false - - - - - - - - - - - diff --git a/Code/Tools/Standalone/Source/Driller/GenericCustomizeCSVExportWidget.cpp b/Code/Tools/Standalone/Source/Driller/GenericCustomizeCSVExportWidget.cpp deleted file mode 100644 index 59884c9b0e..0000000000 --- a/Code/Tools/Standalone/Source/Driller/GenericCustomizeCSVExportWidget.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "Source/Driller/GenericCustomizeCSVExportWidget.hxx" -#include -#include - -namespace Driller -{ - //////////////////////////////////// - // GenericCustomizeCSVExportWidget - //////////////////////////////////// - - GenericCustomizeCSVExportWidget::GenericCustomizeCSVExportWidget(GenericCSVExportSettings& genericSettings, QWidget* parent) - : CustomizeCSVExportWidget(genericSettings, parent) - , m_exportFieldsDirty(false) - , m_gui(nullptr) - { - m_gui = azcreate(Ui::GenericCustomizeCSVExportWidget, ()); - m_gui->setupUi(this); - - QStringList items; - genericSettings.GetExportItems(items); - m_gui->exportFieldSelector->setItemList(items); - - items.clear(); - - genericSettings.GetActiveExportItems(items); - m_gui->exportFieldSelector->setActiveItems(items); - items.clear(); - - m_gui->exportFieldSelector->setActiveTitle("Exported Fields"); - m_gui->exportFieldSelector->setInactiveTitle("Unused Fields"); - - QObject::connect(m_gui->exportFieldSelector, SIGNAL(ActiveItemsChanged()), this, SLOT(OnActiveItemsChanged())); - QObject::connect(m_gui->addDescriptor, SIGNAL(stateChanged(int)), this, SLOT(OnShouldExportStateDescriptorChecked(int))); - } - - GenericCustomizeCSVExportWidget::~GenericCustomizeCSVExportWidget() - { - azdestroy(m_gui); - } - - void GenericCustomizeCSVExportWidget::FinalizeSettings() - { - if (m_exportFieldsDirty) - { - m_exportFieldsDirty = false; - - GenericCSVExportSettings& exportSettings = static_cast(m_exportSettings); - const QStringList& activeItems = m_gui->exportFieldSelector->getActiveItems(); - - exportSettings.UpdateExportOrdering(activeItems); - } - } - - void GenericCustomizeCSVExportWidget::OnActiveItemsChanged() - { - m_exportFieldsDirty = true; - } -} diff --git a/Code/Tools/Standalone/Source/Driller/GenericCustomizeCSVExportWidget.hxx b/Code/Tools/Standalone/Source/Driller/GenericCustomizeCSVExportWidget.hxx deleted file mode 100644 index 970e3d53c6..0000000000 --- a/Code/Tools/Standalone/Source/Driller/GenericCustomizeCSVExportWidget.hxx +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef DRILLER_GENERICCUSTOMIZECSVEXPORTPANEL_H -#define DRILLER_GENERICCUSTOMIZECSVEXPORTPANEL_H - -#if !defined(Q_MOC_RUN) -#include -#include -#include -#include - -#pragma once - -#include "Source/Driller/CustomizeCSVExportWidget.hxx" -#include "Source/Driller/CSVExportSettings.h" -#endif - -namespace Ui -{ - class GenericCustomizeCSVExportWidget; -} - -namespace Driller -{ - class GenericCSVExportSettings; - - class GenericCustomizeCSVExportWidget - : public CustomizeCSVExportWidget - { - Q_OBJECT - public: - AZ_CLASS_ALLOCATOR(GenericCustomizeCSVExportWidget, AZ::SystemAllocator, 0); - - GenericCustomizeCSVExportWidget(GenericCSVExportSettings& exportSettings, QWidget* parent = nullptr); - ~GenericCustomizeCSVExportWidget(); - - void FinalizeSettings() override; - - public slots: - - void OnActiveItemsChanged(); - - private: - - bool m_exportFieldsDirty; - - Ui::GenericCustomizeCSVExportWidget* m_gui; - }; - - class GenericCSVExportSettings - : public CSVExportSettings - { - friend class GenericCustomizeCSVExportWidget; - public: - GenericCSVExportSettings() - { - } - - virtual void GetExportItems(QStringList& items) const = 0; - virtual void GetActiveExportItems(QStringList& items) const = 0; - - protected: - virtual void UpdateExportOrdering(const QStringList& items) = 0; - }; -} - -#endif diff --git a/Code/Tools/Standalone/Source/Driller/GenericCustomizeCSVExportWidget.ui b/Code/Tools/Standalone/Source/Driller/GenericCustomizeCSVExportWidget.ui deleted file mode 100644 index 5aa2839707..0000000000 --- a/Code/Tools/Standalone/Source/Driller/GenericCustomizeCSVExportWidget.ui +++ /dev/null @@ -1,74 +0,0 @@ - - - GenericCustomizeCSVExportWidget - - - - 0 - 0 - 887 - 413 - - - - Form - - - - - - - 0 - 0 - - - - - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - Add Column Descriptor - - - true - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - Driller::DoubleListSelector - QWidget -
Source/Driller/DoubleListSelector.hxx
- 1 -
-
- - -
diff --git a/Code/Tools/Standalone/Source/Driller/IO/StreamerDataAggregator.cpp b/Code/Tools/Standalone/Source/Driller/IO/StreamerDataAggregator.cpp deleted file mode 100644 index 5e4f0a2323..0000000000 --- a/Code/Tools/Standalone/Source/Driller/IO/StreamerDataAggregator.cpp +++ /dev/null @@ -1,584 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "StreamerDataAggregator.hxx" -#include - -#include "StreamerDrillerDialog.hxx" -#include "StreamerEvents.h" -#include -#include -#include "Woodpecker/Driller/Workspaces/Workspace.h" - -#include -#include - -namespace Driller -{ - class StreamerDataAggregatorSavedState - : public AZ::UserSettings - { - public: - AZ_RTTI(StreamerDataAggregatorSavedState, "{0174A3EE-C555-482F-9E7B-7D67D9B4B0A7}", AZ::UserSettings); - AZ_CLASS_ALLOCATOR(StreamerDataAggregatorSavedState, AZ::SystemAllocator, 0); - StreamerDataAggregatorSavedState() {} - - static void Reflect(AZ::ReflectContext* context) - { - AZ::SerializeContext* serialize = azrtti_cast(context); - if (serialize) - { - serialize->Class() - ->Version(1) - ; - } - } - }; - - // WORKSPACES are files loaded and stored independent of the global application - // designed to be used for DRL data specific view settings and to pass around - class StreamerDataAggregatorWorkspace - : public AZ::UserSettings - { - public: - AZ_RTTI(StreamerDataAggregatorWorkspace, "{D35E8CCA-6FA7-47F6-8A24-8E12EF237E40}", AZ::UserSettings); - AZ_CLASS_ALLOCATOR(StreamerDataAggregatorWorkspace, AZ::SystemAllocator, 0); - - int m_activeViewCount; - AZStd::vector m_activeViewTypes; - - StreamerDataAggregatorWorkspace() - : m_activeViewCount(0) - {} - - static void Reflect(AZ::ReflectContext* context) - { - AZ::SerializeContext* serialize = azrtti_cast(context); - if (serialize) - { - serialize->Class() - ->Field("m_activeViewCount", &StreamerDataAggregatorWorkspace::m_activeViewCount) - ->Field("m_activeViewTypes", &StreamerDataAggregatorWorkspace::m_activeViewTypes) - ->Version(1); - } - } - }; - - ////////////////////////////////////////////////////////////////////////// - StreamerDataAggregator::StreamerDataAggregator(int identity) - : Aggregator(identity) - , m_activeViewCount(0) - , m_highwaterFrame(-1) - { - m_parser.SetAggregator(this); - ResetTrackingInfo(); - } - - StreamerDataAggregator::~StreamerDataAggregator() - { - KillAllViews(); - } - - // gross generalization of activity based on total number of all events this frame - float StreamerDataAggregator::ValueAtFrame(FrameNumberType frame) - { - const float maxEventsPerFrame = 10.0f; // just a scale number - float numEventsPerFrame = static_cast(NumOfEventsAtFrame(frame)); - return AZStd::GetMin(numEventsPerFrame / maxEventsPerFrame, 1.0f) * 2.0f - 1.0f; - } - - QColor StreamerDataAggregator::GetColor() const - { - return QColor(0, 255, 255); - } - - QString StreamerDataAggregator::GetName() const - { - return "Streamer"; - } - - QString StreamerDataAggregator::GetChannelName() const - { - return ChannelName(); - } - - QString StreamerDataAggregator::GetDescription() const - { - return "Streamer events driller"; - } - - QString StreamerDataAggregator::GetToolTip() const - { - return "Streamer Events"; - } - - AZ::Uuid StreamerDataAggregator::GetID() const - { - return AZ::Uuid("{9A2854C8-8106-4075-9287-3E047821D934}"); - } - - QWidget* StreamerDataAggregator::DrillDownRequest(FrameNumberType frame) - { - StreamerDrillerDialog* dialog = NULL; - - AZ::u32 availableIdx = 0; - bool foundASpot = true; - do - { - foundASpot = true; - for (DataViewMap::iterator iter = m_dataViews.begin(); iter != m_dataViews.end(); ++iter) - { - if (iter->second == availableIdx) - { - foundASpot = false; - ++availableIdx; - break; - } - } - } while (!foundASpot); - - dialog = aznew StreamerDrillerDialog(this, frame, (1024 * GetIdentity()) + availableIdx); - if (dialog) - { - m_dataViews[dialog] = availableIdx; - connect(dialog, SIGNAL(destroyed(QObject*)), this, SLOT(OnDataViewDestroyed(QObject*))); - ++m_activeViewCount; - } - - return dialog; - } - - QWidget* StreamerDataAggregator::DrillDownRequest(FrameNumberType frame, int type) - { - StreamerDrillerDialog* view = static_cast(DrillDownRequest(frame)); - if (view) - { - view->SetChartType(type); - } - - return view; - } - - void StreamerDataAggregator::OptionsRequest() - { - QMenu* popupMenu = new QMenu(); - QMenu* cachedHitsTypeMenu = new QMenu(tr("Cached Hits")); - cachedHitsTypeMenu->addAction(tr("Do Not Report Cache Hits")); - cachedHitsTypeMenu->addAction(tr("Report Cache Hits")); - popupMenu->addMenu(cachedHitsTypeMenu); - QAction* act = cachedHitsTypeMenu->exec(QCursor::pos()); - if (act) - { - if (act->text() == tr("Report Cache Hits")) - { - m_parser.AllowCacheHitsInReportedStream(true); - } - if (act->text() == tr("Do Not Report Cache Hits")) - { - m_parser.AllowCacheHitsInReportedStream(false); - } - } - } - - void StreamerDataAggregator::OnDataViewDestroyed(QObject* dataView) - { - m_dataViews.erase(dataView); - --m_activeViewCount; - } - - void StreamerDataAggregator::KillAllViews() - { - do - { - DataViewMap::iterator iter = m_dataViews.begin(); - if (iter != m_dataViews.end()) - { - delete iter->first; - continue; - } - break; - } while (1); - } - - void StreamerDataAggregator::ApplySettingsFromWorkspace(WorkspaceSettingsProvider* provider) - { - StreamerDataAggregatorWorkspace* workspace = provider->FindSetting(AZ_CRC("STREAMER DATA AGGREGATOR WORKSPACE", 0x105be192)); - if (workspace) - { - m_activeViewCount = workspace->m_activeViewCount; - } - } - void StreamerDataAggregator::ActivateWorkspaceSettings(WorkspaceSettingsProvider* provider) - { - StreamerDataAggregatorWorkspace* workspace = provider->FindSetting(AZ_CRC("STREAMER DATA AGGREGATOR WORKSPACE", 0x105be192)); - if (workspace) - { - // kill all existing data view windows in preparation of opening the workspace specified ones - KillAllViews(); - - // the internal count should be 0 from the above house cleaning - // and incremented back up from the workspace instantiations - m_activeViewCount = 0; - for (int i = 0; i < workspace->m_activeViewCount; ++i) - { - //// start this check to default - int discoveredType = 0; - if (workspace->m_activeViewTypes.size() > i) - { - discoveredType = workspace->m_activeViewTypes[i]; - } - - Driller::StreamerDrillerDialog* dataView = qobject_cast(DrillDownRequest(1, discoveredType)); - if (dataView) - { - // apply will overlay the workspace settings on top of the local user settings - dataView->ApplySettingsFromWorkspace(provider); - // activate will do the heavy lifting - dataView->ActivateWorkspaceSettings(provider); - } - } - } - } - void StreamerDataAggregator::SaveSettingsToWorkspace(WorkspaceSettingsProvider* provider) - { - StreamerDataAggregatorWorkspace* workspace = provider->CreateSetting(AZ_CRC("STREAMER DATA AGGREGATOR WORKSPACE", 0x105be192)); - if (workspace) - { - workspace->m_activeViewTypes.clear(); - workspace->m_activeViewCount = m_activeViewCount; - - for (DataViewMap::iterator iter = m_dataViews.begin(); iter != m_dataViews.end(); ++iter) - { - Driller::StreamerDrillerDialog* dataView = qobject_cast(iter->first); - if (dataView) - { - workspace->m_activeViewTypes.push_back(dataView->GetViewType()); - dataView->SaveSettingsToWorkspace(provider); - } - } - } - } - - //========================================================================= - // Reset - // [7/10/2013] - //========================================================================= - void StreamerDataAggregator::Reset() - { - m_devices.clear(); - m_streams.clear(); - m_requests.clear(); - m_seeksInfo.clear(); - ResetTrackingInfo(); - } - - void StreamerDataAggregator::ResetTrackingInfo() - { - m_seekTracking.clear(); - m_highwaterFrame = -1; - - // default device with ID := 0 - SeekTrackingInfo seekTrackingInfo; - seekTrackingInfo.m_currentStreamId = 0; - seekTrackingInfo.m_offset = 0; - m_seekTracking.insert(AZStd::make_pair(0, seekTrackingInfo)); - } - - void StreamerDataAggregator::Reflect(AZ::ReflectContext* context) - { - AZ::SerializeContext* serialize = azrtti_cast(context); - if (serialize) - { - StreamerDataAggregatorSavedState::Reflect(context); - StreamerDataAggregatorWorkspace::Reflect(context); - StreamerDrillerDialog::Reflect(context); - - serialize->Class() - ->Version(1) - ; - } - } - - void StreamerDataAggregator::AdvanceToFrame(FrameNumberType frame) - { - while (m_highwaterFrame < frame) - { - ++m_highwaterFrame; - FrameChanged(m_highwaterFrame); - - m_frameInfo.push_back(); - m_frameInfo.back().m_computedSeeksCount = 0; - m_frameInfo.back().m_computedThroughput = 0; - - AZ::s64 numEvents = NumOfEventsAtFrame(m_highwaterFrame); - if (numEvents) - { - AZ::s64 firstIndex = GetFirstIndexAtFrame(m_highwaterFrame); - - for (AZ::s64 idx = 0; idx < numEvents; ++idx) - { - DrillerEvent* dep = m_events[ idx + firstIndex ]; - AZ::u64 geid = dep->GetGlobalEventId(); - - switch (dep->GetEventType()) - { - case Driller::Streamer::SET_DEVICE_MOUNTED: - { - SeekTrackingInfo seekTrackingInfo; - seekTrackingInfo.m_currentStreamId = 0; - seekTrackingInfo.m_offset = 0; - m_seekTracking.insert(AZStd::make_pair(static_cast(dep)->m_deviceData.m_id, seekTrackingInfo)); - break; - } - case Driller::Streamer::SET_DEVICE_UNMOUNTED: - { - m_seekTracking.erase(static_cast(dep)->m_unmountedDeviceData->m_id); - break; - } - case Driller::Streamer::SET_ADD_REQUEST: - { - break; - } - case Driller::Streamer::SET_CANCEL_REQUEST: - case Driller::Streamer::SET_RESCHEDULE_REQUEST: - case Driller::Streamer::SET_COMPLETE_REQUEST: - { - break; - } - case Driller::Streamer::SET_REGISTER_STREAM: - case Driller::Streamer::SET_UNREGISTER_STREAM: - { - break; - } - // m_stream := possibly NULL in these two cases - case Driller::Streamer::SET_OPERATION_START: - { - auto depEvt = static_cast(dep); - if (depEvt->m_stream) - { - auto trackedDevice = m_seekTracking.find(depEvt->m_stream->m_deviceId); - if (trackedDevice == m_seekTracking.end()) - { - SeekTrackingInfo seekTrackingInfo; - seekTrackingInfo.m_currentStreamId = 0; - seekTrackingInfo.m_offset = 0; - - m_seekTracking.insert(AZStd::make_pair(depEvt->m_stream->m_deviceId, seekTrackingInfo)); - trackedDevice = m_seekTracking.find(depEvt->m_stream->m_deviceId); - } - // reasons a device might SEEK - if (trackedDevice->second.m_currentStreamId != depEvt->m_streamId) - { - if ( - (depEvt->m_stream->m_isCompressed && depEvt->m_operation.m_type == Streamer::SOP_COMPRESSOR_READ) - || - (!depEvt->m_stream->m_isCompressed) - ) - { - m_frameInfo.back().m_seekInfo.push_back(); - m_frameInfo.back().m_seekInfo.back().m_eventId = geid; - m_frameInfo.back().m_seekInfo.back().m_eventReason = SEEK_EVENT_SWITCH; - trackedDevice->second.m_currentStreamId = depEvt->m_streamId; - trackedDevice->second.m_offset = depEvt->m_operation.m_offset; - ++m_frameInfo.back().m_computedSeeksCount; - m_seeksInfo.insert(AZStd::make_pair(geid, SEEK_EVENT_SWITCH)); - } - } - else if (trackedDevice->second.m_offset != depEvt->m_operation.m_offset) - { - if ( - (depEvt->m_stream->m_isCompressed && depEvt->m_operation.m_type == Streamer::SOP_COMPRESSOR_READ) - || - (!depEvt->m_stream->m_isCompressed) - ) - { - m_frameInfo.back().m_seekInfo.push_back(); - m_frameInfo.back().m_seekInfo.back().m_eventId = geid; - m_frameInfo.back().m_seekInfo.back().m_eventReason = SEEK_EVENT_SKIP; - trackedDevice->second.m_offset = depEvt->m_operation.m_offset; - ++m_frameInfo.back().m_computedSeeksCount; - m_seeksInfo.insert(AZStd::make_pair(geid, SEEK_EVENT_SKIP)); - } - } - } - break; - } - case Driller::Streamer::SET_OPERATION_COMPLETE: - { - auto depEvt = azdynamic_cast(dep); - - if (depEvt->m_stream) - { - m_frameInfo.back().m_transferInfo.push_back(); - m_frameInfo.back().m_transferInfo.back().m_eventId = geid; - m_frameInfo.back().m_transferInfo.back().m_eventReason = (TransferEventType)(depEvt->m_type); - - auto trackedDevice = m_seekTracking.find(depEvt->m_stream->m_deviceId); - if (trackedDevice == m_seekTracking.end()) - { - SeekTrackingInfo seekTrackingInfo; - seekTrackingInfo.m_currentStreamId = 0; - seekTrackingInfo.m_offset = 0; - - m_seekTracking.insert(AZStd::make_pair(depEvt->m_stream->m_deviceId, seekTrackingInfo)); - trackedDevice = m_seekTracking.find(depEvt->m_stream->m_deviceId); - } - - if (depEvt->m_stream->m_isCompressed) - { - if (static_cast(depEvt->m_type) == TRANSFER_EVENT_COMPRESSOR_READ || static_cast(depEvt->m_type) == TRANSFER_EVENT_COMPRESSOR_WRITE) - { - m_frameInfo.back().m_transferInfo.back().m_byteCount = depEvt->m_bytesTransferred; - m_frameInfo.back().m_computedThroughput += depEvt->m_bytesTransferred; - trackedDevice->second.m_offset += depEvt->m_bytesTransferred; - } - } - else - { - m_frameInfo.back().m_transferInfo.back().m_byteCount = depEvt->m_bytesTransferred; - m_frameInfo.back().m_computedThroughput += depEvt->m_bytesTransferred; - trackedDevice->second.m_offset += depEvt->m_bytesTransferred; - } - } - break; - } - } - } - } - } - } - - const char* StreamerDataAggregator::GetFilenameFromStreamId(unsigned int globalEventId, AZ::u64 streamId) - { - // starting at eventId, skip backwards through the events until a register stream is found - while (1) - { - if (globalEventId > m_events.size()) - { - break; - } - auto event = m_events[globalEventId]; - auto registerEvent = azdynamic_cast(event); - if (registerEvent && registerEvent->m_streamData.m_id == streamId) - { - return registerEvent->m_streamData.m_name; - } - - if (globalEventId == 0) - { - break; - } - - --globalEventId; - } - - return ""; - } - - const char* StreamerDataAggregator::GetDebugNameFromStreamId(unsigned int globalEventId, AZ::u64 streamId) - { - // starting at eventId, skip backwards through the events until a request added (which has debug info) is found - while (1) - { - if (globalEventId > m_events.size()) - { - break; - } - auto event = m_events[globalEventId]; - auto requestEvent = azdynamic_cast(event); - if (requestEvent && requestEvent->m_requestData.m_streamId == streamId) - { - if (requestEvent->m_requestData.m_debugName) - { - return requestEvent->m_requestData.m_debugName; - } - else - { - return ""; - } - } - - if (globalEventId == 0) - { - break; - } - - --globalEventId; - } - - return ""; - } - - - const AZ::u64 StreamerDataAggregator::GetOffsetFromStreamId(unsigned int globalEventId, AZ::u64 streamId) - { - // starting at eventId, skip backwards through the events until the start operation related to this ID is found - while (1) - { - if (globalEventId > m_events.size()) - { - break; - } - auto event = m_events[globalEventId]; - auto startEvent = azdynamic_cast(event); - if (startEvent && startEvent->m_streamId == streamId) - { - return startEvent->m_operation.m_offset; - } - - if (globalEventId == 0) - { - break; - } - - --globalEventId; - } - - return 0; - } - - float StreamerDataAggregator::ThroughputAtFrame(FrameNumberType frame) - { - if (frame >= 0) - { - AdvanceToFrame(frame); - return (float)m_frameInfo[frame].m_computedThroughput; - } - - return 0.0f; - } - float StreamerDataAggregator::SeeksAtFrame(FrameNumberType frame) - { - if (frame >= 0) - { - AdvanceToFrame(frame); - return (float)m_frameInfo[frame].m_computedSeeksCount; - } - - return 0.0f; - } - Driller::StreamerDataAggregator::TransferBreakoutType& StreamerDataAggregator::ThroughputAtFrameBreakout(FrameNumberType frame) - { - AdvanceToFrame(frame); - return m_frameInfo[frame].m_transferInfo; - } - Driller::StreamerDataAggregator::SeeksBreakoutType& StreamerDataAggregator::SeeksAtFrameBreakout(FrameNumberType frame) - { - AdvanceToFrame(frame); - return m_frameInfo[frame].m_seekInfo; - } - StreamerDataAggregator::SeekEventType StreamerDataAggregator::GetSeekType(AZ::s64 id) - { - auto iter = m_seeksInfo.find(id); - if (iter != m_seeksInfo.end()) - { - return iter->second; - } - return SEEK_EVENT_NONE; - } -} // namespace Driller diff --git a/Code/Tools/Standalone/Source/Driller/IO/StreamerDataParser.cpp b/Code/Tools/Standalone/Source/Driller/IO/StreamerDataParser.cpp deleted file mode 100644 index 733f32c004..0000000000 --- a/Code/Tools/Standalone/Source/Driller/IO/StreamerDataParser.cpp +++ /dev/null @@ -1,327 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "StreamerDataAggregator.hxx" - -namespace Driller -{ - AZ::Debug::DrillerHandlerParser* StreamerDrillerHandlerParser::OnEnterTag(AZ::u32 tagName) - { - AZ_Assert(m_data, "You must set a valid memory aggregator before we can process the data!"); - - if (tagName == AZ_CRC("OnDeviceMounted", 0xc6bdd55e)) - { - m_subTag = ST_DEVICE_MOUNTED; - m_data->AddEvent(aznew StreamerMountDeviceEvent()); - return this; - } - else if (tagName == AZ_CRC("OnRegisterStream", 0x893513c1)) - { - m_subTag = ST_STREAM_REGISTER; - m_data->AddEvent(aznew StreamerRegisterStreamEvent()); - return this; - } - else if (tagName == AZ_CRC("OnReadCacheHit", 0xd4535712)) - { - m_subTag = ST_READ_CACHE_HIT; - if (m_allowCacheHitsInReportedStream) - { - m_data->AddEvent(aznew StreamerReadCacheHit()); - } - return this; - } - else if (tagName == AZ_CRC("OnAddRequest", 0xee41c96e)) - { - m_subTag = ST_REQUEST_ADD; - m_data->AddEvent(aznew StreamerAddRequestEvent()); - return this; - } - else if (tagName == AZ_CRC("OnCompleteRequest", 0x7f6b66f7)) - { - m_subTag = ST_REQUEST_COMPLETE; - m_data->AddEvent(aznew StreamerCompleteRequestEvent()); - return this; - } - else if (tagName == AZ_CRC("OnRescheduleRequest", 0x883b3e85)) - { - m_subTag = ST_REQUEST_RESCHEDULE; - m_data->AddEvent(aznew StreamerRescheduleRequestEvent()); - return this; - } - else if (tagName == AZ_CRC("OnRead", 0xd7714b7b)) - { - m_subTag = ST_OPERATION_READ; - m_data->AddEvent(aznew StreamerOperationStartEvent(Streamer::SOP_READ)); - return this; - } - else if (tagName == AZ_CRC("OnReadComplete", 0x0efa014b)) - { - m_subTag = ST_OPERATION_READ_COMPLETE; - m_data->AddEvent(aznew StreamerOperationCompleteEvent(Streamer::SOP_READ)); - return this; - } - else if (tagName == AZ_CRC("OnWrite", 0x6925001a)) - { - m_subTag = ST_OPERATION_WRITE; - m_data->AddEvent(aznew StreamerOperationStartEvent(Streamer::SOP_WRITE)); - return this; - } - else if (tagName == AZ_CRC("OnWriteComplete", 0x6c5f7c79)) - { - m_subTag = ST_OPERATION_WRITE_COMPLETE; - m_data->AddEvent(aznew StreamerOperationCompleteEvent(Streamer::SOP_WRITE)); - return this; - } - else if (tagName == AZ_CRC("OnCompressorRead", 0xbd093b22)) - { - m_subTag = ST_OPERATION_COMPRESSOR_READ; - m_data->AddEvent(aznew StreamerOperationStartEvent(Streamer::SOP_COMPRESSOR_READ)); - return this; - } - else if (tagName == AZ_CRC("OnCompressorReadComplete", 0x9c08d9cd)) - { - m_subTag = ST_OPERATION_COMPRESSOR_READ_COMPLETE; - m_data->AddEvent(aznew StreamerOperationCompleteEvent(Streamer::SOP_COMPRESSOR_READ)); - return this; - } - else if (tagName == AZ_CRC("OnCompressorWrite", 0x7bf8913a)) - { - m_subTag = ST_OPERATION_COMPRESSOR_WRITE; - m_data->AddEvent(aznew StreamerOperationStartEvent(Streamer::SOP_COMPRESSOR_WRITE)); - return this; - } - else if (tagName == AZ_CRC("OnCompressorWriteComplete", 0x6816a8b4)) - { - m_subTag = ST_OPERATION_COMPRESSOR_WRITE_COMPLETE; - m_data->AddEvent(aznew StreamerOperationCompleteEvent(Streamer::SOP_COMPRESSOR_WRITE)); - return this; - } - else - { - m_subTag = ST_NONE; - } - return NULL; - } - - void StreamerDrillerHandlerParser::OnExitTag(DrillerHandlerParser* handler, AZ::u32 tagName) - { - (void)tagName; - if (handler != nullptr) - { - m_subTag = ST_NONE; // we have only one level just go back to the default state - } - } - - void StreamerDrillerHandlerParser::OnData(const AZ::Debug::DrillerSAXParser::Data& dataNode) - { - AZ_Assert(m_data, "You must set a valid memory aggregator before we can process the data!"); - (void)dataNode; - switch (m_subTag) - { - case ST_NONE: - { - if (dataNode.m_name == AZ_CRC("OnDeviceUnmounted", 0x7395545a)) - { - StreamerUnmountDeviceEvent* event = aznew StreamerUnmountDeviceEvent(); - dataNode.Read(event->m_deviceId); - m_data->AddEvent(event); - } - else if (dataNode.m_name == AZ_CRC("OnUnregisterStream", 0x3374d0cb)) - { - StreamerUnregisterStreamEvent* event = aznew StreamerUnregisterStreamEvent(); - dataNode.Read(event->m_streamId); - m_data->AddEvent(event); - } - else if (dataNode.m_name == AZ_CRC("OnCancelRequest", 0x89d4ea74)) - { - StreamerCancelRequestEvent* event = aznew StreamerCancelRequestEvent(); - dataNode.Read(event->m_requestId); - m_data->AddEvent(event); - } - } break; - case ST_DEVICE_MOUNTED: - { - StreamerMountDeviceEvent* event = static_cast(m_data->GetEvents().back()); - if (dataNode.m_name == AZ_CRC("DeviceId", 0x383bcd03)) - { - dataNode.Read(event->m_deviceData.m_id); - } - else if (dataNode.m_name == AZ_CRC("Name", 0x5e237e06)) - { - event->m_deviceData.m_name = dataNode.ReadPooledString(); - } - } break; - case ST_STREAM_REGISTER: - { - StreamerRegisterStreamEvent* event = static_cast(m_data->GetEvents().back()); - if (dataNode.m_name == AZ_CRC("DeviceId", 0x383bcd03)) - { - dataNode.Read(event->m_streamData.m_deviceId); - } - else if (dataNode.m_name == AZ_CRC("StreamId", 0x7597546f)) - { - dataNode.Read(event->m_streamData.m_id); - } - else if (dataNode.m_name == AZ_CRC("Name", 0x5e237e06)) - { - event->m_streamData.m_name = dataNode.ReadPooledString(); - } - else if (dataNode.m_name == AZ_CRC("Flags", 0x0b0541ba)) - { - dataNode.Read(event->m_streamData.m_flags); - } - else if (dataNode.m_name == AZ_CRC("Size", 0xf7c0246a)) - { - dataNode.Read(event->m_streamData.m_size); - } - else if (dataNode.m_name == AZ_CRC("IsCompressed", 0xdd32876c)) - { - dataNode.Read(event->m_streamData.m_isCompressed); - } - } break; - case ST_READ_CACHE_HIT: - { - if (m_allowCacheHitsInReportedStream) - { - StreamerReadCacheHit* event = static_cast(m_data->GetEvents().back()); - if (dataNode.m_name == AZ_CRC("StreamId", 0x7597546f)) - { - dataNode.Read(event->m_streamId); - } - else if (dataNode.m_name == AZ_CRC("Offset", 0x590acad0)) - { - dataNode.Read(event->m_offset); - } - else if (dataNode.m_name == AZ_CRC("Size", 0xf7c0246a)) - { - dataNode.Read(event->m_size); - } - else if (dataNode.m_name == AZ_CRC("DebugName", 0x6c3ea120)) - { - event->m_debugName = dataNode.ReadPooledString(); - } - } - } break; - case ST_REQUEST_ADD: - { - StreamerAddRequestEvent* event = static_cast(m_data->GetEvents().back()); - if (dataNode.m_name == AZ_CRC("RequestId", 0x34e754a3)) - { - dataNode.Read(event->m_requestData.m_id); - } - else if (dataNode.m_name == AZ_CRC("StreamId", 0x7597546f)) - { - dataNode.Read(event->m_requestData.m_streamId); - } - else if (dataNode.m_name == AZ_CRC("Offset", 0x590acad0)) - { - dataNode.Read(event->m_requestData.m_offset); - } - else if (dataNode.m_name == AZ_CRC("Size", 0xf7c0246a)) - { - dataNode.Read(event->m_requestData.m_size); - } - else if (dataNode.m_name == AZ_CRC("Deadline", 0xb74774f2)) - { - dataNode.Read(event->m_requestData.m_deadline); - } - else if (dataNode.m_name == AZ_CRC("Priority", 0x62a6dc27)) - { - dataNode.Read(event->m_requestData.m_priority); - } - else if (dataNode.m_name == AZ_CRC("Operation", 0x1981a66d)) - { - dataNode.Read(event->m_requestData.m_operation); - } - else if (dataNode.m_name == AZ_CRC("DebugName", 0x6c3ea120)) - { - event->m_requestData.m_debugName = dataNode.ReadPooledString(); - } - else if (dataNode.m_name == AZ_CRC("Timestamp", 0xa5d6e63e)) - { - dataNode.Read(event->m_timeStamp); - } - } break; - case ST_REQUEST_COMPLETE: - { - StreamerCompleteRequestEvent* event = static_cast(m_data->GetEvents().back()); - if (dataNode.m_name == AZ_CRC("RequestId", 0x34e754a3)) - { - dataNode.Read(event->m_requestId); - } - else if (dataNode.m_name == AZ_CRC("State", 0xa393d2fb)) - { - dataNode.Read(event->m_state); - } - else if (dataNode.m_name == AZ_CRC("Timestamp", 0xa5d6e63e)) - { - dataNode.Read(event->m_timeStamp); - } - } break; - case ST_REQUEST_RESCHEDULE: - { - StreamerRescheduleRequestEvent* event = static_cast(m_data->GetEvents().back()); - if (dataNode.m_name == AZ_CRC("RequestId", 0x34e754a3)) - { - dataNode.Read(event->m_requestId); - } - else if (dataNode.m_name == AZ_CRC("NewDeadLine", 0x184cc661)) - { - dataNode.Read(event->m_newDeadline); - } - else if (dataNode.m_name == AZ_CRC("NewPriority", 0xcdad6eb4)) - { - dataNode.Read(event->m_newPriority); - } - } break; - case ST_OPERATION_READ: - case ST_OPERATION_WRITE: - case ST_OPERATION_COMPRESSOR_READ: - case ST_OPERATION_COMPRESSOR_WRITE: - { - StreamerOperationStartEvent* event = static_cast(m_data->GetEvents().back()); - if (dataNode.m_name == AZ_CRC("StreamId", 0x7597546f)) - { - dataNode.Read(event->m_streamId); - } - else if (dataNode.m_name == AZ_CRC("Size", 0xf7c0246a)) - { - dataNode.Read(event->m_operation.m_size); - } - else if (dataNode.m_name == AZ_CRC("Offset", 0x590acad0)) - { - dataNode.Read(event->m_operation.m_offset); - } - else if (dataNode.m_name == AZ_CRC("Timestamp", 0xa5d6e63e)) - { - dataNode.Read(event->m_timeStamp); - } - } break; - - case ST_OPERATION_READ_COMPLETE: - case ST_OPERATION_WRITE_COMPLETE: - case ST_OPERATION_COMPRESSOR_READ_COMPLETE: - case ST_OPERATION_COMPRESSOR_WRITE_COMPLETE: - { - StreamerOperationCompleteEvent* event = static_cast(m_data->GetEvents().back()); - if (dataNode.m_name == AZ_CRC("StreamId", 0x7597546f)) - { - dataNode.Read(event->m_streamId); - } - else if (dataNode.m_name == AZ_CRC("bytesTransferred", 0x35684b99)) - { - dataNode.Read(event->m_bytesTransferred); - } - else if (dataNode.m_name == AZ_CRC("Timestamp", 0xa5d6e63e)) - { - dataNode.Read(event->m_timeStamp); - } - } break; - } - } -} // namespace Driller diff --git a/Code/Tools/Standalone/Source/Driller/IO/StreamerDataView.cpp b/Code/Tools/Standalone/Source/Driller/IO/StreamerDataView.cpp deleted file mode 100644 index 6e9786e1cd..0000000000 --- a/Code/Tools/Standalone/Source/Driller/IO/StreamerDataView.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "StreamerDataView.hxx" -#include - -#include -#include - -namespace Driller -{ - StreamerDrillerTableView::StreamerDrillerTableView(QWidget* pParent) - : QTableView(pParent) - , m_isScrollAfterInsert(true) - { - setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); - m_scheduledMaxScroll = false; - } - - StreamerDrillerTableView::~StreamerDrillerTableView() - { - } - - void StreamerDrillerTableView::rowsAboutToBeInserted() - { - m_isScrollAfterInsert = IsAtMaxScroll(); - } - - void StreamerDrillerTableView::rowsInserted() - { - if ((m_isScrollAfterInsert) && (!m_scheduledMaxScroll)) - { - m_scheduledMaxScroll = true; - QTimer::singleShot(0, this, SLOT(doScrollToBottom())); - } - } - - void StreamerDrillerTableView::doScrollToBottom() - { - m_scheduledMaxScroll = false; - scrollToBottom(); - m_isScrollAfterInsert = true; - } - - bool StreamerDrillerTableView::IsAtMaxScroll() const - { - return (verticalScrollBar()->value() == verticalScrollBar()->maximum()); - } -} diff --git a/Code/Tools/Standalone/Source/Driller/IO/StreamerDrillerDialog.cpp b/Code/Tools/Standalone/Source/Driller/IO/StreamerDrillerDialog.cpp deleted file mode 100644 index 98262c5311..0000000000 --- a/Code/Tools/Standalone/Source/Driller/IO/StreamerDrillerDialog.cpp +++ /dev/null @@ -1,1527 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "StreamerDrillerDialog.hxx" -#include - -#include "StreamerDataAggregator.hxx" -#include "StreamerEvents.h" - -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include - -namespace Driller -{ - class StreamerDrillerDialogSavedState; - - // NB: update StreamerDataView.hxx GetXxxxColumn() calls to return matching numbers to SDM_ enums - - enum - { - SDM_NAME = 0, - SDM_DEBUG_NAME, - SDM_EVENT_TYPE, - SDM_OPERATION, - SDM_DELTA_TIME, - SDM_DATA_TRANSFER, - SDM_READ_SIZE, - SDM_OFFSET, - SDM_TOTAL - }; - static const char* SDM_STRING[] = { - "Name", - "Debug Name", - "Event Type", - "Operation", - "uSec Used", - "Data Transfer", - "Read Size", - "Offset", - }; - enum - { - VIEW_TYPE_THROUGHPUT = 0, - VIEW_TYPE_SEEKINFO - }; - - static const char* eventTypeToString[] = - { - "Show All Events", - "Device Mounted", - "Device UnMounted", - "Register Stream", - "UnRegister Stream", - "Cache Hit", - "Request Added", - "Request Canceled", - "Request Rescheduled", - "Request Completed", - "Operation Start", - "Operation Complete", - NULL - }; - static const int eventTypeFromIndex[] = { -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; - - static const char* operationTypeToString[] = - { - "All Operations", - "Invalid", - "Read", - "Write", - "Compressor Read", - "Compressor Write", - NULL - }; - static const int operationTypeFromIndex[] = { -1, 0, 1, 2, 3, 4 }; - - static const char* secondsToDisplayString[] = - { - "10 Seconds", - "15 Seconds", - "30 Seconds", - "60 Seconds", - NULL - }; - static const int secondsFromIndex[] = { 10, 15, 30, 60, 0 }; - - static const char* tableLengthToDisplayString[] = - { - "All Events", - " 1K Events", - " 5K Events", - "10K Events", - "50K Events", - "Playback Start Relative", - NULL - }; - static const int tableLengthFromIndex[] = { 0, 1000, 5000, 10000, 50000, -1, 0 }; - - static const char* chartTypeToDisplayString[] = - { - "Throughput", - "Seek Count", - NULL - }; - static const int chartTypeFromIndex[] = { 0, 1 }; - - static const char* seekTypeToString[] = - { - "", - "Skip Position", - "Switch Streams", - NULL - }; - - class StreamerDrillerDialogLocal - : public AZ::UserSettings - { - public: - AZ_RTTI(StreamerDrillerDialogLocal, "{FBC1032F-A1DE-40CB-97E1-8C5014E31850}", AZ::UserSettings); - AZ_CLASS_ALLOCATOR(StreamerDrillerDialogLocal, AZ::SystemAllocator, 0); - - AZStd::vector m_tableColumnStorage; - - static void Reflect(AZ::ReflectContext* context) - { - AZ::SerializeContext* serialize = azrtti_cast(context); - if (serialize) - { - serialize->Class() - ->Field("m_tableColumnStorage", &StreamerDrillerDialogLocal::m_tableColumnStorage) - ->Version(1); - } - } - }; - - class StreamerDrillerDialogSavedState - : public AZ::UserSettings - { - public: - AZ_RTTI(StreamerDrillerDialogSavedState, "{F97F6145-10D6-4C7F-87DB-FD268EB0EF21}", AZ::UserSettings); - AZ_CLASS_ALLOCATOR(StreamerDrillerDialogSavedState, AZ::SystemAllocator, 0); - - int m_viewType; - bool m_autoZoom; - float m_manualZoomMin; // if we're not automatically zooming, then we remember the prior zoom to re-apply it - float m_manualZoomMax; - int m_chartLengthInSeconds; - AZStd::string m_chartNameFilter; - int m_chartOperationFilter; - int m_chartEventFilter; - int m_tableEventLimiter; - FrameNumberType m_frameDeltaLock; - - StreamerDrillerDialogSavedState() - { - m_viewType = VIEW_TYPE_THROUGHPUT; - m_autoZoom = true; - m_manualZoomMin = 2000000000.0f; - m_manualZoomMax = -2000000000.0f; - m_chartLengthInSeconds = 10; - // -1 := no filter and 0..n := filtered by type - m_chartOperationFilter = -1; - m_chartEventFilter = -1; - m_tableEventLimiter = 0; - m_frameDeltaLock = 0; - } - - static void Reflect(AZ::ReflectContext* context) - { - AZ::SerializeContext* serialize = azrtti_cast(context); - if (serialize) - { - serialize->Class() - ->Field("m_viewType", &StreamerDrillerDialogSavedState::m_viewType) - ->Field("m_autoZoom", &StreamerDrillerDialogSavedState::m_autoZoom) - ->Field("m_manualZoomMin", &StreamerDrillerDialogSavedState::m_manualZoomMin) - ->Field("m_manualZoomMax", &StreamerDrillerDialogSavedState::m_manualZoomMax) - ->Field("m_chartLengthInSeconds", &StreamerDrillerDialogSavedState::m_chartLengthInSeconds) - ->Field("m_chartNameFilter", &StreamerDrillerDialogSavedState::m_chartNameFilter) - ->Field("m_chartOperationFilter", &StreamerDrillerDialogSavedState::m_chartOperationFilter) - ->Field("m_chartEventFilter", &StreamerDrillerDialogSavedState::m_chartEventFilter) - ->Field("m_tableEventLimiter", &StreamerDrillerDialogSavedState::m_tableEventLimiter) - ->Field("m_frameDeltaLock", &StreamerDrillerDialogSavedState::m_frameDeltaLock) - ->Version(8); - } - } - }; - - ////////////////////////////////////////////////////////////////////////// - // Qt supports A "filter proxy model" - // you have a normal model - // and then you wrap that model in a filter proxy model. - // this allows you to filter the inner model and feed the outer (filtered) model to the view. - - // this particular filter model lets you specify search criteria in the Window or the Message field - class StreamerFilterModel - : public QSortFilterProxyModel - { - public: - AZ_CLASS_ALLOCATOR(StreamerFilterModel, AZ::SystemAllocator, 0); - int m_nameColumn; - int m_eventColumn; - int m_operationColumn; - StreamerDataAggregator* m_dataSource; - - QString m_currentNameFilter; - int m_currentEventFilter; - int m_currentOperationFilter; - - FrameNumberType m_frameDeltaLock; - - StreamerFilterModel(StreamerDataAggregator* dataSource, int nameColumn, int eventColumn, int operationColumn, QObject* pParent) - : QSortFilterProxyModel(pParent) - { - m_dataSource = dataSource; - m_nameColumn = nameColumn; - m_eventColumn = eventColumn; - m_operationColumn = operationColumn; - m_currentEventFilter = eventTypeFromIndex[0]; - m_currentOperationFilter = operationTypeFromIndex[0]; - m_frameDeltaLock = 0; - } - - void InvalidateFilter() - { - invalidateFilter(); - } - void SetDeltaLock(FrameNumberType lock) - { - m_frameDeltaLock = lock; - invalidateFilter(); - } - void UpdateNameFilter(const QString& newFilter) - { - if (newFilter.compare(m_currentNameFilter) != 0) - { - if (m_nameColumn >= 0) - { - m_currentNameFilter = newFilter; - invalidateFilter(); - } - } - } - void UpdateEventFilter(int newFilter) - { - if (newFilter != m_currentEventFilter) - { - if (m_eventColumn >= 0) - { - m_currentEventFilter = newFilter; - invalidateFilter(); - } - } - } - void UpdateOperationFilter(int newFilter) - { - if (newFilter != m_currentOperationFilter) - { - if (m_operationColumn >= 0) - { - m_currentOperationFilter = newFilter; - invalidateFilter(); - } - } - } - - protected: - virtual bool filterAcceptsRow(int source_row, const QModelIndex& /*source parent*/) const - { - StreamerDrillerLogModel* ptrModel = static_cast(sourceModel()); - - if (!ptrModel) - { - return true; - } - - EventNumberType firstIndex = ptrModel->GetAggregator()->GetFirstIndexAtFrame(m_frameDeltaLock); - EventNumberType rowEventIndex = ptrModel->RowToGlobalEventIndex(source_row); - if (firstIndex == Driller::kInvalidEventIndex - || rowEventIndex == Driller::kInvalidEventIndex - || rowEventIndex < firstIndex) - { - return false; - } - - AZ_Assert(rowEventIndex < static_cast(m_dataSource->GetEvents().size()), "EventIndex outside of Events vector size."); - - auto pEvt = m_dataSource->GetEvents()[rowEventIndex]; - - if (m_currentNameFilter.size()) - { - QString sourceName = ptrModel->data(source_row, m_nameColumn, Qt::DisplayRole).toString(); - QString sourceDebugName = ptrModel->data(source_row, m_nameColumn + 1, Qt::DisplayRole).toString(); - if ( - (!sourceName.contains(m_currentNameFilter, Qt::CaseInsensitive)) - && - (!sourceDebugName.contains(m_currentNameFilter, Qt::CaseInsensitive)) - ) - { - return false; - } - } - - if (m_currentEventFilter != eventTypeFromIndex[0]) - { - if ((unsigned int)m_currentEventFilter != pEvt->GetEventType()) - { - return false; - } - } - if (m_currentOperationFilter != operationTypeFromIndex[0]) - { - if (pEvt->GetEventType() == Driller::Streamer::SET_OPERATION_COMPLETE) - { - auto completeOp = static_cast(pEvt); - if (m_currentOperationFilter == completeOp->m_type) - { - return true; - } - } - - return false; - } - - return true; - } - }; - - ////////////////////////////////////////////////////////////////////////// - StreamerAxisFormatter::StreamerAxisFormatter(QObject* pParent) - : QAbstractAxisFormatter(pParent) - { - m_dataType = DATA_TYPE_BYTES_PER_SECOND; - m_lastAxisValueForScaling = 1.0f; - } - - QString StreamerAxisFormatter::formatMegabytes(float value) - { - // data is in Bytes per Second! - // so how big is the division size? - if (m_lastAxisValueForScaling > 499999.0f) // greater than half MB - { - return QObject::tr("%1Mb/s").arg(QString::number(value / 1000000.0f, 'f', 1)); - } - else if (m_lastAxisValueForScaling > 1000.0f) // greater than one K - { - if (m_lastAxisValueForScaling > 1000.0f) // whole milliseconds - { - return QObject::tr("%1%2").arg(QString::number(value / 1000.0f, 'f', 0)).arg("Kb/s"); - } - else - { - return QObject::tr("%1%2").arg(QString::number(value / 1000.0f, 'f', 1)).arg("Kb/s"); - } - } - else if (m_lastAxisValueForScaling > 1.0f) - { - return QObject::tr("%1B/s").arg((int)value); - } - else - { - return QObject::tr("%1B/s").arg(QString::number((double)value, 'f', 2)); - } - } - - void StreamerAxisFormatter::SetDataType(int type) - { - m_dataType = type; - } - - QString StreamerAxisFormatter::convertAxisValueToText(Charts::AxisType axis, float value, float /*minDisplayedValue*/, float /*maxDisplayedValue*/, float divisionSize) - { - if (axis == Charts::AxisType::Vertical) - { - m_lastAxisValueForScaling = divisionSize; - if (m_dataType == DATA_TYPE_BYTES_PER_SECOND) - { - return formatMegabytes(value); - } - else - { - return QObject::tr("%1%2").arg(QString::number(value, 'f', 0)).arg("/s"); - } - } - else - { - return QString::number((int)value); - } - }; - - ////////////////////////////////////////////////////////////////////////// - StreamerDrillerDialog::StreamerDrillerDialog(StreamerDataAggregator* aggregator, FrameNumberType atFrame, int profilerIndex) - : QDialog() - , m_aggregator(aggregator) - , m_frame(atFrame) - , m_viewIndex(profilerIndex) - , m_isDeltaLocked(false) - , frameModulo(10) - { - m_gui = azcreate(Ui::StreamerDrillerDialog, ()); - m_gui->setupUi(this); - - setAttribute(Qt::WA_DeleteOnClose, true); - setWindowFlags((this->windowFlags() | Qt::WindowMaximizeButtonHint | Qt::WindowMinimizeButtonHint) & ~(Qt::WindowContextHelpButtonHint)); - - setWindowTitle(aggregator->GetDialogTitle()); - - show(); - raise(); - activateWindow(); - setFocus(); - - m_axisFormatter = aznew StreamerAxisFormatter(this); - m_gui->widgetDataStrip->SetAxisTextFormatter(m_axisFormatter); - - this->layout()->addWidget(m_gui->widgetTableView); - - m_gui->widgetTableView->horizontalHeader()->setSectionsMovable(true); - m_gui->widgetTableView->horizontalHeader()->setSectionResizeMode(QHeaderView::Interactive); - m_gui->widgetTableView->horizontalHeader()->setStretchLastSection(false); - m_gui->widgetTableView->verticalHeader()->setSectionResizeMode(QHeaderView::Fixed); - m_gui->widgetTableView->verticalHeader()->setStretchLastSection(false); - m_gui->widgetTableView->verticalHeader()->setSectionsMovable(false); - m_gui->widgetTableView->verticalHeader()->hide(); - - m_ptrOriginalModel = aznew StreamerDrillerLogModel(aggregator, this); - m_ptrFilter = aznew StreamerFilterModel(m_aggregator, m_gui->widgetTableView->GetNameColumn(), m_gui->widgetTableView->GetEventColumn(), m_gui->widgetTableView->GetOperationColumn(), this); - m_ptrFilter->setSourceModel(m_ptrOriginalModel); - m_gui->widgetTableView->setModel(m_ptrFilter); - - // context menu - actionSelectAll = new QAction(tr("Select All"), this); - connect(actionSelectAll, SIGNAL(triggered()), this, SLOT(SelectAll())); - - actionSelectNone = new QAction(tr("Select None"), this); - connect(actionSelectNone, SIGNAL(triggered()), this, SLOT(SelectNone())); - - actionCopySelected = new QAction(tr("Copy Selected Row(s)"), this); - actionCopySelected->setShortcutContext(Qt::WidgetWithChildrenShortcut); - connect(actionCopySelected, SIGNAL(triggered()), this, SLOT(CopySelected())); - - actionCopyAll = new QAction(tr("Copy All Rows"), this); - connect(actionCopyAll, SIGNAL(triggered()), this, SLOT(CopyAll())); - - // context menu for the table - m_gui->widgetTableView->setContextMenuPolicy(Qt::ActionsContextMenu); - m_gui->widgetTableView->addAction(actionSelectAll); - m_gui->widgetTableView->addAction(actionSelectNone); - m_gui->widgetTableView->addAction(actionCopySelected); - m_gui->widgetTableView->addAction(actionCopyAll); - - connect(aggregator, SIGNAL(destroyed(QObject*)), this, SLOT(OnDataDestroyed())); - - connect(m_ptrFilter, SIGNAL(rowsAboutToBeInserted(const QModelIndex &, int, int)), m_gui->widgetTableView, SLOT(rowsAboutToBeInserted())); - connect(m_ptrFilter, SIGNAL(rowsInserted(const QModelIndex &, int, int)), m_gui->widgetTableView, SLOT(rowsInserted())); - connect(m_gui->nameFilter, SIGNAL(textChanged(const QString &)), this, SLOT(onTextChangeWindowFilter(const QString&))); - - connect(m_ptrFilter, SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, SLOT(UpdateSummary())); - connect(m_ptrFilter, SIGNAL(rowsRemoved(const QModelIndex &, int, int)), this, SLOT(UpdateSummary())); - connect(m_ptrFilter, SIGNAL(modelReset()), this, SLOT(UpdateSummary())); - - connect(m_ptrOriginalModel, SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, SLOT(UpdateSummary())); - connect(m_ptrOriginalModel, SIGNAL(rowsRemoved(const QModelIndex &, int, int)), this, SLOT(UpdateSummary())); - connect(m_ptrOriginalModel, SIGNAL(modelReset()), this, SLOT(UpdateSummary())); - - connect(m_gui->checkBoxAutoZoom, SIGNAL(toggled(bool)), this, SLOT(OnAutoZoomChange(bool))); - - { - QMenu* eventMenu = new QMenu(this); - - for (int i = 0; eventTypeToString[i]; ++i) - { - eventMenu->addAction(CreateEventFilterAction(eventTypeToString[i], eventTypeFromIndex[i])); - } - - m_gui->eventTypeFilterButton->setText(eventTypeToString[0]); - m_gui->eventTypeFilterButton->setMenu(eventMenu); - } - { - QMenu* operationMenu = new QMenu(this); - - for (int i = 0; operationTypeToString[i]; ++i) - { - operationMenu->addAction(CreateOperationFilterAction(operationTypeToString[i], operationTypeFromIndex[i])); - } - - m_gui->operationTypeFilterButton->setText(operationTypeToString[0]); - m_gui->operationTypeFilterButton->setMenu(operationMenu); - } - { - QMenu* secondsMenu = new QMenu(this); - for (int i = 0; secondsToDisplayString[i]; ++i) - { - secondsMenu->addAction(CreateSecondsMenuAction(secondsToDisplayString[i], secondsFromIndex[i])); - } - - m_gui->chartLengthButton->setText(secondsToDisplayString[0]); - m_gui->chartLengthButton->setMenu(secondsMenu); - } - { - QMenu* chartTypeMenu = new QMenu(this); - for (int i = 0; chartTypeToDisplayString[i]; ++i) - { - chartTypeMenu->addAction(CreateChartTypeMenuAction(chartTypeToDisplayString[i], chartTypeFromIndex[i])); - } - - m_gui->chartTypeButton->setText(chartTypeToDisplayString[0]); - m_gui->chartTypeButton->setMenu(chartTypeMenu); - } - { - QMenu* tableLengthMenu = new QMenu(this); - for (int i = 0; tableLengthToDisplayString[i]; ++i) - { - tableLengthMenu->addAction(CreateTableLengthMenuAction(tableLengthToDisplayString[i], i)); - } - - m_gui->tableLengthButton->setText(tableLengthToDisplayString[0]); - m_gui->tableLengthButton->setMenu(tableLengthMenu); - } - - DrillerMainWindowMessages::Handler::BusConnect(m_aggregator->GetIdentity()); - DrillerEventWindowMessages::Handler::BusConnect(m_aggregator->GetIdentity()); - - AZStd::string windowStateStr = AZStd::string::format("STREAMER DATA VIEW WINDOW STATE %i", m_viewIndex); - m_windowStateCRC = AZ::Crc32(windowStateStr.c_str()); - AZStd::intrusive_ptr windowState = AZ::UserSettings::Find(m_windowStateCRC, AZ::UserSettings::CT_GLOBAL); - if (windowState) - { - windowState->RestoreGeometry(this); - } - - AZStd::string tableStateStr = AZStd::string::format("STREAMER TABLE VIEW STATE %i", m_viewIndex); - m_tableStateCRC = AZ::Crc32(tableStateStr.c_str()); - auto tableState = AZ::UserSettings::Find(m_tableStateCRC, AZ::UserSettings::CT_GLOBAL); - if (tableState) - { - QByteArray treeData((const char*)tableState->m_tableColumnStorage.data(), (int)tableState->m_tableColumnStorage.size()); - m_gui->widgetTableView->horizontalHeader()->restoreState(treeData); - } - - AZStd::string dataViewStateStr = AZStd::string::format("STREAMER DATA VIEW STATE %i", m_viewIndex); - m_dataViewStateCRC = AZ::Crc32(dataViewStateStr.c_str()); - m_persistentState = AZ::UserSettings::CreateFind(m_dataViewStateCRC, AZ::UserSettings::CT_GLOBAL); - ApplyPersistentState(); - - FrameChanged(atFrame); - } - - StreamerDrillerDialog::~StreamerDrillerDialog() - { - SaveOnExit(); - azdestroy(m_gui); - } - - QAction* StreamerDrillerDialog::CreateSecondsMenuAction(QString qs, int seconds) - { - QAction* act = new QAction(qs, this); - act->setObjectName(qs); - act->setProperty("Seconds", seconds); - connect(act, SIGNAL(triggered()), this, SLOT(OnSecondsMenu())); - return act; - } - QAction* StreamerDrillerDialog::CreateTableLengthMenuAction(QString qs, int limit) - { - QAction* act = new QAction(qs, this); - act->setObjectName(qs); - act->setProperty("Limit", limit); - connect(act, SIGNAL(triggered()), this, SLOT(OnTableLengthMenu())); - return act; - } - QAction* StreamerDrillerDialog::CreateChartTypeMenuAction(QString qs, int dataType) - { - QAction* act = new QAction(qs, this); - act->setObjectName(qs); - act->setProperty("DataType", dataType); - connect(act, SIGNAL(triggered()), this, SLOT(OnDataTypeMenu())); - return act; - } - - QAction* StreamerDrillerDialog::CreateEventFilterAction(QString qs, int eventType) - { - QAction* act = new QAction(qs, this); - act->setObjectName(qs); - act->setProperty("EventType", eventType); - connect(act, SIGNAL(triggered()), this, SLOT(OnEventFilterMenu())); - return act; - } - - QAction* StreamerDrillerDialog::CreateOperationFilterAction(QString qs, int operationType) - { - QAction* act = new QAction(qs, this); - act->setObjectName(qs); - act->setProperty("OperationType", operationType); - connect(act, SIGNAL(triggered()), this, SLOT(OnOperationFilterMenu())); - return act; - } - - void StreamerDrillerDialog::SaveOnExit() - { - auto tableState = AZ::UserSettings::CreateFind(m_tableStateCRC, AZ::UserSettings::CT_GLOBAL); - if (tableState) - { - if (m_gui->widgetTableView && m_gui->widgetTableView->horizontalHeader()) - { - QByteArray qba = m_gui->widgetTableView->horizontalHeader()->saveState(); - tableState->m_tableColumnStorage.assign((AZ::u8*)qba.begin(), (AZ::u8*)qba.end()); - } - } - - auto pState = AZ::UserSettings::CreateFind(m_windowStateCRC, AZ::UserSettings::CT_GLOBAL); - if (m_persistentState) - { - pState->CaptureGeometry(this); - } - } - void StreamerDrillerDialog::hideEvent(QHideEvent* evt) - { - QDialog::hideEvent(evt); - } - void StreamerDrillerDialog::closeEvent(QCloseEvent* evt) - { - QDialog::closeEvent(evt); - } - void StreamerDrillerDialog::OnDataDestroyed() - { - deleteLater(); - } - - void StreamerDrillerDialog::onTextChangeWindowFilter(const QString& newText) - { - m_ptrFilter->UpdateNameFilter(newText); - m_persistentState->m_chartNameFilter = newText.toUtf8().data(); - } - void StreamerDrillerDialog::OnEventFilterMenu() - { - QAction* qa = qobject_cast(sender()); - if (qa) - { - m_gui->eventTypeFilterButton->setText(qa->objectName()); - int eventType = qa->property("EventType").toInt(); - m_ptrFilter->UpdateEventFilter(eventType); - m_persistentState->m_chartEventFilter = eventType; - } - } - void StreamerDrillerDialog::OnOperationFilterMenu() - { - QAction* qa = qobject_cast(sender()); - if (qa) - { - m_gui->operationTypeFilterButton->setText(qa->objectName()); - int operationType = qa->property("OperationType").toInt(); - m_ptrFilter->UpdateOperationFilter(operationType); - m_persistentState->m_chartOperationFilter = operationType; - } - } - void StreamerDrillerDialog::OnSecondsMenu() - { - QAction* qa = qobject_cast(sender()); - if (qa) - { - m_gui->chartLengthButton->setText(qa->objectName()); - int seconds = qa->property("Seconds").toInt(); - SetChartLength(seconds); - } - } - void StreamerDrillerDialog::OnTableLengthMenu() - { - QAction* qa = qobject_cast(sender()); - if (qa) - { - int limit = qa->property("Limit").toInt(); - OnTableLengthMenu(limit); - } - } - void StreamerDrillerDialog::OnTableLengthMenu(int limit) - { - if (tableLengthFromIndex[limit] >= 0) - { - m_gui->tableLengthButton->setText(tableLengthToDisplayString[limit]); - m_persistentState->m_tableEventLimiter = limit; - m_isDeltaLocked = false; - SetTableLengthLimit(tableLengthFromIndex[limit]); - m_ptrFilter->SetDeltaLock(0); - } - else - { - m_gui->tableLengthButton->setText(QString("Delta:%1").arg(m_frame)); - m_isDeltaLocked = true; - m_ptrFilter->SetDeltaLock(m_persistentState->m_frameDeltaLock); - } - - BuildChart(m_frame, m_persistentState->m_viewType, m_persistentState->m_chartLengthInSeconds); - } - void StreamerDrillerDialog::OnDataTypeMenu() - { - QAction* qa = qobject_cast(sender()); - if (qa) - { - OnDataTypeMenu(qa->property("DataType").toInt()); - } - } - void StreamerDrillerDialog::OnDataTypeMenu(int type) - { - m_gui->chartTypeButton->setText(chartTypeToDisplayString[type]); - m_persistentState->m_viewType = type; - SetChartType(type); - m_axisFormatter->SetDataType(type); - } - void StreamerDrillerDialog::OnAutoZoomChange(bool newValue) - { - if (!newValue) - { - m_persistentState->m_autoZoom = false; - m_gui->widgetDataStrip->GetWindowRange(Charts::AxisType::Vertical, m_persistentState->m_manualZoomMin, m_persistentState->m_manualZoomMax); - } - else - { - m_persistentState->m_autoZoom = true; - m_persistentState->m_manualZoomMin = 2000000000.0f; - m_persistentState->m_manualZoomMax = -2000000000.0f; - } - BuildChart(m_frame, m_persistentState->m_viewType, m_persistentState->m_chartLengthInSeconds); - } - void StreamerDrillerDialog::SetChartLength(int newLength) - { - m_persistentState->m_chartLengthInSeconds = newLength; - BuildChart(m_frame, m_persistentState->m_viewType, newLength); - } - void StreamerDrillerDialog::SetChartType(int newType) - { - BuildChart(m_frame, newType, m_persistentState->m_chartLengthInSeconds); - } - void StreamerDrillerDialog::SetTableLengthLimit(int limit) - { - m_ptrOriginalModel->SetLengthLimit(limit); - m_ptrFilter->InvalidateFilter(); - } - int StreamerDrillerDialog::GetViewType() - { - return m_persistentState->m_viewType; - } - - // Backing code to the context menu - void StreamerDrillerDialog::SelectAll() - { - m_gui->widgetTableView->selectAll(); - } - - void StreamerDrillerDialog::SelectNone() - { - m_gui->widgetTableView->clearSelection(); - } - - QString StreamerDrillerDialog::ConvertRowToText(const QModelIndex& row) - { - auto pModel = m_ptrFilter; - - if (!pModel) - { - return QString(); - } - - int columnCount = pModel->columnCount(); - QString finalString = ""; - - QModelIndex sourceRow = m_ptrFilter->mapToSource(row); - - for (int column = 0; column < columnCount; ++column) - { - QString displayString = m_ptrOriginalModel->data(sourceRow.row(), column, Qt::DisplayRole).toString(); - if ((column != 0) && (finalString.length() > 0)) - { - finalString += "; "; - } - if (displayString.length()) - { - finalString += displayString.toUtf8().data(); - } - else - { - // must enforce some length even on empty strings in the table - // so that comma-delimiters output properly - finalString += " "; - } - } - finalString += "\n"; - - return finalString; - } - - void StreamerDrillerDialog::CopySelected() - { - auto pModel = m_ptrFilter; - if (!pModel) - { - return; - } - - AZStd::string accumulator; - QItemSelectionModel* selectionModel = m_gui->widgetTableView->selectionModel(); - QModelIndexList indices = selectionModel->selectedRows(); - for (QModelIndexList::iterator iter = indices.begin(); iter != indices.end(); ++iter) - { - QString res = this->ConvertRowToText(*iter); - accumulator += res.toUtf8().data(); - } - - if (accumulator.size()) - { - QClipboard* clipboard = QApplication::clipboard(); - if (clipboard) - { - clipboard->setText(accumulator.c_str()); - } - } - } - - void StreamerDrillerDialog::CopyAll() - { - auto pModel = m_ptrFilter; - if (!pModel) - { - return; - } - - QString finalString = ""; - - int numRows = pModel->rowCount(); - for (int rowIdx = 0; rowIdx < numRows; ++rowIdx) - { - QModelIndex idx = pModel->index(rowIdx, 0); - finalString += this->ConvertRowToText(idx); - } - - QClipboard* clipboard = QApplication::clipboard(); - - if (clipboard) - { - clipboard->setText(finalString); - } - } - - void StreamerDrillerDialog::ApplyPersistentState() - { - onTextChangeWindowFilter(m_persistentState->m_chartNameFilter.c_str()); - OnDataTypeMenu(m_persistentState->m_viewType); - - m_gui->tableLengthButton->setText(tableLengthToDisplayString[m_persistentState->m_tableEventLimiter]); - SetTableLengthLimit(tableLengthFromIndex[m_persistentState->m_tableEventLimiter]); - - if (m_isDeltaLocked) - { - m_gui->tableLengthButton->setText(QString("Delta:%1").arg(m_persistentState->m_frameDeltaLock)); - m_ptrFilter->SetDeltaLock(m_persistentState->m_frameDeltaLock); - } - else - { - m_ptrFilter->SetDeltaLock(0); - } - - m_gui->checkBoxAutoZoom->setChecked(m_persistentState->m_autoZoom); - OnAutoZoomChange(m_persistentState->m_autoZoom); - - for (int i = 0; secondsFromIndex[i]; ++i) - { - if (m_persistentState->m_chartLengthInSeconds == secondsFromIndex[i]) - { - m_gui->chartLengthButton->setText(secondsToDisplayString[i]); - break; - } - } - - BuildChart(m_frame, m_persistentState->m_viewType, m_persistentState->m_chartLengthInSeconds); // full seconds, 60 frames per entry on the chart, modulo even seconds - - UpdateSummary(); - } - - void StreamerDrillerDialog::ApplySettingsFromWorkspace(WorkspaceSettingsProvider* provider) - { - AZStd::string workspaceStateStr = AZStd::string::format("STREAMER DATA VIEW WORKSPACE STATE %i", m_viewIndex); - AZ::u32 workspaceStateCRC = AZ::Crc32(workspaceStateStr.c_str()); - - StreamerDrillerDialogSavedState* workspace = provider->FindSetting(workspaceStateCRC); - if (workspace) - { - *m_persistentState = *workspace; - } - } - - void StreamerDrillerDialog::ActivateWorkspaceSettings(WorkspaceSettingsProvider*) - { - ApplyPersistentState(); - } - - void StreamerDrillerDialog::FrameChanged(FrameNumberType frame) - { - m_frame = frame; - BuildChart(m_frame, m_persistentState->m_viewType, m_persistentState->m_chartLengthInSeconds); // full seconds, 60 frames per entry on the chart, modulo even seconds - } - - void StreamerDrillerDialog::PlaybackLoopBeginChanged(FrameNumberType frame) - { - m_persistentState->m_frameDeltaLock = frame; - FrameNumberType lockedFrame = m_isDeltaLocked ? m_persistentState->m_frameDeltaLock : 0; - m_ptrFilter->SetDeltaLock(lockedFrame); - BuildChart(m_frame, m_persistentState->m_viewType, m_persistentState->m_chartLengthInSeconds); // full seconds, 60 frames per entry on the chart, modulo even seconds - } - - void StreamerDrillerDialog::BuildChart(FrameNumberType atFrame, int viewType, int howFar) - { - BuildAllLabels(atFrame, viewType); - - FrameNumberType lockedFrame = m_isDeltaLocked ? m_persistentState->m_frameDeltaLock : 0; - const char* vAxisLabel[] = {"Transfer", "Seek"}; - - m_gui->widgetDataStrip->Reset(); - FrameNumberType flooredFrame = (atFrame + frameModulo - 1) / frameModulo; - float calculatedFrame = (float)(flooredFrame - howFar >= 0 ? flooredFrame - howFar : 0); - m_gui->widgetDataStrip->AddAxis("Time", calculatedFrame, (float)calculatedFrame + howFar, true, true); - m_gui->widgetDataStrip->AddAxis(vAxisLabel[viewType], m_persistentState->m_manualZoomMin, m_persistentState->m_manualZoomMax, false, false); - int channelID = m_gui->widgetDataStrip->AddChannel("ThroughputOrSeeks"); - m_gui->widgetDataStrip->SetChannelStyle(channelID, StripChart::Channel::STYLE_CONNECTED_LINE); - m_gui->widgetDataStrip->SetChannelColor(channelID, Qt::green); - - FrameNumberType currentFrame = atFrame - (atFrame % frameModulo) - 1; - float accumulator = 0; - - while (howFar > 0 && currentFrame >= (lockedFrame - frameModulo)) - { - FrameNumberType displayFrame = currentFrame; - float thisSecond = 0.0f; - - if (viewType == VIEW_TYPE_THROUGHPUT) - { - while ((currentFrame % frameModulo) && (currentFrame >= 0)) - { - thisSecond += m_aggregator->ThroughputAtFrame(currentFrame); - accumulator += m_aggregator->ThroughputAtFrame(currentFrame); - --currentFrame; - } - ; - thisSecond += m_aggregator->ThroughputAtFrame(currentFrame); - accumulator += m_aggregator->ThroughputAtFrame(currentFrame); - } - else if (viewType == VIEW_TYPE_SEEKINFO) - { - while ((currentFrame % frameModulo) && (currentFrame >= 0)) - { - thisSecond += m_aggregator->SeeksAtFrame(currentFrame); - accumulator += m_aggregator->SeeksAtFrame(currentFrame); - --currentFrame; - } - ; - thisSecond += m_aggregator->SeeksAtFrame(currentFrame); - accumulator += m_aggregator->SeeksAtFrame(currentFrame); - } - - m_gui->widgetDataStrip->AddData(channelID, displayFrame / frameModulo, (float)displayFrame / (float)frameModulo, thisSecond * (60.0f / (float)frameModulo)); - - --currentFrame; - --howFar; - } - - if (m_persistentState->m_autoZoom) - { - m_gui->widgetDataStrip->ZoomExtents(Charts::AxisType::Vertical); - } - else - { - m_gui->widgetDataStrip->ZoomManual(Charts::AxisType::Vertical, m_persistentState->m_manualZoomMin, m_persistentState->m_manualZoomMax); - } - } - - void StreamerDrillerDialog::BuildAllLabels(FrameNumberType atFrame, int viewType) - { - FrameNumberType currentFrame = atFrame; - float accumulateDelta = 0; - FrameNumberType lockedFrame = m_isDeltaLocked ? m_persistentState->m_frameDeltaLock : 0; - - while (currentFrame >= lockedFrame) - { - if (viewType == VIEW_TYPE_THROUGHPUT) - { - accumulateDelta += m_aggregator->ThroughputAtFrame(currentFrame); - } - else if (viewType == VIEW_TYPE_SEEKINFO) - { - accumulateDelta += m_aggregator->SeeksAtFrame(currentFrame); - } - - --currentFrame; - } - - QString deltaString = UpdateDeltaLabel(accumulateDelta); - - float accumulateTime = float(atFrame - lockedFrame + 1) / 60.0f; - QString timeString = QString("T=%1s").arg(QString::number(accumulateTime, 'f', 1)); - - float accumulateAverage = 0.0f; - if (atFrame >= lockedFrame) - { - if (viewType == VIEW_TYPE_THROUGHPUT) - { - accumulateAverage = m_aggregator->ThroughputAtFrame(atFrame); - } - else if (viewType == VIEW_TYPE_SEEKINFO) - { - accumulateAverage = m_aggregator->SeeksAtFrame(atFrame); - } - } - QString averageString = UpdateAverageLabel(accumulateAverage); - QString eventsString = UpdateSummary(); - - QString finalString = eventsString + QString(" ") + deltaString + QString(" ") + averageString + QString(" ") + timeString; - m_gui->summaryLabel->setText(finalString); - - m_gui->summaryLabel->update(); - } - - QString StreamerDrillerDialog::UpdateSummary() - { - int filterRows = m_ptrFilter->rowCount(); - int originalRows = m_ptrOriginalModel->rowCount(); - - return QString("[%1 / %2]").arg(filterRows).arg(originalRows); - } - - QString StreamerDrillerDialog::UpdateDeltaLabel(float accumulator) - { - if (m_persistentState->m_viewType == VIEW_TYPE_THROUGHPUT) - { - QString formattedBytes = FormatMegabytes(accumulator); - return QString("Data=%1").arg(formattedBytes); - } - else - { - return QString("Seek=%1").arg(QString::number(accumulator, 'f', 0)); - } - } - - QString StreamerDrillerDialog::UpdateAverageLabel(float accumulator) - { - if (m_persistentState->m_viewType == VIEW_TYPE_THROUGHPUT) - { - QString formattedBytes = FormatMegabytes(accumulator); - return QString("Now=%1").arg(formattedBytes); - } - else - { - return QString("Seek=%1").arg(QString::number(accumulator, 'f', 0)); - } - } - - QString StreamerDrillerDialog::FormatMegabytes(float value) - { - // data is in Bytes - // so how big is the division size? - if (value > 499999.0f) // greater than half MB - { - return QObject::tr("%1Mb").arg(QString::number(value / 1000000.0f, 'f', 1)); - } - else if (value > 1000.0f) // greater than one K - { - if (value > 1000.0f) // whole milliseconds - { - return QObject::tr("%1%2").arg(QString::number(value / 1000.0f, 'f', 0)).arg("Kb"); - } - else - { - return QObject::tr("%1%2").arg(QString::number(value / 1000.0f, 'f', 1)).arg("Kb"); - } - } - else if (value > 1.0f) - { - return QObject::tr("%1B").arg((int)value); - } - else - { - return QObject::tr("%1B").arg(QString::number((double)value, 'f', 2)); - } - } - - void StreamerDrillerDialog::EventFocusChanged(EventNumberType /*eventIdx*/) - { - } - - void StreamerDrillerDialog::SaveSettingsToWorkspace(WorkspaceSettingsProvider* provider) - { - AZStd::string workspaceStateStr = AZStd::string::format("STREAMER DATA VIEW WORKSPACE STATE %i", m_viewIndex); - AZ::u32 workspaceStateCRC = AZ::Crc32(workspaceStateStr.c_str()); - { - StreamerDrillerDialogSavedState* workspace = provider->CreateSetting(workspaceStateCRC); - if (workspace) - { - *workspace = *m_persistentState; - } - } - } - - void StreamerDrillerDialog::Reflect(AZ::ReflectContext* context) - { - AZ::SerializeContext* serialize = azrtti_cast(context); - if (serialize) - { - StreamerDrillerDialogSavedState::Reflect(context); - StreamerDrillerDialogLocal::Reflect(context); - } - } - - ////////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////////// - // StreamerDrillerLogModel - ////////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////////// - StreamerDrillerLogModel::StreamerDrillerLogModel(StreamerDataAggregator* data, QObject* pParent) - : QAbstractTableModel(pParent) - , m_data(data) - , m_lastShownEvent(-1) - , m_lengthLimit(0) - { - connect(data, SIGNAL(OnDataCurrentEventChanged()), this, SLOT(OnDataCurrentEventChanged())); - connect(data, SIGNAL(OnDataAddEvent()), this, SLOT(OnDataAddEvent())); - - m_lastShownEvent = m_data->GetCurrentEvent(); - } - - StreamerDrillerLogModel::~StreamerDrillerLogModel() - { - } - - void StreamerDrillerLogModel::OnDataCurrentEventChanged() - { - // real source data changes operate in real space, not the window of the length limited - int limitStore = m_lengthLimit; - SetLengthLimit(0); - - AZ::s64 currentEvent = m_data->GetCurrentEvent(); - // NOTE: we add +1 to all events, because we are EXECUTING the current event (so it must be shown) - if (m_lastShownEvent > currentEvent) - { - // remove rows - beginRemoveRows(QModelIndex(), (int)currentEvent + 1, (int)m_lastShownEvent); - endRemoveRows(); - } - else if (m_lastShownEvent < currentEvent) - { - // add rows - beginInsertRows(QModelIndex(), (int)m_lastShownEvent + 1, (int)currentEvent); - endInsertRows(); - } - m_lastShownEvent = currentEvent; - - SetLengthLimit(limitStore); - } - - void StreamerDrillerLogModel::OnDataAddEvent() - { - } - - void StreamerDrillerLogModel::SetLengthLimit(int limit) - { - beginResetModel(); - m_lengthLimit = limit; - endResetModel(); - } - - int StreamerDrillerLogModel::rowCount(const QModelIndex&) const - { - AZ::s64 currentEvent = m_data->GetCurrentEvent(); - if (m_lengthLimit && (m_lengthLimit < (currentEvent + 1))) - { - return m_lengthLimit; - } - return (int)currentEvent + 1; - } - int StreamerDrillerLogModel::columnCount(const QModelIndex&) const - { - return SDM_TOTAL; - } - Qt::ItemFlags StreamerDrillerLogModel::flags(const QModelIndex& index) const - { - if (!index.isValid()) - { - return Qt::ItemIsEnabled; - } - - return QAbstractItemModel::flags(index); - } - - QVariant StreamerDrillerLogModel::headerData (int section, Qt::Orientation orientation, int role) const - { - if (role == Qt::DisplayRole) - { - if (orientation == Qt::Horizontal) - { - return QVariant(SDM_STRING[section]); - } - // purposefully ignoring the ::Vertical orientation as part of an optimiztion - } - - return QVariant(); - } - - EventNumberType StreamerDrillerLogModel::RowToGlobalEventIndex(int row) - { - EventNumberType currentEvent = m_data->GetCurrentEvent(); - if (m_lengthLimit && (m_lengthLimit < (currentEvent + 1))) - { - row = row + (int)currentEvent - m_lengthLimit + 1; - } - - return row; - } - - QVariant StreamerDrillerLogModel::data(const QModelIndex& index, int role) const - { - return data(index.row(), index.column(), role); - } - - QVariant StreamerDrillerLogModel::data(int row, int column, int role) const - { - AZ::s64 currentEvent = m_data->GetCurrentEvent(); - if (m_lengthLimit && (m_lengthLimit < (currentEvent + 1))) - { - row = row + (int)currentEvent - m_lengthLimit + 1; - } - - return data(m_data->GetEvents()[row], row, column, role); - } - - QVariant StreamerDrillerLogModel::data(DrillerEvent* event, int row, int column, int role) const - { - using namespace AZ::Debug; - - const bool dummyCompressedFlag = false; // placeholder until set from stream info - - if (role == Qt::DisplayRole) - { - // COLUMN ------------------------------------------------------------- - if (column == SDM_NAME) - { - switch (event->GetEventType()) - { - case Driller::Streamer::SET_DEVICE_MOUNTED: - { - return QVariant(QString(static_cast(event)->m_deviceData.m_name)); - break; - } - case Driller::Streamer::SET_DEVICE_UNMOUNTED: - { - return QVariant(QString(static_cast(event)->m_unmountedDeviceData->m_name)); - break; - } - case Driller::Streamer::SET_REGISTER_STREAM: - { - return QVariant(QString(static_cast(event)->m_streamData.m_name)); - break; - } - case Driller::Streamer::SET_UNREGISTER_STREAM: - { - auto depEvt = static_cast(event); - if (depEvt && depEvt->m_removedStreamData) - { - return QVariant(QString(depEvt->m_removedStreamData->m_name)); - } - return QVariant(QString(m_data->GetFilenameFromStreamId(row, depEvt->m_streamId))); - break; - } - case Driller::Streamer::SET_ADD_REQUEST: - { - auto depEvt = static_cast(event); - return QVariant(QString(m_data->GetFilenameFromStreamId(row, depEvt->m_requestData.m_streamId))); - break; - } - case Driller::Streamer::SET_CANCEL_REQUEST: - { - return QVariant(QString(m_data->GetFilenameFromStreamId(row, static_cast(event)->m_cancelledRequestData->m_streamId))); - break; - } - case Driller::Streamer::SET_RESCHEDULE_REQUEST: - { - return QVariant(QString(m_data->GetFilenameFromStreamId(row, static_cast(event)->m_rescheduledRequestData->m_streamId))); - break; - } - case Driller::Streamer::SET_COMPLETE_REQUEST: - { - auto depEvt = static_cast(event); - return QVariant(QString(m_data->GetFilenameFromStreamId(row, depEvt->m_removedRequest->m_streamId))); - break; - } - case Driller::Streamer::SET_OPERATION_START: - { - auto depEvt = static_cast(event); - return QVariant(QString("%1").arg(m_data->GetFilenameFromStreamId(row, depEvt->m_streamId))); - break; - } - case Driller::Streamer::SET_OPERATION_COMPLETE: - { - auto depEvt = static_cast(event); - return QVariant(QString("%1").arg(m_data->GetFilenameFromStreamId(row, depEvt->m_streamId))); - break; - } - } - } - // COLUMN ------------------------------------------------------------- - if (column == SDM_DEBUG_NAME) - { - switch (event->GetEventType()) - { - case Driller::Streamer::SET_ADD_REQUEST: - { - auto depEvt = static_cast(event); - if (depEvt->m_requestData.m_debugName) - { - return QVariant(QString(depEvt->m_requestData.m_debugName)); - } - break; - } - case Driller::Streamer::SET_CANCEL_REQUEST: - { - return QVariant(QString(static_cast(event)->m_cancelledRequestData->m_debugName)); - break; - } - case Driller::Streamer::SET_RESCHEDULE_REQUEST: - { - return QVariant(QString(static_cast(event)->m_rescheduledRequestData->m_debugName)); - break; - } - case Driller::Streamer::SET_COMPLETE_REQUEST: - { - auto depEvt = static_cast(event); - if (depEvt->m_removedRequest->m_debugName) - { - return QVariant(QString(depEvt->m_removedRequest->m_debugName)); - } - break; - } - case Driller::Streamer::SET_OPERATION_START: - { - auto depEvt = static_cast(event); - return QVariant(QString("%1").arg(m_data->GetDebugNameFromStreamId(row, depEvt->m_streamId))); - break; - } - case Driller::Streamer::SET_OPERATION_COMPLETE: - { - auto depEvt = static_cast(event); - return QVariant(QString("%1").arg(m_data->GetDebugNameFromStreamId(row, depEvt->m_streamId))); - break; - } - } - } - // COLUMN ------------------------------------------------------------- - else if (column == SDM_EVENT_TYPE) - { - return QVariant(QString(eventTypeToString[ event->GetEventType() + 1 ])); - } - // COLUMN ------------------------------------------------------------- - else if (column == SDM_OPERATION) - { - switch (event->GetEventType()) - { - case Driller::Streamer::SET_OPERATION_COMPLETE: - { - return QVariant(QString(operationTypeToString[ static_cast(event)->m_type + 1 ])); - break; - } - } - } - // COLUMN ------------------------------------------------------------- - else if (column == SDM_DELTA_TIME) - { - switch (event->GetEventType()) - { - case Driller::Streamer::SET_OPERATION_START: - { - auto depEvt = static_cast(event); - - StreamerDataAggregator::SeekEventType seekType = m_data->GetSeekType(depEvt->GetGlobalEventId()); - QString seekNotice = seekTypeToString[seekType]; - - return QVariant(QString("%1").arg(seekNotice)); - break; - } - case Driller::Streamer::SET_ADD_REQUEST: - { - // this is a delta between this new request and a previous completion - // useful to determine slack time in incoming request sequences - auto depEvt = static_cast(event); - - int backtrackRow = row - 1; - while (backtrackRow >= 0) - { - DrillerEvent* pastEvent = m_data->GetEvents()[backtrackRow]; - if (pastEvent->GetEventType() == Driller::Streamer::SET_COMPLETE_REQUEST) - { - auto olderRequest = static_cast(pastEvent); - return QVariant(QString("%L1").arg(depEvt->m_timeStamp - olderRequest->m_timeStamp)); - } - - --backtrackRow; - } - break; - } - case Driller::Streamer::SET_COMPLETE_REQUEST: - { - auto thisEvent = static_cast(event); - - int backtrackRow = row - 1; - while (backtrackRow >= 0) - { - DrillerEvent* pastEvent = m_data->GetEvents()[backtrackRow]; - if (pastEvent->GetEventType() == Driller::Streamer::SET_ADD_REQUEST) - { - auto originalRequest = static_cast(pastEvent); - if (thisEvent->m_requestId == originalRequest->m_requestData.m_id) - { - return QVariant(QString("%L1").arg(thisEvent->m_timeStamp - originalRequest->m_timeStamp)); - } - } - - --backtrackRow; - } - break; - } - case Driller::Streamer::SET_OPERATION_COMPLETE: - { - auto thisEvent = static_cast(event); - - int backtrackRow = row - 1; - while (backtrackRow >= 0) - { - DrillerEvent* pastEvent = m_data->GetEvents()[backtrackRow]; - if (pastEvent->GetEventType() == Driller::Streamer::SET_OPERATION_START) - { - auto originalOperation = static_cast(pastEvent); - if (thisEvent->m_streamId == originalOperation->m_streamId) - { - return QVariant(QString("%L1").arg(thisEvent->m_timeStamp - originalOperation->m_timeStamp)); - } - } - - --backtrackRow; - } - break; - } - } - } - // COLUMN ------------------------------------------------------------- - else if (column == SDM_DATA_TRANSFER) - { - switch (event->GetEventType()) - { - case Driller::Streamer::SET_OPERATION_COMPLETE: - { - auto socEvent = static_cast(event); - - if (dummyCompressedFlag) - { - if (static_cast(socEvent->m_type) == StreamerDataAggregator::TRANSFER_EVENT_COMPRESSOR_READ || static_cast(socEvent->m_type) == StreamerDataAggregator::TRANSFER_EVENT_COMPRESSOR_WRITE) - { - return QVariant(QString("%1").arg(socEvent->m_bytesTransferred)); - } - } - else - { - return QVariant(QString("%1").arg(socEvent->m_bytesTransferred)); - } - - break; - } - } - } - // COLUMN ------------------------------------------------------------- - else if (column == SDM_READ_SIZE) - { - switch (event->GetEventType()) - { - case Driller::Streamer::SET_ADD_REQUEST: - { - return QVariant(QString("%1").arg(static_cast(event)->m_requestData.m_size)); - break; - } - case Driller::Streamer::SET_COMPLETE_REQUEST: - { - return QVariant(QString("%1").arg(static_cast(event)->m_removedRequest->m_size)); - break; - } - } - } - else if (column == SDM_OFFSET) - { - switch (event->GetEventType()) - { - case Driller::Streamer::SET_ADD_REQUEST: - { - StreamerAddRequestEvent* actualData = static_cast(event); - return QVariant(QString::number(actualData->m_requestData.m_offset)); - } - break; - case Driller::Streamer::SET_OPERATION_START: - { - StreamerOperationStartEvent* actualData = static_cast(event); - return QVariant(QString::number(actualData->m_operation.m_offset)); - } - break; - } - } - } - - return QVariant(); - } -} diff --git a/Code/Tools/Standalone/Source/Driller/IO/StreamerEvents.cpp b/Code/Tools/Standalone/Source/Driller/IO/StreamerEvents.cpp deleted file mode 100644 index 78e2e1c611..0000000000 --- a/Code/Tools/Standalone/Source/Driller/IO/StreamerEvents.cpp +++ /dev/null @@ -1,228 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "StreamerEvents.h" - -#include "StreamerDataAggregator.hxx" - -namespace Driller -{ - void StreamerMountDeviceEvent::StepForward(Aggregator* data) - { - StreamerDataAggregator* aggr = static_cast(data); - aggr->m_devices.push_back(&m_deviceData); - } - - void StreamerMountDeviceEvent::StepBackward(Aggregator* data) - { - StreamerDataAggregator* aggr = static_cast(data); - StreamerDataAggregator::DeviceArrayType::iterator it = AZStd::find(aggr->m_devices.begin(), aggr->m_devices.end(), &m_deviceData); - if (it != aggr->m_devices.end()) // we can potentially not have registered the device if we did NOT capture the full state! TODO: warn about this - { - aggr->m_devices.erase(it); - } - } - - void StreamerUnmountDeviceEvent::StepForward(Aggregator* data) - { - StreamerDataAggregator* aggr = static_cast(data); - for (StreamerDataAggregator::DeviceArrayType::iterator it = aggr->m_devices.begin(); it != aggr->m_devices.end(); ++it) - { - if ((*it)->m_id == m_deviceId) - { - m_unmountedDeviceData = *it; - aggr->m_devices.erase(it); - break; - } - } - } - - void StreamerUnmountDeviceEvent::StepBackward(Aggregator* data) - { - StreamerDataAggregator* aggr = static_cast(data); - aggr->m_devices.push_back(m_unmountedDeviceData); - } - - void StreamerRegisterStreamEvent::StepForward(Aggregator* data) - { - StreamerDataAggregator* aggr = static_cast(data); - aggr->m_streams.insert(AZStd::make_pair(m_streamData.m_id, &m_streamData)); - } - - void StreamerRegisterStreamEvent::StepBackward(Aggregator* data) - { - StreamerDataAggregator* aggr = static_cast(data); - aggr->m_streams.erase(m_streamData.m_id); - } - - void StreamerUnregisterStreamEvent::StepForward(Aggregator* data) - { - StreamerDataAggregator* aggr = static_cast(data); - StreamerDataAggregator::StreamMapType::iterator it = aggr->m_streams.find(m_streamId); - if (it != aggr->m_streams.end()) - { - m_removedStreamData = it->second; - aggr->m_streams.erase(it); - } - } - - void StreamerUnregisterStreamEvent::StepBackward(Aggregator* data) - { - if (m_removedStreamData != nullptr) - { - StreamerDataAggregator* aggr = static_cast(data); - aggr->m_streams.insert(AZStd::make_pair(m_streamId, m_removedStreamData)); - } - } - - void StreamerReadCacheHit::StepForward(Aggregator* data) - { - StreamerDataAggregator* aggr = static_cast(data); - (void)aggr; // Add to read cache hit map - } - - void StreamerReadCacheHit::StepBackward(Aggregator* data) - { - StreamerDataAggregator* aggr = static_cast(data); - (void)aggr; // Remove from read cache hit map - } - - void StreamerAddRequestEvent::StepForward(Aggregator* data) - { - StreamerDataAggregator* aggr = static_cast(data); - aggr->m_requests.insert(AZStd::make_pair(m_requestData.m_id, &m_requestData)); - } - - void StreamerAddRequestEvent::StepBackward(Aggregator* data) - { - StreamerDataAggregator* aggr = static_cast(data); - aggr->m_requests.erase(m_requestData.m_id); - } - - void StreamerCompleteRequestEvent::StepForward(Aggregator* data) - { - StreamerDataAggregator* aggr = static_cast(data); - StreamerDataAggregator::RequestMapType::iterator it = aggr->m_requests.find(m_requestId); - if (it != aggr->m_requests.end()) - { - m_removedRequest = it->second; - m_oldState = m_removedRequest->m_completeState; - m_removedRequest->m_completeState = m_state; - aggr->m_requests.erase(it); - } - else - { - // TODO warn, this is possible if we did not capture the full state from the beginning - } - } - - void StreamerCompleteRequestEvent::StepBackward(Aggregator* data) - { - if (m_removedRequest != nullptr) - { - StreamerDataAggregator* aggr = static_cast(data); - m_removedRequest->m_completeState = m_oldState; - aggr->m_requests.insert(AZStd::make_pair(m_requestId, m_removedRequest)); - } - } - - void StreamerCancelRequestEvent::StepForward(Aggregator* data) - { - StreamerDataAggregator* aggr = static_cast(data); - StreamerDataAggregator::RequestMapType::iterator it = aggr->m_requests.find(m_requestId); - if (it != aggr->m_requests.end()) - { - m_cancelledRequestData = it->second; - aggr->m_requests.erase(it); - } - } - - void StreamerCancelRequestEvent::StepBackward(Aggregator* data) - { - if (m_cancelledRequestData != nullptr) - { - StreamerDataAggregator* aggr = static_cast(data); - aggr->m_requests.insert(AZStd::make_pair(m_requestId, m_cancelledRequestData)); - } - } - - - void StreamerRescheduleRequestEvent::StepForward(Aggregator* data) - { - StreamerDataAggregator* aggr = static_cast(data); - StreamerDataAggregator::RequestMapType::iterator it = aggr->m_requests.find(m_requestId); - if (it != aggr->m_requests.end()) - { - m_rescheduledRequestData = it->second; - m_oldDeadline = m_rescheduledRequestData->m_deadline; - m_oldPriority = m_rescheduledRequestData->m_priority; - m_rescheduledRequestData->m_deadline = m_newDeadline; - m_rescheduledRequestData->m_priority = m_newPriority; - } - else - { - // TODO warn, this is possible if we did not capture the full state from the beginning - } - } - - void StreamerRescheduleRequestEvent::StepBackward(Aggregator* data) - { - (void)data; - if (m_rescheduledRequestData != nullptr) - { - m_rescheduledRequestData->m_deadline = m_oldDeadline; - m_rescheduledRequestData->m_priority = m_oldPriority; - } - } - - void StreamerOperationStartEvent::StepForward(Aggregator* data) - { - StreamerDataAggregator* aggr = static_cast(data); - StreamerDataAggregator::StreamMapType::iterator it = aggr->m_streams.find(m_streamId); - if (it != aggr->m_streams.end()) - { - m_stream = it->second; - m_previousOperation = m_stream->m_operation; - m_stream->m_operation = &m_operation; - } - else - { - // TODO warn in a smart way too many warnings while scrubbing - //AZ_Warning("Streamer Driller",false,"Operation could not find a stream 0x%08x this can be ok deoending on the streamer mode (if it captures the inital state or not)!",m_streamId); - } - } - - void StreamerOperationStartEvent::StepBackward(Aggregator* data) - { - (void)data; - if (m_stream != nullptr) - { - m_stream->m_operation = m_previousOperation; - } - } - - void StreamerOperationCompleteEvent::StepForward(Aggregator* data) - { - StreamerDataAggregator* aggr = static_cast(data); - StreamerDataAggregator::StreamMapType::iterator it = aggr->m_streams.find(m_streamId); - if (it != aggr->m_streams.end()) - { - m_stream = it->second; - m_stream->m_operation->m_bytesTransferred = m_bytesTransferred; - } - } - - void StreamerOperationCompleteEvent::StepBackward(Aggregator* data) - { - (void)data; - if (m_stream != nullptr) - { - m_stream->m_operation->m_bytesTransferred = 0; - } - } -} // namespace Driller diff --git a/Code/Tools/Standalone/Source/Driller/Memory/MemoryDataAggregator.cpp b/Code/Tools/Standalone/Source/Driller/Memory/MemoryDataAggregator.cpp deleted file mode 100644 index 71d0cf3975..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Memory/MemoryDataAggregator.cpp +++ /dev/null @@ -1,271 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "MemoryDataAggregator.hxx" -#include -#include "MemoryDataView.hxx" - -#include "MemoryEvents.h" -#include -#include -#include "Source/Driller/Workspaces/Workspace.h" - -namespace Driller -{ - class MemoryDataAggregatorSavedState - : public AZ::UserSettings - { - public: - AZ_RTTI(MemoryDataAggregatorSavedState, "{9A117AF1-842B-43C4-8E98-F08E8080579A}", AZ::UserSettings); - AZ_CLASS_ALLOCATOR(MemoryDataAggregatorSavedState, AZ::SystemAllocator, 0); - MemoryDataAggregatorSavedState() - : m_activeViewCount(0) - {} - - int m_activeViewCount; - - static void Reflect(AZ::ReflectContext* context) - { - AZ::SerializeContext* serialize = azrtti_cast(context); - if (serialize) - { - serialize->Class() - ->Field("m_activeViewCount", &MemoryDataAggregatorSavedState::m_activeViewCount) - ->Version(2); - } - } - }; - - class MemoryDataAggregatorWorkspace - : public AZ::UserSettings - { - public: - AZ_RTTI(MemoryDataAggregatorWorkspace, "{4CBE496B-1CC3-4219-A0E2-D88850F6BCFD}", AZ::UserSettings); - AZ_CLASS_ALLOCATOR(MemoryDataAggregatorWorkspace, AZ::SystemAllocator, 0); - - int m_activeViewCount; - - MemoryDataAggregatorWorkspace() - : m_activeViewCount(0) - {} - - static void Reflect(AZ::ReflectContext* context) - { - AZ::SerializeContext* serialize = azrtti_cast(context); - if (serialize) - { - serialize->Class() - ->Field("m_activeViewCount", &MemoryDataAggregatorWorkspace::m_activeViewCount) - ->Version(2); - } - } - }; - - ////////////////////////////////////////////////////////////////////////// - MemoryDataAggregator::MemoryDataAggregator(int identity) - : Aggregator(identity) - { - m_parser.SetAggregator(this); - - m_persistentState = AZ::UserSettings::CreateFind(AZ_CRC("MEMORY DATA AGGREGATOR SAVED STATE", 0x672155eb), AZ::UserSettings::CT_GLOBAL); - AZ_Assert(m_persistentState, "Persistent State is NULL?"); - } - - MemoryDataAggregator::~MemoryDataAggregator() - { - KillAllViews(); - } - - float MemoryDataAggregator::ValueAtFrame(FrameNumberType frame) - { - const float maxEventsPerFrame = 1000.0f; // just a scale number - float numEventsPerFrame = static_cast(NumOfEventsAtFrame(frame)); - return AZStd::GetMin(numEventsPerFrame / maxEventsPerFrame, 1.0f) * 2.0f - 1.0f; - } - - QColor MemoryDataAggregator::GetColor() const - { - return QColor(255, 0, 0); - } - - QString MemoryDataAggregator::GetName() const - { - return "Memory"; - } - - QString MemoryDataAggregator::GetChannelName() const - { - return ChannelName(); - } - - QString MemoryDataAggregator::GetDescription() const - { - return "Memory allocations driller"; - } - - QString MemoryDataAggregator::GetToolTip() const - { - return "Information about Memory allocations"; - } - - AZ::Uuid MemoryDataAggregator::GetID() const - { - return AZ::Uuid("{D97E63EC-D85C-4DBB-B7CD-B092E2AB3A63}"); - } - - QWidget* MemoryDataAggregator::DrillDownRequest(FrameNumberType frame) - { - AZ::u32 availableIdx = 0; - bool foundASpot = true; - do - { - foundASpot = true; - for (DataViewMap::iterator iter = m_dataViews.begin(); iter != m_dataViews.end(); ++iter) - { - if (iter->second == availableIdx) - { - foundASpot = false; - ++availableIdx; - break; - } - } - } while (!foundASpot); - - Driller::MemoryDataView* dv = NULL; - if (m_events.size()) - { - dv = aznew Driller::MemoryDataView(this, frame, (1024 * GetIdentity()) + availableIdx); - if (dv) - { - m_dataViews[dv] = availableIdx; - connect(dv, SIGNAL(destroyed(QObject*)), this, SLOT(OnDataViewDestroyed(QObject*))); - ++m_persistentState->m_activeViewCount; - } - } - - return dv; - } - void MemoryDataAggregator::OptionsRequest() - { - } - void MemoryDataAggregator::OnDataViewDestroyed(QObject* dataView) - { - m_dataViews.erase(static_cast(dataView)); - --m_persistentState->m_activeViewCount; - } - - MemoryDataAggregator::AllocatorInfoArrayType::iterator MemoryDataAggregator::FindAllocatorById(AZ::u64 id) - { - for (MemoryDataAggregator::AllocatorInfoArrayType::iterator alIt = m_allocators.begin(); alIt != m_allocators.end(); ++alIt) - { - if ((*alIt)->m_id == id) - { - return alIt; - } - } - return m_allocators.end(); - } - - MemoryDataAggregator::AllocatorInfoArrayType::iterator MemoryDataAggregator::FindAllocatorByRecordsId(AZ::u64 recordsId) - { - for (MemoryDataAggregator::AllocatorInfoArrayType::iterator alIt = m_allocators.begin(); alIt != m_allocators.end(); ++alIt) - { - if ((*alIt)->m_recordsId == recordsId) - { - return alIt; - } - } - return m_allocators.end(); - } - - void MemoryDataAggregator::KillAllViews() - { - do - { - DataViewMap::iterator iter = m_dataViews.begin(); - if (iter != m_dataViews.end()) - { - iter->first->hide(); - delete iter->first; - continue; - } - break; - } while (1); - } - - void MemoryDataAggregator::ApplySettingsFromWorkspace(WorkspaceSettingsProvider* provider) - { - MemoryDataAggregatorWorkspace* workspace = provider->FindSetting(AZ_CRC("MEMORY DATA AGGREGATOR WORKSPACE", 0x41ee95bc)); - if (workspace) - { - m_persistentState->m_activeViewCount = workspace->m_activeViewCount; - } - } - void MemoryDataAggregator::ActivateWorkspaceSettings(WorkspaceSettingsProvider* provider) - { - MemoryDataAggregatorWorkspace* workspace = provider->FindSetting(AZ_CRC("MEMORY DATA AGGREGATOR WORKSPACE", 0x41ee95bc)); - if (workspace) - { - // kill all existing data view windows in preparation of opening the workspace specified ones - KillAllViews(); - - // the internal count should be 0 from the above house cleaning - // and incremented back up from the workspace instantiations - m_persistentState->m_activeViewCount = 0; - for (int i = 0; i < workspace->m_activeViewCount; ++i) - { - // driller must be created at (frame > 0) for it to have a valid tree to display - Driller::MemoryDataView* dataView = qobject_cast(DrillDownRequest(1)); - if (dataView) - { - // apply will overlay the workspace settings on top of the local user settings - dataView->ApplySettingsFromWorkspace(provider); - // activate will do the heavy lifting - dataView->ActivateWorkspaceSettings(provider); - } - } - } - } - void MemoryDataAggregator::SaveSettingsToWorkspace(WorkspaceSettingsProvider* provider) - { - MemoryDataAggregatorWorkspace* workspace = provider->CreateSetting(AZ_CRC("MEMORY DATA AGGREGATOR WORKSPACE", 0x41ee95bc)); - if (workspace) - { - workspace->m_activeViewCount = m_persistentState->m_activeViewCount; - - for (DataViewMap::iterator iter = m_dataViews.begin(); iter != m_dataViews.end(); ++iter) - { - iter->first->SaveSettingsToWorkspace(provider); - } - } - } - - //========================================================================= - // Reset - // [7/10/2013] - //========================================================================= - void MemoryDataAggregator::Reset() - { - m_allocators.clear(); - } - - void MemoryDataAggregator::Reflect(AZ::ReflectContext* context) - { - AZ::SerializeContext* serialize = azrtti_cast(context); - if (serialize) - { - MemoryDataAggregatorSavedState::Reflect(context); - MemoryDataAggregatorWorkspace::Reflect(context); - MemoryDataView::Reflect(context); - - serialize->Class() - ->Version(1) - ->SerializeWithNoData(); - } - } -} // namespace Driller diff --git a/Code/Tools/Standalone/Source/Driller/Memory/MemoryDataAggregator.hxx b/Code/Tools/Standalone/Source/Driller/Memory/MemoryDataAggregator.hxx deleted file mode 100644 index f124d55947..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Memory/MemoryDataAggregator.hxx +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef DRILLER_MEMORY_DATAAGGREGATOR_TESTS_H -#define DRILLER_MEMORY_DATAAGGREGATOR_TESTS_H - -#if !defined(Q_MOC_RUN) -#include "Source/Driller/DrillerAggregator.hxx" -#include "Source/Driller/DrillerAggregatorOptions.hxx" - -#include - -#include "MemoryDataParser.h" -#include "MemoryDataView.hxx" -#endif - -namespace Driller -{ - namespace Memory - { - struct AllocationInfo; - struct AllocatorInfo; - } - class MemoryDataAggregatorSavedState; - - /** - * Memory data drilling aggregator. - */ - class MemoryDataAggregator : public Aggregator - { - friend class MemoryDataView; - MemoryDataAggregator(const MemoryDataAggregator&) = delete; - Q_OBJECT; - public: - AZ_RTTI(MemoryDataAggregator, "{18589F5B-B9F0-4893-90E7-95C6E08DF798}"); - AZ_CLASS_ALLOCATOR(MemoryDataAggregator,AZ::SystemAllocator,0); - - MemoryDataAggregator(int identity = 0); - virtual ~MemoryDataAggregator(); - - static AZ::u32 DrillerId() { return MemoryDrillerHandlerParser::GetDrillerId(); } - virtual AZ::u32 GetDrillerId() const override { return DrillerId(); } - - static const char* ChannelName() { return "Memory"; } - virtual AZ::Crc32 GetChannelId() const override { return AZ::Crc32(ChannelName()); } - - virtual AZ::Debug::DrillerHandlerParser* GetDrillerDataParser() { return &m_parser; } - - virtual void ApplySettingsFromWorkspace(WorkspaceSettingsProvider*); - virtual void ActivateWorkspaceSettings(WorkspaceSettingsProvider *); - virtual void SaveSettingsToWorkspace(WorkspaceSettingsProvider*); - - void KillAllViews(); - - ////////////////////////////////////////////////////////////////////////// - // Aggregator - virtual void Reset(); - public slots: - float ValueAtFrame( FrameNumberType frame ) override; - QColor GetColor() const override; - QString GetChannelName() const override; - QString GetName() const override; - QString GetDescription() const override; - QString GetToolTip() const override; - AZ::Uuid GetID() const override; - QWidget* DrillDownRequest(FrameNumberType frame) override; - void OptionsRequest() override; - void OnDataViewDestroyed(QObject*); - - //protected: - public: - typedef AZStd::vector AllocatorInfoArrayType; - - AllocatorInfoArrayType::iterator FindAllocatorById(AZ::u64 id); - AllocatorInfoArrayType::iterator FindAllocatorByRecordsId(AZ::u64 recordsId); - AllocatorInfoArrayType::iterator GetAllocatorEnd() { return m_allocators.end(); } - - AllocatorInfoArrayType m_allocators; ///< Current state of allocators - MemoryDrillerHandlerParser m_parser; ///< Parser for this aggregator - - typedef AZStd::unordered_map DataViewMap; - DataViewMap m_dataViews; /// track active dialog indexes - AZStd::intrusive_ptr m_persistentState; - - static void Reflect(AZ::ReflectContext* context); - }; - -} - -#endif diff --git a/Code/Tools/Standalone/Source/Driller/Memory/MemoryDataParser.cpp b/Code/Tools/Standalone/Source/Driller/Memory/MemoryDataParser.cpp deleted file mode 100644 index 4ced538257..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Memory/MemoryDataParser.cpp +++ /dev/null @@ -1,172 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "MemoryDataParser.h" -#include "MemoryDataAggregator.hxx" -#include "MemoryEvents.h" - -namespace Driller -{ - AZ::Debug::DrillerHandlerParser* MemoryDrillerHandlerParser::OnEnterTag(AZ::u32 tagName) - { - AZ_Assert(m_data, "You must set a valid memory aggregator before we can process the data!"); - - if (tagName == AZ_CRC("RegisterAllocator", 0x19f08114)) - { - m_subTag = ST_REGISTER_ALLOCATOR; - m_data->AddEvent(aznew MemoryDrillerRegisterAllocatorEvent()); - return this; // m_registerAllocatorHanler - } - else if (tagName == AZ_CRC("RegisterAllocation", 0x992a9780)) - { - m_subTag = ST_REGISTER_ALLOCATION; - m_data->AddEvent(aznew MemoryDrillerRegisterAllocationEvent()); - return this; // m_registerAllocation - } - else if (tagName == AZ_CRC("UnRegisterAllocation", 0xea5dc4cd)) - { - m_subTag = ST_UNREGISTER_ALLOCATION; - m_data->AddEvent(aznew MemoryDrillerUnregisterAllocationEvent()); - return this; // m_unregisterAllocation - } - else if (tagName == AZ_CRC("ResizeAllocation", 0x8a9c78dc)) - { - m_subTag = ST_RESIZE_ALLOCATION; - m_data->AddEvent(aznew MemoryDrillerResizeAllocationEvent()); - return this; // m_resizeAllocation - } - else - { - m_subTag = ST_NONE; - } - return NULL; - } - - void MemoryDrillerHandlerParser::OnExitTag(DrillerHandlerParser* handler, AZ::u32 tagName) - { - (void)tagName; - if (handler != NULL) - { - m_subTag = ST_NONE; // we have only one level just go back to the default state - } - } - - void MemoryDrillerHandlerParser::OnData(const AZ::Debug::DrillerSAXParser::Data& dataNode) - { - AZ_Assert(m_data, "You must set a valid memory aggregator before we can process the data!"); - - switch (m_subTag) - { - case ST_NONE: - { - if (dataNode.m_name == AZ_CRC("UnregisterAllocator", 0xb2b54f93)) - { - AZ::u64 allocatorId; - dataNode.Read(allocatorId); - MemoryDrillerUnregisterAllocatorEvent* event = aznew MemoryDrillerUnregisterAllocatorEvent(); - event->m_allocatorId = allocatorId; - m_data->AddEvent(event); - } - } break; - case ST_REGISTER_ALLOCATOR: - { - MemoryDrillerRegisterAllocatorEvent* event = static_cast(m_data->GetEvents().back()); - if (dataNode.m_name == AZ_CRC("Name", 0x5e237e06)) - { - event->m_allocatorInfo.m_name = dataNode.ReadPooledString(); - } - else if (dataNode.m_name == AZ_CRC("Id", 0xbf396750)) - { - dataNode.Read(event->m_allocatorInfo.m_id); - } - else if (dataNode.m_name == AZ_CRC("Capacity", 0xb5e8b174)) - { - dataNode.Read(event->m_allocatorInfo.m_capacity); - } - else if (dataNode.m_name == AZ_CRC("RecordsId", 0x7caaca88)) - { - dataNode.Read(event->m_allocatorInfo.m_recordsId); - } - else if (dataNode.m_name == AZ_CRC("RecordsMode", 0x764c147a)) - { - dataNode.Read(event->m_allocatorInfo.m_recordMode); - } - else if (dataNode.m_name == AZ_CRC("NumStackLevels", 0xad9cff15)) - { - dataNode.Read(event->m_allocatorInfo.m_numStackLevels); - } - } break; - case ST_REGISTER_ALLOCATION: - { - MemoryDrillerRegisterAllocationEvent* event = static_cast(m_data->GetEvents().back()); - if (dataNode.m_name == AZ_CRC("RecordsId", 0x7caaca88)) - { - dataNode.Read(event->m_allocationInfo.m_recordsId); - } - else if (dataNode.m_name == AZ_CRC("Address", 0x0d4e6f81)) - { - dataNode.Read(event->m_address); - } - else if (dataNode.m_name == AZ_CRC("Alignment", 0x2cce1e5c)) - { - dataNode.Read(event->m_allocationInfo.m_alignment); - } - else if (dataNode.m_name == AZ_CRC("Size", 0xf7c0246a)) - { - dataNode.Read(event->m_allocationInfo.m_size); - } - else if (dataNode.m_name == AZ_CRC("Name", 0x5e237e06)) - { - event->m_allocationInfo.m_name = dataNode.ReadPooledString(); - } - else if (dataNode.m_name == AZ_CRC("FileName", 0x3c0be965)) - { - event->m_allocationInfo.m_fileName = dataNode.ReadPooledString(); - } - else if (dataNode.m_name == AZ_CRC("FileLine", 0xb33c2395)) - { - dataNode.Read(event->m_allocationInfo.m_fileLine); - } - else if (dataNode.m_name == AZ_CRC("Stack", 0x41a87b6a)) - { - // TODO: we can pool that stack memory - event->m_allocationInfo.m_stackFrames = reinterpret_cast(azmalloc(dataNode.m_dataSize)); - dataNode.Read(event->m_allocationInfo.m_stackFrames, dataNode.m_dataSize); - } - } break; - case ST_UNREGISTER_ALLOCATION: - { - MemoryDrillerUnregisterAllocationEvent* event = static_cast(m_data->GetEvents().back()); - if (dataNode.m_name == AZ_CRC("RecordsId", 0x7caaca88)) - { - dataNode.Read(event->m_recordsId); - } - else if (dataNode.m_name == AZ_CRC("Address", 0x0d4e6f81)) - { - dataNode.Read(event->m_address); - } - } break; - case ST_RESIZE_ALLOCATION: - { - MemoryDrillerResizeAllocationEvent* event = static_cast(m_data->GetEvents().back()); - if (dataNode.m_name == AZ_CRC("RecordsId", 0x7caaca88)) - { - dataNode.Read(event->m_recordsId); - } - else if (dataNode.m_name == AZ_CRC("Address", 0x0d4e6f81)) - { - dataNode.Read(event->m_address); - } - else if (dataNode.m_name == AZ_CRC("Size", 0xf7c0246a)) - { - dataNode.Read(event->m_newSize); - } - } break; - } - } -} // namespace Driller diff --git a/Code/Tools/Standalone/Source/Driller/Memory/MemoryDataParser.h b/Code/Tools/Standalone/Source/Driller/Memory/MemoryDataParser.h deleted file mode 100644 index c7dad612d7..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Memory/MemoryDataParser.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef DRILLER_MEMORY_DRILLER_PARSER_H -#define DRILLER_MEMORY_DRILLER_PARSER_H - -#include - -namespace Driller -{ - class MemoryDataAggregator; - - class MemoryDrillerHandlerParser - : public AZ::Debug::DrillerHandlerParser - { - public: - enum SubTags - { - ST_NONE = 0, - ST_REGISTER_ALLOCATOR, - ST_REGISTER_ALLOCATION, - ST_UNREGISTER_ALLOCATION, - ST_RESIZE_ALLOCATION, - }; - - MemoryDrillerHandlerParser() - : m_subTag(ST_NONE) - , m_data(NULL) - {} - - static AZ::u32 GetDrillerId() { return AZ_CRC("MemoryDriller", 0x1b31269d); } - - void SetAggregator(MemoryDataAggregator* data) { m_data = data; } - - virtual AZ::Debug::DrillerHandlerParser* OnEnterTag(AZ::u32 tagName); - virtual void OnExitTag(DrillerHandlerParser* handler, AZ::u32 tagName); - virtual void OnData(const AZ::Debug::DrillerSAXParser::Data& dataNode); - - protected: - SubTags m_subTag; - MemoryDataAggregator* m_data; - }; -} - -#endif diff --git a/Code/Tools/Standalone/Source/Driller/Memory/MemoryDataView.cpp b/Code/Tools/Standalone/Source/Driller/Memory/MemoryDataView.cpp deleted file mode 100644 index 3ccad8fae0..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Memory/MemoryDataView.cpp +++ /dev/null @@ -1,642 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "MemoryDataView.hxx" -#include - -#include "MemoryDataAggregator.hxx" -#include "MemoryEvents.h" -#include "Source/Driller/DrillerEvent.h" -#include - -#include "Source/Driller/ChannelDataView.hxx" -#include "Source/Driller/DrillerMainWindowMessages.h" - -#include -#include - -#include - -#include -#include -#include - -namespace Driller -{ - static const char* frameRangeToDisplayString[] = - { - "Show 1 Frame", - "Show 2 Frames", - "Show 5 Frames", - "Show 15 Frames", - "Show 30 Frames", - "Show 60 Frames", - "Show 120 Frames", - NULL - }; - static const int frameRangeFromIndex[] = { 1, 2, 5, 15, 30, 60, 120, 0 }; - - MemoryAxisFormatter::MemoryAxisFormatter(QObject* pParent) - : QAbstractAxisFormatter(pParent) - { - } - - QString MemoryAxisFormatter::formatMemorySize(float value, float scalingValue) - { - // data is in whole byte numbers. - - // so how big is the division size? - if (scalingValue > 128.0f * 1024.0f) // greater than a 0.1 mb - { - if (scalingValue > 1024.0f * 1024.0f) // whole seconds - { - return QObject::tr("%1MB").arg(QString::number(value / (1024.0f * 1024.0f), 'f', 0)); - } - else - { - return QObject::tr("%1MB").arg(QString::number(value / (1024.0f * 1024.0f), 'f', 1)); - } - } - else if (scalingValue > 128.0f) // greater than a 128 bytes - { - if (scalingValue > 1024.0f) // whole kilobytes - { - return QObject::tr("%1KB").arg(QString::number(value / 1024.0f, 'f', 0)); - } - else - { - return QObject::tr("%1KB").arg(QString::number(value / 1024, 'f', 1)); - } - } - else - { - return QObject::tr("%1B").arg((AZ::s64)value); - } - } - - - QString MemoryAxisFormatter::convertAxisValueToText(Charts::AxisType axis, float value, float /*minDisplayedValue*/, float /*maxDisplayedValue*/, float divisionSize) - { - if (axis == Charts::AxisType::Vertical) - { - return formatMemorySize(value, divisionSize); - } - else - { - return QString::number((int)value); - } - }; - - - class MemoryDataViewSavedState - : public AZ::UserSettings - { - public: - AZ_RTTI(MemoryDataViewSavedState, "{1F25755D-8477-48B3-AAB5-6CDBB4152723}", AZ::UserSettings); - AZ_CLASS_ALLOCATOR(MemoryDataViewSavedState, AZ::SystemAllocator, 0); - - AZStd::string m_filterMenuString; - AZ::u64 m_filterId; - int m_frameRange; - bool m_autoZoom; - float m_manualZoomMin; // if we're not automatically zooming, then we remember the prior zoom to re-apply it - float m_manualZoomMax; - - MemoryDataViewSavedState() - : m_filterMenuString("Filter: All") - , m_filterId(0) - , m_frameRange(1) - , m_autoZoom(true) - , m_manualZoomMin(2000000000.0f) - , m_manualZoomMax(-2000000000.0f) - {} - - static void Reflect(AZ::ReflectContext* context) - { - AZ::SerializeContext* serialize = azrtti_cast(context); - if (serialize) - { - serialize->Class() - ->Field("m_filterMenuString", &MemoryDataViewSavedState::m_filterMenuString) - ->Field("m_filterId", &MemoryDataViewSavedState::m_filterId) - ->Field("m_frameRange", &MemoryDataViewSavedState::m_frameRange) - ->Field("m_autoZoom", &MemoryDataViewSavedState::m_autoZoom) - ->Field("m_manualZoomMin", &MemoryDataViewSavedState::m_manualZoomMin) - ->Field("m_manualZoomMax", &MemoryDataViewSavedState::m_manualZoomMax) - ->Version(3); - } - } - }; - - - MemoryDataView::MemoryDataView(MemoryDataAggregator* aggregator, FrameNumberType atFrame, int profilerIndex) - : QDialog() - , m_aggregator(aggregator) - , m_Frame(atFrame) - , m_HighestFrameSoFar(-1) - , m_viewIndex(profilerIndex) - { - setAttribute(Qt::WA_DeleteOnClose, true); - setWindowFlags(windowFlags() | Qt::WindowMaximizeButtonHint); - - m_ScrubberIndex = 0; - - show(); - raise(); - activateWindow(); - setFocus(); - - m_gui = azcreate(Ui::MemoryDataView, ()); - m_gui->setupUi(this); - - setWindowTitle(QString("Memory Data View %1 from %2").arg(profilerIndex).arg(aggregator->GetIdentity())); - - m_ptrFormatter = aznew MemoryAxisFormatter(this); - m_gui->widgetDataStrip->SetAxisTextFormatter(m_ptrFormatter); - - connect(m_aggregator, SIGNAL(destroyed(QObject*)), this, SLOT(OnDataDestroyed())); - - connect(m_gui->widgetDataStrip, SIGNAL(onMouseLeftDownDomainValue(float)), this, SLOT(onMouseLeftDownDomainValue(float))); - connect(m_gui->widgetDataStrip, SIGNAL(onMouseLeftDragDomainValue(float)), this, SLOT(onMouseLeftDragDomainValue(float))); - - connect(m_gui->widgetDataStrip, SIGNAL(onMouseOverDataPoint(int, AZ::u64, float, float)), this, SLOT(onMouseOverDataPoint(int, AZ::u64, float, float))); - connect(m_gui->widgetDataStrip, SIGNAL(onMouseOverNothing(float, float)), this, SLOT(onMouseOverNothing(float, float))); - - connect(m_gui->checkLockRight, SIGNAL(stateChanged(int)), this, SLOT(OnCheckLockRight(int))); - connect(m_gui->buttonViewFull, SIGNAL(pressed()), this, SLOT(OnViewFull())); - - connect(m_gui->filterButton, SIGNAL(pressed()), this, SLOT(OnFilterButton())); - - connect(m_gui->checkBoxAutoZoom, SIGNAL(toggled(bool)), this, SLOT(OnAutoZoomChange(bool))); - - { - QMenu* frameRangeMenu = new QMenu(this); - for (int i = 0; frameRangeToDisplayString[i]; ++i) - { - frameRangeMenu->addAction(CreateFrameRangeMenuAction(frameRangeToDisplayString[i], frameRangeFromIndex[i])); - } - - m_gui->frameRangeButton->setText(frameRangeToDisplayString[0]); - m_gui->frameRangeButton->setMenu(frameRangeMenu); - } - - m_aggregatorIdentityCached = m_aggregator->GetIdentity(); - DrillerMainWindowMessages::Handler::BusConnect(m_aggregatorIdentityCached); - DrillerEventWindowMessages::Handler::BusConnect(m_aggregatorIdentityCached); - - AZStd::string windowStateStr = AZStd::string::format("MEMORY DATA VIEW WINDOW STATE %i", m_viewIndex); - m_windowStateCRC = AZ::Crc32(windowStateStr.c_str()); - AZStd::intrusive_ptr windowState = AZ::UserSettings::Find(m_windowStateCRC, AZ::UserSettings::CT_GLOBAL); - if (windowState) - { - windowState->RestoreGeometry(this); - } - - AZStd::string dataViewStateStr = AZStd::string::format("MEMORY DATA VIEW STATE %i", m_viewIndex); - m_viewStateCRC = AZ::Crc32(dataViewStateStr.c_str()); - m_persistentState = AZ::UserSettings::CreateFind(m_viewStateCRC, AZ::UserSettings::CT_GLOBAL); - ApplyPersistentState(); - - SetFrameNumber(); - } - - MemoryDataView::~MemoryDataView() - { - SaveOnExit(); - azdestroy(m_gui); - } - - void MemoryDataView::SaveOnExit() - { - DrillerEventWindowMessages::Handler::BusDisconnect(m_aggregatorIdentityCached); - DrillerMainWindowMessages::Handler::BusDisconnect(m_aggregatorIdentityCached); - - AZStd::intrusive_ptr pState = AZ::UserSettings::CreateFind(m_windowStateCRC, AZ::UserSettings::CT_GLOBAL); - pState->CaptureGeometry(this); - } - void MemoryDataView::hideEvent(QHideEvent* evt) - { - QDialog::hideEvent(evt); - } - void MemoryDataView::closeEvent(QCloseEvent* evt) - { - QDialog::closeEvent(evt); - } - void MemoryDataView::OnDataDestroyed() - { - deleteLater(); - } - - QAction* MemoryDataView::CreateFrameRangeMenuAction(QString qs, int range) - { - QAction* act = new QAction(qs, this); - act->setObjectName(qs); - act->setProperty("Range", range); - connect(act, SIGNAL(triggered()), this, SLOT(OnFrameRangeMenu())); - return act; - } - - QAction* MemoryDataView::CreateFilterSelectorAction(QString qs, AZ::u64 id) - { - QAction* act = new QAction(qs, this); - act->setObjectName(qs); - act->setData(id); - connect(act, SIGNAL(triggered()), this, SLOT(OnFilterSelectorMenu())); - return act; - } - - void MemoryDataView::OnFrameRangeMenu() - { - QAction* qa = qobject_cast(sender()); - if (qa) - { - m_gui->frameRangeButton->setText(qa->objectName()); - int range = qa->property("Range").toInt(); - m_persistentState->m_frameRange = range; - - // force a new data build - SetFrameNumber(); - update(); - } - } - - void MemoryDataView::OnFilterButton() - { - QMenu* filterIDMenu = new QMenu(this); - filterIDMenu->addAction(CreateFilterSelectorAction("Filter: All", 0)); - - for (auto iter = m_aggregator->m_allocators.begin(); iter != m_aggregator->m_allocators.end(); ++iter) - { - filterIDMenu->addAction(CreateFilterSelectorAction(QString("Filter: %1").arg((*iter)->m_name), (*iter)->m_id)); - } - - filterIDMenu->exec(QCursor::pos()); - delete filterIDMenu; - } - - void MemoryDataView::OnFilterSelectorMenu() - { - QAction* qa = qobject_cast(sender()); - if (qa) - { - OnFilterSelectorMenu(qa->objectName(), qa->data().toULongLong()); - } - } - - void MemoryDataView::OnFilterSelectorMenu(QString fromMenu, AZ::u64 id) - { - m_gui->filterButton->setText(fromMenu); - - m_persistentState->m_filterMenuString = fromMenu.toUtf8().data(); - m_persistentState->m_filterId = id; - - // force a new data build - SetFrameNumber(); - update(); - } - - void MemoryDataView::OnAutoZoomChange(bool newValue) - { - if (!newValue) - { - m_persistentState->m_autoZoom = false; - m_gui->widgetDataStrip->GetWindowRange(Charts::AxisType::Vertical, m_persistentState->m_manualZoomMin, m_persistentState->m_manualZoomMax); - } - else - { - m_persistentState->m_autoZoom = true; - m_persistentState->m_manualZoomMin = 2000000000.0f; - m_persistentState->m_manualZoomMax = -2000000000.0f; - } - - UpdateChart(); - } - - void MemoryDataView::ApplyPersistentState() - { - if (m_persistentState) - { - m_gui->checkBoxAutoZoom->setChecked(m_persistentState->m_autoZoom); - OnAutoZoomChange(m_persistentState->m_autoZoom); - - OnFilterSelectorMenu(m_persistentState->m_filterMenuString.c_str(), m_persistentState->m_filterId); - m_gui->frameRangeButton->setText(frameRangeToDisplayString[0]); - for (int i = 0; frameRangeFromIndex[i]; ++i) - { - if (m_persistentState->m_frameRange == frameRangeFromIndex[i]) - { - m_gui->frameRangeButton->setText(frameRangeToDisplayString[i]); - break; - } - } - } - } - - void MemoryDataView::ApplySettingsFromWorkspace(WorkspaceSettingsProvider* provider) - { - AZStd::string workspaceStateStr = AZStd::string::format("MEMORY DATA VIEW WORKSPACE STATE %i", m_viewIndex); - AZ::u32 workspaceStateCRC = AZ::Crc32(workspaceStateStr.c_str()); - - if (m_persistentState) - { - MemoryDataViewSavedState* workspace = provider->FindSetting(workspaceStateCRC); - if (workspace) - { - m_persistentState->m_filterMenuString = workspace->m_filterMenuString; - m_persistentState->m_filterId = workspace->m_filterId; - m_persistentState->m_frameRange = workspace->m_frameRange; - } - } - } - - void MemoryDataView::ActivateWorkspaceSettings(WorkspaceSettingsProvider*) - { - ApplyPersistentState(); - } - - void MemoryDataView::SaveSettingsToWorkspace(WorkspaceSettingsProvider* provider) - { - AZStd::string workspaceStateStr = AZStd::string::format("MEMORY DATA VIEW WORKSPACE STATE %i", m_viewIndex); - AZ::u32 workspaceStateCRC = AZ::Crc32(workspaceStateStr.c_str()); - - if (m_persistentState) - { - MemoryDataViewSavedState* workspace = provider->CreateSetting(workspaceStateCRC); - if (workspace) - { - workspace->m_filterMenuString = m_persistentState->m_filterMenuString; - workspace->m_filterId = m_persistentState->m_filterId; - workspace->m_frameRange = m_persistentState->m_frameRange; - } - } - } - - void MemoryDataView::onMouseOverDataPoint(int channelID, AZ::u64 sampleID, float primaryAxisValue, float dependentAxisValue) - { - (void)primaryAxisValue; - (void)dependentAxisValue; - (void)channelID; - DrillerEvent* dep = m_aggregator->GetEvents()[ sampleID ]; - QString finalText; - - // highlight both channels - - m_gui->widgetDataStrip->SetChannelSampleHighlight(0, sampleID, true); - m_gui->widgetDataStrip->SetChannelSampleHighlight(1, sampleID, true); - - switch (dep->GetEventType()) - { - case Driller::Memory::MET_REGISTER_ALLOCATION: - { - Memory::AllocationInfo* mai = &static_cast(dep)->m_allocationInfo; - - finalText = tr("ALLOCATE %1
%2:%3
%4") - .arg(m_ptrFormatter->formatMemorySize((float)mai->m_size, (float)mai->m_size)) - .arg(mai->m_fileName ? mai->m_fileName : "") - .arg(mai->m_fileLine) - .arg(mai->m_name ? mai->m_name : ""); - } - break; - case Driller::Memory::MET_UNREGISTER_ALLOCATION: - { - MemoryDrillerUnregisterAllocationEvent* uae = static_cast(dep); - if (uae->m_removedAllocationInfo) - { - finalText = tr("DEALLOCATE %1
%2:%3
%4") - .arg(m_ptrFormatter->formatMemorySize((float)uae->m_removedAllocationInfo->m_size, (float)uae->m_removedAllocationInfo->m_size)) - .arg(uae->m_removedAllocationInfo->m_fileName ? uae->m_removedAllocationInfo->m_fileName : "") - .arg(uae->m_removedAllocationInfo->m_fileLine) - .arg(uae->m_removedAllocationInfo->m_name ? uae->m_removedAllocationInfo->m_name : ""); - } - else - { - finalText = tr("DEALLOCATE UNKNOWN "); - } - } - break; - case Driller::Memory::MET_RESIZE_ALLOCATION: - { - MemoryDrillerResizeAllocationEvent* rae = static_cast(dep); - if (rae->m_modifiedAllocationInfo) - { - finalText = tr("RESIZE %1 TO %2
%3:%4
%5") - .arg(m_ptrFormatter->formatMemorySize((float)rae->m_oldSize, (float)rae->m_oldSize)) - .arg(m_ptrFormatter->formatMemorySize((float)rae->m_newSize, (float)rae->m_newSize)) - .arg(rae->m_modifiedAllocationInfo->m_fileName ? rae->m_modifiedAllocationInfo->m_fileName : "") - .arg(rae->m_modifiedAllocationInfo->m_fileLine) - .arg(rae->m_modifiedAllocationInfo->m_name ? rae->m_modifiedAllocationInfo->m_name : ""); - } - else - { - finalText = tr("RESIZE UNKNOWN %1 TO %2") - .arg(m_ptrFormatter->formatMemorySize((float)rae->m_oldSize, (float)rae->m_oldSize)) - .arg(m_ptrFormatter->formatMemorySize((float)rae->m_newSize, (float)rae->m_newSize)); - } - } - break; - } - - if (finalText.length() > 0) - { - if (QApplication::activeWindow() == this) - { - QToolTip::showText(m_gui->widgetDataStrip->mapToGlobal(QPoint(0, -10)), finalText, m_gui->widgetDataStrip); - } - } - } - - void MemoryDataView::onMouseOverNothing(float primaryAxisValue, float dependentAxisValue) - { - (void)primaryAxisValue; - (void)dependentAxisValue; - m_gui->widgetDataStrip->SetChannelSampleHighlight(0, 0, false); - m_gui->widgetDataStrip->SetChannelSampleHighlight(1, 0, false); - QToolTip::hideText(); - } - - void MemoryDataView::onMouseLeftDownDomainValue(float domainValue) - { - AZ::s64 globalEvtID = (AZ::s64)(domainValue); - emit EventRequestEventFocus(globalEvtID); - } - - void MemoryDataView::onMouseLeftDragDomainValue(float domainValue) - { - AZ::s64 globalEvtID = (AZ::s64)(domainValue); - emit EventRequestEventFocus(globalEvtID); - } - - - void MemoryDataView::FrameChanged(FrameNumberType frame) - { - m_Frame = frame; - m_aggregator->FrameChanged(frame); - SetFrameNumber(); - OnViewFull(); - } - - void MemoryDataView::SetFrameNumber() - { - if (m_persistentState->m_filterId) - { - auto found = m_aggregator->FindAllocatorById(m_persistentState->m_filterId); - if (found == m_aggregator->GetAllocatorEnd()) - { - m_gui->progressBar->hide(); - } - else - { - Memory::AllocatorInfo* pinfo = (*found); - if (pinfo->m_capacity) - { - m_gui->progressBar->show(); - int newValue = (int)(((double)pinfo->m_allocatedMemory / (double)pinfo->m_capacity) * 100.0); - if (m_gui->progressBar->value() != newValue) - { - m_gui->progressBar->setValue(newValue); - m_gui->progressBar->setFormat(QString("%1 / %2") - .arg(MemoryAxisFormatter::formatMemorySize((float)pinfo->m_allocatedMemory, (float)pinfo->m_allocatedMemory * 0.1f)) - .arg(MemoryAxisFormatter::formatMemorySize((float)pinfo->m_capacity, (float)pinfo->m_capacity * 0.1f))); - } - } - else - { - m_gui->progressBar->hide(); - } - } - } - else - { - m_gui->progressBar->hide(); - } - - UpdateChart(); - } - - void MemoryDataView::UpdateChart() - { - m_gui->widgetDataStrip->Reset(); - - m_gui->widgetDataStrip->AddAxis("Event", 0.0f, 1.0f, false, false); - m_gui->widgetDataStrip->AddAxis("Size", m_persistentState->m_manualZoomMin, m_persistentState->m_manualZoomMax, true, true); - - m_gui->widgetDataStrip->AddChannel("Total Change"); - m_gui->widgetDataStrip->SetChannelColor(0, QColor(255, 64, 255, 255)); - m_gui->widgetDataStrip->SetChannelStyle(0, StripChart::Channel::STYLE_CONNECTED_LINE); - - m_gui->widgetDataStrip->AddChannel("Delta"); - m_gui->widgetDataStrip->SetChannelColor(1, QColor(255, 255, 0, 255)); - m_gui->widgetDataStrip->SetChannelStyle(1, StripChart::Channel::STYLE_PLUSMINUS); - - if (m_aggregator->IsValid()) - { - float accumulator = 0.0f; - - int frameOffset = m_persistentState->m_frameRange - 1; - if ((m_Frame - frameOffset) < 0) - { - frameOffset = 0; - } - - for (EventNumberType index = m_aggregator->m_frameToEventIndex[m_Frame - frameOffset]; index < static_cast(m_aggregator->m_frameToEventIndex[m_Frame] + m_aggregator->NumOfEventsAtFrame(m_Frame)); ++index) - { - DrillerEvent* dep = m_aggregator->GetEvents()[ index ]; - unsigned int gevtID = dep->GetGlobalEventId(); - - switch (dep->GetEventType()) - { - case Driller::Memory::MET_REGISTER_ALLOCATION: - { - auto mai = static_cast(dep); - if (m_persistentState->m_filterId && m_persistentState->m_filterId != mai->m_modifiedAllocatorInfo->m_id) - { - continue; // outer for() loop - } - accumulator += mai->m_allocationInfo.m_size; - m_gui->widgetDataStrip->AddData(1, (AZ::u64)index, (float)(gevtID), (float)mai->m_allocationInfo.m_size); - } - break; - case Driller::Memory::MET_UNREGISTER_ALLOCATION: - { - auto uae = static_cast(dep); - if (m_persistentState->m_filterId && m_persistentState->m_filterId != uae->m_modifiedAllocatorInfo->m_id) - { - continue; // outer for() loop - } - float uaeValue = (float)(uae->m_removedAllocationInfo != NULL ? uae->m_removedAllocationInfo->m_size : 0.0f); - accumulator -= uaeValue; - m_gui->widgetDataStrip->AddData(1, (AZ::u64)index, (float)(gevtID), -uaeValue); - } - break; - case Driller::Memory::MET_RESIZE_ALLOCATION: - { - auto rae = static_cast(dep); - if (rae->m_modifiedAllocationInfo) - { - auto testIter = m_aggregator->FindAllocatorByRecordsId(rae->m_modifiedAllocationInfo->m_recordsId); - if (testIter != m_aggregator->m_allocators.end()) - { - if (m_persistentState->m_filterId && m_persistentState->m_filterId != (*testIter)->m_id) - { - continue; // outer for() loop - } - } - } - accumulator += rae->m_newSize - rae->m_oldSize; - m_gui->widgetDataStrip->AddData(1, (AZ::u64)index, (float)(gevtID), (float)rae->m_newSize - (float)rae->m_oldSize); - } - break; - } - - m_gui->widgetDataStrip->AddData(0, (AZ::u64)index, (float)(gevtID), accumulator); - } - - FrameNumberType hCalculated = m_Frame - m_persistentState->m_frameRange + 1; - if (hCalculated < 0) - { - hCalculated = 0; - } - - float h1 = (float)(m_aggregator->GetEvents()[ m_aggregator->m_frameToEventIndex[hCalculated] ]->GetGlobalEventId()); - float h2 = (float)(m_aggregator->GetEvents()[ m_aggregator->m_frameToEventIndex[m_Frame] + m_aggregator->NumOfEventsAtFrame(m_Frame) - 1 ]->GetGlobalEventId()); - m_gui->widgetDataStrip->SetWindowRange(Charts::AxisType::Horizontal, h1, h2); - - if (m_persistentState->m_autoZoom) - { - m_gui->widgetDataStrip->ZoomExtents(Charts::AxisType::Vertical); - } - else - { - m_gui->widgetDataStrip->SetWindowRange(Charts::AxisType::Vertical, m_persistentState->m_manualZoomMin, m_persistentState->m_manualZoomMax); - m_gui->widgetDataStrip->ZoomManual(Charts::AxisType::Vertical, m_persistentState->m_manualZoomMin, m_persistentState->m_manualZoomMax); - } - } - } - - void MemoryDataView::OnViewFull() - { - m_gui->widgetDataStrip->SetViewFull(); - } - void MemoryDataView::OnCheckLockRight(int state) - { - m_gui->widgetDataStrip->SetLockRight(state ? true : false); - } - - ////////////////////////////////////////////////////////////////////////// - // Event Window Messages - void MemoryDataView::EventFocusChanged(EventNumberType eventIdx) - { - m_ScrubberIndex = eventIdx; - m_gui->widgetDataStrip->SetMarkerPosition((float)m_ScrubberIndex); - } - - void MemoryDataView::Reflect(AZ::ReflectContext* context) - { - MemoryDataViewSavedState::Reflect(context); - } -} diff --git a/Code/Tools/Standalone/Source/Driller/Memory/MemoryDataView.hxx b/Code/Tools/Standalone/Source/Driller/Memory/MemoryDataView.hxx deleted file mode 100644 index 69dc1a8650..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Memory/MemoryDataView.hxx +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef MEMORYDATAVIEW_H -#define MEMORYDATAVIEW_H - -#if !defined(Q_MOC_RUN) -#include -#include - -#include -#include -#include -#include -#endif - -namespace AZ { class ReflectContext; } - -namespace Ui -{ - class MemoryDataView; -} - -namespace Driller -{ - /* - A modeless dialog that combines custom drawing and active widgets. - */ - - class MemoryAxisFormatter : public Charts::QAbstractAxisFormatter - { - Q_OBJECT - public: - AZ_CLASS_ALLOCATOR(MemoryAxisFormatter, AZ::SystemAllocator, 0); - MemoryAxisFormatter(QObject *pParent); - - static QString formatMemorySize(float value, float scalingValue); - virtual QString convertAxisValueToText(Charts::AxisType axis, float value, float minDisplayedValue, float maxDisplayedValue, float divisionSize); - - private: - - }; - - class MemoryDataAggregator; - class MemoryDataViewSavedState; - - class MemoryDataView - : public QDialog - , public Driller::DrillerMainWindowMessages::Bus::Handler - , public Driller::DrillerEventWindowMessages::Bus::Handler - { - Q_OBJECT; - public: - AZ_CLASS_ALLOCATOR(MemoryDataView,AZ::SystemAllocator,0); - MemoryDataView( MemoryDataAggregator *aggregator, FrameNumberType atFrame, int profilerIndex ); - virtual ~MemoryDataView(void); - - MemoryDataAggregator *m_aggregator; - int m_aggregatorIdentityCached; - FrameNumberType m_Frame; - int m_HighestFrameSoFar; - EventNumberType m_ScrubberIndex; - AZ::u32 m_windowStateCRC; - int m_viewIndex; - AZ::u32 m_viewStateCRC; - - void SetFrameNumber(); - void UpdateChart(); - - // NB: These three methods mimic the workspace bus. - // Because the ProfilerDataAggregator can't know to open these DataView windows - // until after the EBUS message has gone out, the owning aggregator must - // first create these windows and then pass along the provider manually - void ApplySettingsFromWorkspace(WorkspaceSettingsProvider*); - void ActivateWorkspaceSettings(WorkspaceSettingsProvider*); - void SaveSettingsToWorkspace(WorkspaceSettingsProvider*); - void ApplyPersistentState(); - - AZStd::intrusive_ptr m_persistentState; - - QAction * CreateFilterSelectorAction( QString qs, AZ::u64 id ); - QAction *CreateFrameRangeMenuAction( QString qs, int range ); - - void SaveOnExit(); - virtual void closeEvent(QCloseEvent *evt); - virtual void hideEvent(QHideEvent *evt); - - public: - // MainWindow Bus Commands - void FrameChanged(FrameNumberType frame) override; - void EventFocusChanged(EventNumberType eventIndex) override; - void EventChanged(EventNumberType /*eventIndex*/) override{} - - static void Reflect(AZ::ReflectContext* context); - - public slots: - void OnDataDestroyed(); - void OnViewFull(); - void OnCheckLockRight(int state); - void onMouseLeftDownDomainValue(float domainValue); - void onMouseLeftDragDomainValue(float domainValue); - void onMouseOverDataPoint(int channelID, AZ::u64 sampleID, float primaryAxisValue, float dependentAxisValue); - void onMouseOverNothing(float primaryAxisValue, float dependentAxisValue); - void OnFilterButton(); - void OnFilterSelectorMenu(); - void OnFilterSelectorMenu( QString fromMenu, AZ::u64 id ); - void OnFrameRangeMenu(); - void OnAutoZoomChange(bool); - -signals: - void EventRequestEventFocus(AZ::s64); - - private: - Ui::MemoryDataView* m_gui; - MemoryAxisFormatter *m_ptrFormatter; - }; - -} - - -#endif // MEMORYDATAVIEW_H diff --git a/Code/Tools/Standalone/Source/Driller/Memory/MemoryDataView.ui b/Code/Tools/Standalone/Source/Driller/Memory/MemoryDataView.ui deleted file mode 100644 index 6740cfcb82..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Memory/MemoryDataView.ui +++ /dev/null @@ -1,188 +0,0 @@ - - - MemoryDataView - - - - 0 - 0 - 684 - 302 - - - - Memory Data View - - - - - - - - - 0 - 0 - - - - - 224 - 86 - - - - - - - - - - - 0 - 0 - - - - - 0 - 24 - - - - - 16777215 - 24 - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - 3 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - - 64 - 16777215 - - - - View Full - - - - - - - - 0 - 0 - - - - Filter: All - - - - - - - Show 1 Frame - - - - - - - - 84 - 16777215 - - - - Lock Right - - - - - - - Autozoom - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 1 - 0 - - - - 0 - - - Qt::AlignCenter - - - true - - - %p % used - - - - - - - - - - - StripChart::DataStrip - QWidget -
../StripChart.hxx
- 1 -
-
- - -
diff --git a/Code/Tools/Standalone/Source/Driller/Memory/MemoryEvents.cpp b/Code/Tools/Standalone/Source/Driller/Memory/MemoryEvents.cpp deleted file mode 100644 index 3ed07f5f29..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Memory/MemoryEvents.cpp +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "MemoryEvents.h" - -#include "MemoryDataAggregator.hxx" - -namespace Driller -{ - void MemoryDrillerRegisterAllocatorEvent::StepForward(Aggregator* data) - { - MemoryDataAggregator* aggr = static_cast(data); - // add to list of active allocators - aggr->m_allocators.push_back(&m_allocatorInfo); - } - - void MemoryDrillerRegisterAllocatorEvent::StepBackward(Aggregator* data) - { - MemoryDataAggregator* aggr = static_cast(data); - // remove from the list of active allocators - aggr->m_allocators.erase(AZStd::find(aggr->m_allocators.begin(), aggr->m_allocators.end(), &m_allocatorInfo)); - } - - void MemoryDrillerUnregisterAllocatorEvent::StepForward(Aggregator* data) - { - MemoryDataAggregator* aggr = static_cast(data); - MemoryDataAggregator::AllocatorInfoArrayType::iterator alIt = aggr->FindAllocatorById(m_allocatorId); - m_removedAllocatorInfo = *alIt; - aggr->m_allocators.erase(alIt); - } - - void MemoryDrillerUnregisterAllocatorEvent::StepBackward(Aggregator* data) - { - MemoryDataAggregator* aggr = static_cast(data); - aggr->m_allocators.push_back(m_removedAllocatorInfo); - } - - void MemoryDrillerRegisterAllocationEvent::StepForward(Aggregator* data) - { - if (m_modifiedAllocatorInfo == nullptr) - { - MemoryDataAggregator* aggr = static_cast(data); - MemoryDataAggregator::AllocatorInfoArrayType::iterator infoIter = aggr->FindAllocatorByRecordsId(m_allocationInfo.m_recordsId); - - if (infoIter == aggr->GetAllocatorEnd()) - { - AZ_Assert(false, "MemoryDriller - Invalid RecordsId"); - return; - } - - m_modifiedAllocatorInfo = (*infoIter); - } - // add to map of allocations - m_modifiedAllocatorInfo->m_allocations.insert(AZStd::make_pair(m_address, &m_allocationInfo)); - m_modifiedAllocatorInfo->m_allocatedMemory += m_allocationInfo.m_size; - } - - void MemoryDrillerRegisterAllocationEvent::StepBackward(Aggregator* data) - { - if (m_modifiedAllocatorInfo == nullptr) - { - MemoryDataAggregator* aggr = static_cast(data); - MemoryDataAggregator::AllocatorInfoArrayType::iterator infoIter = aggr->FindAllocatorByRecordsId(m_allocationInfo.m_recordsId); - - if (infoIter == aggr->GetAllocatorEnd()) - { - AZ_Assert(false, "MemoryDriller - Invalid RecordsId"); - return; - } - - m_modifiedAllocatorInfo = (*infoIter); - } - - // remove from the list of active allocators - m_modifiedAllocatorInfo->m_allocations.erase(m_address); - m_modifiedAllocatorInfo->m_allocatedMemory -= m_allocationInfo.m_size; - } - - void MemoryDrillerUnregisterAllocationEvent::StepForward(Aggregator* data) - { - if (m_modifiedAllocatorInfo == nullptr) - { - MemoryDataAggregator* aggr = static_cast(data); - // removed from the map of allocations - MemoryDataAggregator::AllocatorInfoArrayType::iterator infoIter = aggr->FindAllocatorByRecordsId(m_recordsId); - - if (infoIter == aggr->GetAllocatorEnd()) - { - AZ_Assert(false, "MemoryDriller - Invalid RecordsId"); - return; - } - - m_modifiedAllocatorInfo = (*infoIter); - } - - Memory::AllocatorInfo::AllocationMapType::iterator allocIt = m_modifiedAllocatorInfo->m_allocations.find(m_address); - m_removedAllocationInfo = allocIt->second; - // we're UNALLOCATING, so subract: - m_modifiedAllocatorInfo->m_allocatedMemory -= m_removedAllocationInfo->m_size; - m_modifiedAllocatorInfo->m_allocations.erase(m_address); - } - - void MemoryDrillerUnregisterAllocationEvent::StepBackward(Aggregator* data) - { - if (m_modifiedAllocatorInfo == nullptr) - { - MemoryDataAggregator* aggr = static_cast(data); - // removed from the map of allocations - MemoryDataAggregator::AllocatorInfoArrayType::iterator infoIter = aggr->FindAllocatorByRecordsId(m_recordsId); - - if (infoIter == aggr->GetAllocatorEnd()) - { - AZ_Assert(false, "MemoryDriller - Invalid RecordsId"); - return; - } - - m_modifiedAllocatorInfo = (*infoIter); - } - - // add back to the map of allocations - auto insertionPair = AZStd::make_pair(m_address, m_removedAllocationInfo); - m_modifiedAllocatorInfo->m_allocations.insert(insertionPair); - - // we're doing the opposite of unallocating, which is allocating, so we add: - m_modifiedAllocatorInfo->m_allocatedMemory += m_removedAllocationInfo->m_size; - } - - void MemoryDrillerResizeAllocationEvent::StepForward(Aggregator* data) - { - if (m_modifiedAllocationInfo == nullptr) - { - MemoryDataAggregator* aggr = static_cast(data); - // change the allocation size - m_modifiedAllocatorInfo = *aggr->FindAllocatorByRecordsId(m_recordsId); - Memory::AllocatorInfo::AllocationMapType::iterator allocIt = m_modifiedAllocatorInfo->m_allocations.find(m_address); - m_modifiedAllocationInfo = allocIt->second; - } - - // reallocating remove old size and add new size: - m_oldSize = m_modifiedAllocationInfo->m_size; - m_modifiedAllocationInfo->m_size = m_newSize; - - m_modifiedAllocatorInfo->m_allocatedMemory -= m_oldSize; - m_modifiedAllocatorInfo->m_allocatedMemory += m_newSize; - } - - void MemoryDrillerResizeAllocationEvent::StepBackward(Aggregator* data) - { - (void)data; - // restore the old size - m_modifiedAllocationInfo->m_size = m_oldSize; - - m_modifiedAllocatorInfo->m_allocatedMemory -= m_newSize; - m_modifiedAllocatorInfo->m_allocatedMemory += m_oldSize; - } -} // namespace Driller diff --git a/Code/Tools/Standalone/Source/Driller/Memory/MemoryEvents.h b/Code/Tools/Standalone/Source/Driller/Memory/MemoryEvents.h deleted file mode 100644 index e9ee33a0ef..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Memory/MemoryEvents.h +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef DRILLER_MEMORY_EVENTS_H -#define DRILLER_MEMORY_EVENTS_H - -#include "Source/Driller/DrillerEvent.h" - -#include - -namespace Driller -{ - namespace Memory - { - struct AllocationInfo - { - AllocationInfo() - : m_recordsId(0) - , m_name(nullptr) - , m_alignment(0) - , m_size(0) - , m_fileName(nullptr) - , m_fileLine(0) - , m_stackFrames(nullptr) - {} - AZ::u64 m_recordsId; - const char* m_name; - unsigned int m_alignment; - AZ::u64 m_size; - const char* m_fileName; - int m_fileLine; - AZ::u64* m_stackFrames; - }; - - struct AllocatorInfo - { - AllocatorInfo() - : m_id(0) - , m_recordsId(0) - , m_name(nullptr) - , m_capacity(0) - , m_recordMode(AZ::Debug::AllocationRecords::RECORD_NO_RECORDS) - , m_numStackLevels(0) - , m_allocatedMemory(0) - {} - AZ::u64 m_id; - AZ::u64 m_recordsId; - const char* m_name; - AZ::u64 m_capacity; - char m_recordMode; - char m_numStackLevels; - typedef AZStd::unordered_map AllocationMapType; - AllocationMapType m_allocations; ///< Current state of allocations - size_t m_allocatedMemory; ///< Number of bytes of allocated memory. - }; - - enum MemoryEventType - { - MET_REGISTER_ALLOCATOR = 0, - MET_UNREGISTER_ALLOCATOR, - MET_REGISTER_ALLOCATION, - MET_RESIZE_ALLOCATION, - MET_UNREGISTER_ALLOCATION, - }; - } - - class MemoryDrillerRegisterAllocatorEvent - : public DrillerEvent - { - public: - AZ_CLASS_ALLOCATOR(MemoryDrillerRegisterAllocatorEvent, AZ::SystemAllocator, 0) - - MemoryDrillerRegisterAllocatorEvent() - : DrillerEvent(Memory::MET_REGISTER_ALLOCATOR) {} - - virtual void StepForward(Aggregator* data); - virtual void StepBackward(Aggregator* data); - Memory::AllocatorInfo m_allocatorInfo; - }; - - class MemoryDrillerUnregisterAllocatorEvent - : public DrillerEvent - { - public: - AZ_CLASS_ALLOCATOR(MemoryDrillerUnregisterAllocatorEvent, AZ::SystemAllocator, 0) - - MemoryDrillerUnregisterAllocatorEvent() - : DrillerEvent(Memory::MET_UNREGISTER_ALLOCATOR) - , m_allocatorId(0) - , m_removedAllocatorInfo(nullptr) - {} - - virtual void StepForward(Aggregator* data); - virtual void StepBackward(Aggregator* data); - - AZ::u64 m_allocatorId; - Memory::AllocatorInfo* m_removedAllocatorInfo; - }; - - class MemoryDrillerRegisterAllocationEvent - : public DrillerEvent - { - public: - AZ_CLASS_ALLOCATOR(MemoryDrillerRegisterAllocationEvent, AZ::SystemAllocator, 0) - - MemoryDrillerRegisterAllocationEvent() - : DrillerEvent(Memory::MET_REGISTER_ALLOCATION) - , m_address(0) - , m_modifiedAllocatorInfo(nullptr) - {} - - ~MemoryDrillerRegisterAllocationEvent() - { - if (m_allocationInfo.m_stackFrames) - { - azfree(m_allocationInfo.m_stackFrames); - } - } - - virtual void StepForward(Aggregator* data); - virtual void StepBackward(Aggregator* data); - - AZ::u64 m_address; - Memory::AllocationInfo m_allocationInfo; - Memory::AllocatorInfo* m_modifiedAllocatorInfo; - }; - - class MemoryDrillerUnregisterAllocationEvent - : public DrillerEvent - { - public: - AZ_CLASS_ALLOCATOR(MemoryDrillerUnregisterAllocationEvent, AZ::SystemAllocator, 0) - - MemoryDrillerUnregisterAllocationEvent() - : DrillerEvent(Memory::MET_UNREGISTER_ALLOCATION) - , m_recordsId(0) - , m_address(0) - , m_removedAllocationInfo(nullptr) - , m_modifiedAllocatorInfo(nullptr) - {} - - virtual void StepForward(Aggregator* data); - virtual void StepBackward(Aggregator* data); - - AZ::u64 m_recordsId; - AZ::u64 m_address; - Memory::AllocationInfo* m_removedAllocationInfo; - Memory::AllocatorInfo* m_modifiedAllocatorInfo; - }; - - class MemoryDrillerResizeAllocationEvent - : public DrillerEvent - { - public: - AZ_CLASS_ALLOCATOR(MemoryDrillerResizeAllocationEvent, AZ::SystemAllocator, 0) - - MemoryDrillerResizeAllocationEvent() - : DrillerEvent(Memory::MET_RESIZE_ALLOCATION) - , m_recordsId(0) - , m_address(0) - , m_newSize(0) - , m_oldSize(0) - , m_modifiedAllocationInfo(nullptr) - {} - - virtual void StepForward(Aggregator* data); - virtual void StepBackward(Aggregator* data); - - AZ::u64 m_recordsId; - AZ::u64 m_address; - AZ::u64 m_newSize; - AZ::u64 m_oldSize; - Memory::AllocationInfo* m_modifiedAllocationInfo; - Memory::AllocatorInfo* m_modifiedAllocatorInfo; - }; -} - -#endif diff --git a/Code/Tools/Standalone/Source/Driller/Profiler/ProfilerDataAggregator.cpp b/Code/Tools/Standalone/Source/Driller/Profiler/ProfilerDataAggregator.cpp deleted file mode 100644 index e67f8e329f..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Profiler/ProfilerDataAggregator.cpp +++ /dev/null @@ -1,465 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "ProfilerDataAggregator.hxx" -#include - -#include "ProfilerDataView.hxx" -#include "ProfilerEvents.h" -#include -#include -#include "Source/Driller/Workspaces/Workspace.h" - -namespace Driller -{ - // used against m_roiVersion to silently clear and reinitialize on internal updates - static const int dataAggregatorVersion = 2; - - // USER SETTINGS are local only, global settings to the application - // designed to be used for window placement, global preferences, that kind of thing - class ProfilerDataAggregatorSavedState - : public AZ::UserSettings - { - public: - AZ_RTTI(ProfilerDataAggregatorSavedState, "{98494FFE-783F-48A7-A35F-714138425640}", AZ::UserSettings); - AZ_CLASS_ALLOCATOR(ProfilerDataAggregatorSavedState, AZ::SystemAllocator, 0); - - struct RegisterOfInterest - { - AZ_RTTI(RegisterOfInterest, "{885335FD-79D1-4462-B637-177FC0FCF01C}"); - AZStd::string m_name; - float m_dataScale; - int m_usesDelta; - int m_useSubValue; - - virtual ~RegisterOfInterest() {} - - static void Reflect(AZ::ReflectContext* context) - { - AZ::SerializeContext* serialize = azrtti_cast(context); - if (serialize) - { - serialize->Class() - ->Field("m_name", &RegisterOfInterest::m_name) - ->Field("m_dataScale", &RegisterOfInterest::m_dataScale) - ->Field("m_usesDelta", &RegisterOfInterest::m_usesDelta) - ->Field("m_useSubValue", &RegisterOfInterest::m_useSubValue) - ->Version(3); - } - } - }; - - int m_activeViewCount; - - AZStd::vector m_registersOfInterest; - int m_roiVersion; - - ProfilerDataAggregatorSavedState() - : m_activeViewCount(0) - , m_roiVersion(1) - {} - - static void Reflect(AZ::ReflectContext* context) - { - AZ::SerializeContext* serialize = azrtti_cast(context); - if (serialize) - { - RegisterOfInterest::Reflect(context); - - serialize->Class() - ->Field("m_activeViewCount", &ProfilerDataAggregatorSavedState::m_activeViewCount) - ->Field("m_registersOfInterest", &ProfilerDataAggregatorSavedState::m_registersOfInterest) - ->Field("m_roiVersion", &ProfilerDataAggregatorSavedState::m_roiVersion) - ->Version(7); - } - } - }; - - // WORKSPACES are files loaded and stored independent of the global application - // designed to be used for DRL data specific view settings and to pass around - class ProfilerDataAggregatorWorkspace - : public AZ::UserSettings - { - public: - AZ_RTTI(ProfilerDataAggregatorWorkspace, "{2C41A0B1-E200-448D-8727-5109DF877B0E}", AZ::UserSettings); - AZ_CLASS_ALLOCATOR(ProfilerDataAggregatorWorkspace, AZ::SystemAllocator, 0); - - int m_activeViewCount; - AZStd::vector m_activeViewTypes; - - ProfilerDataAggregatorWorkspace() - : m_activeViewCount(0) - {} - - static void Reflect(AZ::ReflectContext* context) - { - AZ::SerializeContext* serialize = azrtti_cast(context); - if (serialize) - { - serialize->Class() - ->Field("m_activeViewCount", &ProfilerDataAggregatorWorkspace::m_activeViewCount) - ->Field("m_activeViewTypes", &ProfilerDataAggregatorWorkspace::m_activeViewTypes) - ->Version(3); - } - } - }; - - - ////////////////////////////////////////////////////////////////////////// - ProfilerDataAggregator::ProfilerDataAggregator(int identity) - : Aggregator(identity) - , m_currentDisplayRegister(0) - , m_dataView(nullptr) - { - m_parser.SetAggregator(this); - - // find state and restore it - m_persistentState = AZ::UserSettings::CreateFind(AZ_CRC("PROFILER DATA AGGREGATOR SAVED STATE", 0x49c357f6), AZ::UserSettings::CT_GLOBAL); - AZ_Assert(m_persistentState, "Persistent State is NULL?"); - // please see ::dataAggregatorVersion to control updates - if (m_persistentState->m_registersOfInterest.empty() || m_persistentState->m_roiVersion != dataAggregatorVersion) - { - m_persistentState->m_registersOfInterest.clear(); - m_persistentState->m_registersOfInterest.push_back(); - m_persistentState->m_registersOfInterest[0].m_name = "Component application tick function"; - m_persistentState->m_registersOfInterest[0].m_dataScale = 1.0f / 64000.0f; - m_persistentState->m_registersOfInterest[0].m_usesDelta = 1; // this is a delta time calculated on the fly here - m_persistentState->m_registersOfInterest[0].m_useSubValue = 0; // user data 0 is m_time from the register union - } - - m_allRegistersOfInterestInData.clear(); - if (!m_persistentState->m_registersOfInterest.empty()) - { - m_allRegistersOfInterestInData.resize(m_persistentState->m_registersOfInterest.size(), NULL); - m_allCorrespondingIdsForRegistersOfInterestInData.resize(m_persistentState->m_registersOfInterest.size(), 0); - } - } - - ProfilerDataAggregator::~ProfilerDataAggregator() - { - KillAllViews(); - } - - // this aggregator has to dive deeper into the source data - // to synthesize a meaningful -1...+1 value for the main display - float ProfilerDataAggregator::ValueAtFrame(FrameNumberType frame) - { - size_t numEvents = NumOfEventsAtFrame(frame); - if (numEvents && frame > 0) - { - for (EventNumberType eventIndex = m_frameToEventIndex[frame]; eventIndex < static_cast(m_frameToEventIndex[frame] + numEvents); ++eventIndex) - { - DrillerEvent* drillerEvent = drillerEvent = GetEvents()[ eventIndex ]; - if (drillerEvent->GetEventType() == Driller::Profiler::PET_UPDATE_REGISTER) - { - Driller::ProfilerDrillerUpdateRegisterEvent* reg = static_cast(drillerEvent); - for (auto iter = m_allCorrespondingIdsForRegistersOfInterestInData.begin(); iter != m_allCorrespondingIdsForRegistersOfInterestInData.end(); ++iter) - { - if (reg->GetRegisterId() == *iter) - { - float t = 0.0f; - if (m_persistentState->m_registersOfInterest[m_currentDisplayRegister].m_usesDelta) - { - switch (m_persistentState->m_registersOfInterest[m_currentDisplayRegister].m_useSubValue) - { - case 0: - t = (float)(reg->GetData().m_valueData.m_value1 - (reg->GetPreviousSample() == NULL ? 0 : reg->GetPreviousSample()->GetData().m_valueData.m_value1)); - break; - case 1: - t = (float)(reg->GetData().m_valueData.m_value2 - (reg->GetPreviousSample() == NULL ? 0 : reg->GetPreviousSample()->GetData().m_valueData.m_value2)); - break; - case 2: - t = (float)(reg->GetData().m_valueData.m_value3 - (reg->GetPreviousSample() == NULL ? 0 : reg->GetPreviousSample()->GetData().m_valueData.m_value3)); - break; - case 3: - t = (float)(reg->GetData().m_valueData.m_value4 - (reg->GetPreviousSample() == NULL ? 0 : reg->GetPreviousSample()->GetData().m_valueData.m_value4)); - break; - } - } - else - { - switch (m_persistentState->m_registersOfInterest[m_currentDisplayRegister].m_useSubValue) - { - case 0: - t = (float)reg->GetData().m_valueData.m_value1; - break; - case 1: - t = (float)reg->GetData().m_valueData.m_value2; - break; - case 2: - t = (float)reg->GetData().m_valueData.m_value3; - break; - case 3: - t = (float)reg->GetData().m_valueData.m_value4; - break; - } - } - - t *= m_persistentState->m_registersOfInterest[m_currentDisplayRegister].m_dataScale; - t = t * 2.0f - 1.0f; - t = t > 1.0f ? 1.0f : t; - t = t < -1.0f ? -1.0f : t; - return t; - } - } - } - } - } - - return -1.0f; - } - - QColor ProfilerDataAggregator::GetColor() const - { - return QColor(255, 127, 0); - } - - QString ProfilerDataAggregator::GetName() const - { - return "CPU"; - } - - QString ProfilerDataAggregator::GetChannelName() const - { - return ChannelName(); - } - - QString ProfilerDataAggregator::GetDescription() const - { - return "Profiler Driller"; - } - - QString ProfilerDataAggregator::GetToolTip() const - { - return "Information about CPU usage time and function usage tracking)"; - } - - AZ::Uuid ProfilerDataAggregator::GetID() const - { - return AZ::Uuid("{A6DB5318-82BF-416B-BF3D-FFD187329845}"); - } - - QWidget* ProfilerDataAggregator::DrillDownRequest(FrameNumberType frame) - { - return DrillDownRequest(frame, Profiler::RegisterInfo::PRT_TIME); - } - - QWidget* ProfilerDataAggregator::DrillDownRequest(FrameNumberType frame, int viewType) - { - Driller::ProfilerDataView* pdv = NULL; - - if (m_dataView) - { - KillAllViews(); - } - - pdv = aznew Driller::ProfilerDataView(this, frame, 0, viewType); - if (pdv) - { - m_dataView = pdv; - connect(pdv, SIGNAL(destroyed(QObject*)), this, SLOT(OnDataViewDestroyed(QObject*))); - ++m_persistentState->m_activeViewCount; - } - - return pdv; - } - - void ProfilerDataAggregator::OptionsRequest() - { - char output[64]; - GetID().ToString(output, AZ_ARRAY_SIZE(output), true, true); - AZ_TracePrintf("Driller", "Options Request for ProfilerDataAggregator %s\n", output); - } - - void ProfilerDataAggregator::OnDataViewDestroyed(QObject* dataView) - { - if (dataView == m_dataView) - { - m_dataView = nullptr; - --m_persistentState->m_activeViewCount; - } - } - - void ProfilerDataAggregator::KillAllViews() - { - if (m_dataView) - { - QObject* object = m_dataView; - OnDataViewDestroyed(m_dataView); - m_dataView = nullptr; - delete object; - } - } - - void ProfilerDataAggregator::ApplySettingsFromWorkspace(WorkspaceSettingsProvider* provider) - { - ProfilerDataAggregatorWorkspace* workspace = provider->FindSetting(AZ_CRC("PROFILER DATA AGGREGATOR WORKSPACE", 0xfdb6cb89)); - if (workspace) - { - m_persistentState->m_activeViewCount = workspace->m_activeViewCount; - } - } - void ProfilerDataAggregator::ActivateWorkspaceSettings(WorkspaceSettingsProvider* provider) - { - ProfilerDataAggregatorWorkspace* workspace = provider->FindSetting(AZ_CRC("PROFILER DATA AGGREGATOR WORKSPACE", 0xfdb6cb89)); - if (workspace) - { - // kill all existing data view windows in preparation of opening the workspace specified ones - KillAllViews(); - - // the internal count should be 0 from the above house cleaning - // and incremented back up from the workspace instantiations - m_persistentState->m_activeViewCount = 0; - for (int i = 0; i < workspace->m_activeViewCount; ++i) - { - // older workspaces will not have any active view types - // therefore this check to default PRT_TIME - int discoveredType = Profiler::RegisterInfo::PRT_TIME; - if (workspace->m_activeViewTypes.size() > i) - { - discoveredType = workspace->m_activeViewTypes[i]; - } - - Driller::ProfilerDataView* dataView = qobject_cast(DrillDownRequest(1, discoveredType)); - if (dataView) - { - // apply will overlay the workspace settings on top of the local user settings - dataView->ApplySettingsFromWorkspace(provider); - // activate will do the heavy lifting - dataView->ActivateWorkspaceSettings(provider); - } - } - } - } - void ProfilerDataAggregator::SaveSettingsToWorkspace(WorkspaceSettingsProvider* provider) - { - ProfilerDataAggregatorWorkspace* workspace = provider->CreateSetting(AZ_CRC("PROFILER DATA AGGREGATOR WORKSPACE", 0xfdb6cb89)); - if (workspace) - { - workspace->m_activeViewTypes.clear(); - workspace->m_activeViewCount = m_persistentState->m_activeViewCount; - - if (m_dataView) - { - Driller::ProfilerDataView* dataView = qobject_cast(m_dataView); - - if (dataView) - { - workspace->m_activeViewTypes.push_back(dataView->GetViewType()); - dataView->SaveSettingsToWorkspace(provider); - } - } - } - } - - //========================================================================= - // OnEventLoaded - // [7/10/2013] - //========================================================================= - void ProfilerDataAggregator::OnEventLoaded(DrillerEvent* event) - { - switch (event->GetEventType()) - { - case Profiler::PET_NEW_REGISTER: - { - Driller::ProfilerDrillerNewRegisterEvent* reg = static_cast(event); - - for (AZStd::size_t idx = 0; idx < m_persistentState->m_registersOfInterest.size(); ++idx) - { - AZStd::string registerName; - if (reg->GetInfo().m_name == NULL) - { - registerName = AZStd::string::format("%s(%d)" - , reg->GetInfo().m_function ? reg->GetInfo().m_function : "N/A" - , reg->GetInfo().m_line); - } - else - { - registerName = reg->GetInfo().m_name; - } - - if (!qstricmp(registerName.data(), m_persistentState->m_registersOfInterest[idx].m_name.data())) - { - m_allRegistersOfInterestInData[idx] = reg; - m_allCorrespondingIdsForRegistersOfInterestInData[idx] = reg->GetInfo().m_id; - } - } - - if (m_lifeTimeThreads.find(reg->GetInfo().m_threadId) == m_lifeTimeThreads.end()) - { - // this register belongs to a thread which was not AZStd::thread or was NOT reported to the - // AZStd::ThreadEventBus. This is possible for middleware and so on. Although we should attempt - // to report those threads too (the best we can, with some name at least) - // as of now just add the id. - // NB: threadId can be be defaulted at 0 if this is an older data set - // in which case we do not add it to the threads - if (reg->GetInfo().m_threadId != 0) - { - if (m_lifeTimeThreads.find(reg->GetInfo().m_threadId) == m_lifeTimeThreads.end()) - { - m_lifeTimeThreads.insert(AZStd::make_pair(reg->GetInfo().m_threadId, nullptr)); - } - } - } - break; - } - case Profiler::PET_UPDATE_REGISTER: - { - Driller::ProfilerDrillerUpdateRegisterEvent* reg = static_cast(event); - - for (AZStd::size_t idx = 0; idx < m_allCorrespondingIdsForRegistersOfInterestInData.size(); ++idx) - { - if (reg->GetRegisterId() == m_allCorrespondingIdsForRegistersOfInterestInData[idx]) - { - reg->PreComputeForward(m_allRegistersOfInterestInData[idx]); - } - } - } - break; - - case Profiler::PET_ENTER_THREAD: - { - // make sure we have a valid list with all the threads in the world - ProfilerDrillerEnterThreadEvent* newThread = static_cast(event); - if (m_lifeTimeThreads.find(newThread->m_threadId) == m_lifeTimeThreads.end()) - { - m_lifeTimeThreads.insert(AZStd::make_pair(newThread->m_threadId, newThread)); - } - } break; - } - } - - //========================================================================= - // Reset() - // [7/10/2013] - //========================================================================= - void ProfilerDataAggregator::Reset() - { - m_systems.clear(); - m_threads.clear(); - m_lifeTimeThreads.clear(); - m_registers.clear(); - - KillAllViews(); - } - - void ProfilerDataAggregator::Reflect(AZ::ReflectContext* context) - { - AZ::SerializeContext* serialize = azrtti_cast(context); - if (serialize) - { - ProfilerDataAggregatorSavedState::Reflect(context); - ProfilerDataAggregatorWorkspace::Reflect(context); - ProfilerDataView::Reflect(context); - - serialize->Class() - ->Version(1) - ->SerializeWithNoData(); - } - } -} // namespace Driller diff --git a/Code/Tools/Standalone/Source/Driller/Profiler/ProfilerDataAggregator.hxx b/Code/Tools/Standalone/Source/Driller/Profiler/ProfilerDataAggregator.hxx deleted file mode 100644 index 85a2841f39..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Profiler/ProfilerDataAggregator.hxx +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef DRILLER_PROFILER_DATAAGGREGATOR_TESTS_H -#define DRILLER_PROFILER_DATAAGGREGATOR_TESTS_H - -#if !defined(Q_MOC_RUN) -#include "Source/Driller/DrillerAggregator.hxx" -#include "Source/Driller/DrillerAggregatorOptions.hxx" -#include "AzCore/std/string/string.h" -#include "AzCore/std/containers/map.h" -#include "AzCore/RTTI/RTTI.h" -#include "AzCore/Memory/SystemAllocator.h" - -#include "ProfilerDataParser.h" -#endif - -namespace AZ -{ - class SerializeContext; -} - -namespace Driller -{ - class ProfilerDrillerNewRegisterEvent; - class ProfilerDrillerEnterThreadEvent; - class ProfilerDrillerRegisterSystemEvent; - class ProfilerDataAggregatorSavedState; - - /** - * Profiler data drilling aggregator. - */ - class ProfilerDataAggregator : public Aggregator - { - friend class ProfilerDataView; - ProfilerDataAggregator(const ProfilerDataAggregator&) = delete; - Q_OBJECT; - public: - AZ_RTTI(ProfilerDataAggregator, "{0DDEB1EA-0D49-4A5E-866A-885F51231FDA}"); - AZ_CLASS_ALLOCATOR(ProfilerDataAggregator,AZ::SystemAllocator,0); - - ProfilerDataAggregator(int identity = 0); - virtual ~ProfilerDataAggregator(); - - static AZ::u32 DrillerId() { return ProfilerDrillerHandlerParser::GetDrillerId(); } - virtual AZ::u32 GetDrillerId() const { return DrillerId(); } - - static const char* ChannelName() { return "Timing"; } - virtual AZ::Crc32 GetChannelId() const override { return AZ::Crc32(ChannelName()); } - - virtual AZ::Debug::DrillerHandlerParser* GetDrillerDataParser() { return &m_parser; } - - virtual void ApplySettingsFromWorkspace(WorkspaceSettingsProvider*); - virtual void ActivateWorkspaceSettings(WorkspaceSettingsProvider*); - virtual void SaveSettingsToWorkspace(WorkspaceSettingsProvider*); - - /// Called after an event has been loaded - void OnEventLoaded(DrillerEvent* event); - - void KillAllViews(); - - ////////////////////////////////////////////////////////////////////////// - // Aggregator - - virtual void Reset(); - - public slots: - float ValueAtFrame( FrameNumberType frame ) override; - QColor GetColor() const override; - QString GetName() const override; - QString GetChannelName() const override; - QString GetDescription() const override; - QString GetToolTip() const override; - AZ::Uuid GetID() const override; - QWidget* DrillDownRequest(FrameNumberType frame) override; - QWidget* DrillDownRequest(FrameNumberType frame, int viewType); - virtual void OptionsRequest(); - void OnDataViewDestroyed(QObject*); - - //protected: - public: - typedef AZStd::unordered_map RegisterMapType; - typedef AZStd::unordered_map ThreadMapType; - typedef AZStd::multimap ThreadMultiMapType; - typedef AZStd::unordered_map SystemMapType; - - /** - * Map with all systems in use (system is a logical group of registers, - * which we can enable/disable sampling in order to improve performance and data granularity - */ - SystemMapType m_systems; - ThreadMapType m_threads; ///< Map with all the threads which are currently running. - /** - * Map with all the threads we have ever encountered. - * IMPORTANT: Thread which were NOT reported to AZStd::ThreadEventBus - * will still be in the map, but the ProfilerDrillerEnterThreadEvent* pointer will be null. - * make sure your code accounts for that. - */ - ThreadMultiMapType m_lifeTimeThreads; - RegisterMapType m_registers; - - AZStd::vector m_allRegistersOfInterestInData; - AZStd::vector m_allCorrespondingIdsForRegistersOfInterestInData; - AZ::u64 m_currentDisplayRegister; - - QObject* m_dataView; - ProfilerDrillerHandlerParser m_parser; ///< Parser for this aggregator - - AZStd::intrusive_ptr m_persistentState; - - static void Reflect(AZ::ReflectContext* context); - }; - -} - -#endif diff --git a/Code/Tools/Standalone/Source/Driller/Profiler/ProfilerDataPanel.cpp b/Code/Tools/Standalone/Source/Driller/Profiler/ProfilerDataPanel.cpp deleted file mode 100644 index 5714d75b0f..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Profiler/ProfilerDataPanel.cpp +++ /dev/null @@ -1,1517 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include - -#include -#include - -#include "ProfilerDataPanel.hxx" -#include -#include "ProfilerDataAggregator.hxx" -#include - -#include "Source/Driller/StripChart.hxx" -#include "Source/Driller/DrillerAggregator.hxx" -#include "Source/Driller/Profiler/ProfilerOperationTelemetryEvent.h" - -#include "ProfilerEvents.h" - -#include -#include -#include -#include -#include -#include - -namespace Driller -{ - enum - { - PDM_FUNCTIONNAME = 0, - PDM_COMMENT, - PDM_EXCLUSIVE_TIME, - PDM_INCLUSIVE_TIME, - PDM_EXCLUSIVE_PCT, - PDM_INCLUSIVE_PCT, - PDM_CALLS, - PDM_CHILDREN_TIME, - PDM_ACCUMULATED_TIME, - PDM_CHILDREN_CALLS, - PDM_ACCUMULATED_CALLS, - PDM_THREAD_ID, - PDM_TIME_TOTAL - }; - static const char* PDM_TIME_STRING[] = { - "Function", - "Comment", - "Excl. Time (Micro)", - "Incl. Time (Micro)", - "Excl. Pct", - "Incl. Pct", - "Calls", - "Child Time (Micro)", - "Total Time (Micro)", - "Child Calls", - "Total Calls", - "Thread ID" - }; - enum - { - PDM_NUMERIC_DATA_ROLE = Qt::UserRole + 1 - }; - - enum - { - PDM_VALUE_FUNCTIONNAME = 0, - PDM_VALUE_COMMENT, - PDM_VALUE_1, - PDM_VALUE_2, - PDM_VALUE_3, - PDM_VALUE_4, - PDM_VALUE_5, - PDM_VALUE_THREAD_ID, - PDM_VALUE_TOTAL - }; - static const char* PDM_VALUE_STRING[] = { - "Function", - "Comment", - "Value 1", - "Value 2", - "Value 3", - "Value 4", - "Value 5", - "Thread ID" - }; - - int ProfilerDataModel::m_colorIndexTracker = 0; - - class ProfilerFilterModel - : public QSortFilterProxyModel - { - public: - AZ_CLASS_ALLOCATOR(ProfilerFilterModel, AZ::SystemAllocator, 0); - ProfilerFilterModel(QObject* pParent) - : QSortFilterProxyModel(pParent) - { - setFilterCaseSensitivity(Qt::CaseSensitive); - setDynamicSortFilter(false); - } - protected: - virtual bool lessThan(const QModelIndex& left, const QModelIndex& right) const - { - switch (left.column()) - { - case PDM_FUNCTIONNAME: - case PDM_COMMENT: - return QSortFilterProxyModel::lessThan(left, right); - break; - default: - AZ::u64 leftNumber = 0; - AZ::u64 rightNumber = 0; - // inner switch sanity check that we only pull numbers from numeric fields and default the rest to 0<0 false - switch (left.column()) - { - case PDM_INCLUSIVE_TIME: - case PDM_EXCLUSIVE_TIME: - case PDM_INCLUSIVE_PCT: - case PDM_EXCLUSIVE_PCT: - case PDM_CHILDREN_TIME: - case PDM_ACCUMULATED_TIME: - case PDM_CALLS: - case PDM_CHILDREN_CALLS: - case PDM_ACCUMULATED_CALLS: - case PDM_THREAD_ID: - QVariant retrievedColumnLeft = sourceModel()->data(left, PDM_NUMERIC_DATA_ROLE); - QVariant retrievedColumnRight = sourceModel()->data(right, PDM_NUMERIC_DATA_ROLE); - - leftNumber = retrievedColumnLeft.toULongLong(); - rightNumber = retrievedColumnRight.toULongLong(); - - break; - } - - return leftNumber < rightNumber; - break; - } - } - }; - - class ProfilerValueFilterModel - : public QSortFilterProxyModel - { - public: - AZ_CLASS_ALLOCATOR(ProfilerValueFilterModel, AZ::SystemAllocator, 0); - ProfilerValueFilterModel(QObject* pParent) - : QSortFilterProxyModel(pParent) - { - setFilterCaseSensitivity(Qt::CaseSensitive); - setDynamicSortFilter(false); - } - protected: - virtual bool lessThan(const QModelIndex& left, const QModelIndex& right) const - { - switch (left.column()) - { - case PDM_FUNCTIONNAME: - case PDM_COMMENT: - return QSortFilterProxyModel::lessThan(left, right); - break; - default: - AZ::u64 leftNumber = 0; - AZ::u64 rightNumber = 0; - // inner switch sanity check that we only pull numbers from numeric fields and default the rest to 0<0 false - switch (left.column()) - { - case PDM_VALUE_1: - case PDM_VALUE_2: - case PDM_VALUE_3: - case PDM_VALUE_4: - case PDM_VALUE_5: - case PDM_VALUE_THREAD_ID: - QVariant retrievedColumnLeft = sourceModel()->data(left, PDM_NUMERIC_DATA_ROLE); - QVariant retrievedColumnRight = sourceModel()->data(right, PDM_NUMERIC_DATA_ROLE); - - leftNumber = retrievedColumnLeft.toULongLong(); - rightNumber = retrievedColumnRight.toULongLong(); - - break; - } - - return leftNumber < rightNumber; - break; - } - } - }; - - ProfilerAxisFormatter::ProfilerAxisFormatter(QObject* pParent, int whichTypeOfRegister) - : QAbstractAxisFormatter(pParent) - { - m_lastAxisValueForScaling = 1.0f; - m_whatKindOfRegister = whichTypeOfRegister; - } - - QString ProfilerAxisFormatter::formatMicroseconds(float value) - { - // data is in microseconds! - // so how big is the division size? - if (m_lastAxisValueForScaling > 100000.0f) // greater than a 0.1 second per division - { - if (m_lastAxisValueForScaling > 1000000.0f) // whole seconds - { - return QObject::tr("%1s").arg(QString::number(value / 1000000.0f, 'f', 0)); - } - else - { - return QObject::tr("%1s").arg(QString::number(value / 1000000.0f, 'f', 1)); - } - } - else if (m_lastAxisValueForScaling > 100.0f) // greater than a 0.1 millisecond per division - { - if (m_lastAxisValueForScaling > 1000.0f) // whole milliseconds - { - return QObject::tr("%1%2").arg(QString::number(value / 1000.0f, 'f', 0)).arg("ms"); - } - else - { - return QObject::tr("%1%2").arg(QString::number(value / 1000.0f, 'f', 1)).arg("ms"); - } - } - else if (m_lastAxisValueForScaling > 1.0f) - { - return QObject::tr("%1%2s").arg((int)value).arg(QChar(0x00b5)); - } - else - { - return QObject::tr("%1%2s").arg(QString::number((double)value, 'f', 2)).arg(QChar(0x00b5)); - } - } - - QString ProfilerAxisFormatter::convertAxisValueToText(Charts::AxisType axis, float value, float /*minDisplayedValue*/, float /*maxDisplayedValue*/, float divisionSize) - { - if (axis == Charts::AxisType::Vertical) - { - if (m_whatKindOfRegister == (int)Profiler::RegisterInfo::PRT_TIME) - { - m_lastAxisValueForScaling = divisionSize; - return formatMicroseconds(value); - } - else - { - return QString::number(value); - } - } - else - { - return QString::number((int)value); - } - }; - - - /////////////////////// - // ProfilerDataWidget - /////////////////////// - - ProfilerDataWidget::ProfilerDataWidget(QWidget* parent) - : AzToolsFramework::QTreeViewWithStateSaving(parent) - , m_dataModel(NULL) - { - m_cachedChart = NULL; - m_cachedColumn = PDM_EXCLUSIVE_TIME; - m_autoZoom = true; - m_cachedFlatView = false; - m_cachedDeltaData = true; - m_manualZoomMin = 2000000000.0f; - m_manualZoomMax = -2000000000.0f; - m_iLastHighlightedChannel = -1; - - setFocusPolicy(Qt::StrongFocus); // required for key press handling - - setEnabled(true); - setSortingEnabled(true); - sortByColumn(0, Qt::AscendingOrder); - header()->setSectionResizeMode(QHeaderView::Interactive); - header()->setSectionsMovable(true); - header()->setStretchLastSection(false); - setUniformRowHeights(true); - - connect(this, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(OnDoubleClicked(const QModelIndex &))); - } - - ProfilerDataWidget::~ProfilerDataWidget() - { - //m_stateSaver->Detach(); - - if (m_dataModel) - { - delete m_dataModel; - } - } - - void ProfilerDataWidget::SetViewType(int viewType) - { - m_viewType = viewType; - if (m_viewType == Profiler::RegisterInfo::PRT_TIME) - { - m_dataModel = new ProfilerDataModel(); - if (m_dataModel) - { - m_filterModel = aznew ProfilerFilterModel(this); - m_filterModel->setSourceModel(m_dataModel); - setModel(m_filterModel); - } - } - if (m_viewType == Profiler::RegisterInfo::PRT_VALUE) - { - m_dataModel = new ProfilerCounterDataModel(); - if (m_dataModel) - { - m_filterModel = aznew ProfilerValueFilterModel(this); - m_filterModel->setSourceModel(m_dataModel); - setModel(m_filterModel); - } - } - - AZ_Assert(m_dataModel, "SetViewType has an invalid argument, profiler data model cannot be created!"); - } - - void ProfilerDataWidget::OnChartTypeMenu() - { - QAction* qa = qobject_cast(sender()); - if (qa) - { - OnChartTypeMenu(qa->objectName()); - } - } - - void ProfilerDataWidget::OnChartTypeMenu(QString typeStr) - { - ProfilerOperationTelemetryEvent chartTypeChanged; - - int newValue = 0; - - if (m_viewType == Profiler::RegisterInfo::PRT_TIME) - { - newValue = PDM_EXCLUSIVE_TIME; - - chartTypeChanged.SetAttribute("ChartTimeType", typeStr.toStdString().c_str()); - - if (typeStr == "Incl.Time") - { - newValue = PDM_INCLUSIVE_TIME; - } - if (typeStr == "Excl.Time") - { - newValue = PDM_EXCLUSIVE_TIME; - } - if (typeStr == "Calls") - { - newValue = PDM_CALLS; - } - if (typeStr == "Acc.Time") - { - newValue = PDM_ACCUMULATED_TIME; - } - if (typeStr == "Acc.Calls") - { - newValue = PDM_ACCUMULATED_CALLS; - } - } - else if (m_viewType == Profiler::RegisterInfo::PRT_VALUE) - { - newValue = PDM_VALUE_1; - - chartTypeChanged.SetAttribute("ChartValueType", typeStr.toStdString().c_str()); - - if (typeStr == "Value 1") - { - newValue = PDM_VALUE_1; - } - if (typeStr == "Value 2") - { - newValue = PDM_VALUE_2; - } - if (typeStr == "Value 3") - { - newValue = PDM_VALUE_3; - } - if (typeStr == "Value 4") - { - newValue = PDM_VALUE_4; - } - if (typeStr == "Value 5") - { - newValue = PDM_VALUE_5; - } - } - - chartTypeChanged.Log(); - m_cachedColumn = newValue; - RedrawChart(); - } - - void ProfilerDataWidget::BeginDataModelUpdate() - { - PauseTreeViewSaving(); - - m_dataModel->BeginAddRegisters(); - } - - void ProfilerDataWidget::EndDataModelUpdate() - { - m_dataModel->EndAddRegisters(); - - // this will capture any changes/zoom to the chart by the user - if ((!m_autoZoom) && (m_cachedChart)) - { - m_cachedChart->GetWindowRange(Charts::AxisType::Vertical, m_manualZoomMin, m_manualZoomMax); - } - - UnpauseTreeViewSaving(); - ApplyTreeViewSnapshot(); - } - - void ProfilerDataWidget::OnExpandAll() - { - expandAll(); - CaptureTreeViewSnapshot(); // expand all doesn't signal, this captures the fully open tree - - // now that column organization is being stored in user settings - // I'm disabling this so the user isn't surprised by his view suddenly changing - //resizeColumnToContents( 0 ); - } - - void ProfilerDataWidget::OnHideSelected() - { - m_iLastHighlightedChannel = -1; - QModelIndexList list = selectionModel()->selectedIndexes(); - foreach (QModelIndex index, list) - { - if (index.column() == 0) - { - QModelIndex sourceIndex = m_filterModel->mapToSource(index); - const Driller::ProfilerDrillerUpdateRegisterEvent* tp = (Driller::ProfilerDrillerUpdateRegisterEvent*)(sourceIndex.internalPointer()); - if (tp) - { - if (m_dataModel->m_enabledChartingMap.find(tp->GetRegister()->GetInfo().m_id) != m_dataModel->m_enabledChartingMap.end()) - { - m_dataModel->m_enabledChartingMap[ tp->GetRegister()->GetInfo().m_id ] = 0; - QModelIndex column0(m_dataModel->index(index.row(), 0)); - emit dataChanged(column0, column0); - } - } - } - } - update(); - RedrawChart(); - } - - void ProfilerDataWidget::OnShowSelected() - { - QModelIndexList list = selectionModel()->selectedIndexes(); - foreach (QModelIndex index, list) - { - if (index.column() == 0) - { - QModelIndex sourceIndex = m_filterModel->mapToSource(index); - const Driller::ProfilerDrillerUpdateRegisterEvent* tp = (Driller::ProfilerDrillerUpdateRegisterEvent*)(sourceIndex.internalPointer()); - if (tp) - { - if (m_dataModel->m_enabledChartingMap.find(tp->GetRegister()->GetInfo().m_id) != m_dataModel->m_enabledChartingMap.end()) - { - m_dataModel->m_enabledChartingMap[ tp->GetRegister()->GetInfo().m_id ] = 1; - QModelIndex column0(m_dataModel->index(index.row(), 0)); - emit dataChanged(column0, column0); - } - } - } - } - update(); - RedrawChart(); - } - - void ProfilerDataWidget::OnInvertHidden() - { - AZStd::map::iterator iter = m_dataModel->m_enabledChartingMap.begin(); - while (iter != m_dataModel->m_enabledChartingMap.end()) - { - int current = iter->second; - iter->second = !current; - ++iter; - } - update(); - RedrawChart(); - } - - void ProfilerDataWidget::OnHideAll() - { - m_iLastHighlightedChannel = -1; - AZStd::map::iterator iter = m_dataModel->m_enabledChartingMap.begin(); - while (iter != m_dataModel->m_enabledChartingMap.end()) - { - iter->second = 0; - ++iter; - } - update(); - RedrawChart(); - } - - void ProfilerDataWidget::OnShowAll() - { - AZStd::map::iterator iter = m_dataModel->m_enabledChartingMap.begin(); - while (iter != m_dataModel->m_enabledChartingMap.end()) - { - iter->second = 1; - ++iter; - } - update(); - RedrawChart(); - } - - void ProfilerDataWidget::OnAutoZoomChange(bool newValue) - { - if (!newValue) - { - m_autoZoom = false; - m_cachedChart->GetWindowRange(Charts::AxisType::Vertical, m_manualZoomMin, m_manualZoomMax); - } - else - { - m_autoZoom = true; - m_manualZoomMin = 2000000000.0f; - m_manualZoomMax = -2000000000.0f; - } - update(); - RedrawChart(); - } - - void ProfilerDataWidget::OnFlatView(bool isOn) - { - m_cachedFlatView = isOn; - m_dataModel->SetFlatView(m_cachedFlatView); - - update(); - RedrawChart(); - } - - void ProfilerDataWidget::OnDeltaData(bool isOn) - { - m_cachedDeltaData = isOn; - m_dataModel->SetDeltaData(m_cachedDeltaData); - - update(); - RedrawChart(); - } - - void ProfilerDataWidget::OnDoubleClicked(const QModelIndex& index) - { - if (index.isValid()) - { - QModelIndex sourceIndex = m_filterModel->mapToSource(index); - const Driller::ProfilerDrillerUpdateRegisterEvent* tp = (Driller::ProfilerDrillerUpdateRegisterEvent*)(sourceIndex.internalPointer()); - if (tp) - { - if (m_dataModel->m_enabledChartingMap.find(tp->GetRegister()->GetInfo().m_id) != m_dataModel->m_enabledChartingMap.end()) - { - int current = m_dataModel->m_enabledChartingMap.find(tp->GetRegister()->GetInfo().m_id)->second; - m_dataModel->m_enabledChartingMap[ tp->GetRegister()->GetInfo().m_id ] = !current; - QModelIndex column0(m_dataModel->index(index.row(), 0)); - emit dataChanged(column0, column0); // no matter where we clicked, update only column 0 - RedrawChart(); - } - } - } - } - - void ProfilerDataWidget::selectionChanged(const QItemSelection& selected, const QItemSelection& deselected) - { - QTreeView::selectionChanged(selected, deselected); - } - - void ProfilerDataWidget::RedrawChart() - { - if (m_cachedChart) - { - m_iLastHighlightedChannel = -1; - m_cachedChart->Reset(); - - m_cachedChart->AddAxis("Frame", static_cast(m_cachedStartFrame), static_cast(m_cachedStartFrame + m_cachedDisplayRange), true, true); - m_cachedChart->AddAxis("", m_manualZoomMin, m_manualZoomMax, false, false); - - m_cachedChart->SetDataDirty(); - } - } - - void ProfilerDataWidget::ConfigureChart(StripChart::DataStrip* chart, FrameNumberType atFrame, int howFar, FrameNumberType frameCount) - { - (void)frameCount; - // this can be NULL - if (chart) - { - // stored against the need to update on local selection changes, and used internally - if (m_cachedChart != chart) - { - m_cachedChart = chart; - ProfilerAxisFormatter* prf = aznew ProfilerAxisFormatter(this, (int)m_viewType); - m_cachedChart->SetAxisTextFormatter(prf); - m_formatter = prf; - - m_cachedChart->AttachDataSourceWidget(this); - } - - m_cachedDisplayRange = howFar; - - m_cachedCurrentFrame = atFrame; - m_cachedEndFrame = atFrame; - m_cachedStartFrame = AZStd::GetMax(atFrame - m_cachedDisplayRange, 0); - - RedrawChart(); - } - } - - void ProfilerDataWidget::ProvideData(StripChart::DataStrip* chart) - { - PlotTimeHistory(chart); - } - - void ProfilerDataWidget::onMouseOverNothing(float primaryAxisValue, float dependentAxisValue) - { - (void)primaryAxisValue; - (void)dependentAxisValue; - if (m_iLastHighlightedChannel != -1) - { - m_cachedChart->SetChannelHighlight(m_iLastHighlightedChannel, false); - m_iLastHighlightedChannel = -1; - m_dataModel->SetHighlightedRegisterID(0); - } - } - - void ProfilerDataWidget::onMouseOverDataPoint(int channelID, AZ::u64 sampleID, float primaryAxisValue, float dependentAxisValue) - { - if (!m_cachedChart) - { - return; - } - - (void)primaryAxisValue; - - auto found = m_ChannelsToRegisters.find(channelID); - if (found == m_ChannelsToRegisters.end()) - { - return; - } - const Driller::ProfilerDrillerNewRegisterEvent* currentRegister = found->second; - - if (!currentRegister) - { - return; - } - - if (m_iLastHighlightedChannel != -1) - { - m_cachedChart->SetChannelHighlight(m_iLastHighlightedChannel, false); - m_iLastHighlightedChannel = -1; - m_dataModel->SetHighlightedRegisterID(0); - } - - m_iLastHighlightedChannel = channelID; - m_cachedChart->SetChannelHighlight(m_iLastHighlightedChannel, true); - auto foundChannel = m_ChannelsToRegisters.find(channelID); - if (foundChannel != m_ChannelsToRegisters.end()) - { - m_dataModel->SetHighlightedRegisterID(foundChannel->second->GetInfo().m_id); - } - - const Driller::ProfilerDrillerUpdateRegisterEvent* previousRegister = currentRegister->GetLastSample(); - while ((previousRegister) && (previousRegister->GetGlobalEventId() != (unsigned int)sampleID)) - { - previousRegister = previousRegister->GetPreviousSample(); - } - - if (previousRegister) - { - QString tooltip; - QString identifier = tr("%1(%2) %3") - .arg(currentRegister->GetInfo().m_function ? currentRegister->GetInfo().m_function : "???") - .arg(currentRegister->GetInfo().m_line) - .arg(currentRegister->GetInfo().m_name ? QString("'%1'").arg(currentRegister->GetInfo().m_name) : ""); - - if (previousRegister->GetRegister()->GetInfo().m_type == Profiler::RegisterInfo::PRT_TIME) - { - QString displayValue; - - switch (m_cachedColumn) - { - case PDM_INCLUSIVE_TIME: - displayValue = tr("Inclusive: %1").arg(m_formatter->formatMicroseconds(dependentAxisValue)); - break; - case PDM_EXCLUSIVE_TIME: - displayValue = tr("Exclusive: %1").arg(m_formatter->formatMicroseconds(dependentAxisValue)); - break; - case PDM_CALLS: - displayValue = tr("%1 calls").arg((int)dependentAxisValue); - break; - case PDM_ACCUMULATED_TIME: - displayValue = tr("Accumulated: %1%").arg(m_formatter->formatMicroseconds(dependentAxisValue)); - break; - case PDM_ACCUMULATED_CALLS: - displayValue = tr("%1 accumulated calls").arg((int)dependentAxisValue); - break; - } - - tooltip = QString("%1: %2").arg(identifier).arg(displayValue); - - if (QApplication::activeWindow() == this->parent()) - { - QToolTip::showText(m_cachedChart->mapToGlobal(QPoint(0, 0)), tooltip, m_cachedChart); - } - } - else - { - // value register: - } - } - } - - void ProfilerDataWidget::PlotTimeHistory(StripChart::DataStrip* chart) - { - m_ChannelsToRegisters.clear(); - - if (chart) - { - float maxVerticalValue = 0; - - chart->SetMarkerColor(QColor(255, 0, 0)); - chart->SetMarkerPosition(static_cast(m_cachedCurrentFrame)); - - chart->StartBatchDataAdd(); - - for (const Driller::ProfilerDrillerUpdateRegisterEvent* currentRegister : m_dataModel->m_profilerDrillerUpdateRegisterEvents) - { - const Driller::ProfilerDrillerUpdateRegisterEvent* previousRegister = currentRegister->GetPreviousSample(); - - if (previousRegister) - { - if (m_dataModel->m_enabledChartingMap.find(currentRegister->GetRegister()->GetInfo().m_id)->second) - { - FrameNumberType localAtFrame = m_cachedCurrentFrame; - FrameNumberType localHowFar = m_cachedDisplayRange; - - int channelID = -1; - const Driller::ProfilerDrillerNewRegisterEvent* reg = currentRegister->GetRegister(); - if (reg) - { - if ((reg->GetInfo().m_name) && (strlen(reg->GetInfo().m_name) > 0)) - { - channelID = chart->AddChannel(reg->GetInfo().m_name); - } - else if ((reg->GetInfo().m_function) && (strlen(reg->GetInfo().m_function) > 0)) - { - channelID = chart->AddChannel(tr("%1(%2)").arg(reg->GetInfo().m_function).arg(reg->GetInfo().m_line)); - } - else - { - channelID = chart->AddChannel(tr("Unknown Register:%1").arg(reg->GetInfo().m_id)); - } - - chart->SetChannelStyle(channelID, StripChart::Channel::STYLE_CONNECTED_LINE); - chart->SetChannelColor(channelID, m_dataModel->m_colorMap.find(currentRegister->GetRegister()->GetInfo().m_id)->second); - } - else - { - channelID = chart->AddChannel("NULL"); - chart->SetChannelStyle(channelID, StripChart::Channel::STYLE_CONNECTED_LINE); - chart->SetChannelColor(channelID, m_dataModel->m_colorMap.find(0)->second); - } - - // If we don't have a valid channel ID skip over. - if (!chart->IsValidChannelId(channelID)) - { - continue; - } - - m_ChannelsToRegisters[channelID] = reg; - - while (localAtFrame >= 0 && localHowFar >= 0) - { - float sample = 0.0f; - - if (m_viewType == Profiler::RegisterInfo::PRT_TIME) - { - switch (m_cachedColumn) - { - case PDM_INCLUSIVE_TIME: - sample = (float)(currentRegister->GetData().m_timeData.m_time - (previousRegister == NULL ? 0 : previousRegister->GetData().m_timeData.m_time)); - break; - case PDM_EXCLUSIVE_TIME: - sample = (float)(((currentRegister->GetData().m_timeData.m_time - (previousRegister == NULL ? 0 : previousRegister->GetData().m_timeData.m_time)) - (currentRegister->GetData().m_timeData.m_childrenTime - (previousRegister == NULL ? 0 : previousRegister->GetData().m_timeData.m_childrenTime)))); - break; - case PDM_CALLS: - sample = (float)(currentRegister->GetData().m_timeData.m_calls - (previousRegister == NULL ? 0 : previousRegister->GetData().m_timeData.m_calls)); - break; - case PDM_ACCUMULATED_TIME: - sample = (float)(currentRegister->GetData().m_timeData.m_time); - break; - case PDM_ACCUMULATED_CALLS: - sample = (float)(currentRegister->GetData().m_timeData.m_calls); - break; - } - } - else if (m_viewType == Profiler::RegisterInfo::PRT_VALUE) - { - AZ::u64 columnNumber = 0; - AZ::u64 columnDelta = 0; - - switch (m_cachedColumn) - { - case PDM_VALUE_1: - columnNumber = currentRegister->GetData().m_valueData.m_value1; - break; - case PDM_VALUE_2: - columnNumber = currentRegister->GetData().m_valueData.m_value2; - break; - case PDM_VALUE_3: - columnNumber = currentRegister->GetData().m_valueData.m_value3; - break; - case PDM_VALUE_4: - columnNumber = currentRegister->GetData().m_valueData.m_value4; - break; - case PDM_VALUE_5: - columnNumber = currentRegister->GetData().m_valueData.m_value5; - break; - case PDM_VALUE_THREAD_ID: - columnNumber = currentRegister->GetRegister()->GetInfo().m_threadId; - break; - } - if (m_cachedDeltaData) - { - switch (m_cachedColumn) - { - case PDM_VALUE_1: - columnDelta = (previousRegister == NULL ? 0 : previousRegister->GetData().m_valueData.m_value1); - break; - case PDM_VALUE_2: - columnDelta = (previousRegister == NULL ? 0 : previousRegister->GetData().m_valueData.m_value2); - break; - case PDM_VALUE_3: - columnDelta = (previousRegister == NULL ? 0 : previousRegister->GetData().m_valueData.m_value3); - break; - case PDM_VALUE_4: - columnDelta = (previousRegister == NULL ? 0 : previousRegister->GetData().m_valueData.m_value4); - break; - case PDM_VALUE_5: - columnDelta = (previousRegister == NULL ? 0 : previousRegister->GetData().m_valueData.m_value5); - break; - } - } - - sample = (float)(columnNumber - columnDelta); - } - - maxVerticalValue = AZStd::GetMax(sample, maxVerticalValue); - - chart->AddBatchedData(channelID, currentRegister->GetGlobalEventId(), (float)localAtFrame, sample); - - currentRegister = previousRegister; - if (!currentRegister) - { - break; - } - previousRegister = currentRegister->GetPreviousSample(); - - --localAtFrame; - --localHowFar; - } - } - } - } - - // Always assume 0 as the minimum - chart->SetWindowRange(Charts::AxisType::Vertical, 0, maxVerticalValue); - - // Adding one here so I can actually see the scrubber mark. - float minValue = 0.0f; - float maxValue = 0.0f; - if (chart->GetAxisRange(Charts::AxisType::Horizontal, minValue, maxValue)) - { - chart->SetWindowRange(Charts::AxisType::Horizontal, minValue, maxValue + 0.5f); - } - - chart->EndBatchDataAdd(); - } - - if (m_autoZoom) - { - chart->ZoomExtents(Charts::AxisType::Vertical); - } - else - { - chart->ZoomManual(Charts::AxisType::Vertical, m_manualZoomMin, m_manualZoomMax); - } - - } - - //------------------------------------------------------------------------ - - ProfilerDataModel::ProfilerDataModel() - { - m_SourceAggregator = NULL; - m_cachedFlatView = false; - m_highlightedRegisterID = 0; - } - - ProfilerDataModel::~ProfilerDataModel() - { - EmptyTheEventCache(); - m_colorMap.clear(); - m_iconMap.clear(); - m_enabledChartingMap.clear(); - } - - QVariant ProfilerDataModel::headerData (int section, Qt::Orientation orientation, int role) const - { - (void)orientation; - - if (role == Qt::DisplayRole) - { - return QVariant(PDM_TIME_STRING[section]); - } - - return QVariant(); - } - - QVariant ProfilerDataModel::data (const QModelIndex& index, int role) const - { - if (index.isValid() && m_SourceAggregator && m_SourceAggregator->IsValid()) - { - const Driller::ProfilerDrillerUpdateRegisterEvent* registerEvent = static_cast(index.internalPointer()); - - if (role == Qt::BackgroundRole) - { - if (m_highlightedRegisterID != 0) - { - if (registerEvent->GetRegisterId() == m_highlightedRegisterID) - { - return QVariant::fromValue(QColor(94, 94, 178, 255)); - } - } - } - // a color swatch to match register to chart, or black if not drawn to the chart - if (role == Qt::DecorationRole && index.column() == 0 /*COLOR SWATCH*/) - { - if (registerEvent->GetRegister()) - { - if (m_enabledChartingMap.find(registerEvent->GetRegister()->GetInfo().m_id) != m_enabledChartingMap.end()) - { - if (m_enabledChartingMap.find(registerEvent->GetRegister()->GetInfo().m_id)->second) - { - return QVariant(m_iconMap.find(registerEvent->GetRegister()->GetInfo().m_id)->second); - } - else - { - return QVariant(m_iconMap.find(0)->second); - } - } - else - { - return QVariant(m_iconMap.find(0)->second); - } - } - } - if (role == Qt::DisplayRole || role == PDM_NUMERIC_DATA_ROLE) - { - const Driller::ProfilerDrillerUpdateRegisterEvent* currentRegister = registerEvent; - const Driller::ProfilerDrillerUpdateRegisterEvent* previousRegister = currentRegister->GetPreviousSample(); - - if (role == Qt::DisplayRole) - { - switch (index.column()) - { - case PDM_FUNCTIONNAME: - if (currentRegister->GetRegister()) - { - AZStd::string name = AZStd::string::format("%s(%d)" - , currentRegister->GetRegister()->GetInfo().m_function ? currentRegister->GetRegister()->GetInfo().m_function : "N/A" - , currentRegister->GetRegister()->GetInfo().m_line); - return QVariant(name.c_str()); - } - else - { - return QVariant("N/A"); - } - break; - case PDM_COMMENT: - return QVariant(QString(currentRegister->GetRegister() ? currentRegister->GetRegister()->GetInfo().m_name ? currentRegister->GetRegister()->GetInfo().m_name : "" : "")); - break; - } - } - - AZ::u64 columnNumber = 0; - - switch (index.column()) - { - case PDM_INCLUSIVE_TIME: - columnNumber = currentRegister->GetData().m_timeData.m_time - (previousRegister == NULL ? 0 : previousRegister->GetData().m_timeData.m_time); - break; - case PDM_EXCLUSIVE_TIME: - columnNumber = (currentRegister->GetData().m_timeData.m_time - (previousRegister == NULL ? 0 : previousRegister->GetData().m_timeData.m_time)) - (currentRegister->GetData().m_timeData.m_childrenTime - (previousRegister == NULL ? 0 : previousRegister->GetData().m_timeData.m_childrenTime)); - break; - case PDM_INCLUSIVE_PCT: - columnNumber = currentRegister->GetData().m_timeData.m_time - (previousRegister == NULL ? 0 : previousRegister->GetData().m_timeData.m_time); - break; - case PDM_EXCLUSIVE_PCT: - columnNumber = (currentRegister->GetData().m_timeData.m_time - (previousRegister == NULL ? 0 : previousRegister->GetData().m_timeData.m_time)) - (currentRegister->GetData().m_timeData.m_childrenTime - (previousRegister == NULL ? 0 : previousRegister->GetData().m_timeData.m_childrenTime)); - break; - case PDM_CHILDREN_TIME: - columnNumber = currentRegister->GetData().m_timeData.m_childrenTime - (previousRegister == NULL ? 0 : previousRegister->GetData().m_timeData.m_childrenTime); - break; - case PDM_ACCUMULATED_TIME: - columnNumber = currentRegister->GetData().m_timeData.m_time; - break; - case PDM_CALLS: - columnNumber = currentRegister->GetData().m_timeData.m_calls - (previousRegister == NULL ? 0 : previousRegister->GetData().m_timeData.m_calls); - break; - case PDM_CHILDREN_CALLS: - columnNumber = currentRegister->GetData().m_timeData.m_childrenCalls - (previousRegister == NULL ? 0 : previousRegister->GetData().m_timeData.m_childrenCalls); - break; - case PDM_ACCUMULATED_CALLS: - columnNumber = currentRegister->GetData().m_timeData.m_calls; - break; - case PDM_THREAD_ID: - columnNumber = currentRegister->GetRegister()->GetInfo().m_threadId; - break; - } - - if (role == Qt::DisplayRole) - { - if (index.column() == PDM_INCLUSIVE_PCT || index.column() == PDM_EXCLUSIVE_PCT) - { - float percent = (float)columnNumber / (float)m_totalTime; - return QVariant(QString::number(percent * 100.0f, 'f', 2)); - } - if (index.column() == PDM_THREAD_ID) - { - return QVariant(QString("%1").arg(columnNumber)); - } - else - { - return QVariant(QString("%L1").arg(columnNumber)); - } - } - else if (role == PDM_NUMERIC_DATA_ROLE) - { - return QVariant(columnNumber); - } - - return QVariant(); - } - } - - return QVariant(); - } - - Qt::ItemFlags ProfilerDataModel::flags (const QModelIndex& index) const - { - if (!index.isValid()) - { - return Qt::ItemFlags(); - } - - return Qt::ItemIsSelectable | Qt::ItemIsEnabled; - } - - QModelIndex ProfilerDataModel::index (int row, int column, const QModelIndex& parent) const - { - if (hasIndex(row, column, parent) && m_SourceAggregator && m_SourceAggregator->IsValid()) - { - if (m_cachedFlatView) - { - // look up the rowTh data item - return createIndex(row, column, (void*)(m_profilerDrillerUpdateRegisterEvents[row])); - } - - if (!parent.isValid()) - { - // look up the rowTh data item with no parent itself - int foundCount = 0; - DVVector::const_iterator iter = m_profilerDrillerUpdateRegisterEvents.begin(); - while (iter != m_profilerDrillerUpdateRegisterEvents.end()) - { - if ((*iter)->GetData().m_timeData.m_lastParentRegisterId == 0) - { - if (foundCount == row) - { - return createIndex(row, column, (void*)(*iter)); - } - - ++foundCount; - } - ++iter; - } - } - else - { - Driller::ProfilerDrillerUpdateRegisterEvent* registerEvent = static_cast(parent.internalPointer()); - // look up the rowTh data item with pt as a parent - int foundCount = 0; - DVVector::const_iterator iter = m_profilerDrillerUpdateRegisterEvents.begin(); - while (iter != m_profilerDrillerUpdateRegisterEvents.end()) - { - if ((*iter)->GetData().m_timeData.m_lastParentRegisterId == registerEvent->GetRegister()->GetInfo().m_id) - { - if (foundCount == row) - { - return createIndex(row, column, (void*)(*iter)); - } - ++foundCount; - } - ++iter; - } - } - } - - return QModelIndex(); - } - - QModelIndex ProfilerDataModel::parent (const QModelIndex& index) const - { - if (m_cachedFlatView) - { - return QModelIndex(); - } - if (index.isValid() && m_SourceAggregator && m_SourceAggregator->IsValid()) - { - Driller::ProfilerDrillerUpdateRegisterEvent* childItem = static_cast(index.internalPointer()); - - DVVector::const_iterator mainIter = m_profilerDrillerUpdateRegisterEvents.begin(); - while (mainIter != m_profilerDrillerUpdateRegisterEvents.end()) - { - // 0th frame the updates haven't been linked to their registers yet, that happens on 1st - // this is a guard against that - if ((*mainIter)->GetRegister()) - { - if ((*mainIter)->GetRegister()->GetInfo().m_id == childItem->GetData().m_timeData.m_lastParentRegisterId) - { - // row() should be the parent's row in it's own parent - int parentRow = 0; - DVVector::const_iterator parentIter = m_profilerDrillerUpdateRegisterEvents.begin(); - while (parentIter != m_profilerDrillerUpdateRegisterEvents.end()) - { - if ((*parentIter)->GetRegister()->GetData().m_timeData.m_lastParentRegisterId == (*mainIter)->GetData().m_timeData.m_lastParentRegisterId) - { - if (*parentIter == *mainIter) - { - return createIndex(parentRow, 0, (void*)(*mainIter)); - } - ++parentRow; - } - ++parentIter; - } - } - } - - ++mainIter; - } - } - - return QModelIndex(); - } - - int ProfilerDataModel::rowCount (const QModelIndex& parent) const - { - int foundCount = 0; - - if (m_SourceAggregator && m_SourceAggregator->IsValid()) - { - if (m_cachedFlatView && !parent.isValid()) - { - foundCount = (int)m_profilerDrillerUpdateRegisterEvents.size(); - } - else if (m_cachedFlatView) - { - foundCount = 0; - } - else if (!parent.isValid()) - { - // count data items with no parent id - DVVector::const_iterator iter = m_profilerDrillerUpdateRegisterEvents.begin(); - while (iter != m_profilerDrillerUpdateRegisterEvents.end()) - { - if ((*iter)->GetData().m_timeData.m_lastParentRegisterId == 0) - { - ++foundCount; - } - ++iter; - } - } - else - { - Driller::ProfilerDrillerUpdateRegisterEvent* registerEvent = static_cast(parent.internalPointer()); - // count data items with pt as a parent - DVVector::const_iterator iter = m_profilerDrillerUpdateRegisterEvents.begin(); - while (iter != m_profilerDrillerUpdateRegisterEvents.end()) - { - // 0th frame the updates haven't been linked to their registers yet, that happens on 1st - // this is a guard against that - if (registerEvent->GetRegister()) - { - if ((*iter)->GetData().m_timeData.m_lastParentRegisterId == registerEvent->GetRegister()->GetInfo().m_id) - { - ++foundCount; - } - } - ++iter; - } - } - } - - return foundCount; - } - - int ProfilerDataModel::columnCount (const QModelIndex& /*parent*/) const - { - return PDM_TIME_TOTAL; - } - - void ProfilerDataModel::EmptyTheEventCache() - { - m_profilerDrillerUpdateRegisterEvents.clear(); - } - void ProfilerDataModel::BeginAddRegisters() - { - beginResetModel(); - EmptyTheEventCache(); - m_totalTime = 0; - } - void ProfilerDataModel::AddRegister(const Driller::ProfilerDrillerUpdateRegisterEvent* newData) - { - if (newData->GetRegister()) - { - if (newData->GetRegister()->GetInfo().m_type == Profiler::RegisterInfo::PRT_TIME) - { - m_profilerDrillerUpdateRegisterEvents.push_back(newData); - - const Driller::ProfilerDrillerUpdateRegisterEvent* currentRegister = newData; - const Driller::ProfilerDrillerUpdateRegisterEvent* previousRegister = currentRegister->GetPreviousSample(); - - const AZ::u64 previousRegisterTime = (previousRegister == nullptr ? 0 : previousRegister->GetData().m_timeData.m_time); - const AZ::u64 registerDeltaTime = currentRegister->GetData().m_timeData.m_time - previousRegisterTime; - - const AZ::u64 previousChildTime = (previousRegister == NULL ? 0 : previousRegister->GetData().m_timeData.m_childrenTime); - const AZ::u64 childDeltaTime = currentRegister->GetData().m_timeData.m_childrenTime - previousChildTime; - - AZ::u64 t = registerDeltaTime - childDeltaTime; - m_totalTime += t; - } - } - } - - void ProfilerDataModel::EndAddRegisters() - { - Recolor(); - endResetModel(); - } - void ProfilerDataModel::SetAggregator(Driller::ProfilerDataAggregator* aggregator) - { - m_SourceAggregator = aggregator; - } - - QColor ProfilerDataModel::GetColorByIndex(int colorIdx, int maxNumColors) - { - QColor col; - float sat = .9f; - float val = .9f; - col.setHsvF((float)(colorIdx % maxNumColors) / (float(maxNumColors)), sat, val); - return col; - } - - // lazy build of a mapping between Event ID# and QColor for chart display(s) - void ProfilerDataModel::Recolor() - { - // these two numbers used to cycle broadly around the color wheel - // so that proximal entries are never too similar in hue - const int magicNumber = 32; // magic number - const int magicIncrement = 5; - - // black for disabled on the chart - if (m_colorMap.find(0) == m_colorMap.end()) - { - QPixmap pixmap(16, 16); - QPainter painter(&pixmap); - painter.setBrush(Qt::black); - painter.drawRect(0, 0, 16, 16); - QIcon itemIcon(pixmap); - m_iconMap[ 0 ] = itemIcon; - } - - DVVector::const_iterator iter = m_profilerDrillerUpdateRegisterEvents.begin(); - while (iter != m_profilerDrillerUpdateRegisterEvents.end()) - { - if ((*iter)->GetRegister()) - { - if (m_colorMap.find((*iter)->GetRegister()->GetInfo().m_id) == m_colorMap.end()) - { - // charting map and color map always in lockstep - m_enabledChartingMap[ (*iter)->GetRegister()->GetInfo().m_id ] = 1; - - QColor qc = GetColorByIndex(m_colorIndexTracker, magicNumber); - m_colorMap[ (*iter)->GetRegister()->GetInfo().m_id ] = qc; - - QPixmap pixmap(16, 16); - QPainter painter(&pixmap); - painter.setBrush(qc); - painter.drawRect(0, 0, 16, 16); - QIcon itemIcon(pixmap); - m_iconMap[ (*iter)->GetRegister()->GetInfo().m_id ] = itemIcon; - - m_colorIndexTracker += magicIncrement; - } - } - - ++iter; - } - } - - void ProfilerDataModel::SetFlatView(bool on) - { - emit layoutAboutToBeChanged(); - m_cachedFlatView = on; - emit layoutChanged(); - } - - void ProfilerDataModel::SetDeltaData(bool on) - { - emit layoutAboutToBeChanged(); - m_cachedDeltaData = on; - emit layoutChanged(); - } - - void ProfilerDataModel::SetHighlightedRegisterID(AZ::u64 regid) - { - if (m_highlightedRegisterID != regid) - { - m_highlightedRegisterID = regid; - emit dataChanged(index(0, 0), index(rowCount() - 1, columnCount() - 1)); - } - } - - - //------------------------------------------------------------------------ - - ProfilerCounterDataModel::ProfilerCounterDataModel() - { - } - - ProfilerCounterDataModel::~ProfilerCounterDataModel() - { - } - void ProfilerCounterDataModel::AddRegister(const Driller::ProfilerDrillerUpdateRegisterEvent* newData) - { - if (newData->GetRegister()) - { - if (newData->GetRegister()->GetInfo().m_type == Profiler::RegisterInfo::PRT_VALUE) - { - m_profilerDrillerUpdateRegisterEvents.push_back(newData); - } - } - } - - QVariant ProfilerCounterDataModel::headerData (int section, Qt::Orientation orientation, int role) const - { - (void)orientation; - - if (role == Qt::DisplayRole) - { - return QVariant(PDM_VALUE_STRING[section]); - } - - return QVariant(); - } - - QVariant ProfilerCounterDataModel::data (const QModelIndex& index, int role) const - { - if (index.isValid() && m_SourceAggregator && m_SourceAggregator->IsValid()) - { - const Driller::ProfilerDrillerUpdateRegisterEvent* registerEvent = static_cast(index.internalPointer()); - - if (role == Qt::BackgroundRole) - { - if (m_highlightedRegisterID != 0) - { - if (registerEvent->GetRegisterId() == m_highlightedRegisterID) - { - return QVariant::fromValue(QColor(94, 94, 178, 255)); - } - } - } - // a color swatch to match register to chart, or black if not drawn to the chart - if (role == Qt::DecorationRole && index.column() == 0 /*COLOR SWATCH*/) - { - if (registerEvent->GetRegister()) - { - if (m_enabledChartingMap.find(registerEvent->GetRegister()->GetInfo().m_id) != m_enabledChartingMap.end()) - { - if (m_enabledChartingMap.find(registerEvent->GetRegister()->GetInfo().m_id)->second) - { - return QVariant(m_iconMap.find(registerEvent->GetRegister()->GetInfo().m_id)->second); - } - else - { - return QVariant(m_iconMap.find(0)->second); - } - } - else - { - return QVariant(m_iconMap.find(0)->second); - } - } - } - if (role == Qt::DisplayRole || role == PDM_NUMERIC_DATA_ROLE) - { - const Driller::ProfilerDrillerUpdateRegisterEvent* currentRegister = registerEvent; - const Driller::ProfilerDrillerUpdateRegisterEvent* previousRegister = currentRegister->GetPreviousSample(); - - if (role == Qt::DisplayRole) - { - switch (index.column()) - { - case PDM_FUNCTIONNAME: - if (currentRegister->GetRegister()) - { - AZStd::string name = AZStd::string::format("%s(%d)" - , currentRegister->GetRegister()->GetInfo().m_function ? currentRegister->GetRegister()->GetInfo().m_function : "N/A" - , currentRegister->GetRegister()->GetInfo().m_line); - return QVariant(name.c_str()); - } - else - { - return QVariant("N/A"); - } - break; - case PDM_COMMENT: - return QVariant(QString(currentRegister->GetRegister() ? currentRegister->GetRegister()->GetInfo().m_name ? currentRegister->GetRegister()->GetInfo().m_name : "" : "")); - break; - } - } - - AZ::u64 columnNumber = 0; - AZ::u64 columnDelta = 0; - - switch (index.column()) - { - case PDM_VALUE_1: - columnNumber = currentRegister->GetData().m_valueData.m_value1; - break; - case PDM_VALUE_2: - columnNumber = currentRegister->GetData().m_valueData.m_value2; - break; - case PDM_VALUE_3: - columnNumber = currentRegister->GetData().m_valueData.m_value3; - break; - case PDM_VALUE_4: - columnNumber = currentRegister->GetData().m_valueData.m_value4; - break; - case PDM_VALUE_5: - columnNumber = currentRegister->GetData().m_valueData.m_value5; - break; - case PDM_VALUE_THREAD_ID: - columnNumber = currentRegister->GetRegister()->GetInfo().m_threadId; - break; - } - if (m_cachedDeltaData) - { - switch (index.column()) - { - case PDM_VALUE_1: - columnDelta = (previousRegister == NULL ? 0 : previousRegister->GetData().m_valueData.m_value1); - break; - case PDM_VALUE_2: - columnDelta = (previousRegister == NULL ? 0 : previousRegister->GetData().m_valueData.m_value2); - break; - case PDM_VALUE_3: - columnDelta = (previousRegister == NULL ? 0 : previousRegister->GetData().m_valueData.m_value3); - break; - case PDM_VALUE_4: - columnDelta = (previousRegister == NULL ? 0 : previousRegister->GetData().m_valueData.m_value4); - break; - case PDM_VALUE_5: - columnDelta = (previousRegister == NULL ? 0 : previousRegister->GetData().m_valueData.m_value5); - break; - } - } - - columnNumber -= columnDelta; - - if (role == Qt::DisplayRole) - { - if (index.column() == PDM_VALUE_THREAD_ID) - { - return QVariant(QString("%1").arg(columnNumber)); - } - else - { - return QVariant(QString("%L1").arg(columnNumber)); - } - } - else if (role == PDM_NUMERIC_DATA_ROLE) - { - return QVariant(columnNumber); - } - - return QVariant(); - } - } - - return QVariant(); - } - - int ProfilerCounterDataModel::columnCount (const QModelIndex& /*parent*/) const - { - return PDM_VALUE_TOTAL; - } -} diff --git a/Code/Tools/Standalone/Source/Driller/Profiler/ProfilerDataPanel.hxx b/Code/Tools/Standalone/Source/Driller/Profiler/ProfilerDataPanel.hxx deleted file mode 100644 index 9d31204ba8..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Profiler/ProfilerDataPanel.hxx +++ /dev/null @@ -1,199 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef PROFILER_DATA_PANEL_H -#define PROFILER_DATA_PANEL_H - -#if !defined(Q_MOC_RUN) -#include -#include -#include -#include - -#include -#include -#include -#include - -#include - -#include -#endif - -namespace StripChart -{ - class DataStrip; -} - -class QSortFilterProxyModel; - -#pragma once - - -namespace Driller -{ - class Aggregator; - class ProfilerDrillerUpdateRegisterEvent; - class ProfilerDataAggregator; - class ProfilerFilterModel; - class ProfilerDrillerNewRegisterEvent; - - class ProfilerDataModel : public QAbstractItemModel - { - Q_OBJECT; - - public: - - friend class ProfilerDataWidget; - - ProfilerDataModel(); - ~ProfilerDataModel(); - - virtual QVariant data ( const QModelIndex & index, int role = Qt::DisplayRole ) const; - virtual Qt::ItemFlags flags ( const QModelIndex & index ) const; - virtual QModelIndex index ( int row, int column, const QModelIndex & parent = QModelIndex() ) const; - virtual QModelIndex parent ( const QModelIndex & index ) const; - virtual int rowCount ( const QModelIndex & parent = QModelIndex() ) const; - virtual int columnCount ( const QModelIndex & parent = QModelIndex() ) const; - virtual QVariant headerData ( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const; - - void EmptyTheEventCache(); - void BeginAddRegisters(); - virtual void AddRegister( const Driller::ProfilerDrillerUpdateRegisterEvent *newData ); - void SetAggregator( Driller::ProfilerDataAggregator *aggregator ); - void EndAddRegisters(); - void Recolor(); - void SetFlatView( bool on ); - void SetDeltaData( bool on ); - - void SetHighlightedRegisterID(AZ::u64 regid); - - protected: - // the data = a tree of accumulated profiled events - // cached locally as a vector of pointers into the aggregator data block because - // the aggregator data block is a stream of different types of events - typedef AZStd::vector DVVector; // aggregator hosted pointers guaranteed to not disappear - DVVector m_profilerDrillerUpdateRegisterEvents; - Driller::ProfilerDataAggregator *m_SourceAggregator; - - QColor GetColorByIndex( int colorIdx, int maxNumColors ); - static int m_colorIndexTracker; - AZStd::map m_colorMap; - AZStd::map m_iconMap; - AZStd::map m_enabledChartingMap; - AZ::u64 m_totalTime; // used in percentage calculation - bool m_cachedFlatView; - bool m_cachedDeltaData; - AZ::u64 m_highlightedRegisterID; - QPersistentModelIndex m_LastHighlightedRegister; - }; - - class ProfilerCounterDataModel : public ProfilerDataModel - { - Q_OBJECT; - - public: - - friend class ProfilerDataWidget; - - ProfilerCounterDataModel(); - ~ProfilerCounterDataModel(); - - virtual QVariant data ( const QModelIndex & index, int role = Qt::DisplayRole ) const; - virtual int columnCount ( const QModelIndex & parent = QModelIndex() ) const; - virtual QVariant headerData ( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const; - virtual void AddRegister( const Driller::ProfilerDrillerUpdateRegisterEvent *newData ); - }; - - class ProfilerAxisFormatter : public Charts::QAbstractAxisFormatter - { - Q_OBJECT - public: - AZ_CLASS_ALLOCATOR(ProfilerAxisFormatter, AZ::SystemAllocator, 0); - ProfilerAxisFormatter(QObject *pParent, int whichTypeOfRegister); - - QString formatMicroseconds(float value); - virtual QString convertAxisValueToText(Charts::AxisType axis, float value, float minDisplayedValue, float maxDisplayedValue, float divisionSize); - - private: - float m_lastAxisValueForScaling; - int m_whatKindOfRegister; - - }; - - class ProfilerDataWidget - : public AzToolsFramework::QTreeViewWithStateSaving - { - Q_OBJECT; - public: - - friend class ProfilerDataView; - - ProfilerDataWidget( QWidget * parent = 0 ); - virtual ~ProfilerDataWidget(); - - void SetViewType(int viewType); - void BeginDataModelUpdate(); - void EndDataModelUpdate(); - void ConfigureChart( StripChart::DataStrip *chart, FrameNumberType atFrame, int howFar, FrameNumberType frameCount ); - - public slots: - void OnExpandAll(); - void OnHideSelected(); - void OnShowSelected(); - void OnInvertHidden(); - void OnHideAll(); - void OnShowAll(); - void OnChartTypeMenu(); - void OnChartTypeMenu(QString typeStr); - void OnAutoZoomChange(bool newValue); - void OnFlatView(bool); - void OnDeltaData(bool); - void ProvideData(StripChart::DataStrip*); - - protected: - - void RedrawChart(); - void PlotTimeHistory( StripChart::DataStrip *chart ); - - ProfilerDataModel *m_dataModel; - QSortFilterProxyModel* m_filterModel; - StripChart::DataStrip *m_cachedChart; - ProfilerAxisFormatter* m_formatter; - - FrameNumberType m_cachedStartFrame; - FrameNumberType m_cachedEndFrame; - FrameNumberType m_cachedCurrentFrame; - FrameNumberType m_cachedDisplayRange; - - int m_cachedColumn; - bool m_autoZoom; // do we automatically zoom extents? - float m_manualZoomMin; // if we're not automatically zooming, then we remember the prior zoom to re-apply it - float m_manualZoomMax; - bool m_cachedFlatView; - bool m_cachedDeltaData; - - int m_viewType; - - typedef AZStd::unordered_map ChannelIDToRegisterMap; - - ChannelIDToRegisterMap m_ChannelsToRegisters; - - int m_iLastHighlightedChannel; - - public slots: - void OnDoubleClicked( const QModelIndex & ); - void selectionChanged( const QItemSelection & selected, const QItemSelection & deselected ); - void onMouseOverDataPoint(int channelID, AZ::u64 sampleID,float primaryAxisValue, float dependentAxisValue); - void onMouseOverNothing(float primaryAxisValue, float dependentAxisValue); - }; - - -} - -#endif //PROFILER_DATA_PANEL_H diff --git a/Code/Tools/Standalone/Source/Driller/Profiler/ProfilerDataParser.cpp b/Code/Tools/Standalone/Source/Driller/Profiler/ProfilerDataParser.cpp deleted file mode 100644 index d8daa26b53..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Profiler/ProfilerDataParser.cpp +++ /dev/null @@ -1,255 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "ProfilerDataParser.h" -#include "ProfilerDataAggregator.hxx" -#include "ProfilerEvents.h" - -namespace Driller -{ - AZ::Debug::DrillerHandlerParser* ProfilerDrillerHandlerParser::OnEnterTag(AZ::u32 tagName) - { - AZ_Assert(m_data, "You must set a valid memory aggregator before we can process the data!"); - - if (tagName == AZ_CRC("NewRegister", 0xf0f2f287)) - { - m_subTag = ST_NEW_REGSTER; - m_data->AddEvent(aznew ProfilerDrillerNewRegisterEvent()); - return this; - } - else if (tagName == AZ_CRC("UpdateRegister", 0x6c00b890)) - { - m_subTag = ST_UPDATE_REGSTER; - m_data->AddEvent(aznew ProfilerDrillerUpdateRegisterEvent()); - return this; - } - else if (tagName == AZ_CRC("ThreadEnter", 0x60e4acfb)) - { - m_subTag = ST_ENTER_THREAD; - m_data->AddEvent(aznew ProfilerDrillerEnterThreadEvent()); - return this; - } - else if (tagName == AZ_CRC("OnThreadExit", 0x16042db9)) - { - m_subTag = ST_EXIT_THREAD; - m_data->AddEvent(aznew ProfilerDrillerExitThreadEvent()); - return this; - } - else if (tagName == AZ_CRC("RegisterSystem", 0x957739ef)) - { - m_subTag = ST_REGISTER_SYSTEM; - m_data->AddEvent(aznew ProfilerDrillerRegisterSystemEvent()); - return this; - } - else if (tagName == AZ_CRC("UnregisterSystem", 0xa20538e4)) - { - m_subTag = ST_UNREGISTER_SYSTEM; - m_data->AddEvent(aznew ProfilerDrillerUnregisterSystemEvent()); - return this; - } - else - { - m_subTag = ST_NONE; - } - return nullptr; - } - - void ProfilerDrillerHandlerParser::OnExitTag(DrillerHandlerParser* handler, AZ::u32 tagName) - { - (void)tagName; - if (handler != nullptr) - { - if (m_subTag != ST_NONE) - { - m_data->OnEventLoaded(m_data->GetEvents().back()); - m_subTag = ST_NONE; // we have only one level just go back to the default state - } - } - } - - void ProfilerDrillerHandlerParser::OnData(const AZ::Debug::DrillerSAXParser::Data& dataNode) - { - AZ_Assert(m_data, "You must set a valid memory aggregator before we can process the data!"); - - switch (m_subTag) - { - case ST_NEW_REGSTER: - { - ProfilerDrillerNewRegisterEvent* event = static_cast(m_data->GetEvents().back()); - if (dataNode.m_name == AZ_CRC("Id", 0xbf396750)) - { - dataNode.Read(event->m_registerInfo.m_id); - } - else if (dataNode.m_name == AZ_CRC("ThreadId", 0xd0fd9043)) - { - dataNode.Read(event->m_registerInfo.m_threadId); - } - else if (dataNode.m_name == AZ_CRC("Name", 0x5e237e06)) - { - event->m_registerInfo.m_name = dataNode.ReadPooledString(); - } - else if (dataNode.m_name == AZ_CRC("Function", 0xcaae163d)) - { - event->m_registerInfo.m_function = dataNode.ReadPooledString(); - } - else if (dataNode.m_name == AZ_CRC("Line", 0xd114b4f6)) - { - dataNode.Read(event->m_registerInfo.m_line); - } - else if (dataNode.m_name == AZ_CRC("SystemId", 0x0dfecf6f)) - { - dataNode.Read(event->m_registerInfo.m_systemId); - } - else if (dataNode.m_name == AZ_CRC("Type", 0x8cde5729)) - { - dataNode.Read(event->m_registerInfo.m_type); - } - else if (dataNode.m_name == AZ_CRC("Time", 0x6f949845)) - { - dataNode.Read(event->m_registerData.m_timeData.m_time); - } - else if (dataNode.m_name == AZ_CRC("ChildrenTime", 0x46162d3f)) - { - dataNode.Read(event->m_registerData.m_timeData.m_childrenTime); - } - else if (dataNode.m_name == AZ_CRC("Calls", 0xdaa35c8f)) - { - dataNode.Read(event->m_registerData.m_timeData.m_calls); - } - else if (dataNode.m_name == AZ_CRC("ChildrenCalls", 0x6a5a4618)) - { - dataNode.Read(event->m_registerData.m_timeData.m_childrenCalls); - } - else if (dataNode.m_name == AZ_CRC("ParentId", 0x856a684c)) - { - dataNode.Read(event->m_registerData.m_timeData.m_lastParentRegisterId); - } - else if (dataNode.m_name == AZ_CRC("Value1", 0xa2756c5a)) - { - dataNode.Read(event->m_registerData.m_valueData.m_value1); - } - else if (dataNode.m_name == AZ_CRC("Value2", 0x3b7c3de0)) - { - dataNode.Read(event->m_registerData.m_valueData.m_value2); - } - else if (dataNode.m_name == AZ_CRC("Value3", 0x4c7b0d76)) - { - dataNode.Read(event->m_registerData.m_valueData.m_value3); - } - else if (dataNode.m_name == AZ_CRC("Value4", 0xd21f98d5)) - { - dataNode.Read(event->m_registerData.m_valueData.m_value4); - } - else if (dataNode.m_name == AZ_CRC("Value5", 0xa518a843)) - { - dataNode.Read(event->m_registerData.m_valueData.m_value5); - } - } break; - case ST_UPDATE_REGSTER: - { - ProfilerDrillerUpdateRegisterEvent* event = static_cast(m_data->GetEvents().back()); - if (dataNode.m_name == AZ_CRC("Id", 0xbf396750)) - { - dataNode.Read(event->m_registerId); - } - else if (dataNode.m_name == AZ_CRC("Time", 0x6f949845)) - { - dataNode.Read(event->m_registerData.m_timeData.m_time); - } - else if (dataNode.m_name == AZ_CRC("ChildrenTime", 0x46162d3f)) - { - dataNode.Read(event->m_registerData.m_timeData.m_childrenTime); - } - else if (dataNode.m_name == AZ_CRC("Calls", 0xdaa35c8f)) - { - dataNode.Read(event->m_registerData.m_timeData.m_calls); - } - else if (dataNode.m_name == AZ_CRC("ChildrenCalls", 0x6a5a4618)) - { - dataNode.Read(event->m_registerData.m_timeData.m_childrenCalls); - } - else if (dataNode.m_name == AZ_CRC("ParentId", 0x856a684c)) - { - dataNode.Read(event->m_registerData.m_timeData.m_lastParentRegisterId); - } - else if (dataNode.m_name == AZ_CRC("Value1", 0xa2756c5a)) - { - dataNode.Read(event->m_registerData.m_valueData.m_value1); - } - else if (dataNode.m_name == AZ_CRC("Value2", 0x3b7c3de0)) - { - dataNode.Read(event->m_registerData.m_valueData.m_value2); - } - else if (dataNode.m_name == AZ_CRC("Value3", 0x4c7b0d76)) - { - dataNode.Read(event->m_registerData.m_valueData.m_value3); - } - else if (dataNode.m_name == AZ_CRC("Value4", 0xd21f98d5)) - { - dataNode.Read(event->m_registerData.m_valueData.m_value4); - } - else if (dataNode.m_name == AZ_CRC("Value5", 0xa518a843)) - { - dataNode.Read(event->m_registerData.m_valueData.m_value5); - } - } break; - case ST_ENTER_THREAD: - { - ProfilerDrillerEnterThreadEvent* event = static_cast(m_data->GetEvents().back()); - if (dataNode.m_name == AZ_CRC("Id", 0xbf396750)) - { - dataNode.Read(event->m_threadId); - } - else if (dataNode.m_name == AZ_CRC("Name", 0x5e237e06)) - { - event->m_threadName = dataNode.ReadPooledString(); - } - else if (dataNode.m_name == AZ_CRC("CpuId", 0xdf558508)) - { - dataNode.Read(event->m_cpuId); - } - else if (dataNode.m_name == AZ_CRC("Priority", 0x62a6dc27)) - { - dataNode.Read(event->m_priority); - } - else if (dataNode.m_name == AZ_CRC("StackSize", 0x9cfaf35b)) - { - dataNode.Read(event->m_stackSize); - } - } break; - case ST_EXIT_THREAD: - { - ProfilerDrillerExitThreadEvent* event = static_cast(m_data->GetEvents().back()); - if (dataNode.m_name == AZ_CRC("Id", 0xbf396750)) - { - dataNode.Read(event->m_threadId); - } - } break; - case ST_REGISTER_SYSTEM: - { - ProfilerDrillerRegisterSystemEvent* event = static_cast(m_data->GetEvents().back()); - if (dataNode.m_name == AZ_CRC("Id", 0xbf396750)) - { - dataNode.Read(event->m_systemId); - } - else if (dataNode.m_name == AZ_CRC("Name", 0x5e237e06)) - { - event->m_name = dataNode.ReadPooledString(); - } - } break; - case ST_UNREGISTER_SYSTEM: - { - ProfilerDrillerUnregisterSystemEvent* event = static_cast(m_data->GetEvents().back()); - if (dataNode.m_name == AZ_CRC("Id", 0xbf396750)) - { - dataNode.Read(event->m_systemId); - } - } break; - } - } -} // namespace Driller diff --git a/Code/Tools/Standalone/Source/Driller/Profiler/ProfilerDataParser.h b/Code/Tools/Standalone/Source/Driller/Profiler/ProfilerDataParser.h deleted file mode 100644 index 78b7f10b55..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Profiler/ProfilerDataParser.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef DRILLER_PROFILER_DRILLER_PARSER_H -#define DRILLER_PROFILER_DRILLER_PARSER_H - -#include - -namespace Driller -{ - class ProfilerDataAggregator; - - class ProfilerDrillerHandlerParser - : public AZ::Debug::DrillerHandlerParser - { - public: - enum SubTags - { - ST_NONE = 0, - ST_NEW_REGSTER, - ST_UPDATE_REGSTER, - ST_ENTER_THREAD, - ST_EXIT_THREAD, - ST_REGISTER_SYSTEM, - ST_UNREGISTER_SYSTEM, - }; - - ProfilerDrillerHandlerParser() - : m_subTag(ST_NONE) - , m_data(NULL) - {} - - static AZ::u32 GetDrillerId() { return AZ_CRC("ProfilerDriller", 0x172c5268); } - - void SetAggregator(ProfilerDataAggregator* data) { m_data = data; } - - virtual AZ::Debug::DrillerHandlerParser* OnEnterTag(AZ::u32 tagName); - virtual void OnExitTag(DrillerHandlerParser* handler, AZ::u32 tagName); - virtual void OnData(const AZ::Debug::DrillerSAXParser::Data& dataNode); - - protected: - SubTags m_subTag; - ProfilerDataAggregator* m_data; - }; -} - -#endif diff --git a/Code/Tools/Standalone/Source/Driller/Profiler/ProfilerDataView.cpp b/Code/Tools/Standalone/Source/Driller/Profiler/ProfilerDataView.cpp deleted file mode 100644 index 26bcb82fea..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Profiler/ProfilerDataView.cpp +++ /dev/null @@ -1,628 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "ProfilerDataView.hxx" -#include - -#include "ProfilerDataAggregator.hxx" - -#include "ProfilerEvents.h" -#include "Source/Driller/DrillerEvent.h" - -#include "Source/Driller/ChannelDataView.hxx" -#include "Source/Driller/DrillerMainWindowMessages.h" -#include "Source/Driller/Profiler/ProfilerOperationTelemetryEvent.h" - -#include -#include - -#include -#include -#include - -#include - -#include -#include - -namespace Driller -{ - static const char* menuLengthStrings[] = - { - "60 Frames", - "120 Frames", - "240 Frames", - "480 Frames", - NULL - }; - static const char* menuTypeStrings[] = - { - "Incl.Time", - "Excl.Time", - "Calls", - "Acc.Time", - "Acc.Calls", - NULL - }; - static const int menuTypeViews[] = - { - Profiler::RegisterInfo::PRT_TIME, - Profiler::RegisterInfo::PRT_TIME, - Profiler::RegisterInfo::PRT_VALUE, - Profiler::RegisterInfo::PRT_TIME, - Profiler::RegisterInfo::PRT_VALUE - }; - static const char* menuValueTypeStrings[] = - { - "Value 1", - "Value 2", - "Value 3", - "Value 4", - "Value 5", - NULL - }; - - class ProfilerDataViewLocal - : public AZ::UserSettings - { - public: - AZ_RTTI(ProfilerDataViewLocal, "{7E893482-98BC-4017-B52B-5A36D325976B}", AZ::UserSettings); - AZ_CLASS_ALLOCATOR(ProfilerDataViewLocal, AZ::SystemAllocator, 0); - - AZStd::vector m_treeColumnStorage; - - static void Reflect(AZ::ReflectContext* context) - { - AZ::SerializeContext* serialize = azrtti_cast(context); - if (serialize) - { - serialize->Class() - ->Field("m_treeColumnStorage", &ProfilerDataViewLocal::m_treeColumnStorage) - ->Version(1); - } - } - }; - - class ProfilerDataViewSavedState - : public AZ::UserSettings - { - public: - AZ_RTTI(ProfilerDataViewSavedState, "{432824F6-4078-49F6-BE9E-357EF71B8AB8}", AZ::UserSettings); - AZ_CLASS_ALLOCATOR(ProfilerDataViewSavedState, AZ::SystemAllocator, 0); - - AZStd::string m_chartLengthStr; - AZStd::string m_chartTypeStr; - AZStd::string m_threadIDStr; - AZ::u64 m_threadID; - bool m_autoZoom; - bool m_flatView; - bool m_deltaData; - AZStd::vector< AZStd::string > m_treeExpansionData; - - ProfilerDataViewSavedState() - : m_chartLengthStr(menuLengthStrings[0]) - , m_chartTypeStr(menuTypeStrings[0]) - , m_threadIDStr("All Threads") - , m_threadID(0) - , m_autoZoom(true) - , m_flatView(false) - , m_deltaData(true) - {} - - static void Reflect(AZ::ReflectContext* context) - { - AZ::SerializeContext* serialize = azrtti_cast(context); - if (serialize) - { - serialize->Class() - ->Field("m_chartLengthStr", &ProfilerDataViewSavedState::m_chartLengthStr) - ->Field("m_chartTypeStr", &ProfilerDataViewSavedState::m_chartTypeStr) - ->Field("m_threadIDStr", &ProfilerDataViewSavedState::m_threadIDStr) - ->Field("m_threadID", &ProfilerDataViewSavedState::m_threadID) - ->Field("m_flatView", &ProfilerDataViewSavedState::m_flatView) - ->Field("m_treeExpansionData", &ProfilerDataViewSavedState::m_treeExpansionData) - ->Field("m_autoZoom", &ProfilerDataViewSavedState::m_autoZoom) - ->Field("m_deltaData", &ProfilerDataViewSavedState::m_deltaData) - ->Version(10); - } - } - }; - - ProfilerDataView::ProfilerDataView(ProfilerDataAggregator* aggregator, FrameNumberType atFrame, int profilerIndex, int viewType) - : QDialog() - , m_aggregator(aggregator) - , m_frame(atFrame) - , m_chartLength(60) - , m_windowStateCRC(0) - , m_dataViewStateCRC(0) - , m_viewIndex(profilerIndex) - , m_filterThreadID(0) - , m_viewType(viewType) - , m_lifespanTelemetry("ProfilerDataView") - { - setAttribute(Qt::WA_DeleteOnClose, true); - setWindowFlags(windowFlags() | Qt::WindowMaximizeButtonHint); - - show(); - raise(); - activateWindow(); - setFocus(); - - m_gui = azcreate(Ui::ProfilerDataView, ()); - m_gui->setupUi(this); - - QByteArray fileName = m_aggregator->GetInspectionFileName().toUtf8(); - - AZStd::string treeViewStateStr = AZStd::string::format("PROFILER DATA TREE VIEW STATE %s", fileName.data()); - AZ::u32 treeViewCrc = AZ::Crc32(treeViewStateStr.c_str()); - m_gui->widgetProfilerData->InitializeTreeViewSaving(treeViewCrc); - - for (int i = 0; menuTypeStrings[i]; ++i) - { - m_chartTypeStringToViewType.insert(AZStd::make_pair(menuTypeStrings[i], menuTypeViews[i])); - } - - m_gui->widgetProfilerData->SetViewType(m_viewType); - setWindowTitle(m_aggregator->GetDialogTitle()); - - connect(m_aggregator, SIGNAL(destroyed(QObject*)), this, SLOT(OnDataDestroyed())); - - connect(m_gui->pushButton_ExpandAll, SIGNAL(clicked()), m_gui->widgetProfilerData, SLOT(OnExpandAll())); - connect(m_gui->pushButton_ExpandAll, SIGNAL(released()), this, SLOT(OnSanityCheck())); - connect(m_gui->pushButton_HideSelected, SIGNAL(clicked()), m_gui->widgetProfilerData, SLOT(OnHideSelected())); - connect(m_gui->pushButton_ShowSelected, SIGNAL(clicked()), m_gui->widgetProfilerData, SLOT(OnShowSelected())); - connect(m_gui->pushButton_InvertHidden, SIGNAL(clicked()), m_gui->widgetProfilerData, SLOT(OnInvertHidden())); - connect(m_gui->pushButton_HideAll, SIGNAL(clicked()), m_gui->widgetProfilerData, SLOT(OnHideAll())); - connect(m_gui->pushButton_ShowAll, SIGNAL(clicked()), m_gui->widgetProfilerData, SLOT(OnShowAll())); - connect(m_gui->checkBoxAutoZoom, SIGNAL(toggled(bool)), m_gui->widgetProfilerData, SLOT(OnAutoZoomChange(bool))); - connect(m_gui->checkBoxFlatView, SIGNAL(toggled(bool)), m_gui->widgetProfilerData, SLOT(OnFlatView(bool))); - connect(m_gui->checkBoxDelta, SIGNAL(toggled(bool)), m_gui->widgetProfilerData, SLOT(OnDeltaData(bool))); - - connect(m_gui->widgetDataStrip, SIGNAL(onMouseOverDataPoint(int, AZ::u64, float, float)), m_gui->widgetProfilerData, SLOT(onMouseOverDataPoint(int, AZ::u64, float, float))); - connect(m_gui->widgetDataStrip, SIGNAL(onMouseOverNothing(float, float)), m_gui->widgetProfilerData, SLOT(onMouseOverNothing(float, float))); - - m_gui->checkBoxAutoZoom->setChecked(true); - m_gui->checkBoxFlatView->setChecked(false); - - if (m_viewType == Profiler::RegisterInfo::PRT_TIME) - { - QMenu* chartTypeMenu = new QMenu(this); - - for (int i = 0; menuTypeStrings[i]; ++i) - { - chartTypeMenu->addAction(CreateChartTypeAction(menuTypeStrings[i])); - } - - m_gui->chartTypeButton->setText("Excl.Time"); - m_gui->chartTypeButton->setMenu(chartTypeMenu); - } - else if (m_viewType == Profiler::RegisterInfo::PRT_VALUE) - { - QMenu* chartTypeMenu = new QMenu(this); - - for (int i = 0; menuValueTypeStrings[i]; ++i) - { - chartTypeMenu->addAction(CreateChartTypeAction(menuValueTypeStrings[i])); - } - - m_gui->chartTypeButton->setText("Value 1"); - m_gui->chartTypeButton->setMenu(chartTypeMenu); - } - - QMenu* chartLengthMenu = new QMenu(this); - - for (int i = 0; menuLengthStrings[i]; ++i) - { - chartLengthMenu->addAction(CreateChartLengthAction(menuLengthStrings[i])); - } - - connect(m_gui->threadSelectorButton, SIGNAL(clicked()), this, SLOT(OnThreadSelectorButtonClick())); - - m_gui->chartLengthButton->setText("60 Frames"); - m_gui->chartLengthButton->setMenu(chartLengthMenu); - - m_aggregatorIdentityCached = m_aggregator->GetIdentity(); - DrillerMainWindowMessages::Handler::BusConnect(m_aggregatorIdentityCached); - DrillerEventWindowMessages::Handler::BusConnect(m_aggregatorIdentityCached); - - m_gui->widgetDataStrip->AddAxis("Frame", 0.0f, 1.0f, false); - m_gui->widgetDataStrip->AddAxis("", -1.0f, 1.0f, true); - - SetFrameNumber(); - - AZStd::string windowStateStr = AZStd::string::format("PROFILER DATA VIEW WINDOW STATE %i", m_viewIndex); - m_windowStateCRC = AZ::Crc32(windowStateStr.c_str()); - AZStd::intrusive_ptr windowState = AZ::UserSettings::Find(m_windowStateCRC, AZ::UserSettings::CT_GLOBAL); - if (windowState) - { - windowState->RestoreGeometry(this); - } - - AZStd::string treeStateStr = AZStd::string::format("PROFILER DATA VIEW LOCAL STATE %i", m_viewIndex); - m_treeStateCRC = AZ::Crc32(treeStateStr.c_str()); - auto treeState = AZ::UserSettings::Find(m_treeStateCRC, AZ::UserSettings::CT_GLOBAL); - if (treeState) - { - QByteArray treeData((const char*)treeState->m_treeColumnStorage.data(), (int)treeState->m_treeColumnStorage.size()); - m_gui->widgetProfilerData->header()->restoreState(treeData); - } - - AZStd::string dataViewStateStr = AZStd::string::format("PROFILER DATA VIEW STATE %i", m_viewIndex); - m_dataViewStateCRC = AZ::Crc32(dataViewStateStr.c_str()); - m_persistentState = AZ::UserSettings::CreateFind(m_dataViewStateCRC, AZ::UserSettings::CT_GLOBAL); - ApplyPersistentState(); - } - - ProfilerDataView::~ProfilerDataView() - { - SaveOnExit(); - azdestroy(m_gui); - } - - QAction* ProfilerDataView::CreateChartTypeAction(QString qs) - { - QAction* act = new QAction(qs, this); - act->setObjectName(qs); - connect(act, SIGNAL(triggered()), this, SLOT(OnChartTypeMenu())); - connect(act, SIGNAL(triggered()), m_gui->widgetProfilerData, SLOT(OnChartTypeMenu())); - return act; - } - - QAction* ProfilerDataView::CreateChartLengthAction(QString qs) - { - QAction* act = new QAction(qs, this); - act->setObjectName(qs); - connect(act, SIGNAL(triggered()), this, SLOT(OnChartLengthMenu())); - return act; - } - - QAction* ProfilerDataView::CreateThreadSelectorAction(QString qs, AZ::u64 id) - { - QAction* act = new QAction(qs, this); - act->setObjectName(qs); - act->setData(id); - connect(act, SIGNAL(triggered()), this, SLOT(OnThreadSelectorMenu())); - return act; - } - - void ProfilerDataView::OnThreadSelectorButtonClick() - { - QMenu* threadIDMenu = new QMenu(this); - threadIDMenu->addAction(CreateThreadSelectorAction("All Threads", 0)); - - for (auto iter = m_aggregator->m_lifeTimeThreads.begin(); iter != m_aggregator->m_lifeTimeThreads.end(); ++iter) - { - auto threadID = iter->first; - threadIDMenu->addAction(CreateThreadSelectorAction(QString("Thread = %1").arg(threadID), threadID)); - } - - threadIDMenu->exec(QCursor::pos()); - delete threadIDMenu; - } - - void ProfilerDataView::OnSanityCheck() - { - AZ_TracePrintf("ProfilerDataView", "Released"); - } - - void ProfilerDataView::ApplyPersistentState() - { - if (m_persistentState) - { - // the bridge between our AZStd::string storage and QT's own string type - QString lengthMenuText(m_persistentState->m_chartLengthStr.c_str()); - OnChartLengthMenu(lengthMenuText); - - QString typeMenuText(m_persistentState->m_chartTypeStr.c_str()); - if (IsStringCompatibleWithType(m_persistentState->m_chartTypeStr)) - { - OnChartTypeMenu(typeMenuText); - } - - QString threadMenuText(m_persistentState->m_threadIDStr.c_str()); - OnThreadSelectorMenu(threadMenuText, m_persistentState->m_threadID); - - m_gui->checkBoxAutoZoom->setChecked(m_persistentState->m_autoZoom); - m_gui->checkBoxFlatView->setChecked(m_persistentState->m_flatView); - m_gui->checkBoxDelta->setChecked(m_persistentState->m_deltaData); - m_gui->widgetProfilerData->OnAutoZoomChange(m_persistentState->m_autoZoom); - m_gui->widgetProfilerData->OnFlatView(m_persistentState->m_flatView); - m_gui->widgetProfilerData->OnDeltaData(m_persistentState->m_deltaData); - - QSet qSetQString; - AZStd::vector< AZStd::string >::iterator iter = m_persistentState->m_treeExpansionData.begin(); - while (iter != m_persistentState->m_treeExpansionData.end()) - { - qSetQString.insert(QString(iter->c_str())); - ++iter; - } - - m_gui->widgetProfilerData->ReadTreeViewStateFrom(qSetQString); - } - } - - bool ProfilerDataView::IsStringCompatibleWithType(AZStd::string candidateStr) - { - if (m_viewType == Profiler::RegisterInfo::PRT_TIME) - { - for (int i = 0; menuTypeStrings[i]; ++i) - { - if (candidateStr == menuTypeStrings[i]) - { - return true; - } - } - } - if (m_viewType == Profiler::RegisterInfo::PRT_VALUE) - { - for (int i = 0; menuValueTypeStrings[i]; ++i) - { - if (candidateStr == menuValueTypeStrings[i]) - { - return true; - } - } - } - - return false; - } - - void ProfilerDataView::OnChartTypeMenu() - { - QAction* qa = qobject_cast(sender()); - if (qa) - { - OnChartTypeMenu(qa->objectName()); - } - } - - void ProfilerDataView::OnChartTypeMenu(QString menuText) - { - m_gui->chartTypeButton->setText(menuText); - m_gui->widgetProfilerData->OnChartTypeMenu(menuText); - } - - void ProfilerDataView::OnChartLengthMenu() - { - QAction* qa = qobject_cast(sender()); - if (qa) - { - OnChartLengthMenu(qa->objectName()); - } - } - - void ProfilerDataView::OnChartLengthMenu(QString fromMenu) - { - ProfilerOperationTelemetryEvent chartLengthChange; - chartLengthChange.SetAttribute("ChartLength", fromMenu.toStdString().c_str()); - chartLengthChange.Log(); - - m_gui->chartLengthButton->setText(fromMenu); - - if (fromMenu == "60 Frames") - { - m_chartLength = 60; - } - if (fromMenu == "120 Frames") - { - m_chartLength = 120; - } - if (fromMenu == "240 Frames") - { - m_chartLength = 240; - } - if (fromMenu == "480 Frames") - { - m_chartLength = 480; - } - - SetFrameNumber(); - } - - void ProfilerDataView::OnThreadSelectorMenu() - { - QAction* qa = qobject_cast(sender()); - if (qa) - { - OnThreadSelectorMenu(qa->objectName(), qa->data().toULongLong()); - } - } - - void ProfilerDataView::OnThreadSelectorMenu(QString fromMenu, AZ::u64 id) - { - const char* k_changeThreadFilter = "ThreadFilter"; - - ProfilerOperationTelemetryEvent threadSelector; - - m_gui->threadSelectorButton->setText(fromMenu); - m_persistentState->m_threadIDStr = fromMenu.toUtf8().data(); - m_persistentState->m_threadID = id; - - if (id == 0) - { - threadSelector.SetAttribute(k_changeThreadFilter, "All Threads"); - m_filterThreadID = 0; - } - else - { - threadSelector.SetAttribute(k_changeThreadFilter, m_persistentState->m_threadIDStr); - m_filterThreadID = id; - } - - threadSelector.Log(); - - // force a new data set - SetFrameNumber(); - } - - void ProfilerDataView::SaveOnExit() - { - auto treeState = AZ::UserSettings::CreateFind(m_treeStateCRC, AZ::UserSettings::CT_GLOBAL); - if (treeState) - { - if (m_gui->widgetProfilerData && m_gui->widgetProfilerData->header()) - { - QByteArray qba = m_gui->widgetProfilerData->header()->saveState(); - treeState->m_treeColumnStorage.assign((AZ::u8*)qba.begin(), (AZ::u8*)qba.end()); - } - } - - auto pState = AZ::UserSettings::CreateFind(m_windowStateCRC, AZ::UserSettings::CT_GLOBAL); - if (m_persistentState) - { - if ( - m_gui->chartLengthButton - && m_gui->chartTypeButton - && m_gui->threadSelectorButton - && m_gui->checkBoxAutoZoom - && m_gui->checkBoxDelta - && m_gui->widgetProfilerData - && m_gui->widgetProfilerData->IsTreeViewSavingReady() - ) - { - pState->CaptureGeometry(this); - m_persistentState->m_chartLengthStr = m_gui->chartLengthButton->text().toUtf8().data(); - m_persistentState->m_chartTypeStr = m_gui->chartTypeButton->text().toUtf8().data(); - m_persistentState->m_threadIDStr = m_gui->threadSelectorButton->text().toUtf8().data(); - m_persistentState->m_autoZoom = (int)m_gui->checkBoxAutoZoom->isChecked(); - m_persistentState->m_flatView = (int)m_gui->checkBoxFlatView->isChecked(); - m_persistentState->m_deltaData = (int)m_gui->checkBoxDelta->isChecked(); - - m_persistentState->m_treeExpansionData.clear(); - QSet qSetQString; - m_gui->widgetProfilerData->WriteTreeViewStateTo(qSetQString); - QSet::iterator iter = qSetQString.begin(); - for (auto iterStrings = qSetQString.begin(); iterStrings != qSetQString.end(); ++iterStrings) - { - m_persistentState->m_treeExpansionData.push_back(iterStrings->toUtf8().data()); - } - } - } - } - void ProfilerDataView::hideEvent(QHideEvent* evt) - { - QDialog::hideEvent(evt); - } - void ProfilerDataView::closeEvent(QCloseEvent* evt) - { - DrillerEventWindowMessages::Handler::BusDisconnect(m_aggregatorIdentityCached); - DrillerMainWindowMessages::Handler::BusDisconnect(m_aggregatorIdentityCached); - QDialog::closeEvent(evt); - } - void ProfilerDataView::OnDataDestroyed() - { - deleteLater(); - } - - void ProfilerDataView::FrameChanged(FrameNumberType frame) - { - m_frame = frame; - SetFrameNumber(); - } - - void ProfilerDataView::SetFrameNumber() - { - size_t numEvents = m_aggregator->NumOfEventsAtFrame(m_frame); - - m_aggregator->FrameChanged(m_frame); - - m_gui->widgetProfilerData->BeginDataModelUpdate(); - - if (numEvents) - { - m_gui->widgetProfilerData->m_dataModel->SetAggregator(m_aggregator); - - for (EventNumberType eventIndex = m_aggregator->m_frameToEventIndex[m_frame]; eventIndex < static_cast(m_aggregator->m_frameToEventIndex[m_frame] + numEvents); ++eventIndex) - { - Driller::DrillerEvent* dep = m_aggregator->GetEvents()[ eventIndex ]; - if (dep->GetEventType() == Driller::Profiler::PET_UPDATE_REGISTER) - { - Driller::ProfilerDrillerUpdateRegisterEvent* regEvt = static_cast(dep); - - if (regEvt->GetRegister()) - { - if (m_filterThreadID == 0 || regEvt->GetRegister()->GetInfo().m_threadId == m_filterThreadID) - { - m_gui->widgetProfilerData->m_dataModel->AddRegister(regEvt); - } - } - } - } - - m_gui->widgetProfilerData->EndDataModelUpdate(); - - // build the chart - // this data view responsible for length of history setting and deciding what kind of data is displayed - // that data panel, which owns the data model, responsible for each register on/off and charting - m_gui->widgetProfilerData->ConfigureChart(m_gui->widgetDataStrip, m_frame, m_chartLength, static_cast(m_aggregator->GetFrameCount())); // magic number 60 = frame count to go back in time - } - } - - - void ProfilerDataView::ApplySettingsFromWorkspace(WorkspaceSettingsProvider* provider) - { - AZStd::string workspaceStateStr = AZStd::string::format("PROFILER DATA VIEW WORKSPACE STATE %i", m_viewIndex); - AZ::u32 workspaceStateCRC = AZ::Crc32(workspaceStateStr.c_str()); - - if (m_persistentState) - { - ProfilerDataViewSavedState* workspace = provider->FindSetting(workspaceStateCRC); - if (workspace) - { - m_persistentState->m_chartLengthStr = workspace->m_chartLengthStr; - m_persistentState->m_chartTypeStr = workspace->m_chartTypeStr; - m_persistentState->m_threadIDStr = workspace->m_threadIDStr; - m_persistentState->m_threadID = workspace->m_threadID; - m_persistentState->m_flatView = workspace->m_flatView; - m_persistentState->m_autoZoom = workspace->m_autoZoom; - m_persistentState->m_deltaData = workspace->m_deltaData; - m_persistentState->m_treeExpansionData = workspace->m_treeExpansionData; - } - } - } - - void ProfilerDataView::ActivateWorkspaceSettings(WorkspaceSettingsProvider*) - { - ApplyPersistentState(); - } - - void ProfilerDataView::SaveSettingsToWorkspace(WorkspaceSettingsProvider* provider) - { - AZStd::string workspaceStateStr = AZStd::string::format("PROFILER DATA VIEW WORKSPACE STATE %i", m_viewIndex); - AZ::u32 workspaceStateCRC = AZ::Crc32(workspaceStateStr.c_str()); - - if (m_persistentState) - { - ProfilerDataViewSavedState* workspace = provider->CreateSetting(workspaceStateCRC); - if (workspace) - { - workspace->m_chartLengthStr = m_persistentState->m_chartLengthStr; - workspace->m_chartTypeStr = m_persistentState->m_chartTypeStr; - workspace->m_threadIDStr = m_persistentState->m_threadIDStr; - workspace->m_threadID = m_persistentState->m_threadID; - workspace->m_flatView = m_persistentState->m_flatView; - workspace->m_autoZoom = m_persistentState->m_autoZoom; - workspace->m_deltaData = m_persistentState->m_deltaData; - workspace->m_treeExpansionData = m_persistentState->m_treeExpansionData; - } - } - } - - void ProfilerDataView::Reflect(AZ::ReflectContext* context) - { - AZ::SerializeContext* serialize = azrtti_cast(context); - if (serialize) - { - ProfilerDataViewSavedState::Reflect(context); - ProfilerDataViewLocal::Reflect(context); - - // Driller doesn't use AzToolsFramework directly, so we have to initialize the serialization for the QTreeViewStateSaver - AzToolsFramework::QTreeViewWithStateSaving::Reflect(context); - } - } -} diff --git a/Code/Tools/Standalone/Source/Driller/Profiler/ProfilerDataView.hxx b/Code/Tools/Standalone/Source/Driller/Profiler/ProfilerDataView.hxx deleted file mode 100644 index 44ca07617c..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Profiler/ProfilerDataView.hxx +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef PROFILERDATAVIEW_H -#define PROFILERDATAVIEW_H - -#if !defined(Q_MOC_RUN) -#include -#include -#include - -#include "Source/Driller/DrillerMainWindowMessages.h" -#include "Source/Driller/DrillerOperationTelemetryEvent.h" - -#include -#include - -#include "Source/Driller/DrillerDataTypes.h" -#endif - -namespace Ui -{ - class ProfilerDataView; -} - -namespace AZ { class ReflectContext; } - -namespace Driller -{ - class ProfilerDataAggregator; - class ProfilerDataViewSavedState; - - class ProfilerDataView - : public QDialog - , public Driller::DrillerMainWindowMessages::Bus::Handler - , public Driller::DrillerEventWindowMessages::Bus::Handler - { - Q_OBJECT - public: - AZ_CLASS_ALLOCATOR(ProfilerDataView,AZ::SystemAllocator,0); - ProfilerDataView( ProfilerDataAggregator *aggregator, FrameNumberType atFrame, int profilerIndex, int viewType ); - virtual ~ProfilerDataView(void); - - void SetFrameNumber(); - // called after loading user settings or applying workspace settings on top of local user settings - int GetViewType() { return m_viewType; } - - // MainWindow Bus Commands - void FrameChanged(FrameNumberType frame) override; - void EventFocusChanged(EventNumberType /*eventIndex*/ ) override { }; - void EventChanged(EventNumberType /*eventIndex*/) override {} - - // NB: These three methods mimic the workspace bus. - // Because the ProfilerDataAggregator can't know to open these DataView windows - // until after the EBUS message has gone out, the owning aggregator must - // first create these windows and then pass along the provider manually - void ApplySettingsFromWorkspace(WorkspaceSettingsProvider*); - void ActivateWorkspaceSettings(WorkspaceSettingsProvider*); - void SaveSettingsToWorkspace(WorkspaceSettingsProvider*); - void ApplyPersistentState(); - - void SaveOnExit(); - virtual void closeEvent(QCloseEvent *evt); - virtual void hideEvent(QHideEvent *evt); - - ProfilerDataAggregator *m_aggregator; - // persistent state is used as if they were internal variables, - // though they reside in a storage class - // this lasts for the entire lifetime of this object - AZStd::intrusive_ptr m_persistentState; - - FrameNumberType m_frame; - int m_aggregatorIdentityCached; - AZ::u32 m_windowStateCRC; - AZ::u32 m_dataViewStateCRC; - int m_viewIndex; - QMenu *m_threadIDMenu; - AZ::u64 m_filterThreadID; - int m_viewType; - AZ::u32 m_treeStateCRC; - AZStd::unordered_map m_chartTypeStringToViewType; - - public: - - QAction *CreateChartTypeAction( QString qs ); - QAction *CreateChartLengthAction( QString qs ); - QAction *CreateThreadSelectorAction( QString qs, AZ::u64 id ); - void ClearThreadSelectorActions(); - bool IsStringCompatibleWithType(AZStd::string candidateStr); - - int m_chartLength; - - - public: - static void Reflect(AZ::ReflectContext* context); - - public slots: - void OnDataDestroyed(); - void OnChartTypeMenu(); - void OnChartTypeMenu( QString fromMenu ); - void OnChartLengthMenu(); - void OnChartLengthMenu( QString fromMenu ); - void OnThreadSelectorMenu(); - void OnThreadSelectorMenu( QString fromMenu, AZ::u64 id ); - void OnThreadSelectorButtonClick(); - void OnSanityCheck(); - - private: - DrillerWindowLifepsanTelemetry m_lifespanTelemetry; - Ui::ProfilerDataView* m_gui; - }; - -} - - -#endif // PROFILERDATAVIEW_H diff --git a/Code/Tools/Standalone/Source/Driller/Profiler/ProfilerDataView.ui b/Code/Tools/Standalone/Source/Driller/Profiler/ProfilerDataView.ui deleted file mode 100644 index e4b6b3e229..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Profiler/ProfilerDataView.ui +++ /dev/null @@ -1,490 +0,0 @@ - - - ProfilerDataView - - - - 0 - 0 - 1075 - 320 - - - - Profiler Data View - - - - 4 - - - 4 - - - 4 - - - 4 - - - - - - - - 0 - 1 - - - - - 0 - 128 - - - - - - - - - 0 - 32 - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - 2 - - - 1 - - - 1 - - - 1 - - - 1 - - - - - - 0 - 0 - - - - - 85 - 0 - - - - Qt::NoFocus - - - Hides the selected rows in the tree - - - Hide Selected - - - - - - - - 0 - 0 - - - - - 85 - 0 - - - - Qt::NoFocus - - - Shows the selected rows in the tree - - - Show Selected - - - - - - - - 0 - 0 - - - - - 85 - 0 - - - - Qt::NoFocus - - - Hides all rows in the tree - - - Hide All - - - - - - - - 0 - 0 - - - - - 85 - 0 - - - - Qt::NoFocus - - - Shows all rows in the tree - - - Show All - - - - - - - - 0 - 0 - - - - - 85 - 0 - - - - Qt::NoFocus - - - Inverts what is showing and hiding in the tree - - - Invert - - - - - - - - 0 - 0 - - - - - 85 - 0 - - - - Qt::NoFocus - - - Expands all rows in the tree - - - Expand Tree - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 25 - 20 - - - - - - - - - 0 - 0 - - - - - 85 - 0 - - - - Qt::NoFocus - - - What threads are being displayed in the graph/tree - - - All Threads - - - - - - - - 0 - 0 - - - - - 85 - 0 - - - - Qt::NoFocus - - - What information is being graphed - - - Excl.Time - - - - - - - - 0 - 0 - - - - - 85 - 0 - - - - Qt::NoFocus - - - How many history frames the graph displays - - - 60 Frames - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 5 - 20 - - - - - - - - - 48 - 16777215 - - - - Delta - - - true - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 10 - 20 - - - - - - - - - 0 - 0 - - - - Autozoom - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 10 - 20 - - - - - - - - - 64 - 16777215 - - - - Flattens the tree structure - - - Flat View - - - - - - - Qt::Horizontal - - - - 0 - 0 - - - - - - - - - - - - 0 - 2 - - - - - 224 - 128 - - - - true - - - QAbstractItemView::ExtendedSelection - - - Qt::ElideMiddle - - - true - - - true - - - false - - - false - - - 128 - - - 64 - - - - - - - - - - StripChart::DataStrip - QWidget -
../StripChart.hxx
- 1 -
- - Driller::ProfilerDataWidget - QTreeView -
ProfilerDataPanel.hxx
- 1 -
-
- - -
diff --git a/Code/Tools/Standalone/Source/Driller/Profiler/ProfilerEvents.cpp b/Code/Tools/Standalone/Source/Driller/Profiler/ProfilerEvents.cpp deleted file mode 100644 index aa1ad4ae89..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Profiler/ProfilerEvents.cpp +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "ProfilerEvents.h" - -#include "ProfilerDataAggregator.hxx" - -namespace Driller -{ - //========================================================================= - // ProfilerDrillerUpdateRegisterEvent::StepForward - // [6/3/2013] - //========================================================================= - void ProfilerDrillerUpdateRegisterEvent::StepForward(Aggregator* data) - { - ProfilerDataAggregator* aggr = static_cast(data); - - ProfilerDataAggregator::RegisterMapType::iterator it = aggr->m_registers.find(m_registerId); - if (it != aggr->m_registers.end()) - { - m_register = it->second; - m_previousSample = m_register->m_lastUpdate; - m_register->m_lastUpdate = this; - } - } - - //========================================================================= - // ProfilerDrillerUpdateRegisterEvent::PreProcess - //========================================================================= - void ProfilerDrillerUpdateRegisterEvent::PreComputeForward(ProfilerDrillerNewRegisterEvent* newEvt) - { - m_register = newEvt; - m_previousSample = m_register->m_lastPrecomputed; - m_register->m_lastPrecomputed = this; - } - - //========================================================================= - // ProfilerDrillerUpdateRegisterEvent::StepBackward - // [6/3/2013] - //========================================================================= - void ProfilerDrillerUpdateRegisterEvent::StepBackward(Aggregator* data) - { - (void)data; - - if (m_register) - { - m_register->m_lastUpdate = m_previousSample; - } - } - - //========================================================================= - // ProfilerDrillerNewRegisterEvent::StepForward - // [6/3/2013] - //========================================================================= - void ProfilerDrillerNewRegisterEvent::StepForward(Aggregator* data) - { - ProfilerDataAggregator* aggr = static_cast(data); - aggr->m_registers.insert(AZStd::make_pair(m_registerInfo.m_id, this)); - } - - //========================================================================= - // ProfilerDrillerNewRegisterEvent::StepBackward - // [6/3/2013] - //========================================================================= - void ProfilerDrillerNewRegisterEvent::StepBackward(Aggregator* data) - { - ProfilerDataAggregator* aggr = static_cast(data); - // NOTE: we can store the iterator in this register class, this way we can avoid this search - // as of now search should be fast (at least as fast as insert) plus I am avoiding including "ProfilerDataAggregator.hxx" - // into the header file. - aggr->m_registers.erase(m_registerInfo.m_id); - } - - //========================================================================= - // ProfilerDrillerEnterThreadEvent::StepForward - // [6/3/2013] - //========================================================================= - void ProfilerDrillerEnterThreadEvent::StepForward(Aggregator* data) - { - ProfilerDataAggregator* aggr = static_cast(data); - aggr->m_threads.insert(AZStd::make_pair(m_threadId, this)); - } - - //========================================================================= - // ProfilerDrillerEnterThreadEvent::StepBackward - // [6/3/2013] - //========================================================================= - void ProfilerDrillerEnterThreadEvent::StepBackward(Aggregator* data) - { - ProfilerDataAggregator* aggr = static_cast(data); - // NOTE: we can store the iterator in this register class, this way we can avoid this search - // as of now search should be fast (at least as fast as insert) plus I am avoiding including "ProfilerDataAggregator.hxx" - // into the header file. - aggr->m_threads.erase(m_threadId); - } - - //========================================================================= - // ProfilerDrillerExitThreadEvent::StepForward - // [6/3/2013] - //========================================================================= - void ProfilerDrillerExitThreadEvent::StepForward(Aggregator* data) - { - ProfilerDataAggregator* aggr = static_cast(data); - ProfilerDataAggregator::ThreadMapType::iterator it = aggr->m_threads.find(m_threadId); - m_threadData = it->second; - aggr->m_threads.erase(it); - } - - //========================================================================= - // ProfilerDrillerEnterThreadEvent::StepBackward - // [6/3/2013] - //========================================================================= - void ProfilerDrillerExitThreadEvent::StepBackward(Aggregator* data) - { - ProfilerDataAggregator* aggr = static_cast(data); - aggr->m_threads.insert(AZStd::make_pair(m_threadId, m_threadData)); - } - - //========================================================================= - // ProfilerDrillerRegisterSystemEvent::StepForward - // [6/3/2013] - //========================================================================= - void ProfilerDrillerRegisterSystemEvent::StepForward(Aggregator* data) - { - ProfilerDataAggregator* aggr = static_cast(data); - aggr->m_systems.insert(AZStd::make_pair(m_systemId, this)); - } - - //========================================================================= - // ProfilerDrillerEnterThreadEvent::StepBackward - // [6/3/2013] - //========================================================================= - void ProfilerDrillerRegisterSystemEvent::StepBackward(Aggregator* data) - { - ProfilerDataAggregator* aggr = static_cast(data); - // NOTE: we can store the iterator in this register class, this way we can avoid this search - // as of now search should be fast (at least as fast as insert) plus I am avoiding including "ProfilerDataAggregator.hxx" - // into the header file. - aggr->m_threads.erase(m_systemId); - } - - //========================================================================= - // ProfilerDrillerUnregisterSystemEvent::StepForward - // [6/3/2013] - //========================================================================= - void ProfilerDrillerUnregisterSystemEvent::StepForward(Aggregator* data) - { - ProfilerDataAggregator* aggr = static_cast(data); - ProfilerDataAggregator::SystemMapType::iterator it = aggr->m_systems.find(m_systemId); - m_systemData = it->second; - aggr->m_systems.erase(it); - } - - //========================================================================= - // ProfilerDrillerUnregisterSystemEvent::StepBackward - // [6/3/2013] - //========================================================================= - void ProfilerDrillerUnregisterSystemEvent::StepBackward(Aggregator* data) - { - ProfilerDataAggregator* aggr = static_cast(data); - aggr->m_systems.insert(AZStd::make_pair(m_systemId, m_systemData)); - } -} // namespace Driller diff --git a/Code/Tools/Standalone/Source/Driller/Profiler/ProfilerEvents.h b/Code/Tools/Standalone/Source/Driller/Profiler/ProfilerEvents.h deleted file mode 100644 index 7963a080b8..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Profiler/ProfilerEvents.h +++ /dev/null @@ -1,237 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef DRILLER_PROFILER_EVENTS_H -#define DRILLER_PROFILER_EVENTS_H - -#include "Source/Driller/DrillerEvent.h" -#include - -namespace Driller -{ - namespace Profiler - { - /// Time register data. - struct TimeData - { - AZ::u64 m_time; ///< Total inclusive time current and children in microseconds. - AZ::u64 m_childrenTime; ///< Time taken by child profilers in microseconds. - AZ::s64 m_calls; ///< Number of calls for this register. - AZ::s64 m_childrenCalls;///< Number of children calls. - AZ::u64 m_lastParentRegisterId; ///< Id of the last parent register. - }; - - /// Value register data. - struct ValuesData - { - AZ::s64 m_value1; - AZ::s64 m_value2; - AZ::s64 m_value3; - AZ::s64 m_value4; - AZ::s64 m_value5; - }; - - /// Data that will change every frame (technically only when registers are called) - struct RegisterData - { - RegisterData() - { - m_valueData.m_value1 = 0; - m_valueData.m_value2 = 0; - m_valueData.m_value3 = 0; - m_valueData.m_value4 = 0; - m_valueData.m_value5 = 0; - } - - union - { - TimeData m_timeData; - ValuesData m_valueData; - }; - }; - - /// Data that never changes - struct RegisterInfo - { - RegisterInfo() - : m_id(0) - , m_threadId(0) - , m_name(nullptr) - , m_function(nullptr) - , m_line(-1) - , m_systemId(0) - {} - - enum Type - { - PRT_TIME = 0, ///< Time register - RegisterData::m_time data is used. - PRT_VALUE, ///< Value register - RegisterData::m_values data is used. - }; - - unsigned char m_type; ///< Register type (time or values) - AZ::u64 m_id; ///< Register id (technically the pointer during execution). - AZ::u64 m_threadId; ///< Native thread handle (AZStd::native_thread_id_type) typically a pointer too. - const char* m_name; ///< Name/description of the register it's optional for time registers. - const char* m_function; ///< Name of the function which we are sampling. - int m_line; ///< Line in the code where this register is created (start sampling). - AZ::u32 m_systemId; ///< Crc32 of the system name provided by the user. - }; - - enum ProfilerEventType - { - PET_NEW_REGISTER = 0, - PET_UPDATE_REGISTER, - PET_ENTER_THREAD, - PET_EXIT_THREAD, - PET_REGISTER_SYSTEM, - PET_UNREGISTER_SYSTEM, - }; - } - - class ProfilerDrillerNewRegisterEvent; - class ProfilerDataAggregator; - - class ProfilerDrillerUpdateRegisterEvent - : public DrillerEvent - { - friend class ProfilerDrillerNewRegisterEvent; - friend class ProfilerDrillerHandlerParser; - public: - AZ_CLASS_ALLOCATOR(ProfilerDrillerUpdateRegisterEvent, AZ::SystemAllocator, 0) - - ProfilerDrillerUpdateRegisterEvent() - : DrillerEvent(Profiler::PET_UPDATE_REGISTER) - , m_register(nullptr) - , m_previousSample(nullptr) - {} - - virtual void StepForward(Aggregator* data); - virtual void StepBackward(Aggregator* data); - - void PreComputeForward(ProfilerDrillerNewRegisterEvent* newEvt); - - const Profiler::RegisterData& GetData() const { return m_registerData; } - const ProfilerDrillerNewRegisterEvent* GetRegister() const { return m_register; } - const ProfilerDrillerUpdateRegisterEvent* GetPreviousSample() const { return m_previousSample; } - const AZ::u64 GetRegisterId() const { return m_registerId; } - - private: - AZ::u64 m_registerId; ///< Id if the register. - Profiler::RegisterData m_registerData; ///< Register sample data. - ProfilerDrillerNewRegisterEvent* m_register; ///< Cached pointer to the register. - ProfilerDrillerUpdateRegisterEvent* m_previousSample; ///< Pointer to the previous register values (null if this is the first sample). - }; - - class ProfilerDrillerNewRegisterEvent - : public DrillerEvent - { - friend class ProfilerDrillerUpdateRegisterEvent; - friend class ProfilerDrillerHandlerParser; - public: - AZ_CLASS_ALLOCATOR(ProfilerDrillerNewRegisterEvent, AZ::SystemAllocator, 0) - - ProfilerDrillerNewRegisterEvent() - : DrillerEvent(Profiler::PET_NEW_REGISTER) - , m_lastUpdate(nullptr) - , m_lastPrecomputed(nullptr) - {} - - virtual void StepForward(Aggregator* data); - virtual void StepBackward(Aggregator* data); - - const Profiler::RegisterData& GetData() const { return m_lastUpdate ? m_lastUpdate->m_registerData : m_registerData; } - const Profiler::RegisterInfo& GetInfo() const { return m_registerInfo; } - const ProfilerDrillerUpdateRegisterEvent* GetLastSample() const { return m_lastUpdate; } - - private: - Profiler::RegisterInfo m_registerInfo; ///< Register information. - Profiler::RegisterData m_registerData; ///< Register sample data. - - // m_lastUpdate is actually also the current scrubber frame for that register. - ProfilerDrillerUpdateRegisterEvent* m_lastUpdate; ///< Pointer to the last set of RegisterData (null if there is not last set) - - // because we precompute a small number of registers in order to show the note track in the main view, we need - // a seperate pointer to the prior precomputed data. - ProfilerDrillerUpdateRegisterEvent* m_lastPrecomputed; - }; - - class ProfilerDrillerEnterThreadEvent - : public DrillerEvent - { - public: - AZ_CLASS_ALLOCATOR(ProfilerDrillerEnterThreadEvent, AZ::SystemAllocator, 0) - - ProfilerDrillerEnterThreadEvent() - : DrillerEvent(Profiler::PET_ENTER_THREAD) - {} - - virtual void StepForward(Aggregator* data); - virtual void StepBackward(Aggregator* data); - - AZ::u64 m_threadId; - const char* m_threadName; ///< Debug name of thread if one is provided. - AZ::s32 m_cpuId; ///< If of the CPU where this thread should run. - AZ::s32 m_priority; - AZ::u32 m_stackSize; - }; - - class ProfilerDrillerExitThreadEvent - : public DrillerEvent - { - public: - AZ_CLASS_ALLOCATOR(ProfilerDrillerExitThreadEvent, AZ::SystemAllocator, 0) - - ProfilerDrillerExitThreadEvent() - : DrillerEvent(Profiler::PET_EXIT_THREAD) - , m_threadData(nullptr) - {} - - virtual void StepForward(Aggregator* data); - virtual void StepBackward(Aggregator* data); - - AZ::u64 m_threadId; - ProfilerDrillerEnterThreadEvent* m_threadData; - }; - - class ProfilerDrillerRegisterSystemEvent - : public DrillerEvent - { - public: - AZ_CLASS_ALLOCATOR(ProfilerDrillerRegisterSystemEvent, AZ::SystemAllocator, 0) - - ProfilerDrillerRegisterSystemEvent() - : DrillerEvent(Profiler::PET_REGISTER_SYSTEM) - {} - - virtual void StepForward(Aggregator* data); - virtual void StepBackward(Aggregator* data); - - AZ::u32 m_systemId; - const char* m_name; ///< Debug name of thread system. - }; - - class ProfilerDrillerUnregisterSystemEvent - : public DrillerEvent - { - public: - AZ_CLASS_ALLOCATOR(ProfilerDrillerUnregisterSystemEvent, AZ::SystemAllocator, 0) - - ProfilerDrillerUnregisterSystemEvent() - : DrillerEvent(Profiler::PET_UNREGISTER_SYSTEM) - , m_systemData(nullptr) - {} - - virtual void StepForward(Aggregator* data); - virtual void StepBackward(Aggregator* data); - - AZ::u32 m_systemId; - ProfilerDrillerRegisterSystemEvent* m_systemData; - }; -} - -#endif diff --git a/Code/Tools/Standalone/Source/Driller/Profiler/ProfilerOperationTelemetryEvent.h b/Code/Tools/Standalone/Source/Driller/Profiler/ProfilerOperationTelemetryEvent.h deleted file mode 100644 index ce8956698a..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Profiler/ProfilerOperationTelemetryEvent.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ -#ifndef DRILLER_PROFILER_PROFILEROPERATIONTELEMETRYEVENT_H -#define DRILLER_PROFILER_PROFILEROPERATIONTELEMETRYEVENT_H - -#include "Source/Telemetry/TelemetryEvent.h" - -namespace Driller -{ - class ProfilerOperationTelemetryEvent - : public Telemetry::TelemetryEvent - { - public: - ProfilerOperationTelemetryEvent() - : Telemetry::TelemetryEvent("ProfileDataViewOperation") - { - } - }; -} - -#endif diff --git a/Code/Tools/Standalone/Source/Driller/RacetrackChart.cpp b/Code/Tools/Standalone/Source/Driller/RacetrackChart.cpp deleted file mode 100644 index bf87f7da43..0000000000 --- a/Code/Tools/Standalone/Source/Driller/RacetrackChart.cpp +++ /dev/null @@ -1,608 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "RacetrackChart.hxx" -#include -#include "DrillerMainWindowMessages.h" -#include "Axis.hxx" -#include "ChartNumberFormats.h" - -#include -#include -#include -#include - -namespace Racetrack -{ - ////////////////////////////////////////////////////////////////////////// - DataRacetrack::DataRacetrack(QWidget* parent, Qt::WindowFlags flags) - : QWidget(parent, flags) - , m_Axis(NULL) - , m_InsetL(2) - , m_InsetR(2) - , m_InsetT(2) - , m_InsetB(32) - , m_IsDragging(false) - , m_ZoomLimit(15) - , m_IsLeftDragging(false) - , m_ZeroBasedAxisDisplay(false) - { - m_Axis = aznew Charts::Axis(this); - connect(m_Axis, SIGNAL(Invalidated()), this, SLOT(OnAxisInvalidated())); - this->setMouseTracking(true); - m_iChannelHighlight = -1; - } - - Charts::Axis* DataRacetrack::GetAxis() const - { - return m_Axis; - } - - void DataRacetrack::OnAxisInvalidated() - { - update(); - } - - DataRacetrack::~DataRacetrack() - { - } - - void DataRacetrack::SetZoomLimit(float limit) - { - m_ZoomLimit = limit; - } - - int DataRacetrack::AddChannel(QString name) - { - int id = (int)m_Channels.size(); - m_Channels.push_back(); - m_Channels[id].SetName(name); - - return id; - } - - void DataRacetrack::SetChannelColor(int channelID, QColor color) - { - m_Channels[channelID].SetColor(color); - } - - void DataRacetrack::SetZeroBasedAxisNumbering(bool tf) - { - m_ZeroBasedAxisDisplay = tf; - update(); - } - - void DataRacetrack::SetMarkerColor(QColor qc) - { - m_MarkerColor = qc; - update(); - } - void DataRacetrack::SetMarkerPosition(float qposn) - { - m_MarkerPosition = qposn; - update(); - } - - - void DataRacetrack::AddData(int channelID, float h, float v) - { - m_Channels[channelID].m_Data.push_back(); - m_Channels[channelID].m_Data.back().first = h; - m_Channels[channelID].m_Data.back().second = v; - } - - void DataRacetrack::Clear() - { - m_Axis->Clear(); - m_Channels.clear(); - } - - void DataRacetrack::ClearData(int channelID) - { - if (channelID < m_Channels.size()) - { - m_Channels[channelID].m_Data.clear(); - } - } - - - void DataRacetrack::SetupAxis(QString label, float minimum, float maximum, bool locked) - { - m_Axis->SetLabel(label); - m_Axis->SetAxisRange(minimum, maximum); - m_Axis->SetLockedRange(locked); - } - - void DataRacetrack::Zoom(QPoint pt, int steps) - { - if (m_Axis->GetValid()) - { - if (m_Inset.intersects(QRect(pt, pt))) - { - float ratio = float(pt.x() - m_Inset.left()) / float(m_Inset.width()); - if (m_Axis->GetLockedRight()) - { - ratio = 1.0f; - } - if (!m_Axis->GetLockedRange()) - { - m_Axis->SetAutoWindow(false); - - float testMin = m_Axis->GetWindowMin(); - float testMax = m_Axis->GetWindowMax(); - - testMin -= float(m_Axis->GetWindowMax() - m_Axis->GetWindowMin()) * 0.05f * ratio * float(-steps); - testMax += float(m_Axis->GetWindowMax() - m_Axis->GetWindowMin()) * 0.05f * (1.0f - ratio) * float(-steps); - if ((testMax - testMin) > 0.0f) - { - if (testMax > m_Axis->GetRangeMax()) - { - float offset = m_Axis->GetRangeMax() - testMax; - testMax += offset; - testMin += offset; - } - if (testMin < m_Axis->GetRangeMin()) - { - float offset = testMin - m_Axis->GetRangeMin(); - testMax -= offset; - testMin -= offset; - } - if ((float)m_Inset.width() / (testMax - testMin) < m_ZoomLimit) - { - m_Axis->SetWindowMin(testMin); - m_Axis->SetWindowMax(testMax); - } - - if ((testMax - testMin) > (m_Axis->GetRangeMax() - m_Axis->GetRangeMin())) - { - m_Axis->SetViewFull(); - } - } - } - } - } - } - - void DataRacetrack::Drag(int deltaX) - { - if (m_Axis->GetValid()) - { - if (!m_Axis->GetLockedRange() && !m_Axis->GetLockedRight()) - { - // delta is in pixels. Convert to domain units: - - float pixelWidth = (float)m_Inset.width(); - float domainWidth = m_Axis->GetWindowMax() - m_Axis->GetWindowMin(); - float domainPerPixel = domainWidth / pixelWidth; - float deltaInDomain = domainPerPixel * (float)deltaX; - - if (m_Axis->GetWindowMin() + deltaInDomain > m_Axis->GetRangeMin() && m_Axis->GetWindowMax() + deltaInDomain < m_Axis->GetRangeMax()) - { - m_Axis->SetAutoWindow(false); - m_Axis->UpdateWindowRange((float)deltaInDomain); - } - } - } - } - - QPoint DataRacetrack::Transform(float v) - { - QPoint pt; - - if (m_Axis->GetValid()) - { - if ((v >= m_Axis->GetWindowMin()) && (v <= m_Axis->GetWindowMax())) - { - float fullRange = fabs(m_Axis->GetWindowMax() - m_Axis->GetWindowMin()); - - float ratio = float(v - m_Axis->GetWindowMin()) / fullRange; - pt.setY(m_Inset.bottom() - int((float(m_Inset.height()) * ratio))); - } - } - - return pt; - } - - TransformResult DataRacetrack::Transform(float h, QPoint& outPoint) - { - TransformResult tr = INVALID_RANGE; - QPoint pt(0, 0); - - if (m_Axis->GetValid()) - { - if (h < m_Axis->GetWindowMin()) - { - tr = OUTSIDE_LEFT; - pt.setX(m_Inset.left()); - } - else if (h > m_Axis->GetWindowMax()) - { - tr = OUTSIDE_RIGHT; - pt.setX(m_Inset.left() + m_Inset.width()); - } - else - { - tr = INSIDE_RANGE; - - float fullRange = fabs(m_Axis->GetWindowMax() - m_Axis->GetWindowMin()); - float ratio = float(h - m_Axis->GetWindowMin()) / fullRange; - pt.setX(m_Inset.left() + int((float(m_Inset.width()) * ratio))); - } - } - - outPoint = pt; - return tr; - } - - void DataRacetrack::wheelEvent (QWheelEvent* event) - { - if (!m_Axis->GetValid()) - { - return; - } - - int numDegrees = event->angleDelta().y() / 8; - int numSteps = numDegrees / 15; - // +step := zoom IN - // -step := zoom OUT - QPoint zoomPt = event->position().toPoint() - m_Inset.topLeft(); - - Zoom(zoomPt, numSteps); - - update(); - - event->accept(); - } - void DataRacetrack::mouseMoveEvent (QMouseEvent* event) - { - if (!m_Axis->GetValid()) - { - return; - } - if (m_IsDragging) - { - // far far did we move in the DOMAIN? - QPoint pt = m_DragTracker - event->pos(); - Drag(pt.x()); - m_DragTracker = event->pos(); - update(); - } - else - { - if (m_IsLeftDragging) - { - float fullRange = fabs(m_Axis->GetWindowMax() - m_Axis->GetWindowMin()); - float ratio = (float)(event->pos().x() - m_InsetL) / (float)(width() - m_InsetL - m_InsetR); - float localValue = fullRange * ratio; - Driller::EventNumberType globalEvtID = (Driller::EventNumberType)(m_Axis->GetWindowMin() + localValue); - - emit EventRequestEventFocus(globalEvtID); - } - else - { - int oldChannelHighlight = m_iChannelHighlight; - m_iChannelHighlight = -1; - if (m_Channels.size() > 0) - { - if (m_Inset.contains(event->pos())) - { - QPoint offset = event->pos() - m_Inset.topLeft(); - float ratio = (float)offset.y() / m_Inset.height(); - if (ratio < 1.0f) - { - // so which channel is it over? - int channel = (int)(ratio * (float)m_Channels.size()); - if (m_iChannelHighlight != channel) - { - m_iChannelHighlight = channel; - } - } - } - } - - if (oldChannelHighlight != m_iChannelHighlight) - { - update(); - } - } - } - } - void DataRacetrack::mousePressEvent (QMouseEvent* event) - { - if (!m_Axis->GetValid()) - { - return; - } - - if (event->button() == Qt::RightButton) - { - m_IsDragging = true; - m_DragTracker = event->pos(); - } - else if (event->button() == Qt::LeftButton) - { - m_IsLeftDragging = true; - - float fullRange = fabs(m_Axis->GetWindowMax() - m_Axis->GetWindowMin()); - float ratio = (float)(event->pos().x() - m_Inset.x()) / (float)(width() - m_InsetL - m_InsetR); - float localValue = fullRange * ratio; - Driller::EventNumberType globalEvtID = (Driller::EventNumberType)(m_Axis->GetWindowMin() + localValue); - - emit EventRequestEventFocus(globalEvtID); - } - - event->accept(); - } - - void DataRacetrack::leaveEvent(QEvent*) - { - if (m_iChannelHighlight != -1) - { - m_iChannelHighlight = -1; - update(); - } - } - - void DataRacetrack::mouseReleaseEvent (QMouseEvent* event) - { - if (!m_Axis->GetValid()) - { - return; - } - - if (event->button() == Qt::RightButton) - { - m_IsDragging = false; - } - else - { - if (m_IsLeftDragging) - { - m_IsLeftDragging = false; - } - } - - event->accept(); - } - void DataRacetrack::resizeEvent(QResizeEvent* event) - { - RecalculateInset(); - event->ignore(); - } - - void DataRacetrack::RecalculateInset() - { - m_Inset = QRect(m_InsetL, m_InsetT, rect().width() - m_InsetL - m_InsetR, rect().height() - m_InsetT - m_InsetB); - } - - void DataRacetrack::paintEvent(QPaintEvent* event) - { - (void)event; - - QPen pen; - pen.setWidth(1); - QBrush brush; - brush.setStyle(Qt::SolidPattern); - pen.setBrush(brush); - - QPainter p(this); - p.setPen(pen); - - p.fillRect(rect(), QColor(32, 32, 32, 255)); - p.fillRect(m_Inset, Qt::black); - - brush.setColor(QColor(255, 255, 0, 255)); - pen.setColor(QColor(0, 255, 255, 255)); - p.setPen(pen); - - if (m_Channels.empty()) - { - return; - } - - if (!m_Axis->GetValid()) - { - return; - } - - // HORIZ - if (m_Axis) - { - int barHeight = m_Inset.height() / (int)m_Channels.size() - (int)m_Channels.size(); - - p.drawText(0, 0, rect().width(), rect().height(), Qt::AlignHCenter | Qt::AlignBottom, m_Axis->GetLabel()); - - pen.setStyle(Qt::DashDotLine); - pen.setColor(QColor(72, 72, 72, 255)); - p.setPen(pen); - RenderHorizCallouts(&p); - - TransformResult tr1, tr2; - QPoint pt1, pt2; - tr1 = Transform(m_Axis->GetWindowMin(), pt1); - tr2 = Transform(m_Axis->GetWindowMin() + 1.0f, pt2); - int drawWidth = pt2.x() - pt1.x() + 1; - - int chidx = 0; - for (Channels::iterator chiter = m_Channels.begin(); chiter != m_Channels.end(); ++chiter, ++chidx) - { - Channel& cptr = *chiter; - - - pen.setStyle(Qt::SolidLine); - brush.setColor(chiter->m_Color); - brush.setStyle(Qt::SolidPattern); - pen.setColor(chiter->m_Color); - pen.setBrush(brush); - p.setPen(pen); - - { - float start(0.0f), last(0.0f), current(0.0f); - TransformResult startTR, lastTR; - - AZStd::vector< AZStd::pair >::iterator datiter = cptr.m_Data.begin(); - if (datiter != cptr.m_Data.end()) - { - start = datiter->first; - last = datiter->first; - current = datiter->first; - ++datiter; - while (datiter != cptr.m_Data.end()) - { - current = datiter->first; - ++datiter; - if ((current == last + 1) && (datiter != cptr.m_Data.end())) - { - last = current; - } - else - { - QPoint drawPtS, drawPtL; - startTR = Transform(start, drawPtS); - lastTR = Transform(last, drawPtL); - - if ((startTR == INSIDE_RANGE && lastTR == INSIDE_RANGE) || (startTR != lastTR)) - { - p.fillRect(m_Inset.x() + drawPtS.x(), m_Inset.y() + chidx * barHeight + 1, drawPtL.x() - drawPtS.x() + drawWidth, barHeight, chiter->m_Color); - } - - start = current; - last = current; - } - } - - QPoint drawPtS, drawPtL; - startTR = Transform(start, drawPtS); - lastTR = Transform(last, drawPtL); - if ((startTR == INSIDE_RANGE && lastTR == INSIDE_RANGE) || (startTR != lastTR)) - { - p.fillRect(m_Inset.x() + drawPtS.x(), m_Inset.y() + chidx * barHeight + 1, drawPtL.x() - drawPtS.x() + drawWidth, barHeight, chiter->m_Color); - } - } - } - - // draw the name of the current channel as a highlight: - if (chidx == m_iChannelHighlight) - { - QRect textRect(m_Inset.x() + 8, m_Inset.y() + chidx * barHeight + 1, m_Inset.width() - 16, barHeight); - p.setPen(QPen(QColor(255, 255, 255, 255))); - QRect bound = p.boundingRect(textRect, Qt::AlignVCenter | Qt::AlignLeft, cptr.m_Name); - bound.adjust(-2, -2, 2, 2); - p.fillRect(bound, QColor(0, 0, 0, 128)); - p.drawText(textRect, Qt::AlignVCenter | Qt::AlignLeft, cptr.m_Name); - } - } - - pen.setStyle(Qt::SolidLine); - brush.setStyle(Qt::SolidPattern); - brush.setColor(Qt::black); - pen.setColor(Qt::black); - p.setPen(pen); - - if (drawWidth >= m_ZoomLimit) - { - for (float tickWalker = floorf(m_Axis->GetWindowMin()); tickWalker < ceilf(m_Axis->GetWindowMax()); tickWalker += 1.0f) - { - QPoint markerPt; - if (Transform(tickWalker, markerPt) == INSIDE_RANGE) - { - p.drawLine(m_Inset.x() + markerPt.x(), 0, m_Inset.x() + markerPt.x(), m_Inset.y() + m_Inset.height()); - } - } - } - - brush.setStyle(Qt::Dense2Pattern); - brush.setColor(m_MarkerColor); - pen.setColor(m_MarkerColor); - p.setPen(pen); - - QPoint markerPt; - if (Transform(m_MarkerPosition + 0.5f, markerPt) == INSIDE_RANGE) - { - int xDrawPos = m_Inset.x() + markerPt.x(); - int yDrawPos = m_Inset.y() + m_Inset.height(); - p.drawLine(xDrawPos, 0, xDrawPos, m_Inset.y() + m_Inset.height()); - - // event ID overlay at the bottom of the bar - const float frameWidth = 10.0f; - QPen selPen (QColor(255, 255, 255, 255)); - selPen.setWidth(1); - p.setPen(selPen); - p.setBrush(QColor(0, 0, 0, 255)); - int xOffset = xDrawPos - (int)frameWidth < 0 ? xDrawPos + (int)frameWidth : 0; - xOffset = xDrawPos + xOffset + (int)(frameWidth * 7.0f) > m_Inset.width() ? (int)(-frameWidth * 7.0f) : xOffset; - p.drawRect(xDrawPos - (int)frameWidth + xOffset, yDrawPos - 8, (int)(frameWidth * 7.0f), 16); - p.setBrush(QColor(255, 255, 255, 255)); - int eventNum = (int)(m_MarkerPosition); - - QString frameText = DrillerCharts::FriendlyFormat((AZ::s64)eventNum); - - p.drawText(xDrawPos - (int)frameWidth + 2 + xOffset, yDrawPos + 4, frameText); - } - } - } - - void DataRacetrack::RenderHorizCallouts(QPainter* painter) - { - float textSpaceRequired = (float)painter->fontMetrics().horizontalAdvance("9,999,999.99"); - int fontH = painter->fontMetrics().height(); - - AZStd::vector divisions; - divisions.reserve(10); - m_Axis->ComputeAxisDivisions((float)m_Inset.width(), divisions, textSpaceRequired, textSpaceRequired, false); - - QPen dottedPen; - dottedPen.setStyle(Qt::DotLine); - dottedPen.setColor(QColor(64, 64, 64, 255)); - dottedPen.setWidth(1); - QBrush solidBrush; - QPen solidPen; - solidPen.setStyle(Qt::SolidLine); - solidPen.setColor(QColor(0, 255, 255, 255)); - solidPen.setWidth(1); - - for (auto it = divisions.begin(); it != divisions.end(); ++it) - { - float currentUnit = *it; - QPoint leftEdge; - - // offset by a half becuase we want to slice through the middle of these event tracks. - currentUnit += 0.5f; - - Transform(currentUnit, leftEdge); - - currentUnit -= 0.5f; - - leftEdge += m_Inset.topLeft(); - - QPoint leftline((int)leftEdge.x(), m_Inset.bottom()); - QPoint leftend = leftline - QPoint(0, m_Inset.height()); - painter->setPen(dottedPen); - painter->drawLine(leftline, leftend); - - QString text; - text = QString("%1").number(currentUnit, 'f', 0); - - int textW = painter->fontMetrics().horizontalAdvance(text); - - painter->setPen(solidPen); - painter->drawText((int)leftEdge.x() - textW / 2, m_Inset.bottom() + fontH, text); - } - } - - - void DataRacetrack::DrawRotatedText(QString text, QPainter* painter, float degrees, int x, int y, float scale) - { - painter->save(); - painter->translate(x, y); - painter->scale(scale, scale); - painter->rotate(degrees); - painter->drawText(0, 0, text); - painter->restore(); - } -} diff --git a/Code/Tools/Standalone/Source/Driller/RacetrackChart.hxx b/Code/Tools/Standalone/Source/Driller/RacetrackChart.hxx deleted file mode 100644 index ee4610bcdc..0000000000 --- a/Code/Tools/Standalone/Source/Driller/RacetrackChart.hxx +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef RACETRACKCHART_H -#define RACETRACKCHART_H - -#if !defined(Q_MOC_RUN) -#include -#include -#include -#include - -#include "Source/Driller/DrillerDataTypes.h" -#endif - -namespace Charts -{ - class Axis; -} - - -namespace Racetrack -{ - typedef enum - { - OUTSIDE_LEFT = -1, - INSIDE_RANGE = 0, - OUTSIDE_RIGHT = 1, - INVALID_RANGE = 2 - } TransformResult; - - struct Channel - { - AZ_CLASS_ALLOCATOR(Channel,AZ::SystemAllocator,0); - Channel() : m_Color(QColor(255,255,0,255)) {} - - void SetName( QString name ) { m_Name = name; } - void SetColor( QColor &color ) { m_Color = color; } - - QString m_Name; - AZStd::vector< AZStd::pair > m_Data; - QColor m_Color; - }; - - - class DataRacetrack - : public QWidget - { - Q_OBJECT; - public: - AZ_CLASS_ALLOCATOR(DataRacetrack,AZ::SystemAllocator,0); - DataRacetrack( QWidget* parent = NULL, Qt::WindowFlags flags = Qt::WindowFlags()); - virtual ~DataRacetrack(void); - - void SetupAxis(QString label, float minimum, float maximum, bool locked = true ); - - int AddChannel( QString name ); - void AddData( int channelID, float h, float v = 0.0f ); - void Clear(); - void ClearData( int channelID ); - void SetChannelColor( int channelID, QColor color ); - void SetZoomLimit( float limit ); - void SetZeroBasedAxisNumbering( bool tf ); - - void SetMarkerColor(QColor qc); - void SetMarkerPosition(float qposn); - - Charts::Axis *GetAxis() const; - public slots: - - protected: - virtual void wheelEvent ( QWheelEvent * event ); - virtual void mouseMoveEvent ( QMouseEvent * event ); - virtual void mousePressEvent ( QMouseEvent * event ); - virtual void mouseReleaseEvent ( QMouseEvent * event ); - virtual void resizeEvent( QResizeEvent * event ); - virtual void leaveEvent(QEvent *); - - protected: - int m_InsetL; - int m_InsetR; - int m_InsetT; - int m_InsetB; - QRect m_Inset; - float m_ZoomLimit; - - typedef AZStd::vector Channels; - Channels m_Channels; - QPoint m_DragTracker; - - bool m_IsDragging; - bool m_IsLeftDragging; - - Charts::Axis *m_Axis; - // first submission = horizontal - - QColor m_MarkerColor; - float m_MarkerPosition; - bool m_ZeroBasedAxisDisplay; - int m_iChannelHighlight; - - // internal ops - virtual void paintEvent(QPaintEvent *event); - void DrawRotatedText(QString text, QPainter *painter, float degrees, int x, int y, float scale = 1.0f); - void RecurseVert(QPainter *painter, float step, float ratio ); - void RenderHorizCallouts( QPainter *painter ); - void RecalculateInset(); - void Zoom( QPoint pt, int steps ); - void Drag( int deltaX); - QPoint Transform( float h ); - TransformResult Transform( float h, QPoint &outQPoint ); - - public slots: - void OnAxisInvalidated(); - -signals: - void EventRequestEventFocus(Driller::EventNumberType); - }; - -} - - -#endif //RACETRACKCHART_H diff --git a/Code/Tools/Standalone/Source/Driller/Rendering/VRAM/VRAMDataAggregator.cpp b/Code/Tools/Standalone/Source/Driller/Rendering/VRAM/VRAMDataAggregator.cpp deleted file mode 100644 index 09cda0d0b8..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Rendering/VRAM/VRAMDataAggregator.cpp +++ /dev/null @@ -1,377 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "VRAMDataAggregator.hxx" -#include -#include "VRAMEvents.h" -#include -#include -#include "Source/Driller/Workspaces/Workspace.h" - -namespace Driller -{ - namespace VRAM - { - //========================================================================= - - enum class ExportField - { - RESOURCE_NAME, - ALLOCATION_SIZE, - UNKNOWN - }; - - /** - * VRAM CSV export settings - */ - class VRAMExportSettings - : public GenericCSVExportSettings - { - public: - AZ_CLASS_ALLOCATOR(VRAMExportSettings, AZ::SystemAllocator, 0); - - VRAMExportSettings() - { - m_columnDescriptors = - { - {ExportField::RESOURCE_NAME, "Resource Name"}, - {ExportField::ALLOCATION_SIZE, "VRAM Allocation Size"}, - }; - - m_exportOrdering = - { - ExportField::RESOURCE_NAME, - ExportField::ALLOCATION_SIZE, - }; - - for (const AZStd::pair< ExportField, AZStd::string >& item : m_columnDescriptors) - { - m_stringToExportEnum[item.second] = item.first; - } - } - - virtual void GetExportItems(QStringList& items) const - { - for (const AZStd::pair< ExportField, AZStd::string>& item : m_columnDescriptors) - { - items.push_back(QString(item.second.c_str())); - } - } - - virtual void GetActiveExportItems(QStringList& items) const - { - for (ExportField currentField : m_exportOrdering) - { - if (currentField != ExportField::UNKNOWN) - { - items.push_back(QString(FindColumnDescriptor(currentField).c_str())); - } - } - } - - const AZStd::vector< ExportField >& GetExportOrder() const - { - return m_exportOrdering; - } - - const AZStd::string& FindColumnDescriptor(ExportField exportField) const - { - static const AZStd::string emptyDescriptor; - - AZStd::unordered_map::const_iterator descriptorIter = m_columnDescriptors.find(exportField); - - if (descriptorIter == m_columnDescriptors.end()) - { - AZ_Warning("Standalone Tools", false, "Unknown column descriptor in VRAM CSV Export"); - return emptyDescriptor; - } - else - { - return descriptorIter->second; - } - } - - protected: - virtual void UpdateExportOrdering(const QStringList& activeItems) - { - m_exportOrdering.clear(); - - for (const QString& activeItem : activeItems) - { - ExportField field = FindExportFieldFromDescriptor(activeItem.toStdString().c_str()); - - AZ_Warning("Standalone Tools", field != ExportField::UNKNOWN, "Unknown descriptor %s", activeItem.toStdString().c_str()); - if (field != ExportField::UNKNOWN) - { - m_exportOrdering.push_back(field); - } - } - } - - private: - ExportField FindExportFieldFromDescriptor(const char* columnDescriptor) const - { - AZStd::unordered_map::const_iterator exportIter = m_stringToExportEnum.find(columnDescriptor); - - ExportField retVal = ExportField::UNKNOWN; - - if (exportIter != m_stringToExportEnum.end()) - { - retVal = exportIter->second; - } - - return retVal; - } - - AZStd::unordered_map< ExportField, AZStd::string > m_columnDescriptors; - AZStd::unordered_map< AZStd::string, ExportField > m_stringToExportEnum; - AZStd::vector< ExportField > m_exportOrdering; - }; - - //========================================================================= - - VRAMDataAggregator::VRAMDataAggregator(int identity) - : Aggregator(identity) - { - m_parser.SetAggregator(this); - m_csvExportSettings = aznew VRAMExportSettings(); - } - - VRAMDataAggregator::~VRAMDataAggregator() - { - delete m_csvExportSettings; - } - - float VRAMDataAggregator::ValueAtFrame(FrameNumberType frame) - { - const float maxEventsPerFrame = 1000.0f; // just a scale number - float numEventsPerFrame = static_cast(NumOfEventsAtFrame(frame)); - return AZStd::GetMin(numEventsPerFrame / maxEventsPerFrame, 1.0f) * 2.0f - 1.0f; - } - - QColor VRAMDataAggregator::GetColor() const - { - return QColor(0, 255, 255); - } - - QString VRAMDataAggregator::GetName() const - { - return "VRAM"; - } - - QString VRAMDataAggregator::GetChannelName() const - { - return ChannelName(); - } - - QString VRAMDataAggregator::GetDescription() const - { - return "VRAM allocations driller"; - } - - QString VRAMDataAggregator::GetToolTip() const - { - return "Information about VRAM allocations"; - } - - AZ::Uuid VRAMDataAggregator::GetID() const - { - return AZ::Uuid("{9D895E46-6CF7-4AA1-AC8F-79D8B6FB202E}"); - } - - bool VRAMDataAggregator::RegisterCategory(AZ::u32 categoryId, CategoryInfo* categoryInfo) - { - for (CategoryInfoArrayType::iterator iter = m_categories.begin(); iter != m_categories.end(); ++iter) - { - if ((*iter)->m_categoryId == categoryId) - { - AZ_Assert(0, "Category %u has already been registered", categoryId); - return false; - } - } - - m_categories.push_back(categoryInfo); - return true; - } - - bool VRAMDataAggregator::UnregisterCategory(AZ::u32 categoryId) - { - for (CategoryInfoArrayType::iterator iter = m_categories.begin(); iter != m_categories.end(); ++iter) - { - if ((*iter)->m_categoryId == categoryId) - { - m_categories.erase(iter); - return true; - } - } - - AZ_Assert(0, "Attempting to unregister a category %u which has not been registered", categoryId); - return false; - } - - CategoryInfo* VRAMDataAggregator::FindCategory(AZ::u32 categoryId) - { - for (CategoryInfoArrayType::iterator iter = m_categories.begin(); iter != m_categories.end(); ++iter) - { - if ((*iter)->m_categoryId == categoryId) - { - return (*iter); - } - } - return nullptr; - } - - AllocationInfo* VRAMDataAggregator::FindAndRemoveAllocation(AZ::u64 address) - { - for (CategoryInfoArrayType::iterator iter = m_categories.begin(); iter != m_categories.end(); ++iter) - { - CategoryInfo* category = *iter; - AllocationMapType::iterator allocIt = category->m_allocations.find(address); - if (allocIt != category->m_allocations.end()) - { - AllocationInfo* allocInfo = allocIt->second; - - // Deallocation, so subtract and remove from the allocation table - category->m_allocatedMemory -= allocInfo->m_size; - category->m_allocations.erase(address); - - return allocInfo; - } - } - - return nullptr; - } - - void VRAMDataAggregator::Reset() - { - m_categories.clear(); - } - - //========================================================================= - - CustomizeCSVExportWidget* VRAMDataAggregator::CreateCSVExportCustomizationWidget() - { - return aznew GenericCustomizeCSVExportWidget(*m_csvExportSettings); - } - - void VRAMDataAggregator::ExportCategoryHeaderToCSV(AZ::IO::SystemFile& file) - { - const AZStd::string categoryHeader = AZStd::string("Category,Number of Allocations, Memory Usage,\n"); - file.Write(categoryHeader.c_str(), categoryHeader.size()); - - for (VRAM::CategoryInfo* currentCategory : m_categories) - { - const AZStd::string categoryInfo = AZStd::string::format("%s,%zu,%zu,\n", currentCategory->m_categoryName, currentCategory->m_allocations.size(), currentCategory->m_allocatedMemory); - file.Write(categoryInfo.c_str(), categoryInfo.size()); - } - - file.Write("\n", 1); - } - - void VRAMDataAggregator::ExportColumnDescriptorToCSV(AZ::IO::SystemFile& file, CSVExportSettings* exportSettings) - { - // Write the category information at the top of the file - ExportCategoryHeaderToCSV(file); - - VRAMExportSettings* vramExportSettings = static_cast(exportSettings); - const AZStd::vector< ExportField >& exportOrdering = vramExportSettings->GetExportOrder(); - - bool addComma = false; - - // Now export all of our VRAM allocations - for (ExportField currentField : exportOrdering) - { - if (addComma) - { - file.Write(",", 1); - } - - const AZStd::string& columnDescriptor = vramExportSettings->FindColumnDescriptor(currentField); - file.Write(columnDescriptor.c_str(), columnDescriptor.size()); - addComma = true; - } - - file.Write("\n", 1); - } - - void VRAMDataAggregator::ExportEventToCSV(AZ::IO::SystemFile& file, const DrillerEvent* drillerEvent, CSVExportSettings* exportSettings) - { - // We don't care about logging the category registration events - if (azrtti_istypeof(drillerEvent)) - { - return; - } - - bool isDeallocation = azrtti_istypeof(drillerEvent); - AZ_Assert(azrtti_istypeof(drillerEvent) || isDeallocation, "Invalid Event"); - - const VRAM::AllocationInfo* allocationInformation = nullptr; - if (isDeallocation) - { - const VRAMDrillerUnregisterAllocationEvent* vramDeallocationEvent = static_cast(drillerEvent); - allocationInformation = vramDeallocationEvent->m_removedAllocationInfo; - } - else - { - const VRAMDrillerRegisterAllocationEvent* vramAllocationEvent = static_cast(drillerEvent); - allocationInformation = &vramAllocationEvent->m_allocationInfo; - } - - if (allocationInformation == nullptr) - { - AZ_Warning("System", 0, "Error: Allocation information not found for VRAM tracking event"); - return; - } - - VRAMExportSettings* vramExportSettings = static_cast(exportSettings); - const AZStd::vector< ExportField >& exportOrdering = vramExportSettings->GetExportOrder(); - - bool addComma = false; - AZStd::string field; - - for (ExportField currentField : exportOrdering) - { - if (addComma) - { - file.Write(",", 1); - } - - switch (currentField) - { - case ExportField::RESOURCE_NAME: - { - field = allocationInformation->m_name; - break; - } - case ExportField::ALLOCATION_SIZE: - { - if (isDeallocation) - { - field = AZStd::string::format("-%llu", allocationInformation->m_size); - } - else - { - field = AZStd::string::format("%llu", allocationInformation->m_size); - } - break; - } - default: - AZ_Warning("Standalone Tools", false, "Unknown Export Field for VRAMDataAggreagtor"); - break; - } - - file.Write(field.c_str(), field.length()); - addComma = true; - } - - file.Write("\n", 1); - } - - //========================================================================= - } // namespace VRAM -} // namespace Driller diff --git a/Code/Tools/Standalone/Source/Driller/Rendering/VRAM/VRAMDataAggregator.hxx b/Code/Tools/Standalone/Source/Driller/Rendering/VRAM/VRAMDataAggregator.hxx deleted file mode 100644 index ae1d544e89..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Rendering/VRAM/VRAMDataAggregator.hxx +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef DRILLER_VRAM_DATAAGGREGATOR_H -#define DRILLER_VRAM_DATAAGGREGATOR_H - -#if !defined(Q_MOC_RUN) -#include "Source/Driller/DrillerAggregator.hxx" -#include "Source/Driller/DrillerAggregatorOptions.hxx" -#include "Source/Driller/GenericCustomizeCSVExportWidget.hxx" -#include "VRAMDataParser.h" -#include "AzCore/std/string/string.h" -#include "AzCore/RTTI/RTTI.h" -#endif - -namespace Driller -{ - namespace VRAM - { - //========================================================================= - - struct CategoryInfo; - typedef AZStd::list CategoryInfoArrayType; - - /** - * VRAM data drilling aggregator - */ - class VRAMDataAggregator - : public Aggregator - { - Q_OBJECT; - public: - AZ_RTTI(VRAMDataAggregator, "{D17F2623-A980-4A08-9CEB-B8F89C811C1C}"); - AZ_CLASS_ALLOCATOR(VRAMDataAggregator, AZ::SystemAllocator, 0); - - VRAMDataAggregator(int identity = 0); - virtual ~VRAMDataAggregator(); - - static AZ::u32 DrillerId() - { - return VRAMDrillerHandlerParser::GetDrillerId(); - } - - AZ::u32 GetDrillerId() const override - { - return DrillerId(); - } - - static const char* ChannelName() - { - return "VRAM"; - } - - AZ::Crc32 GetChannelId() const override - { - return AZ::Crc32(ChannelName()); - } - - AZ::Debug::DrillerHandlerParser* GetDrillerDataParser() override - { - return &m_parser; - } - - bool CanExportToCSV() const override - { - return true; - } - - CustomizeCSVExportWidget* CreateCSVExportCustomizationWidget(); - - bool RegisterCategory(AZ::u32 categoryId, CategoryInfo* categoryInfo); - bool UnregisterCategory(AZ::u32 categoryId); - CategoryInfo* FindCategory(AZ::u32 categoryId); - - // Search all categories for this address, remove it from the hash table and return its allocation info. - struct AllocationInfo* FindAndRemoveAllocation( AZ::u64 address ); - - void ApplySettingsFromWorkspace(WorkspaceSettingsProvider*) override {} - void ActivateWorkspaceSettings(WorkspaceSettingsProvider*) override {} - void SaveSettingsToWorkspace(WorkspaceSettingsProvider*) override {} - - void Reset() override; - - public slots: - float ValueAtFrame(FrameNumberType frame) override; - QColor GetColor() const override; - QString GetChannelName() const override; - QString GetName() const override; - QString GetDescription() const override; - QString GetToolTip() const override; - AZ::Uuid GetID() const override; - void OptionsRequest() override {} - QWidget* DrillDownRequest(FrameNumberType frame) override - { - // Create a Qt view window to show a graph view of the VRAM usage - (void)frame; - return nullptr; - } - - protected: - void ExportColumnDescriptorToCSV(AZ::IO::SystemFile& file, CSVExportSettings* exportSettings) override; - void ExportEventToCSV(AZ::IO::SystemFile& file, const DrillerEvent* drillerEvent, CSVExportSettings* exportSettings) override; - void ExportCategoryHeaderToCSV(AZ::IO::SystemFile& file); - - class VRAMExportSettings* m_csvExportSettings; - VRAMDrillerHandlerParser m_parser; - - // Different categories of VRAM allocations and all of the allocations that live in that category. - CategoryInfoArrayType m_categories; - }; - - //========================================================================= - } // namespace VRAM -} // namespace Driller - -#endif diff --git a/Code/Tools/Standalone/Source/Driller/Rendering/VRAM/VRAMDataParser.cpp b/Code/Tools/Standalone/Source/Driller/Rendering/VRAM/VRAMDataParser.cpp deleted file mode 100644 index 419f48d9a3..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Rendering/VRAM/VRAMDataParser.cpp +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "VRAMDataParser.h" -#include "VRAMDataAggregator.hxx" -#include "VRAMEvents.h" - -namespace Driller -{ - namespace VRAM - { - AZ::Debug::DrillerHandlerParser* VRAMDrillerHandlerParser::OnEnterTag(AZ::u32 tagName) - { - AZ_Assert(m_data, "You must set a valid VRAM aggregator before we can process the data!"); - - if (tagName == AZ_CRC("RegisterAllocation", 0x992a9780)) - { - m_subTag = ST_REGISTER_ALLOCATION; - m_data->AddEvent(aznew VRAMDrillerRegisterAllocationEvent()); - return this; - } - else if (tagName == AZ_CRC("UnRegisterAllocation", 0xea5dc4cd)) - { - m_subTag = ST_UNREGISTER_ALLOCATION; - m_data->AddEvent(aznew VRAMDrillerUnregisterAllocationEvent()); - return this; - } - else if (tagName == AZ_CRC("RegisterCategory")) - { - m_subTag = ST_REGISTER_CATEGORY; - m_data->AddEvent(aznew VRAMDrillerRegisterCategoryEvent()); - return this; - } - else if (tagName == AZ_CRC("UnregisterCategory")) - { - m_subTag = ST_UNREGISTER_CATEGORY; - m_data->AddEvent(aznew VRAMDrillerUnregisterCategoryEvent()); - return this; - } - else - { - m_subTag = ST_NONE; - } - return NULL; - } - - void VRAMDrillerHandlerParser::OnExitTag(DrillerHandlerParser* handler, AZ::u32 tagName) - { - (void)tagName; - if (handler != NULL) - { - m_subTag = ST_NONE; // we have only one level just go back to the default state - } - } - - void VRAMDrillerHandlerParser::OnData(const AZ::Debug::DrillerSAXParser::Data& dataNode) - { - AZ_Assert(m_data, "You must set a valid VRAM aggregator before we can process the data!"); - - switch (m_subTag) - { - case ST_REGISTER_ALLOCATION: - { - VRAMDrillerRegisterAllocationEvent* event = static_cast(m_data->GetEvents().back()); - if (dataNode.m_name == AZ_CRC("Category")) - { - dataNode.Read(event->m_allocationInfo.m_category); - } - else if (dataNode.m_name == AZ_CRC("Subcategory")) - { - dataNode.Read(event->m_allocationInfo.m_subcategory); - } - else if (dataNode.m_name == AZ_CRC("Address", 0x0d4e6f81)) - { - dataNode.Read(event->m_address); - } - else if (dataNode.m_name == AZ_CRC("Size", 0xf7c0246a)) - { - dataNode.Read(event->m_allocationInfo.m_size); - } - else if (dataNode.m_name == AZ_CRC("Name", 0x5e237e06)) - { - event->m_allocationInfo.m_name = dataNode.ReadPooledString(); - } - } - break; - - case ST_UNREGISTER_ALLOCATION: - { - VRAMDrillerUnregisterAllocationEvent* event = static_cast(m_data->GetEvents().back()); - if (dataNode.m_name == AZ_CRC("Address", 0x0d4e6f81)) - { - dataNode.Read(event->m_address); - } - } - break; - - case ST_REGISTER_CATEGORY: - { - VRAMDrillerRegisterCategoryEvent* event = static_cast(m_data->GetEvents().back()); - if (dataNode.m_name == AZ_CRC("Category")) - { - dataNode.Read(event->m_categoryId); - event->m_categoryInfo.m_categoryId = event->m_categoryId; - } - else if (dataNode.m_name == AZ_CRC("CategoryName")) - { - event->m_categoryInfo.m_categoryName = dataNode.ReadPooledString(); - } - else if (dataNode.m_name == AZ_CRC("SubcategoryId")) - { - // NOTE: "SubcategoryId" and "SubcategoryName" have to be done in two separate Read events. - // The SubcategoryId read will create a SubcategoryInfo, and we assume when we hit SubcategoryName that we had just registered a new SubcategoryId on the previous read. - unsigned int subcategoryId = 0; - dataNode.Read(subcategoryId); - event->m_categoryInfo.m_subcategories.push_back(SubcategoryInfo(subcategoryId)); - } - else if (dataNode.m_name == AZ_CRC("SubcategoryName")) - { - AZ_Assert(event->m_categoryInfo.m_subcategories.size(), "Error: Found a SubcategoryName data tag, but did not find a previous SubcategoryId tag"); - - // Get the most recently registered subcategory - SubcategoryInfo& subcategory = event->m_categoryInfo.m_subcategories[event->m_categoryInfo.m_subcategories.size() - 1]; - AZ_Assert(subcategory.m_subcategoryName == nullptr, "Error: Subcategory 0x%08x already has a SubcategoryName", subcategory.m_subcategoryId); - - subcategory.m_subcategoryName = dataNode.ReadPooledString(); - } - } - break; - - case ST_UNREGISTER_CATEGORY: - { - VRAMDrillerUnregisterCategoryEvent* event = static_cast(m_data->GetEvents().back()); - if (dataNode.m_name == AZ_CRC("Category")) - { - dataNode.Read(event->m_categoryId); - } - } - break; - } - } - } // namespace VRAM -} // namespace Driller diff --git a/Code/Tools/Standalone/Source/Driller/Rendering/VRAM/VRAMDataParser.h b/Code/Tools/Standalone/Source/Driller/Rendering/VRAM/VRAMDataParser.h deleted file mode 100644 index d66ac32516..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Rendering/VRAM/VRAMDataParser.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef DRILLER_VRAM_DRILLER_PARSER_H -#define DRILLER_VRAM_DRILLER_PARSER_H - -#include - -namespace Driller -{ - namespace VRAM - { - //========================================================================= - - class VRAMDataAggregator; - - class VRAMDrillerHandlerParser - : public AZ::Debug::DrillerHandlerParser - { - public: - enum SubTags - { - ST_NONE = 0, - ST_REGISTER_ALLOCATION, - ST_UNREGISTER_ALLOCATION, - ST_REGISTER_CATEGORY, - ST_UNREGISTER_CATEGORY - }; - - VRAMDrillerHandlerParser() - : m_subTag(ST_NONE) - , m_data(NULL) - {} - - static AZ::u32 GetDrillerId() - { - return AZ_CRC("VRAMDriller"); - } - - void SetAggregator(VRAMDataAggregator* data) - { - m_data = data; - } - - virtual AZ::Debug::DrillerHandlerParser* OnEnterTag(AZ::u32 tagName); - virtual void OnExitTag(DrillerHandlerParser* handler, AZ::u32 tagName); - virtual void OnData(const AZ::Debug::DrillerSAXParser::Data& dataNode); - - protected: - SubTags m_subTag; - VRAMDataAggregator* m_data; - }; - - //========================================================================= - } -} - -#endif diff --git a/Code/Tools/Standalone/Source/Driller/Rendering/VRAM/VRAMEvents.cpp b/Code/Tools/Standalone/Source/Driller/Rendering/VRAM/VRAMEvents.cpp deleted file mode 100644 index b0b85beb6b..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Rendering/VRAM/VRAMEvents.cpp +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "VRAMEvents.h" -#include "VRAMDataAggregator.hxx" - -namespace Driller -{ - namespace VRAM - { - //========================================================================= - - CategoryInfo* GetCategory(Aggregator* data, AZ::u32 categoryId) - { - VRAMDataAggregator* aggregator = static_cast(data); - CategoryInfo* category = aggregator->FindCategory(categoryId); - - if (category == nullptr) - { - AZ_Assert(false, "VRAMDriller - Invalid Category"); - return nullptr; - } - return category; - } - - //========================================================================= - - void VRAMDrillerRegisterAllocationEvent::StepForward(Aggregator* data) - { - CategoryInfo* m_categoryInfo = GetCategory(data, m_allocationInfo.m_category); - if (!m_categoryInfo) - { - return; - } - - // Add the allocation - m_categoryInfo->m_allocations.insert(AZStd::make_pair(m_address, &m_allocationInfo)); - m_categoryInfo->m_allocatedMemory += m_allocationInfo.m_size; - } - - void VRAMDrillerRegisterAllocationEvent::StepBackward(Aggregator* data) - { - CategoryInfo* m_categoryInfo = GetCategory(data, m_allocationInfo.m_category); - if (!m_categoryInfo) - { - return; - } - - // Remove the allocation - m_categoryInfo->m_allocations.erase(m_address); - m_categoryInfo->m_allocatedMemory -= m_allocationInfo.m_size; - } - - //========================================================================= - - void VRAMDrillerUnregisterAllocationEvent::StepForward(Aggregator* data) - { - VRAMDataAggregator* aggregator = static_cast(data); - m_removedAllocationInfo = aggregator->FindAndRemoveAllocation(m_address); - - if (!m_removedAllocationInfo) - { - AZ_Warning("System", 0, "Error: Allocation not found for VRAMDrillerUnregisterAllocationEvent"); - } - } - - void VRAMDrillerUnregisterAllocationEvent::StepBackward(Aggregator* data) - { - if (m_removedAllocationInfo == nullptr) - { - AZ_Warning("System", 0, "Error: Allocation not found for VRAMDrillerUnregisterAllocationEvent"); - return; - } - - CategoryInfo* m_categoryInfo = GetCategory(data, m_removedAllocationInfo->m_category); - if (!m_categoryInfo) - { - return; - } - - // "Reallocation" - auto insertionPair = AZStd::make_pair(m_address, m_removedAllocationInfo); - m_categoryInfo->m_allocations.insert(insertionPair); - - // The opposite of deallocation, which is allocating, so we add: - m_categoryInfo->m_allocatedMemory += m_removedAllocationInfo->m_size; - } - - //========================================================================= - - void VRAMDrillerRegisterCategoryEvent::StepForward(Aggregator* data) - { - VRAMDataAggregator* aggregator = static_cast(data); - aggregator->RegisterCategory(m_categoryId, &m_categoryInfo); - } - - void VRAMDrillerRegisterCategoryEvent::StepBackward(Aggregator* data) - { - VRAMDataAggregator* aggregator = static_cast(data); - aggregator->UnregisterCategory(m_categoryId); - } - - //========================================================================= - - void VRAMDrillerUnregisterCategoryEvent::StepForward(Aggregator* data) - { - // TODO: Need to get m_unregisteredCategoryInfo from the category we are unregistering so we can re-register the category on StepBackward - VRAMDataAggregator* aggregator = static_cast(data); - aggregator->UnregisterCategory(m_categoryId); - } - - void VRAMDrillerUnregisterCategoryEvent::StepBackward(Aggregator* data) - { - VRAMDataAggregator* aggregator = static_cast(data); - aggregator->RegisterCategory(m_categoryId, &m_unregisteredCategoryInfo); - } - - //========================================================================= - } // namespace VRAM -} // namespace Driller diff --git a/Code/Tools/Standalone/Source/Driller/Rendering/VRAM/VRAMEvents.h b/Code/Tools/Standalone/Source/Driller/Rendering/VRAM/VRAMEvents.h deleted file mode 100644 index 88cb6a69e4..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Rendering/VRAM/VRAMEvents.h +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef DRILLER_VRAM_EVENTS_H -#define DRILLER_VRAM_EVENTS_H - -#include "Source/Driller/DrillerEvent.h" -#include - -namespace Driller -{ - namespace VRAM - { - //========================================================================= - - struct AllocationInfo - { - // This is an index for which category this allocation belongs to - AZ::u32 m_category = 0; - - // This is an index for which subcategory this allocation belongs to - AZ::u32 m_subcategory = 0; - - const char* m_name = nullptr; - AZ::u64 m_size = 0; - }; - - struct SubcategoryInfo - { - SubcategoryInfo(AZ::u32 subcategoryId) - : m_subcategoryId(subcategoryId) - {} - - SubcategoryInfo(AZ::u32 subcategoryId, const char* subcategoryName) - : m_subcategoryId(subcategoryId) - , m_subcategoryName(subcategoryName) - {} - - AZ::u32 m_subcategoryId = 0; - const char* m_subcategoryName = nullptr; - }; - - typedef AZStd::unordered_map AllocationMapType; - typedef AZStd::vector SubcategoryVectorType; - - struct CategoryInfo - { - const char* m_categoryName = nullptr; - AZ::u32 m_categoryId = 0; - - // The total amount of memory allocated for this category. - // Note that this amount may be different - size_t m_allocatedMemory = 0; - - // Map of all allocations - AllocationMapType m_allocations; - - // Container of all subcategories - SubcategoryVectorType m_subcategories; - }; - - enum VRAMEventType - { - ET_REGISTER_ALLOCATION, - ET_UNREGISTER_ALLOCATION, - ET_REGISTER_CATEGORY, - ET_UNREGISTER_CATEGORY - }; - - //========================================================================= - - class VRAMDrillerRegisterAllocationEvent - : public DrillerEvent - { - public: - AZ_CLASS_ALLOCATOR(VRAMDrillerRegisterAllocationEvent, AZ::SystemAllocator, 0) - AZ_RTTI(VRAMDrillerRegisterAllocationEvent, "{458DE527-390F-479E-A5AA-408EF44DB93F}", DrillerEvent); - - VRAMDrillerRegisterAllocationEvent() - : DrillerEvent(VRAM::ET_REGISTER_ALLOCATION) - {} - - virtual void StepForward(Aggregator* data); - virtual void StepBackward(Aggregator* data); - - AZ::u64 m_address = 0; - VRAM::AllocationInfo m_allocationInfo; - }; - - //========================================================================= - - class VRAMDrillerUnregisterAllocationEvent - : public DrillerEvent - { - public: - AZ_CLASS_ALLOCATOR(VRAMDrillerUnregisterAllocationEvent, AZ::SystemAllocator, 0) - AZ_RTTI(VRAMDrillerUnregisterAllocationEvent, "{674F8DE3-11C1-4B1E-B0A5-EB45B5F72F68}", DrillerEvent); - - VRAMDrillerUnregisterAllocationEvent() - : DrillerEvent(VRAM::ET_UNREGISTER_ALLOCATION) - {} - - virtual void StepForward(Aggregator* data); - virtual void StepBackward(Aggregator* data); - - AZ::u64 m_address = 0; - AllocationInfo* m_removedAllocationInfo = nullptr; - }; - - //========================================================================= - - class VRAMDrillerRegisterCategoryEvent - : public DrillerEvent - { - public: - AZ_CLASS_ALLOCATOR(VRAMDrillerRegisterCategoryEvent, AZ::SystemAllocator, 0) - AZ_RTTI(VRAMDrillerUnregisterAllocationEvent, "{F024BA49-E8C9-4699-B999-9E6F988CFF8E}", DrillerEvent); - - VRAMDrillerRegisterCategoryEvent() - : DrillerEvent(VRAM::ET_REGISTER_CATEGORY) - {} - - virtual void StepForward(Aggregator* data); - virtual void StepBackward(Aggregator* data); - - AZ::u32 m_categoryId = 0; - CategoryInfo m_categoryInfo; - }; - - //========================================================================= - - class VRAMDrillerUnregisterCategoryEvent - : public DrillerEvent - { - public: - AZ_CLASS_ALLOCATOR(VRAMDrillerUnregisterCategoryEvent, AZ::SystemAllocator, 0) - AZ_RTTI(VRAMDrillerUnregisterCategoryEvent, "{6549C4A4-70E4-47AD-8688-47C00543197A}", DrillerEvent); - - VRAMDrillerUnregisterCategoryEvent() - : DrillerEvent(VRAM::ET_UNREGISTER_CATEGORY) - {} - - virtual void StepForward(Aggregator* data); - virtual void StepBackward(Aggregator* data); - - AZ::u32 m_categoryId = 0; - CategoryInfo m_unregisteredCategoryInfo; - }; - - //========================================================================= - } // namespace VRAM -} // namespace Driller - -#endif diff --git a/Code/Tools/Standalone/Source/Driller/Replica/BaseDetailView.h b/Code/Tools/Standalone/Source/Driller/Replica/BaseDetailView.h deleted file mode 100644 index 2db8966a2e..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Replica/BaseDetailView.h +++ /dev/null @@ -1,674 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef DRILLER_REPLICA_BASEDETAILVIEW_H -#define DRILLER_REPLICA_BASEDETAILVIEW_H - -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include - -#include "Source/Driller/StripChart.hxx" -#include "Source/Driller/Replica/BaseDetailViewQObject.hxx" -#include "Source/Driller/Replica/ReplicaBandwidthChartData.h" -#include "Source/Driller/Replica/ReplicaDisplayHelpers.h" -#include "Source/Driller/Replica/ReplicaDisplayTypes.h" -#include "Source/Driller/Replica/ReplicaDataView.hxx" -#include "Source/Driller/Replica/ReplicaTreeViewModel.hxx" -#include "Source/Driller/Replica/BaseDetailViewSavedState.h" - -#include - -namespace Driller -{ - template - class BaseDetailTreeViewModel; - - template - class BaseDetailView - : public BaseDetailViewQObject - { - typedef AZStd::unordered_set IdSet; - - friend class BaseDetailTreeViewModel; - friend class ReplicaDataView; - - protected: - - enum class DisplayMode - { - Unknown = -2, - Start, - Active, - Aggregate, - End - }; - - enum class DetailMode - { - Unknown = -2, - Start, - Low, - Medium, - High, - End - }; - - public: - AZ_CLASS_ALLOCATOR(BaseDetailView, AZ::SystemAllocator, 0); - - BaseDetailView(ReplicaDataView* replicaDataView) - : BaseDetailViewQObject(nullptr) - , m_displayMode(DisplayMode::Unknown) - , m_detailMode(DetailMode::Low) - , m_bandwidthUsageDisplayType(ReplicaDisplayTypes::BUDT_COMBINED) - , m_windowStateCRC(0) - , m_splitterStateCRC(0) - , m_treeStateCRC(0) - , m_replicaDataView(replicaDataView) - , m_gui(nullptr) - { - setAttribute(Qt::WA_DeleteOnClose, true); - setWindowFlags(windowFlags() | Qt::WindowMaximizeButtonHint | Qt::WindowMinimizeButtonHint); - - m_gui = azcreate(Ui::BaseDetailView, ()); - m_gui->setupUi(this); - - for (int i = static_cast(DetailMode::Start) + 1; i < static_cast(DetailMode::End); ++i) - { - switch (static_cast(i)) - { - case DetailMode::High: - m_gui->graphDetailType->addItem("High"); - break; - case DetailMode::Medium: - m_gui->graphDetailType->addItem("Medium"); - break; - case DetailMode::Low: - m_gui->graphDetailType->addItem("Low"); - break; - default: - AZ_Error("Standalone Tools", false, "Unknown GraphDetailMode."); - m_gui->graphDetailType->addItem("???"); - break; - } - } - - m_gui->graphDetailType->setCurrentIndex(static_cast(m_detailMode)); - - for (int i = ReplicaDisplayTypes::BUDT_START + 1; i < ReplicaDisplayTypes::BUDT_END; ++i) - { - switch (i) - { - case ReplicaDisplayTypes::BUDT_COMBINED: - m_gui->bandwidthUsageDisplayType->addItem(ReplicaDisplayTypes::DisplayNames::BUDT_COMBINED_NAME); - break; - case ReplicaDisplayTypes::BUDT_SENT: - m_gui->bandwidthUsageDisplayType->addItem(ReplicaDisplayTypes::DisplayNames::BUDT_SENT_NAME); - break; - case ReplicaDisplayTypes::BUDT_RECEIVED: - m_gui->bandwidthUsageDisplayType->addItem(ReplicaDisplayTypes::DisplayNames::BUDT_RECEIVED_NAME); - break; - default: - AZ_Error("StandaloneTools", false, "Unknown Bandwidth Usage Display Type"); - m_gui->bandwidthUsageDisplayType->addItem("???"); - break; - } - } - - m_gui->bandwidthUsageDisplayType->setCurrentIndex(m_bandwidthUsageDisplayType); - - SetupSignals(m_replicaDataView,m_gui); - } - - void LoadSavedState() - { - m_windowStateCRC = CreateWindowGeometryCRC(); - - AZStd::intrusive_ptr windowState = AZ::UserSettings::Find(m_windowStateCRC, AZ::UserSettings::CT_GLOBAL); - - if (windowState) - { - windowState->RestoreGeometry(this); - } - - m_splitterStateCRC = CreateSplitterStateCRC(); - - auto splitterState = AZ::UserSettings::Find(m_splitterStateCRC, AZ::UserSettings::CT_GLOBAL); - - if (splitterState) - { - QByteArray splitterData((const char*)splitterState->m_splitterStorage.data(), (int)splitterState->m_splitterStorage.size()); - m_gui->splitter->restoreState(splitterData); - } - - m_treeStateCRC = CreateTreeStateCRC(); - - auto treeState = AZ::UserSettings::Find(m_treeStateCRC, AZ::UserSettings::CT_GLOBAL); - - if (treeState) - { - QByteArray treeData((const char*)treeState->m_treeColumnStorage.data(), (int)treeState->m_treeColumnStorage.size()); - m_gui->treeView->header()->restoreState(treeData); - } - } - - ~BaseDetailView() - { - // Save out whatever data we want to save out. - auto pState = AZ::UserSettings::CreateFind(m_windowStateCRC, AZ::UserSettings::CT_GLOBAL); - if (pState) - { - pState->CaptureGeometry(this); - } - - auto splitterState = AZ::UserSettings::CreateFind(m_splitterStateCRC, AZ::UserSettings::CT_GLOBAL); - if (splitterState) - { - QByteArray qba = m_gui->splitter->saveState(); - splitterState->m_splitterStorage.assign((AZ::u8*)qba.begin(), (AZ::u8*)qba.end()); - } - - auto treeState = AZ::UserSettings::CreateFind(m_treeStateCRC, AZ::UserSettings::CT_GLOBAL); - if (treeState) - { - if (m_gui->treeView && m_gui->treeView->header()) - { - QByteArray qba = m_gui->treeView->header()->saveState(); - treeState->m_treeColumnStorage.assign((AZ::u8*)qba.begin(), (AZ::u8*)qba.end()); - } - } - - if (m_replicaDataView) - { - m_replicaDataView->SignalDialogClosed(this); - } - - azdestroy(m_gui); - } - - void RedrawGraph() - { - AZ_PROFILE_FUNCTION(AzToolsFramework); - switch (m_displayMode) - { - case DisplayMode::Active: - DrawActiveGraph(); - break; - case DisplayMode::Aggregate: - DrawAggregateGraph(); - break; - default: - AZ_Error("BaseDetailView", false, "Trying to display unknown graph configuration."); - } - } - - void SetupTreeView() - { - m_gui->treeView->reset(); - - m_gui->treeView->setSelectionMode(QAbstractItemView::ExtendedSelection); - m_gui->treeView->setExpandsOnDoubleClick(false); - - - m_gui->treeView->header()->setSectionResizeMode(QHeaderView::Interactive); - m_gui->treeView->header()->setStretchLastSection(false); - - OnSetupTreeView(); - SetupTreeViewSignals(m_gui->treeView); - } - - public: - virtual const typename ReplicaBandwidthChartData::FrameMap & GetFrameData() const = 0; - virtual BaseDetailDisplayHelper* FindDetailDisplay(const Key& id) = 0; - virtual const BaseDetailDisplayHelper* FindDetailDisplay(const Key& id) const = 0; - - virtual BaseDetailDisplayHelper* FindAggregateDisplay() { return nullptr; } - virtual Key FindAggregateID() const { return Key(); } - - protected: - void OnDataRangeChanged() override - { - InitializeDisplayData(); - RedrawGraph(); - ShowTreeFrame(m_replicaDataView->GetCurrentFrame()); - } - - void SetAllEnabled(bool enabled) override - { - BaseDetailDisplayHelper* aggregateDisplay = FindAggregateDisplay(); - - if (aggregateDisplay) - { - aggregateDisplay->m_graphEnabled = enabled; - - BaseDisplayHelper* displayHelper = aggregateDisplay->GetDataSetDisplayHelper(); - displayHelper->m_graphEnabled = false; - - const AZStd::vector< BaseDisplayHelper* >& dataSets = displayHelper->GetChildren(); - - for (BaseDisplayHelper* dataSet : dataSets) - { - dataSet->m_graphEnabled = enabled; - } - - displayHelper = aggregateDisplay->GetRPCDisplayHelper(); - displayHelper->m_graphEnabled = false; - - const AZStd::vector< BaseDisplayHelper* >& rpcs = displayHelper->GetChildren(); - - for (BaseDisplayHelper* rpc : rpcs) - { - rpc->m_graphEnabled = enabled; - } - } - - for (Key& currentId : m_activeIds) - { - BaseDetailDisplayHelper* detailHelper = FindDetailDisplay(currentId); - detailHelper->m_graphEnabled = enabled; - - BaseDisplayHelper* displayHelper = detailHelper->GetDataSetDisplayHelper(); - displayHelper->m_graphEnabled = enabled; - - const AZStd::vector< BaseDisplayHelper* >& dataSets = displayHelper->GetChildren(); - - for (BaseDisplayHelper* dataSet : dataSets) - { - dataSet->m_graphEnabled = enabled; - } - - displayHelper = detailHelper->GetRPCDisplayHelper(); - displayHelper->m_graphEnabled = enabled; - - const AZStd::vector< BaseDisplayHelper* >& rpcs = displayHelper->GetChildren(); - - for (BaseDisplayHelper* rpc : rpcs) - { - rpc->m_graphEnabled = enabled; - } - } - - LayoutChanged(); - RedrawGraph(); - } - - void SetSelectedEnabled(bool enabled) override - { - QModelIndexList selection = m_gui->treeView->selectionModel()->selectedIndexes(); - - for (QModelIndex& index : selection) - { - static_cast(index.internalPointer())->m_graphEnabled = enabled; - } - - LayoutChanged(); - RedrawGraph(); - } - - void OnCollapseAll() override - { - m_gui->treeView->collapseAll(); - } - - void OnExpandAll() override - { - m_gui->treeView->expandAll(); - } - - void OnDoubleClicked(const QModelIndex& clickedIndex) override - { - if (!clickedIndex.isValid()) - { - return; - } - - BaseDisplayHelper* displayHelper = static_cast(clickedIndex.internalPointer()); - - displayHelper->m_graphEnabled = !displayHelper->m_graphEnabled; - - LayoutChanged(); - RedrawGraph(); - } - - void OnSelectionChanged(const QItemSelection& selected, const QItemSelection& deselected) override - { - for (const QModelIndex& selectedIndex : selected.indexes()) - { - BaseDisplayHelper* displayHelper = static_cast(selectedIndex.internalPointer()); - - displayHelper->m_selected = true; - displayHelper->m_areaGraphPlotHelper.SetHighlighted(displayHelper->m_selected); - } - - for (const QModelIndex& deselectedIndex : deselected.indexes()) - { - BaseDisplayHelper* displayHelper = static_cast(deselectedIndex.internalPointer()); - - displayHelper->m_selected = false; - displayHelper->m_areaGraphPlotHelper.SetHighlighted(displayHelper->m_selected); - } - } - - void OnUpdateDisplay(const QModelIndex& startIndex, const QModelIndex& endIndex) override - { - (void)startIndex; - (void)endIndex; - - RedrawGraph(); - } - - void OnDisplayModeChanged(int displayMode) override - { - if (displayMode > static_cast(DisplayMode::Start) && displayMode < static_cast(DisplayMode::End)) - { - if (m_displayMode != static_cast(displayMode)) - { - m_displayMode = static_cast(displayMode); - - InitializeDisplayData(); - SetupTreeView(); - RedrawGraph(); - } - } - } - - void OnGraphDetailChanged(int graphDetail) override - { - if (graphDetail > static_cast(DetailMode::Start) && graphDetail < static_cast(DetailMode::End)) - { - if (m_detailMode != static_cast(graphDetail)) - { - m_detailMode = static_cast(graphDetail); - RedrawGraph(); - } - } - } - - void OnBandwidthDisplayUsageTypeChanged(int bandwidthUsageType) - { - if (bandwidthUsageType > ReplicaDisplayTypes::BUDT_START && bandwidthUsageType < ReplicaDisplayTypes::BUDT_END) - { - if (m_bandwidthUsageDisplayType != static_cast(bandwidthUsageType)) - { - m_bandwidthUsageDisplayType = static_cast(bandwidthUsageType); - RedrawGraph(); - } - } - } - - void OnInspectedSeries(size_t seriesId) - { - (void)seriesId; - - // Nothing to see here - } - - void OnSelectedSeries(size_t seriesId, int position) - { - (void)seriesId; - - EBUS_EVENT_ID(m_replicaDataView->GetCaptureWindowIdentity(), DrillerCaptureWindowRequestBus, ScrubToFrameRequest, position); - } - - bool IsInDisplayMode(DisplayMode displayMode) - { - return m_displayMode == displayMode; - } - - protected: - - void SignalDataViewDestroyed(ReplicaDataView* dataView) - { - if (dataView == m_replicaDataView) - { - m_replicaDataView = nullptr; - } - - close(); - } - - virtual void InitializeDisplayData() = 0; - virtual void LayoutChanged() = 0; - virtual void OnSetupTreeView() = 0; - virtual void ShowTreeFrame(FrameNumberType frameId) = 0; - - virtual AZ::u32 CreateWindowGeometryCRC() = 0; - virtual AZ::u32 CreateSplitterStateCRC() = 0; - virtual AZ::u32 CreateTreeStateCRC() = 0; - - DisplayMode m_displayMode; - DetailMode m_detailMode; - - ReplicaDisplayTypes::BandwidthUsageDisplayType m_bandwidthUsageDisplayType; - - AZ::u32 m_windowStateCRC; - AZ::u32 m_splitterStateCRC; - AZ::u32 m_treeStateCRC; - - ReplicaDataView* m_replicaDataView; - IdSet m_activeIds; - IdSet m_activeInspectedIds; - Ui::BaseDetailView* m_gui; - - private: - void DrawActiveGraph(); - void DrawHighDetailActiveGraph(BaseDetailDisplayHelper* detailDisplayHelper, const BandwidthUsageContainer* usageContainer, FrameNumberType frameId); - void DrawMediumDetailActiveGraph(BaseDetailDisplayHelper* detailDisplayHelper, const BandwidthUsageContainer* usageContainer, FrameNumberType frameId); - void DrawLowDetailActiveGraph(BaseDetailDisplayHelper* detailDisplayHelper, const BandwidthUsageContainer* usageContainer, FrameNumberType frameId); - - void DrawAggregateGraph(); - - void PlotBatchedGraphData(AreaGraphPlotHelper& areaPlotHelper, FrameNumberType frameId, const BandwidthUsageAggregator& usageAggregator) - { - switch (m_bandwidthUsageDisplayType) - { - case ReplicaDisplayTypes::BUDT_COMBINED: - areaPlotHelper.PlotBatchedData(frameId, static_cast(usageAggregator.m_bytesSent + usageAggregator.m_bytesReceived)); - break; - case ReplicaDisplayTypes::BUDT_SENT: - areaPlotHelper.PlotBatchedData(frameId, static_cast(usageAggregator.m_bytesSent)); - break; - case ReplicaDisplayTypes::BUDT_RECEIVED: - areaPlotHelper.PlotBatchedData(frameId, static_cast(usageAggregator.m_bytesReceived)); - break; - default: - AZ_Error("BaseDetailView", false, "Unknown bandwidth usage display type."); - } - } - - void ConfigureBaseDetailDisplayHelper(BaseDetailDisplayHelper* detailDisplayHelper); - - void ConfigureGraphAxis() - { - const QColor markerColor(Qt::red); - m_gui->areaChart->ResetChart(); - m_gui->areaChart->ConfigureVerticalAxis("Bandwidth Usage", m_replicaDataView->GetAverageFrameBandwidthBudget()); - m_gui->areaChart->ConfigureHorizontalAxis("Frame", static_cast(m_replicaDataView->GetAxisStartFrame()), static_cast(m_replicaDataView->GetAxisEndFrame())); - m_gui->areaChart->AddMarker(Charts::AxisType::Horizontal, static_cast(m_replicaDataView->GetCurrentFrame()), markerColor); - } - }; - - template - class BaseDetailTreeViewModel - : public ReplicaTreeViewModel - { - typedef ReplicaBandwidthChartData BandwidthChartData; - public: - AZ_CLASS_ALLOCATOR(BaseDetailTreeViewModel, AZ::SystemAllocator, 0); - BaseDetailTreeViewModel(BaseDetailView* detailView) - : ReplicaTreeViewModel(nullptr) - , m_baseDetailView(detailView) - { - } - - void RefreshView(FrameNumberType frameId) - { - AZ_PROFILE_FUNCTION(AzToolsFramework); - AZStd::unordered_set< Key > discoveredSet; - - m_tableViewOrdering.clear(); - - if (m_baseDetailView->IsInDisplayMode(BaseDetailView::DisplayMode::Active)) - { - if (m_baseDetailView->m_replicaDataView->HideInactiveInspectedElements()) - { - m_tableViewOrdering.insert(m_tableViewOrdering.begin(), m_baseDetailView->m_activeInspectedIds.begin(), m_baseDetailView->m_activeInspectedIds.end()); - } - else - { - m_tableViewOrdering.insert(m_tableViewOrdering.begin(), m_baseDetailView->m_activeIds.begin(), m_baseDetailView->m_activeIds.end()); - } - - } - - const typename BandwidthChartData::FrameMap& frameMap = m_baseDetailView->GetFrameData(); - auto frameIter = frameMap.find(frameId); - - BaseDetailDisplayHelper* aggregateDisplayHelper = m_baseDetailView->FindAggregateDisplay(); - - if (aggregateDisplayHelper && m_baseDetailView->IsInDisplayMode(BaseDetailView::DisplayMode::Aggregate)) - { - aggregateDisplayHelper->ResetBandwidthUsage(); - - if (m_baseDetailView->m_replicaDataView->HideInactiveInspectedElements()) - { - if (frameIter != frameMap.end()) - { - m_tableViewOrdering.push_back(m_baseDetailView->FindAggregateID()); - } - } - else - { - m_tableViewOrdering.push_back(m_baseDetailView->FindAggregateID()); - } - } - else - { - aggregateDisplayHelper = nullptr; - } - - if (frameIter != frameMap.end()) - { - const typename BandwidthChartData::BandwidthUsageMap* usageMap = frameIter->second; - - for (typename BandwidthChartData::BandwidthUsageMap::const_iterator usageIter = usageMap->begin(); - usageIter != usageMap->end(); - ++usageIter) - { - const BandwidthUsageContainer* usageContainer = usageIter->second; - - const Key& idKey = usageIter->first; - - BaseDetailDisplayHelper* detailHelper = m_baseDetailView->FindDetailDisplay(idKey); - - if (detailHelper) - { - auto insert = discoveredSet.insert(idKey); - - if (insert.second) - { - detailHelper->ResetBandwidthUsage(); - } - - DataSetDisplayFilter* dataSetDisplayFilter = detailHelper->GetDataSetDisplayHelper(); - - if (dataSetDisplayFilter) - { - const BandwidthUsageContainer::UsageAggregationMap& dataSetUsage = usageContainer->GetDataTypeUsageAggregation(BandwidthUsage::DataType::DATA_SET); - - for (const auto& usagePair : dataSetUsage) - { - const BandwidthUsage& currentUsage = usagePair.second; - - detailHelper->AddDataSetUsage(currentUsage); - - if (aggregateDisplayHelper) - { - aggregateDisplayHelper->AddDataSetUsage(currentUsage); - } - } - } - - RPCDisplayFilter* rpcDisplayFilter = detailHelper->GetRPCDisplayHelper(); - - if (rpcDisplayFilter) - { - const BandwidthUsageContainer::UsageAggregationMap& rpcUsage = usageContainer->GetDataTypeUsageAggregation(BandwidthUsage::DataType::REMOTE_PROCEDURE_CALL); - - for (const auto& usagePair : rpcUsage) - { - const BandwidthUsage& currentUsage = usagePair.second; - - detailHelper->AddRPCUsage(currentUsage); - - if (aggregateDisplayHelper) - { - aggregateDisplayHelper->AddRPCUsage(currentUsage); - } - } - } - } - } - } - else - { - if (aggregateDisplayHelper) - { - aggregateDisplayHelper->ResetBandwidthUsage(); - } - - for (Key& currentId : m_tableViewOrdering) - { - BaseDetailDisplayHelper* detailDisplayHelper = m_baseDetailView->FindDetailDisplay(currentId); - - if (detailDisplayHelper) - { - detailDisplayHelper->ResetBandwidthUsage(); - } - } - } - - AZStd::sort(m_tableViewOrdering.begin(), m_tableViewOrdering.end(), AZStd::less()); - - layoutChanged(); - } - - protected: - - int GetRootRowCount() const override - { - return static_cast(m_tableViewOrdering.size()); - } - - const BaseDisplayHelper* FindDisplayHelperAtRoot(int row) const override - { - if (row < 0 || row >= m_tableViewOrdering.size()) - { - return nullptr; - } - - return m_baseDetailView->FindDetailDisplay(m_tableViewOrdering[row]); - } - - BaseDetailView* m_baseDetailView; - AZStd::vector< Key > m_tableViewOrdering; - }; -} - -#include "BaseDetailView.inl" -#endif diff --git a/Code/Tools/Standalone/Source/Driller/Replica/BaseDetailView.inl b/Code/Tools/Standalone/Source/Driller/Replica/BaseDetailView.inl deleted file mode 100644 index 07aaff4ba3..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Replica/BaseDetailView.inl +++ /dev/null @@ -1,456 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -namespace Driller -{ - template - void BaseDetailView::DrawActiveGraph() - { - const BandwidthUsageContainer emptyContainer; - const typename ReplicaBandwidthChartData::BandwidthUsageMap s_emptyMap; - - ConfigureGraphAxis(); - - for (const Key& currentId : m_activeIds) - { - BaseDetailDisplayHelper* detailDisplayHelper = FindDetailDisplay(currentId); - - ConfigureBaseDetailDisplayHelper(detailDisplayHelper); - } - - const typename ReplicaBandwidthChartData::FrameMap& frameMap = GetFrameData(); - - for (FrameNumberType frameId = m_replicaDataView->GetStartFrame(); frameId <= m_replicaDataView->GetEndFrame(); ++frameId) - { - typename ReplicaBandwidthChartData::FrameMap::const_iterator frameIter = frameMap.find(frameId); - const typename ReplicaBandwidthChartData::BandwidthUsageMap* usageMap = nullptr; - - if (frameIter != frameMap.end()) - { - usageMap = frameIter->second; - } - else - { - usageMap = &s_emptyMap; - } - - AZ_Assert(usageMap != nullptr,"Null pointer added to data map"); - if (usageMap == nullptr) - { - continue; - } - - for (const Key& currentId : m_activeIds) - { - const BandwidthUsageContainer* usageContainer = &emptyContainer; - typename ReplicaBandwidthChartData::BandwidthUsageMap::const_iterator usageIter = usageMap->find(currentId); - - if (usageIter != usageMap->end()) - { - usageContainer = usageIter->second; - } - else - { - usageContainer = &emptyContainer; - } - - BaseDetailDisplayHelper* detailDisplayHelper = FindDetailDisplay(currentId); - - switch (m_detailMode) - { - case DetailMode::Low: - DrawLowDetailActiveGraph(detailDisplayHelper,usageContainer,frameId); - break; - case DetailMode::Medium: - DrawMediumDetailActiveGraph(detailDisplayHelper, usageContainer, frameId); - break; - case DetailMode::High: - DrawHighDetailActiveGraph(detailDisplayHelper, usageContainer, frameId); - break; - default: - break; - } - } - } - } - - template - void BaseDetailView::DrawLowDetailActiveGraph(BaseDetailDisplayHelper* detailDisplayHelper, const BandwidthUsageContainer* usageContainer, FrameNumberType frameId) - { - if (detailDisplayHelper->m_graphEnabled) - { - BandwidthUsageAggregator usageAggregator; - usageAggregator.m_bytesSent = usageContainer->GetTotalBytesSent(); - usageAggregator.m_bytesReceived = usageContainer->GetTotalBytesReceived(); - - PlotBatchedGraphData(detailDisplayHelper->m_areaGraphPlotHelper, frameId, usageAggregator); - } - } - - template - void BaseDetailView::DrawMediumDetailActiveGraph(BaseDetailDisplayHelper* detailDisplayHelper, const BandwidthUsageContainer* usageContainer, FrameNumberType frameId) - { - DataSetDisplayFilter* dataSetFilter = detailDisplayHelper->GetDataSetDisplayHelper(); - - if (dataSetFilter && dataSetFilter->m_graphEnabled) - { - BandwidthUsageAggregator overallDataSetUsage; - const BandwidthUsageContainer::UsageAggregationMap& dataSetUsage = usageContainer->GetDataTypeUsageAggregation(BandwidthUsage::DataType::DATA_SET); - - const AZStd::vector< BaseDisplayHelper* >& dataSets = dataSetFilter->GetChildren(); - - for (BaseDisplayHelper* helper : dataSets) - { - KeyedDisplayHelper* dataSet = static_cast*>(helper); - const BandwidthUsageContainer::UsageAggregationMap::const_iterator usageIter = dataSetUsage.find(dataSet->GetKey()); - - if (usageIter != dataSetUsage.end()) - { - const BandwidthUsage& currentUsage = usageIter->second; - overallDataSetUsage.m_bytesSent += currentUsage.m_usageAggregator.m_bytesSent; - overallDataSetUsage.m_bytesReceived += currentUsage.m_usageAggregator.m_bytesReceived; - } - } - - PlotBatchedGraphData(dataSetFilter->m_areaGraphPlotHelper, frameId, overallDataSetUsage); - } - - RPCDisplayFilter* rpcFilter = detailDisplayHelper->GetRPCDisplayHelper(); - - if (rpcFilter && rpcFilter->m_graphEnabled) - { - BandwidthUsageAggregator overallRPCUsage; - const BandwidthUsageContainer::UsageAggregationMap& rpcUsage = usageContainer->GetDataTypeUsageAggregation(BandwidthUsage::DataType::REMOTE_PROCEDURE_CALL); - - const AZStd::vector< BaseDisplayHelper* >& rpcs = rpcFilter->GetChildren(); - - for (BaseDisplayHelper* helper : rpcs) - { - KeyedDisplayHelper* rpc = static_cast*>(helper); - const BandwidthUsageContainer::UsageAggregationMap::const_iterator usageIter = rpcUsage.find(rpc->GetKey()); - - if (usageIter != rpcUsage.end()) - { - const BandwidthUsage& currentUsage = usageIter->second; - - overallRPCUsage.m_bytesSent += currentUsage.m_usageAggregator.m_bytesSent; - overallRPCUsage.m_bytesReceived += currentUsage.m_usageAggregator.m_bytesReceived; - } - } - - PlotBatchedGraphData(rpcFilter->m_areaGraphPlotHelper, frameId, overallRPCUsage); - } - } - - template - void BaseDetailView::DrawHighDetailActiveGraph(BaseDetailDisplayHelper* detailDisplayHelper, const BandwidthUsageContainer* usageContainer, FrameNumberType frameId) - { - DataSetDisplayFilter* dataSetFilter = detailDisplayHelper->GetDataSetDisplayHelper(); - - if (dataSetFilter) - { - const BandwidthUsageContainer::UsageAggregationMap& dataSetUsage = usageContainer->GetDataTypeUsageAggregation(BandwidthUsage::DataType::DATA_SET); - const AZStd::vector< BaseDisplayHelper* >& dataSets = dataSetFilter->GetChildren(); - - for (BaseDisplayHelper* helper : dataSets) - { - if (helper->m_graphEnabled) - { - KeyedDisplayHelper* dataSet = static_cast*>(helper); - const BandwidthUsageContainer::UsageAggregationMap::const_iterator usageIter = dataSetUsage.find(dataSet->GetKey()); - - if (usageIter == dataSetUsage.end()) - { - const BandwidthUsageAggregator emptyUsage; - PlotBatchedGraphData(dataSet->m_areaGraphPlotHelper, frameId, emptyUsage); - } - else - { - const BandwidthUsage& currentUsage = usageIter->second; - PlotBatchedGraphData(dataSet->m_areaGraphPlotHelper, frameId, currentUsage.m_usageAggregator); - } - } - } - } - - RPCDisplayFilter* rpcFilter = detailDisplayHelper->GetRPCDisplayHelper(); - - if (rpcFilter) - { - const BandwidthUsageContainer::UsageAggregationMap& rpcUsage = usageContainer->GetDataTypeUsageAggregation(BandwidthUsage::DataType::REMOTE_PROCEDURE_CALL); - - const AZStd::vector< BaseDisplayHelper* >& rpcs = rpcFilter->GetChildren(); - - for (BaseDisplayHelper* helper : rpcs) - { - if (helper->m_graphEnabled) - { - KeyedDisplayHelper* rpc = static_cast*>(helper); - const BandwidthUsageContainer::UsageAggregationMap::const_iterator usageIter = rpcUsage.find(rpc->GetKey()); - - if (usageIter == rpcUsage.end()) - { - const BandwidthUsageAggregator emptyUsage; - PlotBatchedGraphData(rpc->m_areaGraphPlotHelper, frameId, emptyUsage); - } - else - { - const BandwidthUsage& currentUsage = usageIter->second; - PlotBatchedGraphData(rpc->m_areaGraphPlotHelper, frameId, currentUsage.m_usageAggregator); - } - } - } - } - } - - // GRAPHCHANGE - template - void BaseDetailView::DrawAggregateGraph() - { - BandwidthUsageContainer emptyContainer; - - ConfigureGraphAxis(); - - BaseDetailDisplayHelper* aggregateDisplayHelper = FindAggregateDisplay(); - - ConfigureBaseDetailDisplayHelper(aggregateDisplayHelper); - - const typename ReplicaBandwidthChartData::FrameMap& frameMap = GetFrameData(); - - for (FrameNumberType frameId = m_replicaDataView->GetStartFrame(); frameId <= m_replicaDataView->GetEndFrame(); ++frameId) - { - typename ReplicaBandwidthChartData::FrameMap::const_iterator frameIter = frameMap.find(frameId); - const typename ReplicaBandwidthChartData::BandwidthUsageMap* usageMap = nullptr; - - if (frameIter != frameMap.end()) - { - usageMap = frameIter->second; - } - else - { - static typename ReplicaBandwidthChartData::BandwidthUsageMap s_emptyMap; - usageMap = &s_emptyMap; - } - - AZ_Assert(usageMap != nullptr,"Null pointer added to data map"); - if (usageMap == nullptr) - { - continue; - } - - BandwidthUsageAggregator overallUsageAggregator; - - BandwidthUsageAggregator overallDataSetUsage; - AZStd::unordered_map dataSetAggregators; - DataSetDisplayFilter* dataSetFilter = aggregateDisplayHelper->GetDataSetDisplayHelper(); - - BandwidthUsageAggregator overallRPCUsage; - AZStd::unordered_map rpcAggregators; - RPCDisplayFilter* rpcFilter = aggregateDisplayHelper->GetRPCDisplayHelper(); - - for (const Key& currentId : m_activeIds) - { - const BandwidthUsageContainer* usageContainer = nullptr; - typename ReplicaBandwidthChartData::BandwidthUsageMap::const_iterator usageIter = usageMap->find(currentId); - - if (usageIter != usageMap->end()) - { - usageContainer = usageIter->second; - - overallUsageAggregator.m_bytesSent += usageContainer->GetTotalBytesSent(); - overallUsageAggregator.m_bytesReceived += usageContainer->GetTotalBytesReceived(); - } - else - { - usageContainer = &emptyContainer; - } - - if (dataSetFilter) - { - const BandwidthUsageContainer::UsageAggregationMap& dataSetUsage = usageContainer->GetDataTypeUsageAggregation(BandwidthUsage::DataType::DATA_SET); - - const AZStd::vector< BaseDisplayHelper* >& dataSets = dataSetFilter->GetChildren(); - - for (BaseDisplayHelper* helper : dataSets) - { - KeyedDisplayHelper* dataSet = static_cast*>(helper); - const BandwidthUsageContainer::UsageAggregationMap::const_iterator usageAggIter = dataSetUsage.find(dataSet->GetKey()); - - if (usageAggIter != dataSetUsage.end()) - { - const BandwidthUsage& currentUsage = usageAggIter->second; - - overallDataSetUsage.m_bytesSent += currentUsage.m_usageAggregator.m_bytesSent; - overallDataSetUsage.m_bytesReceived += currentUsage.m_usageAggregator.m_bytesReceived; - - if (helper->m_graphEnabled) - { - BandwidthUsageAggregator& dataSetAggregator = dataSetAggregators[dataSet->GetKey()]; - dataSetAggregator.m_bytesSent += currentUsage.m_usageAggregator.m_bytesSent; - dataSetAggregator.m_bytesReceived += currentUsage.m_usageAggregator.m_bytesReceived; - } - } - } - } - - if (rpcFilter) - { - const BandwidthUsageContainer::UsageAggregationMap& rpcUsage = usageContainer->GetDataTypeUsageAggregation(BandwidthUsage::DataType::REMOTE_PROCEDURE_CALL); - - const AZStd::vector< BaseDisplayHelper* >& rpcs = rpcFilter->GetChildren(); - - for (BaseDisplayHelper* helper : rpcs) - { - KeyedDisplayHelper* rpc = static_cast*>(helper); - const BandwidthUsageContainer::UsageAggregationMap::const_iterator usageAggIter = rpcUsage.find(rpc->GetKey()); - - if (usageAggIter != rpcUsage.end()) - { - const BandwidthUsage& currentUsage = usageAggIter->second; - - overallRPCUsage.m_bytesSent += currentUsage.m_usageAggregator.m_bytesSent; - overallRPCUsage.m_bytesReceived += currentUsage.m_usageAggregator.m_bytesReceived; - - if (helper->m_graphEnabled) - { - BandwidthUsageAggregator& rpcAggregator = rpcAggregators[rpc->GetKey()]; - rpcAggregator.m_bytesSent += currentUsage.m_usageAggregator.m_bytesSent; - rpcAggregator.m_bytesReceived += currentUsage.m_usageAggregator.m_bytesReceived; - } - } - } - } - } - - if (m_detailMode == DetailMode::Low) - { - if (aggregateDisplayHelper->m_graphEnabled) - { - PlotBatchedGraphData(aggregateDisplayHelper->m_areaGraphPlotHelper, frameId, overallUsageAggregator); - } - } - else if (m_detailMode == DetailMode::Medium) - { - if (dataSetFilter && dataSetFilter->m_graphEnabled) - { - PlotBatchedGraphData(dataSetFilter->m_areaGraphPlotHelper, frameId, overallDataSetUsage); - } - - if (rpcFilter && rpcFilter->m_graphEnabled) - { - PlotBatchedGraphData(rpcFilter->m_areaGraphPlotHelper, frameId, overallRPCUsage); - } - } - else if (m_detailMode == DetailMode::High) - { - if (dataSetFilter) - { - const AZStd::vector< BaseDisplayHelper* >& dataSets = dataSetFilter->GetChildren(); - for (BaseDisplayHelper* helper : dataSets) - { - if (!helper->m_graphEnabled) - { - continue; - } - - KeyedDisplayHelper* dataSet = static_cast*>(helper); - BandwidthUsageAggregator& dataSetAggregator = dataSetAggregators[dataSet->GetKey()]; - - PlotBatchedGraphData(helper->m_areaGraphPlotHelper, frameId, dataSetAggregator); - } - } - - if (rpcFilter) - { - const AZStd::vector< BaseDisplayHelper* >& rpcs = rpcFilter->GetChildren(); - for (BaseDisplayHelper* helper : rpcs) - { - if (!helper->m_graphEnabled) - { - continue; - } - - KeyedDisplayHelper* rpc = static_cast*>(helper); - BandwidthUsageAggregator& rpcAggregator = rpcAggregators[rpc->GetKey()]; - - PlotBatchedGraphData(helper->m_areaGraphPlotHelper, frameId, rpcAggregator); - } - } - } - } - } - - template - void BaseDetailView::ConfigureBaseDetailDisplayHelper(BaseDetailDisplayHelper* detailDisplayHelper) - { - detailDisplayHelper->ResetGraphConfiguration(); - - if (detailDisplayHelper->m_graphEnabled && m_detailMode == DetailMode::Low) - { - detailDisplayHelper->m_areaGraphPlotHelper.SetupPlotHelper(m_gui->areaChart, detailDisplayHelper->GetDisplayName(), m_replicaDataView->GetActiveFrameCount()); - detailDisplayHelper->m_areaGraphPlotHelper.SetHighlighted(detailDisplayHelper->m_selected); - } - - if (m_detailMode == DetailMode::Medium || m_detailMode == DetailMode::High) - { - RPCDisplayFilter* rpcFilter = detailDisplayHelper->GetRPCDisplayHelper(); - - if (rpcFilter) - { - if (m_detailMode == DetailMode::Medium) - { - if (rpcFilter->m_graphEnabled) - { - rpcFilter->m_areaGraphPlotHelper.SetupPlotHelper(m_gui->areaChart, rpcFilter->GetDisplayName(), m_replicaDataView->GetActiveFrameCount()); - rpcFilter->m_areaGraphPlotHelper.SetHighlighted(rpcFilter->m_selected); - } - } - else if (m_detailMode == DetailMode::High) - { - const AZStd::vector< BaseDisplayHelper* >& rpcs = rpcFilter->GetChildren(); - - for (BaseDisplayHelper* helper : rpcs) - { - if (helper->m_graphEnabled) - { - helper->m_areaGraphPlotHelper.SetupPlotHelper(m_gui->areaChart, helper->GetDisplayName(), m_replicaDataView->GetActiveFrameCount()); - helper->m_areaGraphPlotHelper.SetHighlighted(helper->m_selected); - } - } - } - } - - DataSetDisplayFilter* dataSetFilter = detailDisplayHelper->GetDataSetDisplayHelper(); - - if (dataSetFilter) - { - if (m_detailMode == DetailMode::Medium) - { - if (dataSetFilter->m_graphEnabled) - { - dataSetFilter->m_areaGraphPlotHelper.SetupPlotHelper(m_gui->areaChart, dataSetFilter->GetDisplayName(), m_replicaDataView->GetActiveFrameCount()); - dataSetFilter->m_areaGraphPlotHelper.SetHighlighted(dataSetFilter->m_selected); - } - } - else if (m_detailMode == DetailMode::High) - { - const AZStd::vector< BaseDisplayHelper* >& dataSets = dataSetFilter->GetChildren(); - - for (BaseDisplayHelper* helper : dataSets) - { - if (helper->m_graphEnabled) - { - helper->m_areaGraphPlotHelper.SetupPlotHelper(m_gui->areaChart, dataSetFilter->GetDisplayName(), m_replicaDataView->GetActiveFrameCount()); - helper->m_areaGraphPlotHelper.SetHighlighted(helper->m_selected); - } - } - } - } - } - } -} diff --git a/Code/Tools/Standalone/Source/Driller/Replica/BaseDetailViewQObject.cpp b/Code/Tools/Standalone/Source/Driller/Replica/BaseDetailViewQObject.cpp deleted file mode 100644 index 4c71c2bf57..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Replica/BaseDetailViewQObject.cpp +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "BaseDetailViewQObject.hxx" -#include -#include - -#include "Source/Driller/AreaChart.hxx" -#include "Source/Driller/Replica/ReplicaDataView.hxx" - -namespace Driller -{ - BaseDetailViewQObject::BaseDetailViewQObject(QWidget* parent) - : QDialog(parent) - { - } - - void BaseDetailViewQObject::SetupSignals(ReplicaDataView* dataView, Ui::BaseDetailView* detailView) - { - QObject::connect(dataView,SIGNAL(DataRangeChanged()),this,SLOT(DataRangeChanged())); - QObject::connect(detailView->treeView,SIGNAL(doubleClicked(const QModelIndex&)),this,SLOT(DoubleClicked(const QModelIndex&))); - QObject::connect(detailView->bandwidthUsageDisplayType, SIGNAL(currentIndexChanged(int)), this, SLOT(BandwidthDisplayUsageTypeChanged(int))); - QObject::connect(detailView->graphDetailType, SIGNAL(currentIndexChanged(int)), this, SLOT(GraphDetailChanged(int))); - - detailView->areaChart->EnableMouseInspection(true); - - QObject::connect(detailView->areaChart, SIGNAL(InspectedSeries(size_t)), this, SLOT(InspectedSeries(size_t))); - QObject::connect(detailView->areaChart, SIGNAL(SelectedSeries(size_t, int)), this, SLOT(SelectedSeries(size_t, int))); - - QObject::connect(detailView->configToolbar,SIGNAL(hideAll()),this,SLOT(HideAll())); - QObject::connect(detailView->configToolbar,SIGNAL(hideSelected()),this,SLOT(HideSelected())); - QObject::connect(detailView->configToolbar,SIGNAL(showAll()),this,SLOT(ShowAll())); - QObject::connect(detailView->configToolbar,SIGNAL(showSelected()),this,SLOT(ShowSelected())); - QObject::connect(detailView->configToolbar,SIGNAL(collapseAll()),this,SLOT(CollapseAll())); - QObject::connect(detailView->configToolbar,SIGNAL(expandAll()),this,SLOT(ExpandAll())); - } - - void BaseDetailViewQObject::SetupTreeViewSignals(QTreeView* treeView) - { - QObject::connect(treeView->selectionModel(),SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)),this, SLOT(SelectionChanged(const QItemSelection&, const QItemSelection&))); - } - - void BaseDetailViewQObject::DataRangeChanged() - { - OnDataRangeChanged(); - } - - void BaseDetailViewQObject::HideAll() - { - SetAllEnabled(false); - } - - void BaseDetailViewQObject::ShowAll() - { - SetAllEnabled(true); - } - - void BaseDetailViewQObject::HideSelected() - { - SetSelectedEnabled(false); - } - - void BaseDetailViewQObject::ShowSelected() - { - SetSelectedEnabled(true); - } - - void BaseDetailViewQObject::CollapseAll() - { - OnCollapseAll(); - } - - void BaseDetailViewQObject::ExpandAll() - { - OnExpandAll(); - } - - void BaseDetailViewQObject::DoubleClicked(const QModelIndex& index) - { - OnDoubleClicked(index); - } - - void BaseDetailViewQObject::SelectionChanged(const QItemSelection& selected, const QItemSelection& deselected) - { - OnSelectionChanged(selected,deselected); - } - - void BaseDetailViewQObject::UpdateDisplay(const QModelIndex& startIndex, const QModelIndex& endIndex) - { - OnUpdateDisplay(startIndex,endIndex); - } - - void BaseDetailViewQObject::DisplayModeChanged(int aggregationType) - { - OnDisplayModeChanged(aggregationType); - } - - void BaseDetailViewQObject::GraphDetailChanged(int graphDetailType) - { - OnGraphDetailChanged(graphDetailType); - } - - void BaseDetailViewQObject::BandwidthDisplayUsageTypeChanged(int bandwidthUsageType) - { - OnBandwidthDisplayUsageTypeChanged(bandwidthUsageType); - } - - void BaseDetailViewQObject::InspectedSeries(size_t seriesId) - { - OnInspectedSeries(seriesId); - } - - void BaseDetailViewQObject::SelectedSeries(size_t seriesId, int position) - { - OnSelectedSeries(seriesId, position); - } -} diff --git a/Code/Tools/Standalone/Source/Driller/Replica/BaseDetailViewQObject.hxx b/Code/Tools/Standalone/Source/Driller/Replica/BaseDetailViewQObject.hxx deleted file mode 100644 index 16dbaed6fa..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Replica/BaseDetailViewQObject.hxx +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef DRILLER_REPLICA_BASEDETAILVIEWQOBJECT_H -#define DRILLER_REPLICA_BASEDETAILVIEWQOBJECT_H - -#if !defined(Q_MOC_RUN) -#include -#include - -#include -#include -#endif - -namespace Ui -{ - class BaseDetailView; -} - -namespace Driller -{ - class ReplicaDataView; - - // This class is a work around because QT does not play nicely with templates. - // So I'm going to do all of my Qt related signalling here and just pass it along - // to a virtual function. - class BaseDetailViewQObject : public QDialog - { - Q_OBJECT - public: - - AZ_CLASS_ALLOCATOR(BaseDetailViewQObject, AZ::SystemAllocator,0); - - BaseDetailViewQObject(QWidget* parent = nullptr); - - void SetupSignals(ReplicaDataView* dataView, Ui::BaseDetailView* detailView); - void SetupTreeViewSignals(QTreeView* treeView); - - public slots: - void DataRangeChanged(); - void HideAll(); - void ShowAll(); - - void HideSelected(); - void ShowSelected(); - - void CollapseAll(); - void ExpandAll(); - - void DoubleClicked(const QModelIndex& index); - void SelectionChanged(const QItemSelection& selected, const QItemSelection& deselected); - void UpdateDisplay(const QModelIndex& startIndex, const QModelIndex& endIndex); - - void DisplayModeChanged(int); - void GraphDetailChanged(int); - void BandwidthDisplayUsageTypeChanged(int); - - void InspectedSeries(size_t seriesId); - void SelectedSeries(size_t seriesId, int position); - - protected: - virtual void OnDataRangeChanged() = 0; - - virtual void SetAllEnabled(bool enabled) = 0; - virtual void SetSelectedEnabled(bool enabled) = 0; - - virtual void OnCollapseAll() = 0; - virtual void OnExpandAll() = 0; - - virtual void OnDoubleClicked(const QModelIndex& index) = 0; - virtual void OnSelectionChanged(const QItemSelection& selected, const QItemSelection& deselected) = 0; - virtual void OnUpdateDisplay(const QModelIndex& startIndex, const QModelIndex& endIndex) = 0; - - virtual void OnDisplayModeChanged(int) = 0; - virtual void OnGraphDetailChanged(int) = 0; - virtual void OnBandwidthDisplayUsageTypeChanged(int) = 0; - - virtual void OnInspectedSeries(size_t seriesId) = 0; - virtual void OnSelectedSeries(size_t seriesId, int position) = 0; - }; -} - -#endif diff --git a/Code/Tools/Standalone/Source/Driller/Replica/BaseDetailViewSavedState.h b/Code/Tools/Standalone/Source/Driller/Replica/BaseDetailViewSavedState.h deleted file mode 100644 index 8c16507c42..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Replica/BaseDetailViewSavedState.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef DRILLER_REPLICA_BASEDETAILVIEWSAVEDSTATE_H -#define DRILLER_REPLICA_BASEDETAILVIEWSAVEDSTATE_H - -#include -#include -#include - -namespace Driller -{ - class BaseDetailViewSplitterSavedState - : public AZ::UserSettings - { - public: - AZ_RTTI(BaseDetailViewSplitterSavedState, "{280A523E-9A7F-4E23-BAF8-1F6084AB77D6}", AZ::UserSettings); - AZ_CLASS_ALLOCATOR(BaseDetailViewSplitterSavedState, AZ::SystemAllocator, 0); - - AZStd::vector< AZ::u8 > m_splitterStorage; - - static void Reflect(AZ::ReflectContext* context) - { - AZ::SerializeContext* serialize = azrtti_cast(context); - - if (serialize) - { - serialize->Class() - ->Field("m_splitterStorage", &BaseDetailViewSplitterSavedState::m_splitterStorage) - ->Version(1); - ; - } - } - }; - - class BaseDetailViewTreeSavedState - : public AZ::UserSettings - { - public: - AZ_RTTI(BaseDetailViewTreeSavedState, "{4B3ED3CE-5446-4DCD-98D3-62B577A75786}", AZ::UserSettings); - AZ_CLASS_ALLOCATOR(BaseDetailViewTreeSavedState, AZ::SystemAllocator, 0); - - AZStd::vector m_treeColumnStorage; - - static void Reflect(AZ::ReflectContext* context) - { - AZ::SerializeContext* serialize = azrtti_cast(context); - - if (serialize) - { - serialize->Class() - ->Field("m_treeColumnStorage", &BaseDetailViewTreeSavedState::m_treeColumnStorage) - ->Version(1); - } - } - }; -} -#endif diff --git a/Code/Tools/Standalone/Source/Driller/Replica/OverallReplicaDetailView.cpp b/Code/Tools/Standalone/Source/Driller/Replica/OverallReplicaDetailView.cpp deleted file mode 100644 index 54bdf1a77e..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Replica/OverallReplicaDetailView.cpp +++ /dev/null @@ -1,746 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ -#include - -#include -#include - -#include "OverallReplicaDetailView.hxx" -#include -#include - -#include "ReplicaChunkUsageDataContainers.h" -#include "ReplicaDataAggregator.hxx" -#include "ReplicaDataEvents.h" -#include "ReplicaUsageDataContainers.h" - -#include "Source/Driller/DrillerMainWindowMessages.h" -#include "Source/Driller/DrillerOperationTelemetryEvent.h" -#include "Source/Driller/Replica/ReplicaDataView.hxx" -#include "Source/Driller/Replica/ReplicaDisplayHelpers.h" -#include "Source/Driller/Workspaces/Workspace.h" - -namespace Driller -{ - //////////////////////// - // TreeModelSavedState - //////////////////////// - class TreeModelSavedState - : public AZ::UserSettings - { - public: - AZ_RTTI(TreeModelSavedState, "{36103E46-2503-4EEE-BA4B-2650E25A5B26}", AZ::UserSettings); - AZ_CLASS_ALLOCATOR(TreeModelSavedState, AZ::SystemAllocator, 0); - - AZStd::vector m_treeColumnStorage; - - static void Reflect(AZ::ReflectContext* context) - { - AZ::SerializeContext* serialize = azrtti_cast(context); - - if (serialize) - { - serialize->Class() - ->Field("m_treeColumnStorage", &TreeModelSavedState::m_treeColumnStorage) - ->Version(1); - } - } - }; - - //////////////////////////////// - // OverallReplicaTreeViewModel - //////////////////////////////// - - OverallReplicaTreeViewModel::OverallReplicaTreeViewModel(AbstractOverallReplicaDetailView* overallDetailView) - : BaseOverallTreeViewModel(overallDetailView) - { - } - - int OverallReplicaTreeViewModel::columnCount(const QModelIndex& parentIndex) const - { - (void)parentIndex; - - return CD_COUNT; - } - - QVariant OverallReplicaTreeViewModel::data(const QModelIndex& index, int role) const - { - const bool relativeValue = true; - const bool absoluteValue = false; - - const BaseDisplayHelper* baseDisplay = static_cast(index.internalPointer()); - - switch (index.column()) - { - case CD_DISPLAY_NAME: - return displayNameData(baseDisplay, role); - case CD_REPLICA_ID: - { - if (role == Qt::DisplayRole || role == Qt::UserRole) - { - AZ::u64 replicaId = 0; - - const BaseDisplayHelper* currentDisplay = baseDisplay; - - while (currentDisplay != nullptr && !azrtti_istypeof(currentDisplay)) - { - currentDisplay = currentDisplay->GetParent(); - } - - if (currentDisplay) - { - const OverallReplicaDetailDisplayHelper* replicaDisplay = static_cast(currentDisplay); - replicaId = replicaDisplay->GetReplicaId(); - } - - if (role == Qt::DisplayRole) - { - return FormattingHelper::ReplicaID(replicaId); - } - else - { - return QVariant(replicaId); - } - } - } - break; - case CD_TOTAL_SENT: - return totalSentData(baseDisplay, role); - case CD_AVG_SENT_FRAME: - return avgSentPerFrameData(baseDisplay, role); - case CD_AVG_SENT_SECOND: - return avgSentPerSecondData(baseDisplay, role); - case CD_PARENT_PERCENT_SENT: - return percentOfSentData(baseDisplay, role, relativeValue); - case CD_TOTAL_PERCENT_SENT: - return percentOfSentData(baseDisplay, role, absoluteValue); - case CD_TOTAL_RECEIVED: - return totalReceivedData(baseDisplay, role); - case CD_AVG_RECEIVED_FRAME: - return avgReceivedPerFrameData(baseDisplay, role); - case CD_AVG_RECEIVED_SECOND: - return avgReceivedPerSecondData(baseDisplay, role); - case CD_PARENT_PERCENT_RECEIVED: - return percentOfReceivedData(baseDisplay, role, relativeValue); - case CD_TOTAL_PERCENT_RECEIVED: - return percentOfReceivedData(baseDisplay, role, absoluteValue); - default: - AZ_Warning("OverallReplicaTreeViewModel", false, "Unknown Column"); - break; - } - - return QVariant(); - } - - QVariant OverallReplicaTreeViewModel::headerData(int section, Qt::Orientation orientation, int role) const - { - if (role == Qt::DisplayRole) - { - if (orientation == Qt::Horizontal) - { - switch (section) - { - case CD_DISPLAY_NAME: - return QString("Name"); - case CD_REPLICA_ID: - return QString("ReplicaId"); - case CD_TOTAL_SENT: - return QString("Sent Bytes"); - case CD_AVG_SENT_FRAME: - return QString("Sent Bytes/Frame"); - case CD_AVG_SENT_SECOND: - return QString("Sent Bytes/Second"); - case CD_PARENT_PERCENT_SENT: - return QString("% of Parent Sent"); - case CD_TOTAL_PERCENT_SENT: - return QString("% of Total Sent"); - case CD_TOTAL_RECEIVED: - return QString("Received Bytes"); - case CD_AVG_RECEIVED_FRAME: - return QString("Received Bytes/Frame"); - case CD_AVG_RECEIVED_SECOND: - return QString("Received Bytes/Second"); - case CD_PARENT_PERCENT_RECEIVED: - return QString("% of Parent Received"); - case CD_TOTAL_PERCENT_RECEIVED: - return QString("% of Total Received"); - } - } - } - - return QVariant(); - } - - const BaseDisplayHelper* OverallReplicaTreeViewModel::FindDisplayHelperAtRoot(int row) const - { - if (row < 0 || row >= m_tableViewOrdering.size()) - { - return nullptr; - } - - return m_overallReplicaDetailView->FindReplicaDisplayHelper(m_tableViewOrdering[row]); - } - - ///////////////////////////////////////// - // OverallReplicaChunkTypeTreeViewModel - ///////////////////////////////////////// - - OverallReplicaChunkTypeTreeViewModel::OverallReplicaChunkTypeTreeViewModel(AbstractOverallReplicaDetailView* overallDetailView) - : BaseOverallTreeViewModel(overallDetailView) - { - } - - int OverallReplicaChunkTypeTreeViewModel::columnCount(const QModelIndex& parentIndex) const - { - (void)parentIndex; - - return CD_COUNT; - } - - QVariant OverallReplicaChunkTypeTreeViewModel::data(const QModelIndex& index, int role) const - { - const bool relativeValue = true; - const bool absoluteValue = false; - - const BaseDisplayHelper* baseDisplay = static_cast(index.internalPointer()); - - switch (index.column()) - { - case CD_DISPLAY_NAME: - return displayNameData(baseDisplay, role); - case CD_TOTAL_SENT: - return totalSentData(baseDisplay, role); - case CD_AVG_SENT_FRAME: - return avgSentPerFrameData(baseDisplay, role); - case CD_AVG_SENT_SECOND: - return avgSentPerSecondData(baseDisplay, role); - case CD_PARENT_PERCENT_SENT: - return percentOfSentData(baseDisplay, role, relativeValue); - case CD_TOTAL_PERCENT_SENT: - return percentOfSentData(baseDisplay, role, absoluteValue); - case CD_TOTAL_RECEIVED: - return totalReceivedData(baseDisplay, role); - case CD_AVG_RECEIVED_FRAME: - return avgReceivedPerFrameData(baseDisplay, role); - case CD_AVG_RECEIVED_SECOND: - return avgReceivedPerSecondData(baseDisplay, role); - case CD_PARENT_PERCENT_RECEIVED: - return percentOfReceivedData(baseDisplay, role, relativeValue); - case CD_TOTAL_PERCENT_RECEIVED: - return percentOfReceivedData(baseDisplay, role, absoluteValue); - default: - AZ_Warning("OverallReplicaTreeViewModel", false, "Unknown Column"); - break; - } - - return QVariant(); - } - - QVariant OverallReplicaChunkTypeTreeViewModel::headerData(int section, Qt::Orientation orientation, int role) const - { - if (role == Qt::DisplayRole) - { - if (orientation == Qt::Horizontal) - { - switch (section) - { - case CD_DISPLAY_NAME: - return QString("Name"); - case CD_TOTAL_SENT: - return QString("Sent Bytes"); - case CD_AVG_SENT_FRAME: - return QString("Sent Bytes/Frame"); - case CD_AVG_SENT_SECOND: - return QString("Sent Bytes/Second"); - case CD_PARENT_PERCENT_SENT: - return QString("% of Parent Sent"); - case CD_TOTAL_PERCENT_SENT: - return QString("% of Total Sent"); - case CD_TOTAL_RECEIVED: - return QString("Received Bytes"); - case CD_AVG_RECEIVED_FRAME: - return QString("Received Bytes/Frame"); - case CD_AVG_RECEIVED_SECOND: - return QString("Received Bytes/Second"); - case CD_PARENT_PERCENT_RECEIVED: - return QString("% of Parent Received"); - case CD_TOTAL_PERCENT_RECEIVED: - return QString("% of Total Received"); - } - } - } - - return QVariant(); - } - - const BaseDisplayHelper* OverallReplicaChunkTypeTreeViewModel::FindDisplayHelperAtRoot(int row) const - { - if (row < 0 || row >= m_tableViewOrdering.size()) - { - return nullptr; - } - - return m_overallReplicaDetailView->FindReplicaChunkTypeDisplayHelper(m_tableViewOrdering[row]); - } - - ///////////////////////////// - // OverallReplicaDetailView - ///////////////////////////// - - const char* OverallReplicaDetailView::WINDOW_STATE_FORMAT = "OVERALL_REPLICA_DETAIL_VIEW_WINDOW_STATE"; - const char* OverallReplicaDetailView::REPLICA_TREE_STATE_FORMAT = "OVERALL_REPLICA_DETAIL_VIEW_TREE_STATE"; - const char* OverallReplicaDetailView::REPLICA_CHUNK_TREE_STATE_FORMAT = "OVERALL_REPLICA_CHUNK_DETAIL_VIEW_TREE_STATE"; - - OverallReplicaDetailView::OverallReplicaDetailView(ReplicaDataView* dataView, const ReplicaDataAggregator& dataAggregator) - : AbstractOverallReplicaDetailView() - , m_lifespanTelemetry("OverallReplicaDetailView") - , m_replicaDataView(dataView) - , m_windowStateCRC(AZ::Crc32(WINDOW_STATE_FORMAT)) - , m_replicaTreeStateCRC(AZ::Crc32(REPLICA_TREE_STATE_FORMAT)) - , m_replicaChunkTreeStateCRC(AZ::Crc32(REPLICA_CHUNK_TREE_STATE_FORMAT)) - , m_dataAggregator(dataAggregator) - , m_overallReplicaModel(this) - , m_replicaFilterProxyModel(this) - , m_overallChunkTypeModel(this) - , m_replicaChunkTypeFilterProxyModel(this) - { - setAttribute(Qt::WA_DeleteOnClose, true); - setWindowFlags(windowFlags() | Qt::WindowMaximizeButtonHint | Qt::WindowMinimizeButtonHint); - - m_gui = azcreate(Ui::OverallReplicaDetailView, ()); - m_gui->setupUi(this); - - show(); - raise(); - activateWindow(); - setFocus(); - - QString titleName("Overall Replica Usage - %2"); - this->setWindowTitle(titleName.arg(m_dataAggregator.GetInspectionFileName())); - - // Loading up saved state - AZStd::intrusive_ptr windowState = AZ::UserSettings::Find(m_windowStateCRC, AZ::UserSettings::CT_GLOBAL); - - if (windowState) - { - windowState->RestoreGeometry(this); - } - auto treeState = AZ::UserSettings::Find(m_replicaTreeStateCRC, AZ::UserSettings::CT_GLOBAL); - - if (treeState) - { - QByteArray treeData((const char*)treeState->m_treeColumnStorage.data(), (int)treeState->m_treeColumnStorage.size()); - m_gui->overallReplicaUsage->header()->restoreState(treeData); - } - - treeState = AZ::UserSettings::Find(m_replicaChunkTreeStateCRC, AZ::UserSettings::CT_GLOBAL); - - if (treeState) - { - QByteArray treeData((const char*)treeState->m_treeColumnStorage.data(), (int)treeState->m_treeColumnStorage.size()); - m_gui->overallChunkTypeUsage->header()->restoreState(treeData); - } - - m_gui->startFrame->setMinimum(0); - m_gui->startFrame->setValue(0); - - m_gui->endFrame->setMaximum(static_cast(m_dataAggregator.GetFrameCount()) - 1); - m_gui->endFrame->setValue(static_cast(m_dataAggregator.GetFrameCount() - 1)); - - m_changeTimer.setInterval(500); - m_changeTimer.setSingleShot(true); - - UpdateFrameBoundaries(); - ParseData(); - SetupTreeView(); - UpdateDisplay(); - - QObject::connect(m_gui->startFrame, SIGNAL(valueChanged(int)), this, SLOT(QueueUpdate(int))); - QObject::connect(m_gui->endFrame, SIGNAL(valueChanged(int)), this, SLOT(QueueUpdate(int))); - QObject::connect(m_gui->framesPerSecond, SIGNAL(valueChanged(int)),this,SLOT(OnFPSChanged(int))); - connect(&m_changeTimer, SIGNAL(timeout()), SLOT(OnDataRangeChanged())); - } - - OverallReplicaDetailView::~OverallReplicaDetailView() - { - ClearData(); - - // Save out whatever data we want to save out. - auto pState = AZ::UserSettings::CreateFind(m_windowStateCRC, AZ::UserSettings::CT_GLOBAL); - if (pState) - { - pState->CaptureGeometry(this); - } - - auto treeState = AZ::UserSettings::CreateFind(m_replicaTreeStateCRC, AZ::UserSettings::CT_GLOBAL); - if (treeState) - { - if (m_gui->overallReplicaUsage && m_gui->overallReplicaUsage->header()) - { - QByteArray qba = m_gui->overallReplicaUsage->header()->saveState(); - treeState->m_treeColumnStorage.assign((AZ::u8*)qba.begin(), (AZ::u8*)qba.end()); - } - } - - treeState = AZ::UserSettings::CreateFind(m_replicaChunkTreeStateCRC, AZ::UserSettings::CT_GLOBAL); - if (treeState) - { - if (m_gui->overallChunkTypeUsage && m_gui->overallChunkTypeUsage->header()) - { - QByteArray qba = m_gui->overallChunkTypeUsage->header()->saveState(); - treeState->m_treeColumnStorage.assign((AZ::u8*)qba.begin(), (AZ::u8*)qba.end()); - } - } - - if (m_replicaDataView) - { - m_replicaDataView->SignalDialogClosed(this); - } - - azdestroy(m_gui); - } - - int OverallReplicaDetailView::GetFrameRange() const - { - return m_frameRange; - } - - int OverallReplicaDetailView::GetFPS() const - { - return m_gui->framesPerSecond->value(); - } - - void OverallReplicaDetailView::SignalDataViewDestroyed(ReplicaDataView* replicaDataView) - { - if (m_replicaDataView == replicaDataView) - { - m_replicaDataView = nullptr; - } - - close(); - } - - void OverallReplicaDetailView::ApplySettingsFromWorkspace(WorkspaceSettingsProvider*) - { - } - - void OverallReplicaDetailView::ActivateWorkspaceSettings(WorkspaceSettingsProvider*) - { - } - - void OverallReplicaDetailView::SaveSettingsToWorkspace(WorkspaceSettingsProvider*) - { - } - - void OverallReplicaDetailView::ApplyPersistentState() - { - } - - void OverallReplicaDetailView::Reflect(AZ::ReflectContext* context) - { - (void)context; - } - - void OverallReplicaDetailView::OnFPSChanged(int fps) - { - (void)fps; - - UpdateDisplay(); - } - - void OverallReplicaDetailView::QueueUpdate(int ignoredFrame) - { - (void)ignoredFrame; - - m_changeTimer.start(); - } - - void OverallReplicaDetailView::OnDataRangeChanged() - { - ParseData(); - UpdateFrameBoundaries(); - UpdateDisplay(); - } - - OverallReplicaDetailDisplayHelper* OverallReplicaDetailView::CreateReplicaDisplayHelper(const char* replicaName, AZ::u64 replicaId) - { - OverallReplicaDetailDisplayHelper* detailDisplay = nullptr; - - ReplicaDisplayHelperMap::iterator displayIter = m_replicaDisplayHelpers.find(replicaId); - - if (displayIter == m_replicaDisplayHelpers.end()) - { - detailDisplay = aznew OverallReplicaDetailDisplayHelper(replicaName, replicaId); - m_replicaDisplayHelpers.insert(ReplicaDisplayHelperMap::value_type(replicaId, detailDisplay)); - - m_overallReplicaModel.m_tableViewOrdering.push_back(replicaId); - } - else - { - detailDisplay = displayIter->second; - } - - return detailDisplay; - } - - OverallReplicaDetailDisplayHelper* OverallReplicaDetailView::FindReplicaDisplayHelper(AZ::u64 replicaId) - { - OverallReplicaDetailDisplayHelper* detailDisplay = nullptr; - - ReplicaDisplayHelperMap::iterator displayIter = m_replicaDisplayHelpers.find(replicaId); - - if (displayIter != m_replicaDisplayHelpers.end()) - { - detailDisplay = displayIter->second; - } - - return detailDisplay; - } - - ReplicaChunkDetailDisplayHelper* OverallReplicaDetailView::CreateReplicaChunkTypeDisplayHelper(const AZStd::string& chunkTypeName, AZ::u32 chunkIndex) - { - ReplicaChunkDetailDisplayHelper* detailDisplay = nullptr; - - ReplicaChunkTypeDisplayHelperMap::iterator displayIter = m_replicaChunkTypeDisplayHelpers.find(chunkTypeName); - - if (displayIter == m_replicaChunkTypeDisplayHelpers.end()) - { - detailDisplay = aznew ReplicaChunkDetailDisplayHelper(chunkTypeName.c_str(), chunkIndex); - m_replicaChunkTypeDisplayHelpers.insert(ReplicaChunkTypeDisplayHelperMap::value_type(chunkTypeName, detailDisplay)); - - m_overallChunkTypeModel.m_tableViewOrdering.push_back(chunkTypeName); - } - else - { - detailDisplay = displayIter->second; - } - - return detailDisplay; - } - - ReplicaChunkDetailDisplayHelper* OverallReplicaDetailView::FindReplicaChunkTypeDisplayHelper(const AZStd::string& chunkTypeName) - { - ReplicaChunkDetailDisplayHelper* detailDisplay = nullptr; - - ReplicaChunkTypeDisplayHelperMap::iterator displayIter = m_replicaChunkTypeDisplayHelpers.find(chunkTypeName); - - if (displayIter != m_replicaChunkTypeDisplayHelpers.end()) - { - detailDisplay = displayIter->second; - } - - return detailDisplay; - } - - void OverallReplicaDetailView::SaveOnExit() - { - } - - void OverallReplicaDetailView::UpdateFrameBoundaries() - { - m_gui->startFrame->setMaximum(m_gui->endFrame->value()); - m_gui->endFrame->setMinimum(m_gui->startFrame->value()); - - m_frameRange = (m_gui->endFrame->value() - m_gui->startFrame->value()) + 1; - - if (m_frameRange <= 0) - { - m_frameRange = 1; - } - } - - void OverallReplicaDetailView::ParseData() - { - // Not the best approach. But this shouldn't update all that frequently. - ClearData(); - - FrameNumberType startFrame = static_cast(m_gui->startFrame->value()); - FrameNumberType endFrame = static_cast(m_gui->endFrame->value()); - - EventNumberType startIndex = m_dataAggregator.GetFirstIndexAtFrame(startFrame); - EventNumberType endIndex = m_dataAggregator.GetFirstIndexAtFrame(endFrame) + m_dataAggregator.NumOfEventsAtFrame(endFrame); - - const Aggregator::EventListType& events = m_dataAggregator.GetEvents(); - - for (EventNumberType currentIndex = startIndex; currentIndex < endIndex; ++currentIndex) - { - ReplicaChunkEvent* chunkEvent = static_cast(events[currentIndex]); - - // Since I process each event twice, I need to do the total aggregation seperately. - if (chunkEvent->GetEventType() == Replica::RET_CHUNK_DATASET_SENT - || chunkEvent->GetEventType() == Replica::RET_CHUNK_RPC_SENT) - { - m_totalUsageAggregator.m_bytesSent += chunkEvent->GetUsageBytes(); - } - else - { - m_totalUsageAggregator.m_bytesReceived += chunkEvent->GetUsageBytes(); - } - - ProcessForReplica(chunkEvent); - ProcessForReplicaChunk(chunkEvent); - } - } - - void OverallReplicaDetailView::ProcessForReplica(ReplicaChunkEvent* chunkEvent) - { - const char* replicaName = chunkEvent->GetReplicaName(); - AZ::u64 replicaId = chunkEvent->GetReplicaId(); - - OverallReplicaDetailDisplayHelper* replicaDisplayHelper = CreateReplicaDisplayHelper(replicaName, replicaId); - - if (replicaDisplayHelper) - { - if (chunkEvent->GetEventType() == Replica::RET_CHUNK_DATASET_SENT - || chunkEvent->GetEventType() == Replica::RET_CHUNK_RPC_SENT) - { - replicaDisplayHelper->m_bandwidthUsageAggregator.m_bytesSent += chunkEvent->GetUsageBytes(); - } - else if (chunkEvent->GetEventType() == Replica::RET_CHUNK_RPC_RECEIVED - || chunkEvent->GetEventType() == Replica::RET_CHUNK_DATASET_RECEIVED) - { - replicaDisplayHelper->m_bandwidthUsageAggregator.m_bytesReceived += chunkEvent->GetUsageBytes(); - } - - ReplicaChunkDetailDisplayHelper* chunkDetailDisplayHelper = replicaDisplayHelper->FindReplicaChunk(chunkEvent->GetReplicaChunkIndex()); - - if (chunkDetailDisplayHelper == nullptr) - { - chunkDetailDisplayHelper = replicaDisplayHelper->CreateReplicaChunkDisplayHelper(chunkEvent->GetChunkTypeName(), chunkEvent->GetReplicaChunkIndex()); - } - - ProcessForBaseDetailDisplayHelper(chunkEvent, chunkDetailDisplayHelper); - } - } - - void OverallReplicaDetailView::ProcessForReplicaChunk(ReplicaChunkEvent* chunkEvent) - { - AZ::u32 chunkId = chunkEvent->GetReplicaChunkIndex(); - AZStd::string chunkTypeName = chunkEvent->GetChunkTypeName(); - - ReplicaChunkDetailDisplayHelper* chunkDisplayHelper = CreateReplicaChunkTypeDisplayHelper(chunkTypeName, chunkId); - - if (chunkDisplayHelper) - { - ProcessForBaseDetailDisplayHelper(chunkEvent, chunkDisplayHelper); - } - } - - void OverallReplicaDetailView::ProcessForBaseDetailDisplayHelper(ReplicaChunkEvent* chunkEvent, BaseDetailDisplayHelper* detailDisplayHelper) - { - if (chunkEvent->GetEventType() == Replica::RET_CHUNK_DATASET_SENT - || chunkEvent->GetEventType() == Replica::RET_CHUNK_DATASET_RECEIVED) - { - ReplicaChunkDataSetEvent* dataSetEvent = static_cast(chunkEvent); - - detailDisplayHelper->SetupDataSet(dataSetEvent->GetIndex(), dataSetEvent->GetDataSetName()); - - DataSetDisplayFilter* dataSetDisplayFilter = detailDisplayHelper->GetDataSetDisplayHelper(); - DataSetDisplayHelper* dataSetDisplayHelper = detailDisplayHelper->FindDataSet(dataSetEvent->GetIndex()); - - if (chunkEvent->GetEventType() == Replica::RET_CHUNK_DATASET_SENT) - { - detailDisplayHelper->m_bandwidthUsageAggregator.m_bytesSent += chunkEvent->GetUsageBytes(); - dataSetDisplayFilter->m_bandwidthUsageAggregator.m_bytesSent += chunkEvent->GetUsageBytes(); - dataSetDisplayHelper->m_bandwidthUsageAggregator.m_bytesSent += chunkEvent->GetUsageBytes(); - } - else - { - detailDisplayHelper->m_bandwidthUsageAggregator.m_bytesReceived += chunkEvent->GetUsageBytes(); - dataSetDisplayFilter->m_bandwidthUsageAggregator.m_bytesReceived += chunkEvent->GetUsageBytes(); - dataSetDisplayHelper->m_bandwidthUsageAggregator.m_bytesReceived += chunkEvent->GetUsageBytes(); - } - } - else - { - ReplicaChunkRPCEvent* rpcEvent = static_cast(chunkEvent); - - detailDisplayHelper->SetupRPC(rpcEvent->GetIndex(), rpcEvent->GetRPCName()); - - RPCDisplayFilter* rpcDisplayFilter = detailDisplayHelper->GetRPCDisplayHelper(); - RPCDisplayHelper* rpcDisplayHelper = detailDisplayHelper->FindRPC(rpcEvent->GetIndex()); - - if (chunkEvent->GetEventType() == Replica::RET_CHUNK_RPC_SENT) - { - detailDisplayHelper->m_bandwidthUsageAggregator.m_bytesSent += chunkEvent->GetUsageBytes(); - rpcDisplayFilter->m_bandwidthUsageAggregator.m_bytesSent += chunkEvent->GetUsageBytes(); - rpcDisplayHelper->m_bandwidthUsageAggregator.m_bytesSent += chunkEvent->GetUsageBytes(); - } - else - { - detailDisplayHelper->m_bandwidthUsageAggregator.m_bytesReceived += chunkEvent->GetUsageBytes(); - rpcDisplayFilter->m_bandwidthUsageAggregator.m_bytesReceived += chunkEvent->GetUsageBytes(); - rpcDisplayHelper->m_bandwidthUsageAggregator.m_bytesReceived += chunkEvent->GetUsageBytes(); - } - } - } - - void OverallReplicaDetailView::ClearData() - { - for (auto& mapPair : m_replicaDisplayHelpers) - { - delete mapPair.second; - } - m_replicaDisplayHelpers.clear(); - m_overallReplicaModel.m_tableViewOrdering.clear(); - - for (auto& mapPair : m_replicaChunkTypeDisplayHelpers) - { - delete mapPair.second; - } - m_replicaChunkTypeDisplayHelpers.clear(); - m_overallChunkTypeModel.m_tableViewOrdering.clear(); - - m_totalUsageAggregator.m_bytesSent = 0; - m_totalUsageAggregator.m_bytesReceived = 0; - } - - void OverallReplicaDetailView::UpdateDisplay() - { - int frameRange = GetFrameRange(); - - // Sent Total - m_gui->totalBytesSent->setText(QString::number(m_totalUsageAggregator.m_bytesSent)); - - size_t avgBytesPerFrame = m_totalUsageAggregator.m_bytesSent / frameRange; - m_gui->avgBytesSentFrame->setText(QString::number(avgBytesPerFrame)); - m_gui->avgBytesSentSecond->setText(QString::number(avgBytesPerFrame * GetFPS())); - - // Received Total - m_gui->totalBytesReceived->setText(QString::number(m_totalUsageAggregator.m_bytesReceived)); - - avgBytesPerFrame = m_totalUsageAggregator.m_bytesReceived / frameRange; - m_gui->avgBytesReceivedFrame->setText(QString::number(avgBytesPerFrame)); - m_gui->avgBytesReceivedSecond->setText(QString::number(avgBytesPerFrame * GetFPS())); - - m_overallChunkTypeModel.layoutChanged(); - m_overallReplicaModel.layoutChanged(); - } - - void OverallReplicaDetailView::SetupTreeView() - { - SetupReplicaTreeView(); - SetupReplicaChunkTypeTreeView(); - } - - void OverallReplicaDetailView::SetupReplicaTreeView() - { - m_replicaFilterProxyModel.setSortRole(Qt::UserRole); - m_replicaFilterProxyModel.setSourceModel(&m_overallReplicaModel); - - m_gui->overallReplicaUsage->setModel(&m_replicaFilterProxyModel); - } - - void OverallReplicaDetailView::SetupReplicaChunkTypeTreeView() - { - m_replicaChunkTypeFilterProxyModel.setSortRole(Qt::UserRole); - m_replicaChunkTypeFilterProxyModel.setSourceModel(&m_overallChunkTypeModel); - - m_gui->overallChunkTypeUsage->setModel(&m_replicaChunkTypeFilterProxyModel); - } -}; diff --git a/Code/Tools/Standalone/Source/Driller/Replica/OverallReplicaDetailView.hxx b/Code/Tools/Standalone/Source/Driller/Replica/OverallReplicaDetailView.hxx deleted file mode 100644 index 9232f678d7..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Replica/OverallReplicaDetailView.hxx +++ /dev/null @@ -1,470 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef PROFILER_REPLICA_OVERALLDETAILVIEW_H -#define PROFILER_REPLICA_OVERALLDETAILVIEW_H - -#if !defined(Q_MOC_RUN) -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include "Source/Driller/DrillerMainWindowMessages.h" -#include "Source/Driller/DrillerOperationTelemetryEvent.h" - -#include "Source/Driller/DrillerDataTypes.h" -#include "Source/Driller/Replica/ReplicaDisplayHelpers.h" -#include "Source/Driller/Replica/ReplicaTreeViewModel.hxx" - -#include "ReplicaBandwidthChartData.h" -#endif - -namespace Ui -{ - class OverallReplicaDetailView; -} - -namespace AZ { class ReflectContext; } - -namespace Driller -{ - class OverallReplicaDetailView; - class ReplicaDataView; - - class ReplicaDataAggregator; - - class ReplicaChunkDataEvent; - class ReplicaChunkReceivedDataEvent; - class ReplicaChunkSentDataEvent; - - class AbstractOverallReplicaDetailView - : public QDialog - { - template - friend class BaseOverallTreeViewModel; - - friend class OverallReplicaTreeViewModel; - friend class OverallReplicaChunkTypeTreeViewModel; - - Q_OBJECT - public: - virtual int GetFrameRange() const = 0; - virtual int GetFPS() const = 0; - - protected: - virtual OverallReplicaDetailDisplayHelper* FindReplicaDisplayHelper(AZ::u64 replicaId) = 0; - virtual ReplicaChunkDetailDisplayHelper* FindReplicaChunkTypeDisplayHelper(const AZStd::string& chunkTypeName) = 0; - - BandwidthUsageAggregator m_totalUsageAggregator; - }; - - template - class BaseOverallTreeViewModel : public ReplicaTreeViewModel - { - public: - AZ_CLASS_ALLOCATOR(BaseOverallTreeViewModel, AZ::SystemAllocator,0); - BaseOverallTreeViewModel(AbstractOverallReplicaDetailView* overallDetailView) - : m_overallReplicaDetailView(overallDetailView) - { - } - - AZStd::vector< Key > m_tableViewOrdering; - - protected: - - int GetRootRowCount() const override - { - return static_cast(m_tableViewOrdering.size()); - } - - QVariant displayNameData(const BaseDisplayHelper* baseDisplay, int role) const - { - if (role == Qt::DisplayRole || role == Qt::UserRole) - { - QString displayName = baseDisplay->GetDisplayName(); - - if (displayName.isEmpty()) - { - return QString(""); - } - else - { - return displayName; - } - } - else if (role == Qt::TextAlignmentRole) - { - return QVariant(Qt::AlignVCenter); - } - - return QVariant(); - } - - QVariant totalSentData(const BaseDisplayHelper* baseDisplay, int role) const - { - if (role == Qt::DisplayRole) - { - return QString::number(baseDisplay->m_bandwidthUsageAggregator.m_bytesSent); - } - else if (role == Qt::UserRole) - { - return baseDisplay->m_bandwidthUsageAggregator.m_bytesSent; - } - - return QVariant(); - } - - QVariant totalReceivedData(const BaseDisplayHelper* baseDisplay, int role) const - { - if (role == Qt::DisplayRole) - { - return QString::number(baseDisplay->m_bandwidthUsageAggregator.m_bytesReceived); - } - else if (role == Qt::UserRole) - { - return baseDisplay->m_bandwidthUsageAggregator.m_bytesReceived; - } - - return QVariant(); - } - - QVariant avgSentPerFrameData(const BaseDisplayHelper* baseDisplay, int role) const - { - if (role == Qt::DisplayRole) - { - return QString::number(baseDisplay->m_bandwidthUsageAggregator.m_bytesSent/m_overallReplicaDetailView->GetFrameRange()); - } - else if (role == Qt::UserRole) - { - return baseDisplay->m_bandwidthUsageAggregator.m_bytesSent/m_overallReplicaDetailView->GetFrameRange(); - } - - return QVariant(); - } - - QVariant avgReceivedPerFrameData(const BaseDisplayHelper* baseDisplay, int role) const - { - if (role == Qt::DisplayRole) - { - return QString::number(baseDisplay->m_bandwidthUsageAggregator.m_bytesReceived/m_overallReplicaDetailView->GetFrameRange()); - } - else if (role == Qt::UserRole) - { - return baseDisplay->m_bandwidthUsageAggregator.m_bytesReceived/m_overallReplicaDetailView->GetFrameRange(); - } - - return QVariant(); - } - - QVariant avgSentPerSecondData(const BaseDisplayHelper* baseDisplay, int role) const - { - if (role == Qt::DisplayRole) - { - return QString::number((baseDisplay->m_bandwidthUsageAggregator.m_bytesSent/m_overallReplicaDetailView->GetFrameRange()) * m_overallReplicaDetailView->GetFPS()); - } - else if (role == Qt::UserRole) - { - return (baseDisplay->m_bandwidthUsageAggregator.m_bytesSent/m_overallReplicaDetailView->GetFrameRange()) * m_overallReplicaDetailView->GetFPS(); - } - - return QVariant(); - } - - QVariant avgReceivedPerSecondData(const BaseDisplayHelper* baseDisplay, int role) const - { - if (role == Qt::DisplayRole) - { - return QString::number((baseDisplay->m_bandwidthUsageAggregator.m_bytesReceived/m_overallReplicaDetailView->GetFrameRange()) * m_overallReplicaDetailView->GetFPS()); - } - else if (role == Qt::UserRole) - { - return (baseDisplay->m_bandwidthUsageAggregator.m_bytesReceived/m_overallReplicaDetailView->GetFrameRange()) * m_overallReplicaDetailView->GetFPS(); - } - - return QVariant(); - } - - QVariant percentOfSentData(const BaseDisplayHelper* baseDisplay, int role, bool isRelative) const - { - if (role == Qt::DisplayRole || role == Qt::UserRole) - { - size_t denominator = m_overallReplicaDetailView->m_totalUsageAggregator.m_bytesSent; - - if (isRelative) - { - const BaseDisplayHelper* parentHelper = baseDisplay->GetParent(); - if (parentHelper) - { - denominator = parentHelper->m_bandwidthUsageAggregator.m_bytesSent; - } - } - - if (denominator == 0) - { - if (role == Qt::DisplayRole) - { - return QString::number(0,'f',3); - } - else - { - return QVariant(0.0f); - } - } - else - { - float value = static_cast(baseDisplay->m_bandwidthUsageAggregator.m_bytesSent)/static_cast(denominator)*100.0f; - - if (role == Qt::DisplayRole) - { - return QString::number(value,'f',3); - } - else - { - return QVariant(value); - } - } - } - - return QVariant(); - } - - QVariant percentOfReceivedData(const BaseDisplayHelper* baseDisplay, int role, bool isRelative) const - { - if (role == Qt::DisplayRole || role == Qt::UserRole) - { - size_t denominator = m_overallReplicaDetailView->m_totalUsageAggregator.m_bytesReceived; - - if (isRelative) - { - const BaseDisplayHelper* parentHelper = baseDisplay->GetParent(); - if (parentHelper) - { - denominator = parentHelper->m_bandwidthUsageAggregator.m_bytesReceived; - } - } - - if (denominator == 0) - { - if (role == Qt::DisplayRole) - { - return QString::number(0,'f',3); - } - else - { - return QVariant(0.0f); - } - } - else - { - float value = static_cast(baseDisplay->m_bandwidthUsageAggregator.m_bytesReceived)/static_cast(denominator)*100.0f; - - if (role == Qt::DisplayRole) - { - return QString::number(value,'f',3); - } - else - { - return QVariant(value); - } - } - } - - return QVariant(); - } - - AbstractOverallReplicaDetailView* m_overallReplicaDetailView; - }; - - class OverallReplicaTreeViewModel : public BaseOverallTreeViewModel - { - public: - enum ColumnDescriptor - { - // Forcing the index to start at 0 - CD_INDEX_FORCE = -1, - - // Ordering of this enum determines the display order in the tree - CD_DISPLAY_NAME, - CD_REPLICA_ID, - - CD_TOTAL_SENT, - CD_AVG_SENT_FRAME, - CD_AVG_SENT_SECOND, - CD_PARENT_PERCENT_SENT, - CD_TOTAL_PERCENT_SENT, - - CD_TOTAL_RECEIVED, - CD_AVG_RECEIVED_FRAME, - CD_AVG_RECEIVED_SECOND, - CD_PARENT_PERCENT_RECEIVED, - CD_TOTAL_PERCENT_RECEIVED, - - // Used for sizing of the TableView. Anything after this won't be displayed. - CD_COUNT - }; - - AZ_CLASS_ALLOCATOR(OverallReplicaTreeViewModel, AZ::SystemAllocator,0); - OverallReplicaTreeViewModel(AbstractOverallReplicaDetailView* overallDetailView); - - int columnCount(const QModelIndex& parentIndex = QModelIndex()) const override; - QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; - QVariant headerData(int section, Qt::Orientation orientation, int role) const override; - - protected: - const BaseDisplayHelper* FindDisplayHelperAtRoot(int row) const; - }; - - class OverallReplicaChunkTypeTreeViewModel : public BaseOverallTreeViewModel - { - public: - enum ColumnDescriptor - { - // Forcing the index to start at 0 - CD_INDEX_FORCE = -1, - - // Ordering of this enum determines the display order in the tree - CD_DISPLAY_NAME, - - CD_TOTAL_SENT, - CD_AVG_SENT_FRAME, - CD_AVG_SENT_SECOND, - CD_PARENT_PERCENT_SENT, - CD_TOTAL_PERCENT_SENT, - - CD_TOTAL_RECEIVED, - CD_AVG_RECEIVED_FRAME, - CD_AVG_RECEIVED_SECOND, - CD_PARENT_PERCENT_RECEIVED, - CD_TOTAL_PERCENT_RECEIVED, - - // Used for sizing of the TableView. Anything after this won't be displayed. - CD_COUNT - }; - - AZ_CLASS_ALLOCATOR(OverallReplicaChunkTypeTreeViewModel, AZ::SystemAllocator,0); - OverallReplicaChunkTypeTreeViewModel(AbstractOverallReplicaDetailView* overallDetailView); - - int columnCount(const QModelIndex& parentIndex = QModelIndex()) const override; - QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; - QVariant headerData(int section, Qt::Orientation orientation, int role) const override; - - protected: - const BaseDisplayHelper* FindDisplayHelperAtRoot(int row) const; - }; - - class OverallReplicaDetailView - : public AbstractOverallReplicaDetailView - { - private: - - Q_OBJECT - - template - friend class BaseOverallTreeViewModel; - - friend class OverallReplicaTreeViewModel; - friend class OverallReplicaChunkTypeTreeViewModel; - - typedef AZStd::unordered_map ReplicaDisplayHelperMap; - typedef AZStd::unordered_map ReplicaChunkTypeDisplayHelperMap; - - static const char* WINDOW_STATE_FORMAT; - static const char* REPLICA_TREE_STATE_FORMAT; - static const char* REPLICA_CHUNK_TREE_STATE_FORMAT; - - public: - AZ_CLASS_ALLOCATOR(OverallReplicaDetailView, AZ::SystemAllocator, 0); - - OverallReplicaDetailView(ReplicaDataView* dataView, const ReplicaDataAggregator& dataAggregator); - ~OverallReplicaDetailView(); - - int GetFrameRange() const override; - int GetFPS() const override; - - void SignalDataViewDestroyed(ReplicaDataView* replicaDataView); - - void ApplySettingsFromWorkspace(WorkspaceSettingsProvider*); - void ActivateWorkspaceSettings(WorkspaceSettingsProvider*); - void SaveSettingsToWorkspace(WorkspaceSettingsProvider*); - void ApplyPersistentState(); - - static void Reflect(AZ::ReflectContext* context); - - public slots: - - void OnFPSChanged(int); - - void QueueUpdate(int); - void OnDataRangeChanged(); - - private: - - OverallReplicaDetailDisplayHelper* CreateReplicaDisplayHelper(const char* replicaName, AZ::u64 replicaId); - OverallReplicaDetailDisplayHelper* FindReplicaDisplayHelper(AZ::u64 replicaId); - - ReplicaChunkDetailDisplayHelper* CreateReplicaChunkTypeDisplayHelper(const AZStd::string& chunkTypeName, AZ::u32 chunkIndex); - ReplicaChunkDetailDisplayHelper* FindReplicaChunkTypeDisplayHelper(const AZStd::string& chunkTypeName); - - void SaveOnExit(); - void UpdateFrameBoundaries(); - - void ParseData(); - void ProcessForReplica(ReplicaChunkEvent* chunkEvent); - void ProcessForReplicaChunk(ReplicaChunkEvent* chunkEvent); - void ProcessForBaseDetailDisplayHelper(ReplicaChunkEvent* chunkEvent, BaseDetailDisplayHelper* baseDetailDisplayHelper); - - void ClearData(); - - void UpdateDisplay(); - - void SetupTreeView(); - void SetupReplicaTreeView(); - void SetupReplicaChunkTypeTreeView(); - - // Window Telemetry - DrillerWindowLifepsanTelemetry m_lifespanTelemetry; - - ReplicaDataView* m_replicaDataView; - - // Window Saved State - AZ::Crc32 m_windowStateCRC; - AZ::Crc32 m_replicaTreeStateCRC; - AZ::Crc32 m_replicaChunkTreeStateCRC; - - // General Data Source - const ReplicaDataAggregator& m_dataAggregator; - - // Cached data - int m_frameRange; - - // UX niceties - QTimer m_changeTimer; - - // Display features for the Replica usage table - OverallReplicaTreeViewModel m_overallReplicaModel; - QSortFilterProxyModel m_replicaFilterProxyModel; - ReplicaDisplayHelperMap m_replicaDisplayHelpers; - - // Display features for the ReplicaChunkType usage table - OverallReplicaChunkTypeTreeViewModel m_overallChunkTypeModel; - QSortFilterProxyModel m_replicaChunkTypeFilterProxyModel; - ReplicaChunkTypeDisplayHelperMap m_replicaChunkTypeDisplayHelpers; - - Ui::OverallReplicaDetailView* m_gui; - }; -} - -#endif diff --git a/Code/Tools/Standalone/Source/Driller/Replica/ReplicaBandwidthChartData.cpp b/Code/Tools/Standalone/Source/Driller/Replica/ReplicaBandwidthChartData.cpp deleted file mode 100644 index d455f8ae29..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Replica/ReplicaBandwidthChartData.cpp +++ /dev/null @@ -1,397 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include - -#include "ReplicaBandwidthChartData.h" - -namespace Driller -{ - //////////////////// - // GraphPlotHelper - //////////////////// - - GraphPlotHelper::GraphPlotHelper(const QColor& displayColor) - : m_color(displayColor) - , m_channelId(StripChart::DataStrip::s_invalidChannelId) - , m_zeroOutLine(false) - , m_initializeLine(false) - , m_lastHorizontalValue(0.0f) - { - } - - void GraphPlotHelper::Reset() - { - m_initializeLine = true; - m_zeroOutLine = false; - m_channelId = StripChart::DataStrip::s_invalidChannelId; - m_lastHorizontalValue = 0.0f; - } - - bool GraphPlotHelper::IsSetup() const - { - return m_channelId != StripChart::DataStrip::s_invalidChannelId; - } - - void GraphPlotHelper::SetupPlotHelper(StripChart::DataStrip* chart, const char* channelName, float startValue) - { - if (chart == nullptr) - { - return; - } - - AZ_Assert(m_channelId == StripChart::DataStrip::s_invalidChannelId, "Double registering the GraphPlotHelper"); - - m_channelId = chart->AddChannel(channelName); - chart->SetChannelStyle(m_channelId, StripChart::Channel::STYLE_CONNECTED_LINE); - chart->SetChannelColor(m_channelId, m_color); - - m_lastHorizontalValue = startValue; - } - - void GraphPlotHelper::PlotData(StripChart::DataStrip* chart, float tickSize, float horizontalValue, float verticalValue, bool forceDraw) - { - if (chart == nullptr) - { - return; - } - - if (!IsSetup()) - { - SetupPlotHelper(chart, "", horizontalValue); - } - - bool hasData = !AZ::IsClose(verticalValue, 0.0f, 0.001f); - - float stepDifference = horizontalValue - m_lastHorizontalValue; - - if (m_zeroOutLine || hasData || forceDraw || m_initializeLine) - { - if (!hasData) - { - if (m_zeroOutLine) - { - chart->AddData(m_channelId, 0, m_lastHorizontalValue + tickSize, 0.0f); - } - else if (m_initializeLine) - { - chart->AddData(m_channelId, 0, m_lastHorizontalValue, 0.0f); - } - } - - if (stepDifference > tickSize + 0.001f) - { - chart->AddData(m_channelId, 0, horizontalValue - tickSize, 0.0f); - } - - m_initializeLine = false; - m_zeroOutLine = hasData; - m_lastHorizontalValue = horizontalValue; - - chart->AddData(m_channelId, 0, horizontalValue, verticalValue); - } - } - - void GraphPlotHelper::PlotBatchedData(StripChart::DataStrip* chart, float tickSize, float horizontalValue, float verticalValue, bool forceDraw) - { - bool hasData = !AZ::IsClose(verticalValue, 0.0f, 0.001f); - - float stepDifference = horizontalValue - m_lastHorizontalValue; - - if (m_zeroOutLine || hasData || forceDraw || m_initializeLine) - { - if (!hasData) - { - if (m_zeroOutLine) - { - chart->AddBatchedData(m_channelId, 0, m_lastHorizontalValue + tickSize, 0.0f); - } - else if (m_initializeLine) - { - chart->AddBatchedData(m_channelId, 0, m_lastHorizontalValue, 0.0f); - } - } - - if (stepDifference > tickSize + 0.001f) - { - chart->AddBatchedData(m_channelId, 0, horizontalValue - tickSize, 0.0f); - } - - m_initializeLine = false; - m_zeroOutLine = hasData; - m_lastHorizontalValue = horizontalValue; - - chart->AddBatchedData(m_channelId, 0, horizontalValue, verticalValue); - } - } - - void GraphPlotHelper::SetHighlight(StripChart::DataStrip* chart, bool highlight) - { - if (chart == nullptr || m_channelId == StripChart::DataStrip::s_invalidChannelId) - { - return; - } - - chart->SetChannelHighlight(m_channelId, highlight); - } - - void GraphPlotHelper::ZeroOutLine(float lastHorizontalValue, float tickSize, StripChart::DataStrip* chart) - { - if (m_zeroOutLine && !AZ::IsClose(lastHorizontalValue, m_lastHorizontalValue, 0.001f)) - { - chart->AddData(m_channelId, 0, m_lastHorizontalValue + tickSize, 0.0f); - } - } - - //////////////////////// - // AreaGraphPlotHelper - //////////////////////// - - AreaGraphPlotHelper::AreaGraphPlotHelper(const QColor& displayColor) - : m_color(displayColor) - , m_areaChart(nullptr) - , m_seriesId(AreaChart::AreaChart::k_invalidSeriesId) - { - } - - bool AreaGraphPlotHelper::IsSetup() const - { - return m_areaChart != nullptr && m_seriesId != AreaChart::AreaChart::k_invalidSeriesId; - } - - void AreaGraphPlotHelper::Reset() - { - m_areaChart = nullptr; - m_seriesId = AreaChart::AreaChart::k_invalidSeriesId; - } - - void AreaGraphPlotHelper::SetupPlotHelper(AreaChart::AreaChart* chart, const char* channelName, size_t seriesSize) - { - AZ_Error("AreaGraphPlotHelper", !IsSetup(), "Plot Helper is already setup."); - if (IsSetup()) - { - Reset(); - } - - QString name(channelName); - - m_areaChart = chart; - m_seriesId = m_areaChart->CreateSeries(name, m_color,seriesSize); - } - - void AreaGraphPlotHelper::PlotData(int position, unsigned int value) - { - if (IsSetup()) - { - m_areaChart->AddPoint(m_seriesId, position, value); - } - } - - void AreaGraphPlotHelper::PlotBatchedData(int position, unsigned int value) - { - m_areaChart->AddPoint(m_seriesId, position, value); - } - - void AreaGraphPlotHelper::SetHighlighted(bool highlighted) - { - if (IsSetup()) - { - m_areaChart->SetSeriesHighlight(m_seriesId, highlighted); - } - } - - void AreaGraphPlotHelper::SetEnabled(bool enabled) - { - if (IsSetup()) - { - m_areaChart->SetSeriesEnabled(m_seriesId, enabled); - } - } - - bool AreaGraphPlotHelper::IsSeries(size_t seriesId) const - { - if (m_seriesId == AreaChart::AreaChart::k_invalidSeriesId) - { - return false; - } - else - { - return m_seriesId == seriesId; - } - } - - ////////////////////////////// - // BandwidthUsageAggregator - ////////////////////////////// - - BandwidthUsageAggregator::BandwidthUsageAggregator() - : m_bytesSent(0) - , m_bytesReceived(0) - { - } - - void BandwidthUsageAggregator::Reset() - { - m_bytesSent = 0; - m_bytesReceived = 0; - } - - //////////////////////////// - // BandwidthUsageContainer - //////////////////////////// - - BandwidthUsageContainer::BandwidthUsageContainer() - { - m_dataTypeAggregationMap.insert(DataTypeAggreationMap::value_type(BandwidthUsage::DataType::DATA_SET, UsageAggregationMap())); - m_dataTypeAggregationMap.insert(DataTypeAggreationMap::value_type(BandwidthUsage::DataType::REMOTE_PROCEDURE_CALL, UsageAggregationMap())); - } - - BandwidthUsageContainer::~BandwidthUsageContainer() - { - } - - void BandwidthUsageContainer::ProcessChunkEvent(const ReplicaChunkEvent* chunkEvent) - { - BandwidthUsage* bandwidthUsage = nullptr; - - if (azrtti_istypeof(chunkEvent)) - { - const ReplicaChunkDataSetEvent* dataSetEvent = static_cast(chunkEvent); - - size_t index = dataSetEvent->GetIndex(); - - UsageAggregationMap& dataSetAggregationMap = m_dataTypeAggregationMap[BandwidthUsage::DataType::DATA_SET]; - - UsageAggregationMap::iterator usageIter = dataSetAggregationMap.find(index); - - if (usageIter == dataSetAggregationMap.end()) - { - BandwidthUsage usage; - - usage.m_dataType = BandwidthUsage::DataType::DATA_SET; - usage.m_identifier = dataSetEvent->GetDataSetName(); - usage.m_index = dataSetEvent->GetIndex(); - - usageIter = dataSetAggregationMap.insert(UsageAggregationMap::value_type(index, usage)).first; - } - - bandwidthUsage = (&usageIter->second); - - if (azrtti_istypeof(dataSetEvent)) - { - m_totalUsageAggregator.m_bytesSent += dataSetEvent->GetUsageBytes(); - bandwidthUsage->m_usageAggregator.m_bytesSent += dataSetEvent->GetUsageBytes(); - OnProcessSentDataSet(static_cast(dataSetEvent)); - } - else if (azrtti_istypeof(dataSetEvent)) - { - m_totalUsageAggregator.m_bytesReceived += dataSetEvent->GetUsageBytes(); - bandwidthUsage->m_usageAggregator.m_bytesReceived += dataSetEvent->GetUsageBytes(); - OnProcessReceivedDataSet(static_cast(dataSetEvent)); - } - else - { - AZ_Error("Standalone Tools", false, "Unknown event type in BadnwidthUsageContainer::ProcessChunkEvent."); - } - } - else if (azrtti_istypeof(chunkEvent)) - { - const ReplicaChunkRPCEvent* rpcEvent = static_cast(chunkEvent); - - size_t index = rpcEvent->GetIndex(); - - UsageAggregationMap& rpcUsageAggregationMap = m_dataTypeAggregationMap[BandwidthUsage::DataType::REMOTE_PROCEDURE_CALL]; - - UsageAggregationMap::iterator usageIter = rpcUsageAggregationMap.find(index); - - if (usageIter == rpcUsageAggregationMap.end()) - { - BandwidthUsage usage; - - usage.m_dataType = BandwidthUsage::DataType::REMOTE_PROCEDURE_CALL; - usage.m_identifier = rpcEvent->GetRPCName(); - usage.m_index = rpcEvent->GetIndex(); - - usageIter = rpcUsageAggregationMap.insert(UsageAggregationMap::value_type(index, usage)).first; - } - - bandwidthUsage = (&usageIter->second); - - if (azrtti_istypeof(rpcEvent)) - { - m_totalUsageAggregator.m_bytesSent += rpcEvent->GetUsageBytes(); - bandwidthUsage->m_usageAggregator.m_bytesSent += rpcEvent->GetUsageBytes(); - OnProcessSentRPC(static_cast(rpcEvent)); - } - else if (azrtti_istypeof(rpcEvent)) - { - m_totalUsageAggregator.m_bytesReceived += rpcEvent->GetUsageBytes(); - bandwidthUsage->m_usageAggregator.m_bytesReceived += rpcEvent->GetUsageBytes(); - OnProcessReceivedRPC(static_cast(rpcEvent)); - } - else - { - AZ_Error("Standalone Tools", false, "Unknown event type in BadnwidthUsageContainer::ProcessChunkEvent."); - } - } - else - { - AZ_Error("Standalone Tools", false, "Unknown event type in BadnwidthUsageContainer::ProcessChunkEvent."); - } - } - - size_t BandwidthUsageContainer::GetTotalBytesSent() const - { - return m_totalUsageAggregator.m_bytesSent; - } - - size_t BandwidthUsageContainer::GetTotalBytesReceived() const - { - return m_totalUsageAggregator.m_bytesReceived; - } - - size_t BandwidthUsageContainer::GetTotalBandwidthUsage() const - { - return GetTotalBytesSent() + GetTotalBytesReceived(); - } - - const BandwidthUsageContainer::UsageAggregationMap& BandwidthUsageContainer::GetDataTypeUsageAggregation(BandwidthUsage::DataType dataType) const - { - static UsageAggregationMap s_emptyMap; - - DataTypeAggreationMap::const_iterator dataTypeIterator = m_dataTypeAggregationMap.find(dataType); - - AZ_Error("Standalone Tools", dataTypeIterator != m_dataTypeAggregationMap.end(), "Use of Unknown DataType inside of GetDataTypeUsageAggreation"); - if (dataTypeIterator != m_dataTypeAggregationMap.end()) - { - return dataTypeIterator->second; - } - - return s_emptyMap; - } - - void BandwidthUsageContainer::OnProcessSentDataSet(const ReplicaChunkSentDataSetEvent* sentData) - { - (void)sentData; - } - - void BandwidthUsageContainer::OnProcessReceivedDataSet(const ReplicaChunkReceivedDataSetEvent* receivedData) - { - (void)receivedData; - } - - void BandwidthUsageContainer::OnProcessSentRPC(const ReplicaChunkSentRPCEvent* sentData) - { - (void)sentData; - } - - void BandwidthUsageContainer::OnProcessReceivedRPC(const ReplicaChunkReceivedRPCEvent* receivedData) - { - (void)receivedData; - } -} diff --git a/Code/Tools/Standalone/Source/Driller/Replica/ReplicaBandwidthChartData.h b/Code/Tools/Standalone/Source/Driller/Replica/ReplicaBandwidthChartData.h deleted file mode 100644 index 618dd54a89..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Replica/ReplicaBandwidthChartData.h +++ /dev/null @@ -1,401 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef DRILLER_REPLICA_BANDWIDTHCHARTDATA_H -#define DRILLER_REPLICA_BANDWIDTHCHARTDATA_H - -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "ReplicaDataEvents.h" -#include "Source/Driller/StripChart.hxx" -#include "Source/Driller/AreaChart.hxx" - -#include "Source/Driller/DrillerDataTypes.h" - -#include - -namespace Driller -{ - // Graph Helper - class GraphPlotHelper - { - public: - GraphPlotHelper(const QColor& displayColor); - - void Reset(); - bool IsSetup() const; - void SetupPlotHelper(StripChart::DataStrip* chart, const char* channelName, float startValue); - void PlotData(StripChart::DataStrip* chart, float tickSize, float horizontalValue, float verticalValue, bool forceDraw); - - // Call this if you are going to do safety checks and don't want the GraphPlotHelper to do that. - // i.e. if your adding a bunch of data in a row, you'll want to safety check once, then add all the data here. - void PlotBatchedData(StripChart::DataStrip* chart, float tickSize, float horizontalValue, float verticalValue, bool forceDraw); - - void SetHighlight(StripChart::DataStrip* chart, bool highlight); - void ZeroOutLine(float lastHorizontalValue, float tickSize, StripChart::DataStrip* chart); - - private: - QColor m_color; - int m_channelId; - bool m_zeroOutLine; - bool m_initializeLine; - float m_lastHorizontalValue; - }; - - class AreaGraphPlotHelper - { - public: - AreaGraphPlotHelper(const QColor& displayColor); - - bool IsSetup() const; - void Reset(); - - void SetupPlotHelper(AreaChart::AreaChart* chart, const char* channelName, size_t seriesSize = 0); - - void PlotData(int position, unsigned int value); - void PlotBatchedData(int position, unsigned int value); - - void SetHighlighted(bool highlighted); - void SetEnabled(bool enabled); - - bool IsSeries(size_t seriesId) const; - - private: - - QColor m_color; - - AreaChart::AreaChart* m_areaChart; - size_t m_seriesId; - }; - - struct BandwidthUsageAggregator - { - BandwidthUsageAggregator(); - - void Reset(); - - quint64 m_bytesSent; - quint64 m_bytesReceived; - }; - - struct BandwidthUsage - { - enum class DataType - { - UNKNOWN, - DATA_SET, - REMOTE_PROCEDURE_CALL - }; - - DataType m_dataType = DataType::UNKNOWN; - BandwidthUsageAggregator m_usageAggregator; - - size_t m_index; - AZStd::string m_identifier; - }; - - class BandwidthUsageContainer - { - public: - typedef AZStd::unordered_map UsageAggregationMap; - typedef AZStd::unordered_map DataTypeAggreationMap; - - AZ_CLASS_ALLOCATOR(BandwidthUsageContainer, AZ::SystemAllocator, 0); - - BandwidthUsageContainer(); - virtual ~BandwidthUsageContainer(); - - void ProcessChunkEvent(const ReplicaChunkEvent* chunkEvent); - - size_t GetTotalBytesSent() const; - size_t GetTotalBytesReceived() const; - size_t GetTotalBandwidthUsage() const; - - const UsageAggregationMap& GetDataTypeUsageAggregation(BandwidthUsage::DataType dataType) const; - - protected: - virtual void OnProcessSentDataSet(const ReplicaChunkSentDataSetEvent* sentData); - virtual void OnProcessReceivedDataSet(const ReplicaChunkReceivedDataSetEvent* receivedData); - - virtual void OnProcessSentRPC(const ReplicaChunkSentRPCEvent* sentData); - virtual void OnProcessReceivedRPC(const ReplicaChunkReceivedRPCEvent* receivedData); - - private: - DataTypeAggreationMap m_dataTypeAggregationMap; - - BandwidthUsageAggregator m_totalUsageAggregator; - }; - - template - class ReplicaBandwidthChartData - { - public: - typedef AZStd::unordered_map BandwidthUsageMap; - typedef AZStd::unordered_map FrameMap; - - public: - AZ_CLASS_ALLOCATOR(ReplicaBandwidthChartData, AZ::SystemAllocator, 0); - - ReplicaBandwidthChartData(const QColor& color) - : m_color(color) - , m_enabled(true) - , m_selected(false) - , m_inspected(false) - , m_areaGraphPlotHelper(color) - { - QPixmap pixmap(16, 16); - QPainter painter(&pixmap); - painter.setBrush(m_color); - painter.drawRect(0, 0, 16, 16); - - m_icon.addPixmap(pixmap); - } - - virtual ~ReplicaBandwidthChartData() - { - for (typename FrameMap::iterator frameIter = m_frameMapping.begin(); - frameIter != m_frameMapping.end(); - ++frameIter) - { - BandwidthUsageMap* bandwidthUsageMap = frameIter->second; - - for (typename BandwidthUsageMap::iterator usageIter = bandwidthUsageMap->begin(); - usageIter != bandwidthUsageMap->end(); - ++usageIter) - { - delete usageIter->second; - } - - azdestroy(bandwidthUsageMap); - } - } - - virtual const char* GetAxisName() const = 0; - - const QColor& GetColor() const - { - return m_color; - } - - const QIcon& GetIcon() const - { - if (m_enabled) - { - return m_icon; - } - else - { - static bool s_doOnce = true; - static QIcon s_blackIcon; - - if (s_doOnce) - { - s_doOnce = false; - - QPixmap pixmap(16, 16); - QPainter painter(&pixmap); - painter.setBrush(Qt::black); - painter.drawRect(0, 0, 16, 16); - - s_blackIcon.addPixmap(pixmap); - } - - return s_blackIcon; - } - } - - bool HasUsageForFrame(FrameNumberType frame) const - { - return m_frameMapping.find(frame) != m_frameMapping.end(); - } - - const BandwidthUsageMap& FindUsageForFrame(FrameNumberType frameId) const - { - static const BandwidthUsageMap emptyMap; - - typename FrameMap::const_iterator frameIter = m_frameMapping.find(frameId); - - if (frameIter == m_frameMapping.end()) - { - return emptyMap; - } - else - { - return (*frameIter->second); - } - } - - const FrameMap& GetUsageForAllFrames() const - { - return m_frameMapping; - } - - size_t GetSentUsageForFrame(FrameNumberType frameId) const - { - size_t totalSentUsage = 0; - const BandwidthUsageMap& frameMap = FindUsageForFrame(frameId); - - for (auto frameIter = frameMap.begin(); - frameIter != frameMap.end(); - ++frameIter) - { - totalSentUsage += frameIter->second->GetTotalBytesSent(); - } - - return totalSentUsage; - } - - size_t GetReceivedUsageForFrame(FrameNumberType frameId) const - { - size_t totalReceivedUsage = 0; - - const BandwidthUsageMap& frameMap = FindUsageForFrame(frameId); - - for (auto frameIter = frameMap.begin(); - frameIter != frameMap.end(); - ++frameIter) - { - totalReceivedUsage += frameIter->second->GetTotalBytesReceived(); - } - - return totalReceivedUsage; - } - - const FrameMap& GetAllFrames() const - { - return m_frameMapping; - } - - AZ::s64 GetActiveFrameCount() const - { - return m_frameMapping.size(); - } - - void SetEnabled(bool enabled) - { - m_enabled = enabled; - } - - bool IsEnabled() const - { - return m_enabled; - } - - void SetSelected(bool selected) - { - m_selected = selected; - } - - bool IsSelected() const - { - return m_selected; - } - - void SetInspected(bool inspected) - { - m_inspected = inspected; - } - - bool IsInspected() const - { - return m_inspected; - } - - AreaGraphPlotHelper& GetAreaGraphPlotHelper() - { - return m_areaGraphPlotHelper; - } - - void ProcessReplicaChunkEvent(FrameNumberType frameId, const ReplicaChunkEvent* chunkEvent) - { - BandwidthUsageContainer* container = GetUsageForFrame(frameId, chunkEvent); - - if (container) - { - container->ProcessChunkEvent(chunkEvent); - } - } - - protected: - - BandwidthUsageMap* GetUsageForFrame(FrameNumberType frameId) - { - BandwidthUsageMap* retVal = nullptr; - - typename FrameMap::iterator frameIter = m_frameMapping.find(frameId); - - if (frameIter == m_frameMapping.end()) - { - retVal = azcreate(BandwidthUsageMap, ()); - - if (retVal) - { - m_frameMapping.insert(typename FrameMap::value_type(frameId, retVal)); - } - } - else - { - retVal = frameIter->second; - } - - return retVal; - } - - BandwidthUsageContainer* GetUsageForFrame(FrameNumberType frameId, const ReplicaChunkEvent* chunkEvent) - { - BandwidthUsageContainer* chunkContainer = nullptr; - BandwidthUsageMap* usageMap = GetUsageForFrame(frameId); - - if (usageMap) - { - T usageKey = GetKeyFromEvent(chunkEvent); - typename BandwidthUsageMap::iterator chunkIter = usageMap->find(usageKey); - - if (chunkIter == usageMap->end()) - { - chunkContainer = CreateBandwidthUsage(chunkEvent); - - if (chunkContainer) - { - usageMap->insert(typename BandwidthUsageMap::value_type(usageKey, chunkContainer)); - } - } - else - { - chunkContainer = static_cast(chunkIter->second); - } - } - - return chunkContainer; - } - - virtual BandwidthUsageContainer* CreateBandwidthUsage(const ReplicaChunkEvent* chunkEvent) = 0; - virtual T GetKeyFromEvent(const ReplicaChunkEvent* chunkEvent) const = 0; - - private: - - QIcon m_icon; - QColor m_color; - - FrameMap m_frameMapping; - bool m_enabled; - bool m_selected; - bool m_inspected; - - AreaGraphPlotHelper m_areaGraphPlotHelper; - }; -} -#endif diff --git a/Code/Tools/Standalone/Source/Driller/Replica/ReplicaChunkTypeDetailView.cpp b/Code/Tools/Standalone/Source/Driller/Replica/ReplicaChunkTypeDetailView.cpp deleted file mode 100644 index 5a35b095e3..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Replica/ReplicaChunkTypeDetailView.cpp +++ /dev/null @@ -1,430 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include -#include - -#include "ReplicaChunkTypeDetailView.h" - -#include - -#include "ReplicaChunkUsageDataContainers.h" -#include "ReplicaDataAggregator.hxx" - -namespace Driller -{ - //////////////////////////////////// - // ReplicaChunkTypeDetailViewModel - //////////////////////////////////// - - ReplicaChunkTypeDetailViewModel::ReplicaChunkTypeDetailViewModel(ReplicaChunkTypeDetailView* chunkDetailView) - : BaseDetailTreeViewModel(chunkDetailView) - { - } - - int ReplicaChunkTypeDetailViewModel::columnCount(const QModelIndex& parentIndex) const - { - (void)parentIndex; - - return static_cast(CD_COUNT); - } - - QVariant ReplicaChunkTypeDetailViewModel::data(const QModelIndex& index, int role) const - { - const BaseDisplayHelper* baseDisplay = static_cast(index.internalPointer()); - - if (role == Qt::BackgroundRole) - { - if (baseDisplay->m_inspected) - { - return QVariant::fromValue(QColor(94, 94, 178, 255)); - } - } - else - { - switch (index.column()) - { - case CD_DISPLAY_NAME: - if (role == Qt::DecorationRole) - { - if (baseDisplay->HasIcon()) - { - return baseDisplay->GetIcon(); - } - } - else if (role == Qt::DisplayRole) - { - QString displayName = baseDisplay->GetDisplayName(); - - if (displayName.isEmpty()) - { - return QString(""); - } - else - { - return displayName; - } - } - else if (role == Qt::TextAlignmentRole) - { - return QVariant(Qt::AlignVCenter); - } - - break; - case CD_REPLICA_ID: - { - if (role == Qt::DisplayRole) - { - AZ::u64 replicaId = 0; - - const BaseDisplayHelper* currentDisplay = baseDisplay; - - while (currentDisplay != nullptr && !azrtti_istypeof(currentDisplay)) - { - currentDisplay = currentDisplay->GetParent(); - } - - if (currentDisplay) - { - const ReplicaDetailDisplayHelper* replicaDisplay = static_cast(currentDisplay); - replicaId = replicaDisplay->GetReplicaId(); - } - - return FormattingHelper::ReplicaID(replicaId); - } - else if (role == Qt::TextAlignmentRole) - { - return QVariant(Qt::AlignCenter); - } - } - break; - case CD_TOTAL_SENT: - if (role == Qt::DisplayRole) - { - return QString::number(baseDisplay->m_bandwidthUsageAggregator.m_bytesSent); - } - else if (role == Qt::TextAlignmentRole) - { - return QVariant(Qt::AlignCenter); - } - break; - case CD_TOTAL_RECEIVED: - if (role == Qt::DisplayRole) - { - return QString::number(baseDisplay->m_bandwidthUsageAggregator.m_bytesReceived); - } - else if (role == Qt::TextAlignmentRole) - { - return QVariant(Qt::AlignCenter); - } - break; - case CD_RPC_COUNT: - if (role == Qt::DisplayRole) - { - if (azrtti_istypeof(baseDisplay)) - { - size_t count = 0; - - for (BaseDisplayHelper* displayHelper : baseDisplay->GetChildren()) - { - count += displayHelper->GetChildren().size(); - } - - return QString::number(count); - } - else if (azrtti_istypeof(baseDisplay)) - { - return QString::number(baseDisplay->GetChildren().size()); - } - } - break; - default: - AZ_Assert(false,"Unknown column index %i",index.column()); - break; - } - } - - return QVariant(); - } - - QVariant ReplicaChunkTypeDetailViewModel::headerData(int section, Qt::Orientation orientation, int role) const - { - if (role == Qt::DisplayRole) - { - if (orientation == Qt::Horizontal) - { - switch (section) - { - case CD_DISPLAY_NAME: - return QString("Name"); - case CD_REPLICA_ID: - return QString("ReplicaId"); - case CD_TOTAL_SENT: - return QString("Sent Bytes"); - case CD_TOTAL_RECEIVED: - return QString("Received Bytes"); - case CD_RPC_COUNT: - return QString("RPC Count"); - default: - AZ_Assert(false, "Unknown section index %i", section); - break; - } - } - } - - return QVariant(); - } - - /////////////////////////////// - // ReplicaChunkTypeDetailView - /////////////////////////////// - ReplicaChunkTypeDetailView::ReplicaChunkTypeDetailView(ReplicaDataView* replicaDataView, ReplicaChunkTypeDataContainer* chunkTypeDataContainer) - : BaseDetailView(replicaDataView) - , m_inspectedSeries(AreaChart::AreaChart::k_invalidSeriesId) - , m_aggregateDisplayHelper(nullptr) - , m_replicaChunkData(chunkTypeDataContainer) - , m_chunkTypeDetailView(this) - , m_lifespanTelemetry("ReplicaChunkTypeDetailView") - { - QString replicaChunkType = QString("%1").arg(chunkTypeDataContainer->GetChunkType()); - - show(); - raise(); - activateWindow(); - setFocus(); - - setWindowTitle(QString("%1's breakdown - %2").arg(replicaChunkType).arg(replicaDataView->m_aggregator->GetInspectionFileName())); - - m_gui->replicaName->setText(replicaChunkType); - - // Ordering here needs to match ordering in BaseDetailView.h - m_gui->aggregationTypeComboBox->addItem(QString("Replica")); - m_gui->aggregationTypeComboBox->addItem(QString("Combined")); - - if (m_gui->aggregationTypeComboBox->count() == 1) - { - m_gui->aggregationTypeComboBox->setEditable(false); - m_gui->aggregationTypeComboBox->setEnabled(false); - } - - QObject::connect((&m_chunkTypeDetailView), SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)), this, SLOT(UpdateDisplay(const QModelIndex&, const QModelIndex&))); - QObject::connect(m_gui->aggregationTypeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(DisplayModeChanged(int))); - - m_gui->aggregationTypeComboBox->setCurrentIndex(static_cast(DisplayMode::Aggregate)); - } - - ReplicaChunkTypeDetailView::~ReplicaChunkTypeDetailView() - { - for (ReplicaDetailDisplayMap::iterator displayIter = m_replicaDisplayMapping.begin(); - displayIter != m_replicaDisplayMapping.end(); - ++displayIter) - { - delete displayIter->second; - } - } - - const ReplicaBandwidthChartData::FrameMap& ReplicaChunkTypeDetailView::GetFrameData() const - { - return m_replicaChunkData->GetAllFrames(); - } - - BaseDetailDisplayHelper* ReplicaChunkTypeDetailView::FindDetailDisplay(const AZ::u64& replicaId) - { - BaseDetailDisplayHelper* retVal = nullptr; - - ReplicaDetailDisplayMap::iterator displayIter = m_replicaDisplayMapping.find(replicaId); - - if (displayIter != m_replicaDisplayMapping.end()) - { - retVal = displayIter->second; - } - - return retVal; - } - - const BaseDetailDisplayHelper* ReplicaChunkTypeDetailView::FindDetailDisplay(const AZ::u64& replicaId) const - { - const BaseDetailDisplayHelper* retVal = nullptr; - - ReplicaDetailDisplayMap::const_iterator displayIter = m_replicaDisplayMapping.find(replicaId); - - if (displayIter != m_replicaDisplayMapping.end()) - { - retVal = displayIter->second; - } - - return retVal; - } - - void ReplicaChunkTypeDetailView::InitializeDisplayData() - { - m_activeIds.clear(); - m_activeInspectedIds.clear(); - - BaseDetailDisplayHelper* aggregateDisplayHelper = FindAggregateDisplay(); - - if (aggregateDisplayHelper) - { - aggregateDisplayHelper->GetDataSetDisplayHelper()->ClearActiveDisplay(); - aggregateDisplayHelper->GetRPCDisplayHelper()->ClearActiveDisplay(); - } - - const ReplicaChunkTypeDataContainer::FrameMap& frameMap = m_replicaChunkData->GetAllFrames(); - - for (FrameNumberType currentFrame = m_replicaDataView->GetStartFrame(); currentFrame <= m_replicaDataView->GetEndFrame(); ++currentFrame) - { - ReplicaChunkTypeDataContainer::FrameMap::const_iterator frameIter = frameMap.find(currentFrame); - - if (frameIter == frameMap.end()) - { - continue; - } - - const ReplicaChunkTypeDataContainer::BandwidthUsageMap* usageMap = frameIter->second; - - for (ReplicaChunkTypeDataContainer::BandwidthUsageMap::const_iterator usageIter = usageMap->begin(); - usageIter != usageMap->end(); - ++usageIter) - { - ReplicaBandwidthUsage* bandwidthUsage = static_cast(usageIter->second); - - ReplicaDetailDisplayMap::iterator displayIter = m_replicaDisplayMapping.find(bandwidthUsage->GetReplicaId()); - ReplicaDetailDisplayHelper* replicaDisplay = nullptr; - - if (displayIter == m_replicaDisplayMapping.end()) - { - replicaDisplay = aznew ReplicaDetailDisplayHelper(bandwidthUsage->GetReplicaName(), bandwidthUsage->GetReplicaId()); - - if (replicaDisplay) - { - m_replicaDisplayMapping.insert(AZStd::make_pair(replicaDisplay->GetReplicaId(), replicaDisplay)); - } - } - else - { - replicaDisplay = displayIter->second; - } - - // Consider sending along an overall descriptor of the replcia so we can easily setup the display instead - // of iterating blindly over our detail information trying to get a sense of what the thing is. - if (replicaDisplay) - { - if (currentFrame == m_replicaDataView->GetCurrentFrame()) - { - m_activeInspectedIds.insert(replicaDisplay->GetReplicaId()); - } - - // First time we add an object in we want to reset it's display. - if (m_activeIds.insert(replicaDisplay->GetReplicaId()).second) - { - replicaDisplay->GetDataSetDisplayHelper()->ClearActiveDisplay(); - replicaDisplay->GetRPCDisplayHelper()->ClearActiveDisplay(); - } - - const ReplicaBandwidthUsage::UsageAggregationMap& dataSetBandwidthUsage = bandwidthUsage->GetDataTypeUsageAggregation(BandwidthUsage::DataType::DATA_SET); - - for (const auto& usagePair : dataSetBandwidthUsage) - { - const BandwidthUsage& currentUsage = usagePair.second; - - replicaDisplay->SetupDataSet(currentUsage.m_index, currentUsage.m_identifier.c_str()); - - if (aggregateDisplayHelper) - { - aggregateDisplayHelper->SetupDataSet(currentUsage.m_index, currentUsage.m_identifier.c_str()); - } - } - - const ReplicaBandwidthUsage::UsageAggregationMap& rpcBandwidthUsage = bandwidthUsage->GetDataTypeUsageAggregation(BandwidthUsage::DataType::REMOTE_PROCEDURE_CALL); - - for (const auto& usagePair : rpcBandwidthUsage) - { - const BandwidthUsage& currentUsage = usagePair.second; - - replicaDisplay->SetupRPC(currentUsage.m_index, currentUsage.m_identifier.c_str()); - - if (aggregateDisplayHelper) - { - aggregateDisplayHelper->SetupRPC(currentUsage.m_index, currentUsage.m_identifier.c_str()); - } - } - } - } - } - } - - BaseDetailDisplayHelper* ReplicaChunkTypeDetailView::FindAggregateDisplay() - { - if (m_aggregateDisplayHelper == nullptr) - { - m_aggregateDisplayHelper = aznew ReplicaDetailDisplayHelper("Combined Usage", FindAggregateID()); - m_replicaDisplayMapping.insert(AZStd::make_pair(m_aggregateDisplayHelper->GetReplicaId(), m_aggregateDisplayHelper)); - } - - return m_aggregateDisplayHelper; - } - - AZ::u64 ReplicaChunkTypeDetailView::FindAggregateID() const - { - return 0; - } - - void ReplicaChunkTypeDetailView::LayoutChanged() - { - m_chunkTypeDetailView.layoutChanged(); - } - - void ReplicaChunkTypeDetailView::OnSetupTreeView() - { - m_gui->treeView->setModel(&m_chunkTypeDetailView); - ShowTreeFrame(m_replicaDataView->GetCurrentFrame()); - } - - void ReplicaChunkTypeDetailView::ShowTreeFrame(FrameNumberType frameId) - { - m_chunkTypeDetailView.RefreshView(frameId); - } - - AZ::u32 ReplicaChunkTypeDetailView::CreateWindowGeometryCRC() - { - return AZ::Crc32("REPLICA_CHUNK_DETAIL_VIEW_WINDOW_STATE"); - } - - AZ::u32 ReplicaChunkTypeDetailView::CreateSplitterStateCRC() - { - return AZ::Crc32("REPLICA_CHUNK_DETAIL_VIEW_SPLITTER_STATE"); - } - - AZ::u32 ReplicaChunkTypeDetailView::CreateTreeStateCRC() - { - return AZ::Crc32("REPLICA_CHUNK_DETAIL_VIEW_TREE_STATE"); - } - - void ReplicaChunkTypeDetailView::OnInspectedSeries(size_t seriesId) - { - if (m_inspectedSeries != seriesId) - { - m_inspectedSeries = seriesId; - - // TODO: Handle expanding the tree and scrolling to the selected value. - for (auto& mapPair : m_replicaDisplayMapping) - { - BaseDetailDisplayHelper* displayHelper = mapPair.second; - - displayHelper->InspectSeries(m_inspectedSeries); - } - - if (m_aggregateDisplayHelper) - { - m_aggregateDisplayHelper->InspectSeries(m_inspectedSeries); - } - - m_chunkTypeDetailView.layoutChanged(); - } - } -} diff --git a/Code/Tools/Standalone/Source/Driller/Replica/ReplicaChunkTypeDetailView.h b/Code/Tools/Standalone/Source/Driller/Replica/ReplicaChunkTypeDetailView.h deleted file mode 100644 index 16b2ba7cba..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Replica/ReplicaChunkTypeDetailView.h +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef DRILLER_REPLICA_REPLICACHUNKTYPEDETAILVIEW_H -#define DRILLER_REPLICA_REPLICACHUNKTYPEDETAILVIEW_H - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include "Source/Driller/StripChart.hxx" -#include "Source/Driller/Replica/ReplicaDisplayHelpers.h" -#include "Source/Driller/Replica/ReplicaDataView.hxx" - -#include "Source/Driller/Replica/BaseDetailView.h" - -namespace Ui -{ - class ReplicaDetailView; -} - -namespace Driller -{ - class ReplicaBandwidthUsage; - class ReplicaChunkTypeDetailView; - - class ReplicaChunkTypeDetailViewModel - : public BaseDetailTreeViewModel - { - public: - enum ColumnDescriptor - { - // Forcing the index to start at 0 - CD_INDEX_FORCE = -1, - - // Ordering of this enum determines the display order - CD_DISPLAY_NAME, - CD_REPLICA_ID, - CD_TOTAL_SENT, - CD_TOTAL_RECEIVED, - CD_RPC_COUNT, - - // Used for sizing of the TableView. Anything after this won't be displayed. - CD_COUNT - }; - - AZ_CLASS_ALLOCATOR(ReplicaChunkTypeDetailViewModel, AZ::SystemAllocator, 0); - ReplicaChunkTypeDetailViewModel(ReplicaChunkTypeDetailView* detailView); - - int columnCount(const QModelIndex& parentIndex = QModelIndex()) const override; - - QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; - QVariant headerData(int section, Qt::Orientation orientation, int role) const override; - }; - - class ReplicaChunkTypeDetailView - : public BaseDetailView - { - typedef AZStd::unordered_map ReplicaDetailDisplayMap; - - friend class ReplicaChunkTypeDetailViewModel; - - public: - AZ_CLASS_ALLOCATOR(ReplicaChunkTypeDetailView, AZ::SystemAllocator, 0); - - ReplicaChunkTypeDetailView(ReplicaDataView* replicaDataView, ReplicaChunkTypeDataContainer* chunkTypeDataContainer); - ~ReplicaChunkTypeDetailView(); - - const ReplicaBandwidthChartData::FrameMap& GetFrameData() const override; - BaseDetailDisplayHelper* FindDetailDisplay(const AZ::u64& replicaId) override; - const BaseDetailDisplayHelper* FindDetailDisplay(const AZ::u64& replicaId) const override; - - BaseDetailDisplayHelper* FindAggregateDisplay() override; - AZ::u64 FindAggregateID() const override; - - protected: - - void InitializeDisplayData() override; - - void LayoutChanged() override; - void OnSetupTreeView() override; - void ShowTreeFrame(FrameNumberType frameId) override; - - AZ::u32 CreateWindowGeometryCRC() override; - AZ::u32 CreateSplitterStateCRC() override; - AZ::u32 CreateTreeStateCRC() override; - - void OnInspectedSeries(size_t seriesId); - - private: - - size_t m_inspectedSeries; - - ReplicaDetailDisplayHelper* m_aggregateDisplayHelper; - - ReplicaDetailDisplayMap m_replicaDisplayMapping; - ReplicaChunkTypeDataContainer* m_replicaChunkData; - - ReplicaChunkTypeDetailViewModel m_chunkTypeDetailView; - - DrillerWindowLifepsanTelemetry m_lifespanTelemetry; - }; -} - -#endif diff --git a/Code/Tools/Standalone/Source/Driller/Replica/ReplicaChunkUsageDataContainers.cpp b/Code/Tools/Standalone/Source/Driller/Replica/ReplicaChunkUsageDataContainers.cpp deleted file mode 100644 index 28bcf29daa..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Replica/ReplicaChunkUsageDataContainers.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "ReplicaChunkUsageDataContainers.h" - -#include "Source/Driller/StripChart.hxx" -#include "ReplicaDataEvents.h" - -#include "Source/Driller/Replica/ReplicaDisplayHelpers.h" - -namespace Driller -{ - ////////////////////////// - // ReplicaBandwidthUsage - ////////////////////////// - - ReplicaBandwidthUsage::ReplicaBandwidthUsage(const char* replicaName, AZ::u64 replicaId) - : m_replicaName(replicaName) - , m_replicaId(replicaId) - { - } - - AZ::u64 ReplicaBandwidthUsage::GetReplicaId() const - { - return m_replicaId; - } - - const char* ReplicaBandwidthUsage::GetReplicaName() const - { - return m_replicaName.c_str(); - } - - ////////////////////////////////// - // ReplicaChunkTypeDataContainer - ////////////////////////////////// - - ReplicaChunkTypeDataContainer::ReplicaChunkTypeDataContainer(const char* replicaType, const QColor& displayColor) - : ReplicaBandwidthChartData(displayColor) - , m_replicaType(replicaType) - { - } - - const char* ReplicaChunkTypeDataContainer::GetChunkType() const - { - return m_replicaType.c_str(); - } - - const char* ReplicaChunkTypeDataContainer::GetAxisName() const - { - return GetChunkType(); - } - - BandwidthUsageContainer* ReplicaChunkTypeDataContainer::CreateBandwidthUsage(const ReplicaChunkEvent* dataEvent) - { - return aznew ReplicaBandwidthUsage(dataEvent->GetReplicaName(), dataEvent->GetReplicaId()); - } - - AZ::u64 ReplicaChunkTypeDataContainer::GetKeyFromEvent(const ReplicaChunkEvent* dataEvent) const - { - return dataEvent->GetReplicaId(); - } -} diff --git a/Code/Tools/Standalone/Source/Driller/Replica/ReplicaChunkUsageDataContainers.h b/Code/Tools/Standalone/Source/Driller/Replica/ReplicaChunkUsageDataContainers.h deleted file mode 100644 index 946359b006..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Replica/ReplicaChunkUsageDataContainers.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef DRILLER_REPLICA_CHUNK_USAGE_DATA_CONTAINER_H -#define DRILLER_REPLICA_CHUNK_USAGE_DATA_CONTAINER_H - -#include -#include -#include -#include -#include -#include - -#include - -#include "ReplicaBandwidthChartData.h" - -namespace Driller -{ - class ReplicaDataAggregator; - class ReplicaChunkEvent; - class ReplicaDataView; - - class BaseDetailDisplayHelper; - - class ReplicaBandwidthUsage - : public BandwidthUsageContainer - { - public: - AZ_CLASS_ALLOCATOR(ReplicaBandwidthUsage, AZ::SystemAllocator, 0); - ReplicaBandwidthUsage(const char* replicaName, AZ::u64 replicaId); - - AZ::u64 GetReplicaId() const; - const char* GetReplicaName() const; - - private: - AZStd::string m_replicaName; - AZ::u64 m_replicaId; - }; - - class ReplicaChunkTypeDataContainer - : public ReplicaBandwidthChartData - { - public: - AZ_CLASS_ALLOCATOR(ReplicaChunkTypeDataContainer, AZ::SystemAllocator, 0); - - ReplicaChunkTypeDataContainer(const char* replicaType, const QColor& displayColor); - - const char* GetChunkType() const; - const char* GetAxisName() const override; - - protected: - BandwidthUsageContainer* CreateBandwidthUsage(const ReplicaChunkEvent* dataEvent) override; - AZ::u64 GetKeyFromEvent(const ReplicaChunkEvent* dataEvent) const override; - - private: - - ReplicaBandwidthUsage* GetReplicaForFrame(AZ::u64 frameId, const ReplicaChunkEvent* dataEvent); - - AZStd::string m_replicaType; - }; -} - -#endif diff --git a/Code/Tools/Standalone/Source/Driller/Replica/ReplicaDataAggregator.cpp b/Code/Tools/Standalone/Source/Driller/Replica/ReplicaDataAggregator.cpp deleted file mode 100644 index 9cc2c9ae10..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Replica/ReplicaDataAggregator.cpp +++ /dev/null @@ -1,690 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include -#include -#include -#include -#include - -#include "ReplicaDataAggregator.hxx" -#include - -#include "ReplicaDataEvents.h" -#include "ReplicaDataView.hxx" - -#include "Source/Driller/Workspaces/Workspace.h" -#include "Source/Driller/Replica/ReplicaDataAggregatorConfigurationPanel.hxx" -#include "Source/Driller/ChannelDataView.hxx" - -namespace Driller -{ - //////////////////////////////////// - // ReplicaDataAggregatorSavedState - //////////////////////////////////// - - class ReplicaDataAggregatorSavedState : public AZ::UserSettings - { - public: - AZ_RTTI(ReplicaDataAggregatorSavedState, "{599BCB69-C521-4EFD-9D79-C09790907F81}", AZ::UserSettings); - AZ_CLASS_ALLOCATOR(ReplicaDataAggregatorSavedState, AZ::SystemAllocator, 0); - - ReplicaDataAggregatorSavedState() - { - } - - static void Reflect(AZ::ReflectContext* context) - { - AZ::SerializeContext* serialize = azrtti_cast(context); - - if (serialize) - { - serialize->Class() - ->Version(1) - ->Field("FrameBudget", &ReplicaDataConfigurationSettings::m_averageFrameBudget) - ->Field("DisplayType", &ReplicaDataConfigurationSettings::m_configurationDisplay) - ->Field("FrameRate", &ReplicaDataConfigurationSettings::m_frameRate) - ; - - serialize->Class() - ->Version(2) - ->Field("ConfigurationSettings",&ReplicaDataAggregatorSavedState::m_configurationSettings) - ; - } - } - - ReplicaDataConfigurationSettings m_configurationSettings; - }; - - /////////////////////////////////// - // ReplicaDataAggregatorWorkspace - /////////////////////////////////// - - class ReplicaDataAggregatorWorkspace : public AZ::UserSettings - { - public: - AZ_RTTI(ReplicaDataAggregatorWorkspace, "{EF501646-46BB-4C20-83C9-4C6816294448}", AZ::UserSettings); - AZ_CLASS_ALLOCATOR(ReplicaDataAggregatorWorkspace,AZ::SystemAllocator,0); - - AZStd::vector m_activeViewIndexes; - - ReplicaDataAggregatorWorkspace() - { - } - - static void Reflect(AZ::ReflectContext* context) - { - AZ::SerializeContext* serialize = azrtti_cast(context); - if (serialize) - { - serialize->Class() - ->Field("m_activeViewIndexes",&ReplicaDataAggregatorWorkspace::m_activeViewIndexes) - ->Version(1); - } - } - }; - - //////////////////////////////////// - // ReplicaExportSettingsSavedState - //////////////////////////////////// - - class ReplicaExportSettingsSavedState : public AZ::UserSettings - { - public: - AZ_RTTI(ReplicaExportSettingsSavedState,"{5CE5D03E-04A9-4D28-91D4-5587E0643E84}", AZ::UserSettings); - AZ_CLASS_ALLOCATOR(ReplicaExportSettingsSavedState,AZ::SystemAllocator,0); - - bool m_exportColumnDescriptors; - AZStd::vector< int > m_exportOrdering; - - ReplicaExportSettingsSavedState() - : m_exportColumnDescriptors(true) - { - } - - void Init() - { - m_exportOrdering = - { - static_cast(ReplicaExportSettings::ExportField::Name), - static_cast(ReplicaExportSettings::ExportField::Id), - static_cast(ReplicaExportSettings::ExportField::ChunkType), - static_cast(ReplicaExportSettings::ExportField::UsageType), - static_cast(ReplicaExportSettings::ExportField::UsageIdentifier), - static_cast(ReplicaExportSettings::ExportField::Bytes_Sent), - static_cast(ReplicaExportSettings::ExportField::Bytes_Received), - }; - } - - static void Reflect(AZ::ReflectContext* context) - { - AZ::SerializeContext* serialize = azrtti_cast(context); - if (serialize) - { - serialize->Class() - ->Field("m_exportColumnDescriptors",&ReplicaExportSettingsSavedState::m_exportColumnDescriptors) - ->Field("m_exportOrdering",&ReplicaExportSettingsSavedState::m_exportOrdering) - ->Version(1); - } - } - }; - - ////////////////////////// - // ReplicaExportSettings - ////////////////////////// - - const char* ReplicaExportSettings::REPLICA_CSV_EXPORT_SETTINGS = "REPLICA_CSV_EXPORT_SETTINGS"; - - ReplicaExportSettings::ReplicaExportSettings() - { - m_columnDescriptors = - { - { ExportField::Name, "Replica Name"}, - { ExportField::Id, "Replica Id"}, - { ExportField::ChunkType,"ReplicaChunk Type"}, - { ExportField::UsageType,"Usage Type"}, - { ExportField::UsageIdentifier,"Usage Identifier"}, - { ExportField::Bytes_Sent,"Data Sent(Bytes)"}, - { ExportField::Bytes_Received,"Data Received(Bytes)"}, - }; - - for (const AZStd::pair< ExportField, AZStd::string >& item : m_columnDescriptors) - { - m_stringToExportEnum[item.second] = item.first; - } - } - - void ReplicaExportSettings::LoadSettings() - { - m_persistentState = AZ::UserSettings::Find(AZ_CRC(REPLICA_CSV_EXPORT_SETTINGS), AZ::UserSettings::CT_GLOBAL); - - if (m_persistentState == nullptr) - { - m_persistentState = AZ::UserSettings::CreateFind(AZ_CRC(REPLICA_CSV_EXPORT_SETTINGS), AZ::UserSettings::CT_GLOBAL); - m_persistentState->Init(); - } - } - - void ReplicaExportSettings::GetExportItems(QStringList& items) const - { - for (const AZStd::pair< ReplicaExportField, AZStd::string>& item : m_columnDescriptors) - { - items.push_back(QString(item.second.c_str())); - } - } - - void ReplicaExportSettings::GetActiveExportItems(QStringList& items) const - { - for (unsigned int i=0; i < m_persistentState->m_exportOrdering.size(); ++i) - { - ReplicaExportField currentField = static_cast(m_persistentState->m_exportOrdering[i]); - - if (currentField != ReplicaExportField::UNKNOWN) - { - items.push_back(QString(FindColumnDescriptor(currentField).c_str())); - } - } - } - - void ReplicaExportSettings::UpdateExportOrdering(const QStringList& activeItems) - { - m_persistentState->m_exportOrdering.clear(); - - for (const QString& activeItem : activeItems) - { - ExportField field = FindExportFieldFromDescriptor(activeItem.toStdString().c_str()); - - AZ_Warning("Standalone Tools",field != ExportField::UNKNOWN,"Unknown descriptor %s",activeItem.toStdString().c_str()); - if (field != ExportField::UNKNOWN) - { - m_persistentState->m_exportOrdering.push_back(static_cast(field)); - } - } - - m_persistentState->m_exportColumnDescriptors = this->ShouldExportColumnDescriptors(); - } - - const AZStd::vector< int >& ReplicaExportSettings::GetExportOrder() const - { - return m_persistentState->m_exportOrdering; - } - - const AZStd::string& ReplicaExportSettings::FindColumnDescriptor(ExportField exportField) const - { - static const AZStd::string emptyDescriptor; - - AZStd::unordered_map::const_iterator descriptorIter = m_columnDescriptors.find(exportField); - - if (descriptorIter == m_columnDescriptors.end()) - { - AZ_Warning("Standalone Tools",false,"Unknown column descriptor in Carrier CSV Export"); - return emptyDescriptor; - } - else - { - return descriptorIter->second; - } - } - - ReplicaExportField ReplicaExportSettings::FindExportFieldFromDescriptor(const char* columnDescriptor) const - { - AZStd::unordered_map::const_iterator exportIter = m_stringToExportEnum.find(columnDescriptor); - - ExportField retVal = ExportField::UNKNOWN; - - if (exportIter != m_stringToExportEnum.end()) - { - retVal = exportIter->second; - } - - return retVal; - } - - ////////////////////////// - // ReplicaDataAggregator - ////////////////////////// - - const char* ReplicaDataAggregator::REPLICA_AGGREGATOR_SAVED_STATE = "REPLICA_DATA_AGGREGATOR_SAVED_STATE"; - const char* ReplicaDataAggregator::REPLICA_AGGREGATOR_WORKSPACE = "REPLICA_DATA_AGGREGATOR_WORKSPACE"; - - ReplicaDataAggregator::ReplicaDataAggregator(int identity) - : Aggregator(identity) - , m_parser(this) - , m_budgetMarkerTicket(0) - , m_processingFrame(0) - , m_currentFrameUsage(0.0f) - , m_maxFrameUsage(0.0f) - , m_normalizingValue(1.0f) - { - // find state and restore it - m_persistentState = AZ::UserSettings::CreateFind(AZ_CRC(REPLICA_AGGREGATOR_SAVED_STATE), AZ::UserSettings::CT_GLOBAL); - m_csvExportSettings.LoadSettings(); - - OnConfigurationChanged(); - - connect(this, SIGNAL(OnEventFinalized(DrillerEvent*)), SLOT(ProcessDrillerEvent(DrillerEvent*))); - } - - ReplicaDataAggregator::~ReplicaDataAggregator() - { - // Clear out our open data views - while (!m_openDataViews.empty()) - { - delete m_openDataViews.front(); - } - } - - CustomizeCSVExportWidget* ReplicaDataAggregator::CreateCSVExportCustomizationWidget() - { - return aznew GenericCustomizeCSVExportWidget(m_csvExportSettings); - } - - bool ReplicaDataAggregator::HasConfigurations() const - { - return true; - } - - ChannelConfigurationWidget* ReplicaDataAggregator::CreateConfigurationWidget() - { - return aznew ReplicaDataAggregatorConfigurationPanel(m_persistentState->m_configurationSettings); - } - - void ReplicaDataAggregator::OnConfigurationChanged() - { - // Adding a bit of fluff room into average frame budget in order to give it a bit of extra space above it - // so the line is really clear. - float normalizingValue = m_normalizingValue; - - // Only allow the maximum usage to double our specified budget to avoid losing too much fidelity - // for outlier data. - float maxUsage = AZ::GetMin(m_maxFrameUsage,m_persistentState->m_configurationSettings.m_averageFrameBudget * 2.0f); - - m_normalizingValue = AZStd::max(maxUsage, m_persistentState->m_configurationSettings.m_averageFrameBudget); - m_normalizingValue = AZStd::GetMax(1.0f, m_normalizingValue); - - if (!AZ::IsClose(normalizingValue,m_normalizingValue,0.001f)) - { - emit NormalizedRangeChanged(); - } - } - - void ReplicaDataAggregator::AnnotateChannelView(ChannelDataView* channelDataView) - { - RemoveChannelAnnotation(channelDataView); - - float budgetMarker = (2.0f * (m_persistentState->m_configurationSettings.m_averageFrameBudget / m_normalizingValue) - 1.0f); - - QColor color = GetColor(); - color.setRed(AZStd::min(color.red() + 50, 255)); - color.setGreen(AZStd::min(color.green() + 50, 255)); - color.setBlue(AZStd::min(color.blue() + 50, 255)); - - m_budgetMarkerTicket = channelDataView->AddBudgetMarker(budgetMarker, color); - } - - void ReplicaDataAggregator::RemoveChannelAnnotation(ChannelDataView* channelDataView) - { - if (m_budgetMarkerTicket != 0) - { - channelDataView->RemoveBudgetMarker(m_budgetMarkerTicket); - m_budgetMarkerTicket = 0; - } - } - - float ReplicaDataAggregator::ValueAtFrame(FrameNumberType frame) - { - size_t totalChunkBandwidth = 0; - - const EventListType& eventList = GetEvents(); - - // If we have an event, do some fancy color coding. - AZ::s64 numEvents = NumOfEventsAtFrame(frame); - AZ::s64 startIndex = GetFirstIndexAtFrame(frame); - - for (AZ::s64 i = 0; i < numEvents; ++i) - { - ReplicaChunkEvent* replicaChunkEvent = static_cast(eventList[startIndex + i]); - - totalChunkBandwidth += replicaChunkEvent->GetUsageBytes(); - } - - return AZStd::min(1.0f, static_cast(totalChunkBandwidth) / m_normalizingValue)*2.0f - 1.0f; - } - - void ReplicaDataAggregator::OnDataViewDestroyed(QObject* object) - { - for (AZStd::vector::iterator dataViewIter = m_openDataViews.begin(); - dataViewIter != m_openDataViews.end(); - ++dataViewIter) - { - if ((*dataViewIter) == object) - { - m_openDataViews.erase(dataViewIter); - break; - } - } - } - - void ReplicaDataAggregator::ProcessDrillerEvent(DrillerEvent* drillerEvent) - { - size_t currentFrame = GetFrameCount(); - - if (currentFrame != m_processingFrame) - { - m_processingFrame = currentFrame; - m_currentFrameUsage = 0; - } - - ReplicaChunkEvent* replicaChunkEvent = static_cast(drillerEvent); - m_currentFrameUsage += replicaChunkEvent->GetUsageBytes(); - - if (m_currentFrameUsage > m_maxFrameUsage) - { - m_maxFrameUsage = m_currentFrameUsage; - OnConfigurationChanged(); - } - } - - void ReplicaDataAggregator::ApplySettingsFromWorkspace(WorkspaceSettingsProvider* settingsProvider) - { - (void)settingsProvider; - } - - void ReplicaDataAggregator::ActivateWorkspaceSettings(WorkspaceSettingsProvider* settingsProvider) - { - ReplicaDataAggregatorWorkspace* workspace = settingsProvider->FindSetting(AZ_CRC(REPLICA_AGGREGATOR_WORKSPACE)); - - if (workspace) - { - // Clear out our open data views - while (!m_openDataViews.empty()) - { - delete m_openDataViews.front(); - } - - for (int i=0; i < workspace->m_activeViewIndexes.size(); ++i) - { - ReplicaDataView* dataView = aznew ReplicaDataView(workspace->m_activeViewIndexes[i],1,this); - RegisterReplicaDataView(dataView); - - dataView->ApplySettingsFromWorkspace(settingsProvider); - dataView->ActivateWorkspaceSettings(settingsProvider); - } - } - } - - void ReplicaDataAggregator::SaveSettingsToWorkspace(WorkspaceSettingsProvider* settingsProvider) - { - ReplicaDataAggregatorWorkspace* workspace = settingsProvider->CreateSetting(AZ_CRC(REPLICA_AGGREGATOR_WORKSPACE)); - - if (workspace) - { - workspace->m_activeViewIndexes.clear(); - - for (ReplicaDataView* dataView : m_openDataViews) - { - workspace->m_activeViewIndexes.push_back(dataView->GetDataViewIndex()); - dataView->SaveSettingsToWorkspace(settingsProvider); - } - } - } - - unsigned int ReplicaDataAggregator::GetAverageFrameBandwidthBudget() const - { - return static_cast(m_persistentState->m_configurationSettings.m_averageFrameBudget); - } - - QColor ReplicaDataAggregator::GetColor() const - { - return QColor(0, 0, 255); - } - - QString ReplicaDataAggregator::GetName() const - { - return QString("Replica activity"); - } - - QString ReplicaDataAggregator::GetChannelName() const - { - return ChannelName(); - } - - QString ReplicaDataAggregator::GetDescription() const - { - return QString("GridMate Replica Usage Per Frame"); - } - - QString ReplicaDataAggregator::GetToolTip() const - { - return QString("Information about Replica's, DataSet's, and RPC's"); - } - - AZ::Uuid ReplicaDataAggregator::GetID() const - { - return AZ::Uuid("{1252CBE9-111B-4CD3-AF10-FFAE9566B2FF}"); - } - - QWidget* ReplicaDataAggregator::DrillDownRequest(FrameNumberType frame) - { - unsigned int replicaDataViewIndex = static_cast(m_openDataViews.size()); - - // We only push to the back, so the list will be ordered with the highest index - // being at the back. - // Not exactly bulletproof, but simple(and if they want to open 4 billion windows to cause a slight error, more power to them). - if (!m_openDataViews.empty()) - { - replicaDataViewIndex = m_openDataViews.back()->GetDataViewIndex() + 1; - } - - ReplicaDataView* retVal = aznew ReplicaDataView(replicaDataViewIndex, frame, this); - RegisterReplicaDataView(retVal); - - return retVal; - } - - void ReplicaDataAggregator::OptionsRequest() - { - } - - void ReplicaDataAggregator::ExportColumnDescriptorToCSV(AZ::IO::SystemFile& file, CSVExportSettings* exportSettings) - { - ReplicaExportSettings* replicaExportSettings = static_cast(exportSettings); - const AZStd::vector< int >& exportOrdering = replicaExportSettings->GetExportOrder(); - - bool addComma = false; - - for (int fieldId : exportOrdering) - { - ReplicaExportField currentField = static_cast(fieldId); - - if (addComma) - { - file.Write(",",1); - } - - const AZStd::string& columnDescriptor = replicaExportSettings->FindColumnDescriptor(currentField); - file.Write(columnDescriptor.c_str(),columnDescriptor.size()); - addComma = true; - } - - file.Write("\n",1); - } - - void ReplicaDataAggregator::ExportEventToCSV(AZ::IO::SystemFile& file, const DrillerEvent* drillerEvent, CSVExportSettings* exportSettings) - { - AZ_Assert(azrtti_istypeof(drillerEvent),"Invalid Event"); - const ReplicaChunkEvent* replicaChunkEvent = static_cast(drillerEvent); - - ReplicaExportSettings* replicaExportSettings = static_cast(exportSettings); - - const AZStd::vector< int >& exportOrdering = replicaExportSettings->GetExportOrder(); - bool addComma = false; - - AZStd::string field; - - for (int fieldId : exportOrdering) - { - ReplicaExportField currentField = static_cast(fieldId); - - if (addComma) - { - file.Write(",",1); - } - - switch (currentField) - { - case ReplicaExportField::Name: - { - field = replicaChunkEvent->GetReplicaName(); - break; - } - case ReplicaExportField::Id: - { - AZStd::to_string(field,replicaChunkEvent->GetReplicaId()); - break; - } - case ReplicaExportField::ChunkType: - { - field = replicaChunkEvent->GetChunkTypeName(); - break; - } - case ReplicaExportField::UsageType: - { - switch (replicaChunkEvent->GetEventType()) - { - case Replica::RET_CHUNK_DATASET_SENT: - case Replica::RET_CHUNK_DATASET_RECEIVED: - { - field = "DataSet"; - break; - } - case Replica::RET_CHUNK_RPC_SENT: - case Replica::RET_CHUNK_RPC_RECEIVED: - { - field = "RPC"; - break; - } - default: - AZ_Warning("Standalone Tools",false,"Unknown Event Type for Replica Event"); - break; - } - break; - } - case ReplicaExportField::UsageIdentifier: - { - if (azrtti_istypeof(replicaChunkEvent)) - { - const ReplicaChunkSentDataSetEvent* dataSetEvent = static_cast(replicaChunkEvent); - field = dataSetEvent->GetDataSetName(); - } - else if (azrtti_istypeof(replicaChunkEvent)) - { - const ReplicaChunkReceivedDataSetEvent* dataSetEvent = static_cast(replicaChunkEvent); - field = dataSetEvent->GetDataSetName(); - } - else if (azrtti_istypeof(replicaChunkEvent)) - { - const ReplicaChunkSentRPCEvent* rpcEvent = static_cast(replicaChunkEvent); - field = rpcEvent->GetRPCName(); - } - else if (azrtti_istypeof(replicaChunkEvent)) - { - const ReplicaChunkReceivedRPCEvent* rpcEvent = static_cast(replicaChunkEvent); - field = rpcEvent->GetRPCName(); - } - else - { - AZ_Warning("Standalone Tools",false,"Invalid ReplicaEvent Type Usage"); - } - - break; - } - case ReplicaExportField::Bytes_Sent: - { - switch (replicaChunkEvent->GetEventType()) - { - case Replica::RET_CHUNK_RPC_SENT: - case Replica::RET_CHUNK_DATASET_SENT: - { - field = AZStd::to_string(static_cast(replicaChunkEvent->GetUsageBytes())); - break; - } - case Replica::RET_CHUNK_RPC_RECEIVED: - case Replica::RET_CHUNK_DATASET_RECEIVED: - { - field = "0"; - break; - } - default: - AZ_Warning("Standalone Tools",false,"Unknown EventType for ReplicaEvent"); - break; - } - break; - } - case ReplicaExportField::Bytes_Received: - { - switch (replicaChunkEvent->GetEventType()) - { - case Replica::RET_CHUNK_RPC_SENT: - case Replica::RET_CHUNK_DATASET_SENT: - { - field = "0"; - break; - } - case Replica::RET_CHUNK_RPC_RECEIVED: - case Replica::RET_CHUNK_DATASET_RECEIVED: - { - field = AZStd::to_string(static_cast(replicaChunkEvent->GetUsageBytes())); - break; - } - default: - AZ_Warning("Standalone Tools",false,"Unknown EventType for ReplicaEvent"); - break; - } - break; - } - default: - AZ_Warning("Standalone Tools",false,"Unknown Export Field for ReplicaDataAggreagtor"); - break; - } - - file.Write(field.c_str(),field.length()); - addComma = true; - } - - file.Write("\n",1); - } - - void ReplicaDataAggregator::RegisterReplicaDataView(ReplicaDataView* replicaDataView) - { - if (replicaDataView) - { - m_openDataViews.push_back(replicaDataView); - - connect(replicaDataView,SIGNAL(destroyed(QObject*)),this,SLOT(OnDataViewDestroyed(QObject*))); - } - } - - void ReplicaDataAggregator::Reflect(AZ::ReflectContext* context) - { - AZ::SerializeContext* serialize = azrtti_cast(context); - - if (serialize) - { - ReplicaDataView::Reflect(context); - - ReplicaExportSettingsSavedState::Reflect(context); - ReplicaDataAggregatorSavedState::Reflect(context); - ReplicaDataAggregatorWorkspace::Reflect(context); - - serialize->Class() - ->Version(1) - ->SerializeWithNoData(); - } - } -} diff --git a/Code/Tools/Standalone/Source/Driller/Replica/ReplicaDataAggregator.hxx b/Code/Tools/Standalone/Source/Driller/Replica/ReplicaDataAggregator.hxx deleted file mode 100644 index 66c0b9d179..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Replica/ReplicaDataAggregator.hxx +++ /dev/null @@ -1,203 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef DRILLER_REPLICA_DATAAGGREGATOR_H -#define DRILLER_REPLICA_DATAAGGREGATOR_H - -#if !defined(Q_MOC_RUN) -#include "Source/Driller/DrillerAggregator.hxx" -#include "ReplicaDataParser.h" - -#include "GridMate/Drillers/ReplicaDriller.h" - -#include "Source/Driller/GenericCustomizeCSVExportWidget.hxx" -#include -#endif - -namespace Driller -{ - class ReplicaDataView; - class ReplicaDataAggregatorSavedState; - class ReplicaExportSettingsSavedState; - - class ReplicaExportSettings - : public GenericCSVExportSettings - { - // Serialization Keys - static const char* REPLICA_CSV_EXPORT_SETTINGS; - - public: - enum class ExportField - { - Name = 0, - Id, - ChunkType, - UsageType, - UsageIdentifier, - Bytes_Sent, - Bytes_Received, - UNKNOWN - }; - - private: - AZStd::unordered_map< ExportField, AZStd::string > m_columnDescriptors; - AZStd::unordered_map< AZStd::string, ExportField > m_stringToExportEnum; - - AZStd::intrusive_ptr m_persistentState; - - public: - AZ_CLASS_ALLOCATOR(ReplicaExportSettings, AZ::SystemAllocator, 0); - - ReplicaExportSettings(); - - void LoadSettings(); - - void GetExportItems(QStringList& items) const override; - void GetActiveExportItems(QStringList& items) const override; - - const AZStd::vector< int >& GetExportOrder() const; - const AZStd::string& FindColumnDescriptor(ExportField exportField) const; - protected: - void UpdateExportOrdering(const QStringList& activeItems) override; - - private: - ExportField FindExportFieldFromDescriptor(const char* descriptor) const; - }; - - struct ReplicaDataConfigurationSettings - { - public: - enum ConfigurationDisplayType - { - CDT_Start = -1, - - CDT_Frame, - CDT_Second, - CDT_Minute, - - CDT_Max - }; - - AZ_TYPE_INFO(ReplicaDataConfigurationSettings, "{7A075B8E-DCAF-47A1-96CF-2CA3A44F38EF}"); - - ReplicaDataConfigurationSettings() - : m_averageFrameBudget(1024.0f * 10.0f) - , m_configurationDisplay(CDT_Frame) - , m_frameRate(60) - { - } - - // Actual data to be used in the display settings - float m_averageFrameBudget; - - // Information needed purely for the display - ConfigurationDisplayType m_configurationDisplay; - unsigned int m_frameRate; - }; - - typedef ReplicaExportSettings::ExportField ReplicaExportField; - - class ReplicaDataAggregator : public Aggregator - { - Q_OBJECT - - // Serialization Keys - static const char* REPLICA_AGGREGATOR_SAVED_STATE; - static const char* REPLICA_AGGREGATOR_WORKSPACE; - public: - AZ_RTTI(ReplicaDataAggregator, "{764A4084-E579-4811-89D5-3ADA0632358D}"); - AZ_CLASS_ALLOCATOR(ReplicaDataAggregator, AZ::SystemAllocator, 0); - - ReplicaDataAggregator(int identity = 0); - ~ReplicaDataAggregator(); - - static AZ::u32 DrillerId() { return GridMate::Debug::ReplicaDriller::Tags::REPLICA_DRILLER; } - - AZ::u32 GetDrillerId() const override - { - return ReplicaDataAggregator::DrillerId(); - } - - static const char* ChannelName() { return "GridMate"; } - - AZ::Crc32 GetChannelId() const override - { - return AZ::Crc32(ChannelName()); - } - - AZ::Debug::DrillerHandlerParser* GetDrillerDataParser() override - { - return &m_parser; - } - - bool CanExportToCSV() const override - { - return true; - } - - CustomizeCSVExportWidget* CreateCSVExportCustomizationWidget() override; - - bool HasConfigurations() const; - ChannelConfigurationWidget* CreateConfigurationWidget() override; - void OnConfigurationChanged() override; - - void AnnotateChannelView(ChannelDataView* channelDataView) override; - void RemoveChannelAnnotation(ChannelDataView* channelDataView) override; - - // Driller::Aggregator. - void ApplySettingsFromWorkspace(WorkspaceSettingsProvider*) override; - void ActivateWorkspaceSettings(WorkspaceSettingsProvider*) override; - void SaveSettingsToWorkspace(WorkspaceSettingsProvider*) override; - - static void Reflect(AZ::ReflectContext* context); - - // ReplicaDataAggregator - unsigned int GetAverageFrameBandwidthBudget() const; - - public slots: - // Driller::Aggregator - float ValueAtFrame(FrameNumberType frame) override; - QColor GetColor() const override; - QString GetName() const override; - QString GetChannelName() const override; - QString GetDescription() const override; - QString GetToolTip() const override; - AZ::Uuid GetID() const override; - QWidget* DrillDownRequest(FrameNumberType frame) override; - void OptionsRequest() override; - void OnDataViewDestroyed(QObject* object); - - void ProcessDrillerEvent(DrillerEvent* drillerEvent); - - protected: - void ExportColumnDescriptorToCSV(AZ::IO::SystemFile& file,CSVExportSettings* exportSettings) override; - void ExportEventToCSV(AZ::IO::SystemFile& file, const DrillerEvent* drillerEvent,CSVExportSettings* exportSettings) override; - - private: - ReplicaDataAggregator(const ReplicaDataAggregator&) = delete; - void RegisterReplicaDataView(ReplicaDataView* replicaDataView); - - ReplicaExportSettings m_csvExportSettings; - ReplicaDataParser m_parser; - - unsigned int m_budgetMarkerTicket; - - size_t m_processingFrame; - - float m_currentFrameUsage; - float m_maxFrameUsage; - - float m_normalizingValue; - - AZStd::vector< ReplicaDataView* > m_openDataViews; - - AZStd::intrusive_ptr m_persistentState; - }; -} - -#endif diff --git a/Code/Tools/Standalone/Source/Driller/Replica/ReplicaDataAggregatorConfigurationPanel.cpp b/Code/Tools/Standalone/Source/Driller/Replica/ReplicaDataAggregatorConfigurationPanel.cpp deleted file mode 100644 index 91098eab54..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Replica/ReplicaDataAggregatorConfigurationPanel.cpp +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ -#include -#include - -namespace Driller -{ - //////////////////////////////////////////// - // ReplicaDataAggregatorConfigurationPanel - //////////////////////////////////////////// - - ReplicaDataAggregatorConfigurationPanel::ReplicaDataAggregatorConfigurationPanel(ReplicaDataConfigurationSettings& configurationSettings) - : m_configurationSettings(configurationSettings) - { - setupUi(this); - - InitUI(); - - connect(fpsSpinBox, SIGNAL(valueChanged(int)), SLOT(OnFPSChanged(int))); - connect(unitSelector, SIGNAL(currentIndexChanged(int)), SLOT(OnTypeChanged(int))); - connect(budgetSpinBox, SIGNAL(valueChanged(int)), SLOT(OnBudgetChanged(int))); - - m_changeTimer.setInterval(500); - m_changeTimer.setSingleShot(true); - - connect(&m_changeTimer, SIGNAL(timeout()), SLOT(OnTimeout())); - } - - ReplicaDataAggregatorConfigurationPanel::~ReplicaDataAggregatorConfigurationPanel() - { - } - - void ReplicaDataAggregatorConfigurationPanel::InitUI() - { - fpsSpinBox->setValue(m_configurationSettings.m_frameRate); - - for (unsigned int i = 0; i < static_cast(ReplicaDataConfigurationSettings::CDT_Max); ++i) - { - switch (static_cast(i)) - { - case ReplicaDataConfigurationSettings::CDT_Frame: - unitSelector->addItem("Bytes per Frame"); - break; - case ReplicaDataConfigurationSettings::CDT_Second: - unitSelector->addItem("Bytes per Second"); - break; - case ReplicaDataConfigurationSettings::CDT_Minute: - unitSelector->addItem("Bytes per Minute"); - break; - default: - unitSelector->addItem("???"); - AZ_Error("ReplicaDataAggregatorConfigurationPanel", false, "Unhandled unit given to ReplicaDataConfigurationSettings."); - break; - } - } - - int displayConfiguration = static_cast(m_configurationSettings.m_configurationDisplay); - - if (displayConfiguration >= 0 && displayConfiguration < static_cast(ReplicaDataConfigurationSettings::CDT_Max)) - { - unitSelector->setCurrentIndex(displayConfiguration); - } - - DisplayTypeDescriptor(); - UpdateBudgetDisplay(); - } - - void ReplicaDataAggregatorConfigurationPanel::OnBudgetChanged(int value) - { - float budget = static_cast(value); - switch (m_configurationSettings.m_configurationDisplay) - { - case ReplicaDataConfigurationSettings::CDT_Frame: - // Don't need to do anything on Seconds - break; - case ReplicaDataConfigurationSettings::CDT_Minute: - budget = budget / 60.0f; - // Fall through to the seconds. - case ReplicaDataConfigurationSettings::CDT_Second: - budget = budget / static_cast(m_configurationSettings.m_frameRate); - break; - default: - AZ_Error("ReplicaDataAggregatorConfigurationPanel", false, "Unknown configuraiton display given."); - break; - } - - m_configurationSettings.m_averageFrameBudget = static_cast(budget); - - m_changeTimer.start(); - } - - void ReplicaDataAggregatorConfigurationPanel::OnTypeChanged(int type) - { - if (type >= 0 && type < static_cast(ReplicaDataConfigurationSettings::CDT_Max)) - { - m_configurationSettings.m_configurationDisplay = static_cast(type); - - DisplayTypeDescriptor(); - UpdateBudgetDisplay(); - } - } - - void ReplicaDataAggregatorConfigurationPanel::OnFPSChanged(int fps) - { - // We don't want the budget to change when we switch FPS - // but we may need to update the value we actually store. - // so we'll store the original value - int budget = budgetSpinBox->value(); - - m_configurationSettings.m_frameRate = fps; - - // Then fake setting that value to recalculate using the - // new frame rate correctly. - OnBudgetChanged(budget); - } - - void ReplicaDataAggregatorConfigurationPanel::OnTimeout() - { - emit ConfigurationChanged(); - } - - void ReplicaDataAggregatorConfigurationPanel::DisplayTypeDescriptor() - { - switch (m_configurationSettings.m_configurationDisplay) - { - case ReplicaDataConfigurationSettings::CDT_Frame: - unitLabel->setText("Frame"); - break; - case ReplicaDataConfigurationSettings::CDT_Second: - unitLabel->setText("Second"); - break; - case ReplicaDataConfigurationSettings::CDT_Minute: - unitLabel->setText("Minute"); - break; - default: - unitLabel->setText("???"); - AZ_Error("ReplicaDataAggregatorCOnfigurationPanel", false, "Unknown unit configuration."); - } - } - - void ReplicaDataAggregatorConfigurationPanel::UpdateBudgetDisplay() - { - float displayValue = m_configurationSettings.m_averageFrameBudget; - - switch (m_configurationSettings.m_configurationDisplay) - { - case ReplicaDataConfigurationSettings::CDT_Frame: - // Frame is good as is. - break; - case ReplicaDataConfigurationSettings::CDT_Minute: - // Multiply by 60 then let it fall through into the conversion to seconds. - displayValue *= 60; - case ReplicaDataConfigurationSettings::CDT_Second: - // For seconds, multiply the average frame budget, by the frame rate. - displayValue *= m_configurationSettings.m_frameRate; - break; - default: - AZ_Error("ReplicaDataAggregationConfigurationPanel", false, "Unknown configuration type given."); - } - - budgetSpinBox->setValue(static_cast(displayValue)); - } - - -#undef TOSTRING -} diff --git a/Code/Tools/Standalone/Source/Driller/Replica/ReplicaDataAggregatorConfigurationPanel.hxx b/Code/Tools/Standalone/Source/Driller/Replica/ReplicaDataAggregatorConfigurationPanel.hxx deleted file mode 100644 index 9293c7ed39..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Replica/ReplicaDataAggregatorConfigurationPanel.hxx +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ -#pragma once - -#ifndef DRILLER_REPLICA_REPLICADATAAGGREGATORCONFIGURATIONPANEL_H -#define DRILLER_REPLICA_REPLICADATAAGGREGATORCONFIGURATIONPANEL_H - -#if !defined(Q_MOC_RUN) -#include -#include - -#include -#include - -// Generated File -#include - -#include -#include -#endif - -namespace Driller -{ - class ReplicaDataAggregatorConfigurationPanel - : public ChannelConfigurationWidget - , private Ui::ReplicaDataAggregatorConfigurationPanel - { - Q_OBJECT - public: - AZ_CLASS_ALLOCATOR(ReplicaDataAggregatorConfigurationPanel, AZ::SystemAllocator, 0); - - ReplicaDataAggregatorConfigurationPanel(ReplicaDataConfigurationSettings& configurationSettings); - ~ReplicaDataAggregatorConfigurationPanel(); - - public slots: - void OnBudgetChanged(int budget); - void OnTypeChanged(int type); - void OnFPSChanged(int fps); - - void OnTimeout(); - - private: - - void InitUI(); - - void DisplayTypeDescriptor(); - void UpdateBudgetDisplay(); - - ReplicaDataConfigurationSettings& m_configurationSettings; - QTimer m_changeTimer; - }; -} - -#endif diff --git a/Code/Tools/Standalone/Source/Driller/Replica/ReplicaDataAggregatorConfigurationPanel.ui b/Code/Tools/Standalone/Source/Driller/Replica/ReplicaDataAggregatorConfigurationPanel.ui deleted file mode 100644 index f0eff2308d..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Replica/ReplicaDataAggregatorConfigurationPanel.ui +++ /dev/null @@ -1,345 +0,0 @@ - - - ReplicaDataAggregatorConfigurationPanel - - - - 0 - 0 - 354 - 127 - - - - Form - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Replica Data Aggregator Configuration - - - - 5 - - - 10 - - - 5 - - - 0 - - - 0 - - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - 6 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - - 120 - 0 - - - - Qt::LeftToRight - - - Unit of Measure - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 115 - 0 - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - 0 - 0 - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 120 - 0 - - - - Bandwidth Usage Budget - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 115 - 0 - - - - 999999999 - - - - - - - - 0 - 0 - - - - bytes per - - - - - - - Frame - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - Qt::Horizontal - - - - - - - - 0 - 0 - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 120 - 0 - - - - FPS - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - 0 - - - - - - - - 115 - 0 - - - - 1 - - - 240 - - - 60 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - - - - - - diff --git a/Code/Tools/Standalone/Source/Driller/Replica/ReplicaDataEvents.h b/Code/Tools/Standalone/Source/Driller/Replica/ReplicaDataEvents.h deleted file mode 100644 index 18e325435a..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Replica/ReplicaDataEvents.h +++ /dev/null @@ -1,291 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef DRILLER_REPLICA_DATAEVENTS_H -#define DRILLER_REPLICA_DATAEVENTS_H - -#include -#include -#include -#include -#include - -#include "Source/Driller/DrillerEvent.h" - -namespace Driller -{ - namespace Replica - { - enum ReplicaEventType - { - RET_CHUNK_DATASET_SENT = 0, - RET_CHUNK_DATASET_RECEIVED, - RET_CHUNK_RPC_SENT, - RET_CHUNK_RPC_RECEIVED - }; - } - - class ReplicaChunkEvent - : public DrillerEvent - { - protected: - ReplicaChunkEvent(Replica::ReplicaEventType eventType) - : DrillerEvent(static_cast(eventType)) - , m_replicaId(0) - , m_replicaChunkId(0) - , m_replicaChunkIndex(std::numeric_limits::max()) - , m_timeProcessed(0) - , m_usageBytes(0) - { - } - - public: - - AZ_CLASS_ALLOCATOR(ReplicaChunkEvent, AZ::SystemAllocator, 0); - AZ_RTTI(ReplicaChunkEvent, "{76B2DCFB-2D63-4B11-AD18-48843209FF26}", DrillerEvent); - - void SetReplicaName(const char* replicaName) - { - m_replicaName = replicaName; - } - - const char* GetReplicaName() const - { - return m_replicaName.c_str(); - } - - void SetReplicaChunkIndex(AZ::u32 index) - { - m_replicaChunkIndex = index; - } - - AZ::u32 GetReplicaChunkIndex() const - { - return m_replicaChunkIndex; - } - - void SetChunkTypeName(const char* chunkTypeName) - { - m_chunkTypeName = chunkTypeName; - - // Temporary measure to maintain data integrity - if (m_replicaChunkIndex == std::numeric_limits::max()) - { - m_replicaChunkIndex = static_cast(AZ::Crc32(chunkTypeName)); - } - } - - const char* GetChunkTypeName() const - { - return m_chunkTypeName.c_str(); - } - - void SetUsageBytes(size_t usageBytes) - { - m_usageBytes = usageBytes; - } - - size_t GetUsageBytes() const - { - return m_usageBytes; - } - - void SetReplicaId(AZ::u64 replicaId) - { - m_replicaId = replicaId; - } - - AZ::u64 GetReplicaId() const - { - return m_replicaId; - } - - void SetReplicaChunkId(AZ::u64 replicaChunkId) - { - m_replicaChunkId = replicaChunkId; - } - - AZ::u64 GetReplicaChunkId() const - { - return m_replicaChunkId; - } - - void SetTimeProcssed(const AZStd::chrono::milliseconds& timeProcessed) - { - m_timeProcessed = timeProcessed; - } - - AZStd::chrono::milliseconds GetTimeProcessed() const - { - return m_timeProcessed; - } - - void StepForward(Aggregator* data) override { (void)data; }; - void StepBackward(Aggregator* data) override { (void)data; }; - - private: - AZStd::string m_replicaName; - AZStd::string m_chunkTypeName; - - AZ::u64 m_replicaId; - AZ::u64 m_replicaChunkId; - - AZ::u32 m_replicaChunkIndex; - - AZStd::chrono::milliseconds m_timeProcessed; - - size_t m_usageBytes; - }; - - class ReplicaChunkDataSetEvent - : public ReplicaChunkEvent - { - protected: - ReplicaChunkDataSetEvent(Replica::ReplicaEventType eventType) - : ReplicaChunkEvent(eventType) - , m_hasIndex(false) - , m_index(0) - { - } - - public: - AZ_RTTI(ReplicaChunkDataSetEvent, "{39D9C3E7-B119-4C9C-BC70-DB4890A131FD}", ReplicaChunkEvent); - - void SetDataSetName(const char* dataSetName) - { - m_dataSetName = dataSetName; - } - - const char* GetDataSetName() const - { - return m_dataSetName.c_str(); - } - - void SetIndex(size_t dataSetIndex) - { - m_hasIndex = true; - m_index = dataSetIndex; - } - - size_t GetIndex() const - { - return m_index; - } - - bool HasIndex() const - { - return m_hasIndex; - } - - private: - AZStd::string m_dataSetName; - bool m_hasIndex; - size_t m_index; - }; - - class ReplicaChunkRPCEvent - : public ReplicaChunkEvent - { - protected: - ReplicaChunkRPCEvent(Replica::ReplicaEventType eventType) - : ReplicaChunkEvent(eventType) - , m_hasIndex(false) - , m_index(0) - { - } - - public: - AZ_CLASS_ALLOCATOR(ReplicaChunkDataSetEvent, AZ::SystemAllocator, 0); - AZ_RTTI(ReplicaChunkRPCEvent, "{27213952-E66A-4DE7-A60D-683895A5A973}", ReplicaChunkEvent); - - void SetRPCName(const char* rpcName) - { - m_RPCName = rpcName; - } - - const char* GetRPCName() const - { - return m_RPCName.c_str(); - } - - void SetIndex(size_t rpcIndex) - { - m_hasIndex = true; - m_index = rpcIndex; - } - - size_t GetIndex() const - { - return m_index; - } - - bool HasIndex() const - { - return m_hasIndex; - } - - private: - AZStd::string m_RPCName; - bool m_hasIndex; - size_t m_index; - }; - - class ReplicaChunkSentDataSetEvent - : public ReplicaChunkDataSetEvent - { - public: - AZ_CLASS_ALLOCATOR(ReplicaChunkSentDataSetEvent, AZ::SystemAllocator, 0); - AZ_RTTI(ReplicaChunkSentDataSetEvent, "{2B6BDB9C-4465-4BC6-BB80-73CD85A0B818}", ReplicaChunkDataSetEvent); - - ReplicaChunkSentDataSetEvent() - : ReplicaChunkDataSetEvent(Replica::RET_CHUNK_DATASET_SENT) - { - } - }; - - class ReplicaChunkReceivedDataSetEvent - : public ReplicaChunkDataSetEvent - { - public: - AZ_CLASS_ALLOCATOR(ReplicaChunkReceivedDataSetEvent, AZ::SystemAllocator, 0); - AZ_RTTI(ReplicaChunkReceivedDataSetEvent, "{138F7C4A-3727-4565-9395-673E43BC325C}", ReplicaChunkDataSetEvent); - - ReplicaChunkReceivedDataSetEvent() - : ReplicaChunkDataSetEvent(Replica::RET_CHUNK_DATASET_RECEIVED) - { - } - }; - - class ReplicaChunkSentRPCEvent - : public ReplicaChunkRPCEvent - { - public: - AZ_CLASS_ALLOCATOR(ReplicaChunkSentRPCEvent, AZ::SystemAllocator, 0); - AZ_RTTI(ReplicaChunkSentRPCEvent, "{04E9EE7E-5F41-4566-B584-0C671B2E09DE}", ReplicaChunkRPCEvent); - - ReplicaChunkSentRPCEvent() - : ReplicaChunkRPCEvent(Replica::RET_CHUNK_RPC_SENT) - { - } - }; - - class ReplicaChunkReceivedRPCEvent - : public ReplicaChunkRPCEvent - { - public: - AZ_CLASS_ALLOCATOR(ReplicaChunkReceivedRPCEvent, AZ::SystemAllocator, 0); - AZ_RTTI(ReplicaChunkReceivedRPCEvent, "{68482B1F-8A70-4152-9014-714B46641A12}", ReplicaChunkRPCEvent); - - ReplicaChunkReceivedRPCEvent() - : ReplicaChunkRPCEvent(Replica::RET_CHUNK_RPC_RECEIVED) - { - } - }; -} - -#endif diff --git a/Code/Tools/Standalone/Source/Driller/Replica/ReplicaDataParser.cpp b/Code/Tools/Standalone/Source/Driller/Replica/ReplicaDataParser.cpp deleted file mode 100644 index 26a40f46c3..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Replica/ReplicaDataParser.cpp +++ /dev/null @@ -1,217 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "ReplicaDataParser.h" - -#include "ReplicaDataAggregator.hxx" -#include "ReplicaDataEvents.h" - -#include "GridMate/Drillers/ReplicaDriller.h" - -namespace Driller -{ - ////////////////////// - // ReplicaDataParser - ////////////////////// - - ReplicaDataParser::ReplicaDataParser(ReplicaDataAggregator* aggregator) - : DrillerHandlerParser(false) - , m_currentType(Replica::DataType::NONE) - , m_aggregator(aggregator) - { - } - - AZ::Debug::DrillerHandlerParser* ReplicaDataParser::OnEnterTag(AZ::u32 tagName) - { - if (tagName == GridMate::Debug::ReplicaDriller::Tags::CHUNK_SEND_DATASET) - { - AZ_Assert(m_currentType == Replica::DataType::NONE, "ERROR: Bad flow received."); - - ReplicaChunkSentDataSetEvent* newEvent = aznew ReplicaChunkSentDataSetEvent; - - if (newEvent) - { - m_currentType = Replica::DataType::SENT_REPLICA_CHUNK; - m_aggregator->AddEvent(newEvent); - return this; - } - } - else if (tagName == GridMate::Debug::ReplicaDriller::Tags::CHUNK_RECEIVE_DATASET) - { - AZ_Assert(m_currentType == Replica::DataType::NONE, "ERROR: Bad flow received."); - - ReplicaChunkReceivedDataSetEvent* newEvent = aznew ReplicaChunkReceivedDataSetEvent; - - if (newEvent) - { - m_currentType = Replica::DataType::RECEIVED_REPLICA_CHUNK; - m_aggregator->AddEvent(newEvent); - return this; - } - } - else if (tagName == GridMate::Debug::ReplicaDriller::Tags::CHUNK_SEND_RPC) - { - AZ_Assert(m_currentType == Replica::DataType::NONE, "ERROR: Bad flow received."); - - ReplicaChunkSentRPCEvent* newEvent = aznew ReplicaChunkSentRPCEvent; - - if (newEvent) - { - m_currentType = Replica::DataType::SENT_REPLICA_CHUNK; - m_aggregator->AddEvent(newEvent); - return this; - } - } - else if (tagName == GridMate::Debug::ReplicaDriller::Tags::CHUNK_RECEIVE_RPC) - { - AZ_Assert(m_currentType == Replica::DataType::NONE, "ERROR: Bad flow received."); - - ReplicaChunkReceivedRPCEvent* newEvent = aznew ReplicaChunkReceivedRPCEvent; - - if (newEvent) - { - m_currentType = Replica::DataType::RECEIVED_REPLICA_CHUNK; - m_aggregator->AddEvent(newEvent); - return this; - } - } - - return nullptr; - } - - void ReplicaDataParser::OnExitTag(AZ::Debug::DrillerHandlerParser* handler, AZ::u32 tagName) - { - (void)handler; - - if (tagName == GridMate::Debug::ReplicaDriller::Tags::CHUNK_SEND_DATASET - || tagName == GridMate::Debug::ReplicaDriller::Tags::CHUNK_RECEIVE_DATASET - || tagName == GridMate::Debug::ReplicaDriller::Tags::CHUNK_SEND_RPC - || tagName == GridMate::Debug::ReplicaDriller::Tags::CHUNK_RECEIVE_RPC) - { - m_currentType = Replica::DataType::NONE; - m_aggregator->FinalizeEvent(); - } - } - - void ReplicaDataParser::OnData(const AZ::Debug::DrillerSAXParser::Data& dataNode) - { - if (m_currentType == Replica::DataType::NONE - || m_aggregator->GetEvents().empty()) - { - return; - } - - ProcessReplicaChunk(dataNode); - - switch (m_currentType) - { - case Replica::DataType::SENT_REPLICA_CHUNK: - ProcessSentReplicaChunk(dataNode); - break; - case Replica::DataType::RECEIVED_REPLICA_CHUNK: - ProcessReceivedReplicaChunk(dataNode); - break; - default: - break; - } - } - - void ReplicaDataParser::ProcessReplicaChunk(const AZ::Debug::DrillerSAXParser::Data& dataNode) - { - ReplicaChunkEvent* receivedEvent = static_cast(m_aggregator->GetEvents().back()); - - if (dataNode.m_name == GridMate::Debug::ReplicaDriller::Tags::CHUNK_TYPE) - { - AZStd::string chunkType; - dataNode.Read(chunkType); - - receivedEvent->SetChunkTypeName(chunkType.c_str()); - } - else if (dataNode.m_name == GridMate::Debug::ReplicaDriller::Tags::CHUNK_INDEX) - { - AZ::u32 chunkIndex; - dataNode.Read(chunkIndex); - - receivedEvent->SetReplicaChunkIndex(chunkIndex); - } - else if (dataNode.m_name == GridMate::Debug::ReplicaDriller::Tags::SIZE) - { - size_t usageBytes; - dataNode.Read(usageBytes); - - receivedEvent->SetUsageBytes(usageBytes); - } - else if (dataNode.m_name == GridMate::Debug::ReplicaDriller::Tags::REPLICA_ID) - { - AZ::u32 replicaId; - dataNode.Read(replicaId); - - receivedEvent->SetReplicaId(replicaId); - } - else if (dataNode.m_name == GridMate::Debug::ReplicaDriller::Tags::REPLICA_NAME) - { - AZStd::string replicaName; - dataNode.Read(replicaName); - - receivedEvent->SetReplicaName(replicaName.c_str()); - } - else if (dataNode.m_name == GridMate::Debug::ReplicaDriller::Tags::TIME_PROCESSED_MILLISEC) - { - AZStd::sys_time_t time; - dataNode.Read(time); - - AZStd::chrono::milliseconds timeMS(time); - receivedEvent->SetTimeProcssed(timeMS); - } - else if (dataNode.m_name == GridMate::Debug::ReplicaDriller::Tags::DATA_SET_NAME) - { - AZStd::string dataSetName; - dataNode.Read(dataSetName); - - ReplicaChunkDataSetEvent* dataSetEvent = static_cast(receivedEvent); - - dataSetEvent->SetDataSetName(dataSetName.c_str()); - } - else if (dataNode.m_name == GridMate::Debug::ReplicaDriller::Tags::DATA_SET_INDEX) - { - size_t dataSetIndex; - dataNode.Read(dataSetIndex); - - ReplicaChunkDataSetEvent* dataSetEvent = static_cast(receivedEvent); - - dataSetEvent->SetIndex(dataSetIndex); - } - else if (dataNode.m_name == GridMate::Debug::ReplicaDriller::Tags::RPC_NAME) - { - AZStd::string rpcName; - dataNode.Read(rpcName); - - ReplicaChunkRPCEvent* rpcEvent = static_cast(receivedEvent); - - rpcEvent->SetRPCName(rpcName.c_str()); - } - else if (dataNode.m_name == GridMate::Debug::ReplicaDriller::Tags::RPC_INDEX) - { - size_t rpcIndex; - dataNode.Read(rpcIndex); - - ReplicaChunkRPCEvent* rpcEvent = static_cast(receivedEvent); - rpcEvent->SetIndex(rpcIndex); - } - } - - void ReplicaDataParser::ProcessSentReplicaChunk(const AZ::Debug::DrillerSAXParser::Data& dataNode) - { - (void)dataNode; - } - - void ReplicaDataParser::ProcessReceivedReplicaChunk(const AZ::Debug::DrillerSAXParser::Data& dataNode) - { - (void)dataNode; - } -} diff --git a/Code/Tools/Standalone/Source/Driller/Replica/ReplicaDataParser.h b/Code/Tools/Standalone/Source/Driller/Replica/ReplicaDataParser.h deleted file mode 100644 index 0b6e6c6347..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Replica/ReplicaDataParser.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef DRILLER_REPLICA_DATAPARSER_H -#define DRILLER_REPLICA_DATAPARSER_H - -#include - -namespace Driller -{ - class ReplicaDataAggregator; - - namespace Replica - { - enum class DataType - { - NONE, - SENT_REPLICA_CHUNK, - RECEIVED_REPLICA_CHUNK - }; - } - - class ReplicaDataParser - : public AZ::Debug::DrillerHandlerParser - { - public: - ReplicaDataParser(ReplicaDataAggregator* aggregator); - - AZ::Debug::DrillerHandlerParser* OnEnterTag(AZ::u32 tagName) override; - void OnExitTag(AZ::Debug::DrillerHandlerParser* handler, AZ::u32 tagName) override; - void OnData(const AZ::Debug::DrillerSAXParser::Data& dataNode) override; - - private: - - void ProcessReplicaChunk(const AZ::Debug::DrillerSAXParser::Data& dataNode); - void ProcessSentReplicaChunk(const AZ::Debug::DrillerSAXParser::Data& dataNode); - void ProcessReceivedReplicaChunk(const AZ::Debug::DrillerSAXParser::Data& dataNode); - - Replica::DataType m_currentType; - - ReplicaDataAggregator* m_aggregator; - }; -} - -#endif diff --git a/Code/Tools/Standalone/Source/Driller/Replica/ReplicaDataView.cpp b/Code/Tools/Standalone/Source/Driller/Replica/ReplicaDataView.cpp deleted file mode 100644 index be4c7d14ff..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Replica/ReplicaDataView.cpp +++ /dev/null @@ -1,1808 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include -#include -#include -#include -#include - -#include -#include - -#include -#include - -#include "ReplicaDataView.hxx" -#include - -#include "BaseDetailView.h" -#include "ReplicaChunkTypeDetailView.h" -#include "ReplicaChunkUsageDataContainers.h" -#include "ReplicaDataAggregator.hxx" -#include "ReplicaDataEvents.h" -#include "ReplicaDetailView.h" -#include "ReplicaOperationTelemetryEvent.h" -#include "ReplicaUsageDataContainers.h" - -#include "Source/Driller/DrillerMainWindowMessages.h" -#include "Source/Driller/DrillerOperationTelemetryEvent.h" -#include "Source/Driller/Replica/OverallReplicaDetailView.hxx" -#include "Source/Driller/Replica/ReplicaDisplayHelpers.h" -#include "Source/Driller/Workspaces/Workspace.h" - -namespace Driller -{ - ////////////////////////////// - // ReplicaDataViewSavedState - ////////////////////////////// - - class ReplicaDataViewSavedState - : public AZ::UserSettings - { - public: - AZ_RTTI(ReplicaDataViewSavedState, "{8C5CA0D3-CD56-4972-83E5-2A7D3217E8FE}", AZ::UserSettings); - AZ_CLASS_ALLOCATOR(ReplicaDataViewSavedState, AZ::SystemAllocator, 0); - - int m_displayTimeType; - int m_displayDataType; - int m_displayRange; - int m_bandwidthUsageDisplayType; - int m_tableFilterType; - - ReplicaDataViewSavedState() - : m_displayDataType(ReplicaDataView::DDT_START + 1) - , m_displayRange(30) - , m_bandwidthUsageDisplayType(ReplicaDisplayTypes::BUDT_START + 1) - , m_tableFilterType(ReplicaDataView::TFT_START + 1) - { - } - - void CopyStateFrom(const ReplicaDataViewSavedState* source) - { - m_displayTimeType = source->m_displayTimeType; - m_displayDataType = source->m_displayDataType; - m_displayRange = source->m_displayRange; - m_bandwidthUsageDisplayType = source->m_bandwidthUsageDisplayType; - m_tableFilterType = source->m_tableFilterType; - } - - static void Reflect(AZ::ReflectContext* context) - { - AZ::SerializeContext* serialize = azrtti_cast(context); - if (serialize) - { - serialize->Class() - ->Field("m_displayDataType", &ReplicaDataViewSavedState::m_displayDataType) - ->Field("m_displayRange", &ReplicaDataViewSavedState::m_displayRange) - ->Field("m_bandwidthUsageDisplayType",&ReplicaDataViewSavedState::m_bandwidthUsageDisplayType) - ->Field("m_tableFilterType", &ReplicaDataViewSavedState::m_tableFilterType) - ->Version(4); - } - } - }; - - //////////////////////////////////////// - // ReplicaDataViewTableModelSavedState - //////////////////////////////////////// - - class ReplicaDataViewTableModelSavedState - : public AZ::UserSettings - { - public: - AZ_RTTI(ReplicaDataViewTableModelSavedState, "{36103E46-2503-4EEE-BA4B-2650E25A5B26}", AZ::UserSettings); - AZ_CLASS_ALLOCATOR(ReplicaDataViewTableModelSavedState, AZ::SystemAllocator, 0); - - AZStd::vector m_treeColumnStorage; - - static void Reflect(AZ::ReflectContext* context) - { - AZ::SerializeContext* serialize = azrtti_cast(context); - - if (serialize) - { - serialize->Class() - ->Field("m_treeColumnStorage", &ReplicaDataViewTableModelSavedState::m_treeColumnStorage) - ->Version(1); - } - } - }; - - ////////////////////////////////////// - // ReplicaDataViewSplitterSavedState - ////////////////////////////////////// - - class ReplicaDataViewSplitterSavedState - : public AZ::UserSettings - { - public: - AZ_RTTI(ReplicaDataViewSplitterSavedState, "{E698D9E8-D8E9-4115-87E7-2BEEBE5F7FB3}", AZ::UserSettings); - AZ_CLASS_ALLOCATOR(ReplicaDataViewSplitterSavedState, AZ::SystemAllocator, 0); - - AZStd::vector m_splitterSavedState; - - static void Reflect(AZ::ReflectContext* context) - { - AZ::SerializeContext* serialize = azrtti_cast(context); - - if (serialize) - { - serialize->Class() - ->Field("m_splitterSavedState", &ReplicaDataViewSplitterSavedState::m_splitterSavedState) - ->Version(1) - ; - } - } - }; - - ////////////////////////// - // ReplicaTableViewModel - ////////////////////////// - - ReplicaTableViewModel::ReplicaTableViewModel(ReplicaDataView* replicaDataView) - : QAbstractTableModel(replicaDataView) - , m_replicaDataView(replicaDataView) - { - } - - void ReplicaTableViewModel::RefreshView() - { - m_replicaIds.clear(); - - if (m_replicaDataView->HideInactiveInspectedElements()) - { - m_replicaIds.insert(m_replicaIds.begin(), m_replicaDataView->m_activeInspectedReplicaIds.begin(), m_replicaDataView->m_activeInspectedReplicaIds.end()); - } - else - { - m_replicaIds.insert(m_replicaIds.begin(), m_replicaDataView->m_activeReplicaIds.begin(), m_replicaDataView->m_activeReplicaIds.end()); - } - - AZStd::sort(m_replicaIds.begin(), m_replicaIds.end(), AZStd::less()); - - layoutChanged(); - } - - int ReplicaTableViewModel::rowCount(const QModelIndex& parentIndex) const - { - (void)parentIndex; - - return static_cast(m_replicaIds.size()); - } - - int ReplicaTableViewModel::columnCount(const QModelIndex& parentIndex) const - { - (void)parentIndex; - - return CD_COUNT; - } - - Qt::ItemFlags ReplicaTableViewModel::flags(const QModelIndex& index) const - { - Qt::ItemFlags flags = QAbstractTableModel::flags(index); - - switch (index.column()) - { - case CD_INSPECT: - flags &= ~(Qt::ItemIsSelectable); - break; - default: - break; - } - - return flags; - } - - - QVariant ReplicaTableViewModel::data(const QModelIndex& index, int role) const - { - AZ::u64 replicaId = GetReplicaIdFromIndex(index); - - ReplicaDataContainer* replicaContainer = m_replicaDataView->FindReplicaData(replicaId); - - - if (replicaContainer != nullptr) - { - if (role == Qt::BackgroundRole) - { - if (replicaContainer->IsInspected()) - { - return QVariant::fromValue(QColor(94, 94, 178, 255)); - } - } - else - { - switch (index.column()) - { - case CD_REPLICA_ID: - if (role == Qt::DisplayRole) - { - return FormattingHelper::ReplicaID(replicaContainer->GetReplicaId()); - } - else if (role == Qt::TextAlignmentRole) - { - return QVariant(Qt::AlignCenter); - } - break; - case CD_TOTAL_SENT: - if (role == Qt::DisplayRole) - { - return QString::number(replicaContainer->GetSentUsageForFrame(m_replicaDataView->GetCurrentFrame())); - } - else if (role == Qt::TextAlignmentRole) - { - return QVariant(Qt::AlignCenter); - } - break; - case CD_TOTAL_RECEIVED: - if (role == Qt::DisplayRole) - { - return QString::number(replicaContainer->GetReceivedUsageForFrame(m_replicaDataView->GetCurrentFrame())); - } - else if (role == Qt::TextAlignmentRole) - { - return QVariant(Qt::AlignCenter); - } - break; - case CD_REPLICA_NAME: - if (role == Qt::DecorationRole) - { - return replicaContainer->GetIcon(); - } - else if (role == Qt::DisplayRole) - { - AZStd::string replicaName = replicaContainer->GetReplicaName(); - return QString(replicaName.empty() ? "" : replicaName.c_str()); - } - else if (role == Qt::TextAlignmentRole) - { - return QVariant(Qt::AlignLeft | Qt::AlignVCenter); - } - break; - case CD_INSPECT: - if (role == Qt::DecorationRole || role == Qt::SizeHintRole) - { - QPixmap pixmap = QPixmap(":/general/inspect_icon"); - - if (role == Qt::DecorationRole) - { - return pixmap; - } - else if (role == Qt::SizeHintRole) - { - return pixmap.size(); - } - } - else if (role == Qt::TextAlignmentRole) - { - return QVariant(Qt::AlignCenter); - } - break; - default: - AZ_Assert(false,"Unknown column index %i",index.column()); - break; - } - } - } - - return QVariant(); - } - - QVariant ReplicaTableViewModel::headerData(int section, Qt::Orientation orientation, int role) const - { - if (role == Qt::DisplayRole) - { - if (orientation == Qt::Horizontal) - { - switch (section) - { - case CD_REPLICA_ID: - return QString("Replica ID"); - case CD_TOTAL_SENT: - return QString("Sent Bytes"); - case CD_TOTAL_RECEIVED: - return QString("Received Bytes"); - case CD_REPLICA_NAME: - return QString("Replica Name"); - case CD_INSPECT: - return QString(""); - default: - AZ_Assert(false, "Unknown section index %i", section); - break; - } - } - } - - return QVariant(); - } - - AZ::u64 ReplicaTableViewModel::GetReplicaIdFromIndex(const QModelIndex& index) const - { - return GetReplicaIdForRow(index.row()); - } - - AZ::u64 ReplicaTableViewModel::GetReplicaIdForRow(int row) const - { - if (row < 0 || row >= m_replicaIds.size()) - { - return 0; - } - - return m_replicaIds[row]; - } - - /////////////////////////////////// - // ReplicaChunkTypeTableViewModel - /////////////////////////////////// - - ReplicaChunkTypeTableViewModel::ReplicaChunkTypeTableViewModel(ReplicaDataView* replicaDataView) - : QAbstractTableModel(replicaDataView) - , m_replicaDataView(replicaDataView) - { - } - - void ReplicaChunkTypeTableViewModel::RefreshView() - { - m_replicaChunkTypes.clear(); - - if (m_replicaDataView->HideInactiveInspectedElements()) - { - m_replicaChunkTypes.insert(m_replicaChunkTypes.begin(), m_replicaDataView->m_activeInspectedChunkTypes.begin(), m_replicaDataView->m_activeInspectedChunkTypes.end()); - } - else - { - m_replicaChunkTypes.insert(m_replicaChunkTypes.begin(), m_replicaDataView->m_activeChunkTypes.begin(), m_replicaDataView->m_activeChunkTypes.end()); - } - - AZStd::sort(m_replicaChunkTypes.begin(), m_replicaChunkTypes.end(), AZStd::less()); - layoutChanged(); - } - - int ReplicaChunkTypeTableViewModel::rowCount(const QModelIndex& parentIndex) const - { - (void)parentIndex; - - return static_cast(m_replicaChunkTypes.size()); - } - - int ReplicaChunkTypeTableViewModel::columnCount(const QModelIndex& parentIndex) const - { - (void)parentIndex; - - return CD_COUNT; - } - - Qt::ItemFlags ReplicaChunkTypeTableViewModel::flags(const QModelIndex& index) const - { - Qt::ItemFlags flags = QAbstractTableModel::flags(index); - - switch (index.column()) - { - case CD_INSPECT: - flags &= ~(Qt::ItemIsSelectable); - break; - default: - break; - } - - return flags; - } - - QVariant ReplicaChunkTypeTableViewModel::data(const QModelIndex& index, int role) const - { - const char* chunkType = GetReplicaChunkTypeFromIndex(index); - ReplicaChunkTypeDataContainer* replicaChunkTypeContainer = m_replicaDataView->FindReplicaChunkTypeData(chunkType); - - if (replicaChunkTypeContainer != nullptr) - { - if (role == Qt::BackgroundRole) - { - if (replicaChunkTypeContainer->IsInspected()) - { - return QVariant::fromValue(QColor(94, 94, 178, 255)); - } - } - else - { - switch (index.column()) - { - case CD_CHUNK_TYPE: - if (role == Qt::DecorationRole) - { - return replicaChunkTypeContainer->GetIcon(); - } - else if (role == Qt::DisplayRole) - { - AZStd::string chunkTypeString = replicaChunkTypeContainer->GetChunkType(); - return QString(chunkTypeString.empty() ? "" : chunkTypeString.c_str()); - } - else if (role == Qt::TextAlignmentRole) - { - return QVariant(Qt::AlignCenter); - } - break; - case CD_TOTAL_SENT: - if (role == Qt::DisplayRole) - { - return QString::number(replicaChunkTypeContainer->GetSentUsageForFrame(m_replicaDataView->GetCurrentFrame())); - } - else if (role == Qt::TextAlignmentRole) - { - return QVariant(Qt::AlignCenter); - } - break; - case CD_TOTAL_RECEIVED: - if (role == Qt::DisplayRole) - { - return QString::number(replicaChunkTypeContainer->GetReceivedUsageForFrame(m_replicaDataView->GetCurrentFrame())); - } - else if (role == Qt::TextAlignmentRole) - { - return QVariant(Qt::AlignCenter); - } - break; - case CD_INSPECT: - if (role == Qt::DecorationRole || role == Qt::SizeHintRole) - { - QPixmap pixmap = QPixmap(":/general/inspect_icon"); - - if (role == Qt::DecorationRole) - { - return pixmap; - } - else if (role == Qt::SizeHintRole) - { - return pixmap.size(); - } - } - else if (role == Qt::TextAlignmentRole) - { - return QVariant(Qt::AlignCenter); - } - break; - default: - AZ_Assert(false,"Unknown column index %i",index.column()); - break; - } - } - } - - return QVariant(); - } - - QVariant ReplicaChunkTypeTableViewModel::headerData(int section, Qt::Orientation orientation, int role) const - { - if (role == Qt::DisplayRole) - { - if (orientation == Qt::Horizontal) - { - switch (section) - { - case CD_CHUNK_TYPE: - return QString("Chunk Type"); - case CD_TOTAL_SENT: - return QString("Sent Bytes"); - case CD_TOTAL_RECEIVED: - return QString("Received Bytes"); - case CD_INSPECT: - return QString(""); - default: - AZ_Assert(false, "Unknown section index %i", section); - break; - } - } - } - - return QVariant(); - } - - const char* ReplicaChunkTypeTableViewModel::GetReplicaChunkTypeFromIndex(const QModelIndex& index) const - { - return GetReplicaChunkTypeForRow(index.row()); - } - - const char* ReplicaChunkTypeTableViewModel::GetReplicaChunkTypeForRow(int row) const - { - const char* retVal = nullptr; - - if (row < 0 || row >= m_replicaChunkTypes.size()) - { - return retVal; - } - - retVal = m_replicaChunkTypes[row].c_str(); - - return retVal; - } - - //////////////////////// - // ChartZoomMaintainer - //////////////////////// - - ReplicaDataView::ChartZoomMaintainer::ChartZoomMaintainer() - : m_axis(Charts::AxisType::Horizontal) - , m_minValue(0.0f) - , m_maxValue(1.0f) - { - } - - void ReplicaDataView::ChartZoomMaintainer::GetZoomFromChart(StripChart::DataStrip& chart, Charts::AxisType axis) - { - m_axis = axis; - - bool gotWindowRange = chart.GetWindowRange(axis, m_minValue, m_maxValue); - - float minRange; - float maxRange; - - bool gotAxisRange = chart.GetAxisRange(axis, minRange, maxRange); - - if (gotWindowRange && gotAxisRange) - { - float range = maxRange - minRange; - - if (AZ::IsClose(maxRange, minRange, 0.01f)) - { - range = 1.0f; - } - - m_minValue /= range; - m_maxValue /= range; - } - else - { - m_minValue = 0.0f; - m_maxValue = 1.0f; - } - } - - void ReplicaDataView::ChartZoomMaintainer::SetZoomOnChart(StripChart::DataStrip& chart, Charts::AxisType axis) - { - AZ_Assert(axis == m_axis, "Warning: Manipulating different axis from when zoom was set"); - - float minRange; - float maxRange; - - bool gotRange = chart.GetAxisRange(axis, minRange, maxRange); - - if (gotRange) - { - float range = maxRange - minRange; - - if (AZ::IsClose(maxRange, minRange, 0.01f)) - { - range = 1.0f; - } - - chart.ZoomManual(axis, range * m_minValue, range * m_maxValue); - } - } - - //////////////////// - // ReplicaDataView - //////////////////// - const char* ReplicaDataView::DDT_REPLICA_NAME = "Replica"; - const char* ReplicaDataView::DDT_CHUNK_NAME = "Chunk Type"; - - const char* ReplicaDataView::WINDOW_STATE_FORMAT = "REPLICA_DATA_VIEW_WINDOW_STATE_%u"; - const char* ReplicaDataView::SPLITTER_STATE_FORMAT = "REPLICA_DATA_VIEW_SPLITTER_STATE_%u"; - const char* ReplicaDataView::TABLE_STATE_FORMAT = "REPLICA_DATA_VIEW_TABLE_STATE_%u"; - const char* ReplicaDataView::DATA_VIEW_STATE_FORMAT = "REPLICA_DATA_VIEW_DATA_VIEW_STATE_%u"; - const char* ReplicaDataView::DATA_VIEW_WORKSPACE_FORMAT = "REPLICA_DATA_VIEW_WORKSPACE_%u"; - - const int ReplicaDataView::INSPECT_ICON_COLUMN_SIZE = 32; - - ReplicaDataView::ReplicaDataView(unsigned int dataViewIndex, FrameNumberType currentFrame, const ReplicaDataAggregator* aggregator) - : QDialog() - , m_dataViewIndex(dataViewIndex) - , m_inspectedSeries(AreaChart::AreaChart::k_invalidSeriesId) - , m_windowStateCRC(0) - , m_splitterStateCRC(0) - , m_tableViewCRC(0) - , m_dataViewCRC(0) - , m_aggregatorIdentity(aggregator->GetIdentity()) - , m_aggregator(aggregator) - , m_currentFrame(currentFrame) - , m_startFrame(0) - , m_endFrame(0) - , m_overallReplicaDetailView(nullptr) - , m_replicaTypeTableView(this) - , m_replicaChunkTypeTableView(this) - , m_lifespanTelemetry("ReplicaDataView") - { - setAttribute(Qt::WA_DeleteOnClose, true); - setWindowFlags(windowFlags() | Qt::WindowMaximizeButtonHint | Qt::WindowMinimizeButtonHint); - - // Create a window defined in CarrierDataView.ui. - m_gui = azcreate(Ui::ReplicaDataView, ()); - m_gui->setupUi(this); - - show(); - raise(); - activateWindow(); - setFocus(); - - m_gui->areaChart->ConfigureVerticalAxis("Bandwidth Usage", GetAverageFrameBandwidthBudget()); - m_gui->areaChart->EnableMouseInspection(true); - - this->setWindowTitle(m_aggregator->GetDialogTitle()); - - for (int i = DDT_START + 1; i < DDT_END; ++i) - { - switch (i) - { - case DDT_REPLICA: - m_gui->dataSelectionComboBox->addItem(QString(DDT_REPLICA_NAME)); - break; - case DDT_CHUNK: - m_gui->dataSelectionComboBox->addItem(QString(DDT_CHUNK_NAME)); - break; - default: - break; - } - } - - if (m_gui->dataSelectionComboBox->count() == 1) - { - m_gui->dataSelectionComboBox->setEditable(false); - m_gui->dataSelectionComboBox->setEnabled(false); - } - - for (int i = ReplicaDisplayTypes::BUDT_START + 1; i < ReplicaDisplayTypes::BUDT_END; ++i) - { - switch (i) - { - case ReplicaDisplayTypes::BUDT_COMBINED: - m_gui->bandwidthUsageComboBox->addItem(QString(ReplicaDisplayTypes::DisplayNames::BUDT_COMBINED_NAME)); - break; - case ReplicaDisplayTypes::BUDT_SENT: - m_gui->bandwidthUsageComboBox->addItem(QString(ReplicaDisplayTypes::DisplayNames::BUDT_SENT_NAME)); - break; - case ReplicaDisplayTypes::BUDT_RECEIVED: - m_gui->bandwidthUsageComboBox->addItem(QString(ReplicaDisplayTypes::DisplayNames::BUDT_RECEIVED_NAME)); - break; - default: - break; - } - } - - if (m_gui->bandwidthUsageComboBox->count() == 1) - { - m_gui->dataSelectionComboBox->setEditable(false); - m_gui->dataSelectionComboBox->setEnabled(false); - } - - for (int i = TFT_START + 1; i < TFT_END; ++i) - { - switch (i) - { - case TFT_NONE: - m_gui->tableFilterComboBox->addItem("No Filter"); - break; - case TFT_ACTIVE_ONLY: - m_gui->tableFilterComboBox->addItem("Active Types"); - break; - } - } - - if (m_gui->tableFilterComboBox->count() == 1) - { - m_gui->tableFilterComboBox->setEditable(false); - m_gui->tableFilterComboBox->setEnabled(false); - } - - m_gui->drillerConfigToolbar->enableTreeCommands(false); - - AZStd::string serializationString = AZStd::string::format(WINDOW_STATE_FORMAT, m_dataViewIndex); - m_windowStateCRC = AZ::Crc32(serializationString.c_str()); - - AZStd::intrusive_ptr windowState = AZ::UserSettings::Find(m_windowStateCRC, AZ::UserSettings::CT_GLOBAL); - - if (windowState) - { - windowState->RestoreGeometry(this); - } - - serializationString = AZStd::string::format(DATA_VIEW_STATE_FORMAT, m_dataViewIndex); - m_dataViewCRC = AZ::Crc32(serializationString.c_str()); - m_persistentState = AZ::UserSettings::CreateFind(m_dataViewCRC, AZ::UserSettings::CT_GLOBAL); - - ApplyPersistentState(); - - // do the table state formatting - serializationString = AZStd::string::format(TABLE_STATE_FORMAT, m_dataViewIndex); - m_tableViewCRC = AZ::Crc32(serializationString.c_str()); - auto treeState = AZ::UserSettings::Find(m_tableViewCRC, AZ::UserSettings::CT_GLOBAL); - - if (treeState) - { - QByteArray treeData((const char*)treeState->m_treeColumnStorage.data(), (int)treeState->m_treeColumnStorage.size()); - m_gui->tableView->horizontalHeader()->restoreState(treeData); - } - - serializationString = AZStd::string::format(SPLITTER_STATE_FORMAT, m_dataViewIndex); - m_splitterStateCRC = AZ::Crc32(serializationString.c_str()); - auto splitterState = AZ::UserSettings::Find(m_splitterStateCRC,AZ::UserSettings::CT_GLOBAL); - - if (splitterState) - { - QByteArray splitterData((const char*)splitterState->m_splitterSavedState.data(), (int)splitterState->m_splitterSavedState.size()); - m_gui->splitter->restoreState(splitterData); - } - - DrillerMainWindowMessages::Handler::BusConnect(m_aggregatorIdentity); - DrillerEventWindowMessages::Handler::BusConnect(m_aggregatorIdentity); - - QObject::connect((&m_replicaTypeTableView), SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)), this, SLOT(UpdateDisplay(const QModelIndex&, const QModelIndex&))); - QObject::connect((&m_replicaChunkTypeTableView), SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)), this, SLOT(UpdateDisplay(const QModelIndex&, const QModelIndex&))); - - QObject::connect(m_gui->tableView, SIGNAL(clicked(const QModelIndex&)), this, SLOT(OnCellClicked(const QModelIndex&))); - QObject::connect(m_gui->tableView, SIGNAL(doubleClicked(const QModelIndex&)), this, SLOT(OnDoubleClicked(const QModelIndex&))); - - QObject::connect(m_gui->drillerConfigToolbar, SIGNAL(hideAll()), this, SLOT(HideAll())); - QObject::connect(m_gui->drillerConfigToolbar, SIGNAL(hideSelected()), this, SLOT(HideSelected())); - QObject::connect(m_gui->drillerConfigToolbar, SIGNAL(showAll()), this, SLOT(ShowAll())); - QObject::connect(m_gui->drillerConfigToolbar, SIGNAL(showSelected()), this, SLOT(ShowSelected())); - - QObject::connect(m_gui->showOverallStatistics,SIGNAL(clicked()),this,SLOT(OnShowOverallStatistics())); - QObject::connect(m_gui->displayRange, SIGNAL(valueChanged(int)), this, SLOT(OnDisplayRangeChanged(int))); - QObject::connect(m_gui->dataSelectionComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(OnDataTypeChanged(int))); - QObject::connect(m_gui->bandwidthUsageComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(OnBandwidthUsageDisplayTypeChanged(int))); - QObject::connect(m_gui->tableFilterComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(OnTableFilterTypeChanged(int))); - - QObject::connect(m_gui->areaChart, SIGNAL(InspectedSeries(size_t)), this, SLOT(OnInspectedSeries(size_t))); - QObject::connect(m_gui->areaChart, SIGNAL(SelectedSeries(size_t,int)), this, SLOT(OnSelectedSeries(size_t, int))); - } - - ReplicaDataView::~ReplicaDataView() - { - DrillerEventWindowMessages::Handler::BusDisconnect(m_aggregatorIdentity); - DrillerMainWindowMessages::Handler::BusDisconnect(m_aggregatorIdentity); - - // Save out whatever data we want to save out. - auto pState = AZ::UserSettings::CreateFind(m_windowStateCRC, AZ::UserSettings::CT_GLOBAL); - if (pState) - { - pState->CaptureGeometry(this); - } - - auto splitterState = AZ::UserSettings::CreateFind(m_splitterStateCRC, AZ::UserSettings::CT_GLOBAL); - if (splitterState) - { - QByteArray qba = m_gui->splitter->saveState(); - splitterState->m_splitterSavedState.assign((AZ::u8*)qba.begin(), (AZ::u8*)qba.end()); - } - - auto treeState = AZ::UserSettings::CreateFind(m_tableViewCRC, AZ::UserSettings::CT_GLOBAL); - if (treeState) - { - if (m_gui->tableView && m_gui->tableView->horizontalHeader()) - { - QByteArray qba = m_gui->tableView->horizontalHeader()->saveState(); - treeState->m_treeColumnStorage.assign((AZ::u8*)qba.begin(), (AZ::u8*)qba.end()); - } - } - - for (ReplicaDataMap::iterator replicaIter = m_replicaData.begin(); - replicaIter != m_replicaData.end(); - ++replicaIter) - { - delete replicaIter->second; - } - - m_replicaData.clear(); - - for (ReplicaChunkTypeDataMap::iterator chunkIter = m_replicaChunkTypeData.begin(); - chunkIter != m_replicaChunkTypeData.end(); - ++chunkIter) - { - delete chunkIter->second; - } - m_replicaChunkTypeData.clear(); - - for (ReplicaDetailView* view : m_spawnedReplicaDetailViews) - { - view->SignalDataViewDestroyed(this); - view->close(); - } - - for (ReplicaChunkTypeDetailView* view : m_spawnedChunkDetailViews) - { - view->SignalDataViewDestroyed(this); - view->close(); - } - - if (m_overallReplicaDetailView) - { - m_overallReplicaDetailView->SignalDataViewDestroyed(this); - m_overallReplicaDetailView->close(); - m_overallReplicaDetailView = nullptr; - } - - azdestroy(m_gui); - } - - void ReplicaDataView::FrameChanged(FrameNumberType frame) - { - int displayRange = GetDisplayRange(); - int halfRange = displayRange / 2; - - m_currentFrame = frame; - - m_startFrame = AZStd::GetMax(m_currentFrame - halfRange, 0); - - if (m_startFrame == 0) - { - m_endFrame = AZStd::GetMin(m_startFrame + displayRange, static_cast(m_aggregator->GetFrameCount())); - } - else - { - m_endFrame = AZStd::GetMin(m_currentFrame + halfRange, static_cast(m_aggregator->GetFrameCount())); - } - - if (m_endFrame == m_aggregator->GetFrameCount()) - { - m_startFrame = AZStd::GetMax(m_endFrame - displayRange, 0); - } - - UpdateData(); - - RefreshGraph(); - RefreshTableView(); - - emit DataRangeChanged(); - } - - void ReplicaDataView::EventFocusChanged(EventNumberType eventIndex) - { - (void)eventIndex; - } - - void ReplicaDataView::EventChanged(EventNumberType eventIndex) - { - (void)eventIndex; - } - - float ReplicaDataView::GetAxisStartFrame() const - { - return static_cast(m_startFrame); - } - - FrameNumberType ReplicaDataView::GetStartFrame() const - { - return m_startFrame; - } - - float ReplicaDataView::GetAxisEndFrame() const - { - return static_cast(AZStd::GetMax(m_endFrame, GetDisplayRange())); - } - - FrameNumberType ReplicaDataView::GetEndFrame() const - { - return m_endFrame; - } - - FrameNumberType ReplicaDataView::GetActiveFrameCount() const - { - return GetDisplayRange(); - } - - FrameNumberType ReplicaDataView::GetCurrentFrame() const - { - return m_currentFrame; - } - - bool ReplicaDataView::HideInactiveInspectedElements() const - { - return m_persistentState->m_tableFilterType == TFT_ACTIVE_ONLY; - } - - int ReplicaDataView::GetCaptureWindowIdentity() const - { - return m_aggregator->GetIdentity(); - } - - unsigned int ReplicaDataView::GetAverageFrameBandwidthBudget() const - { - return m_aggregator->GetAverageFrameBandwidthBudget(); - } - - void ReplicaDataView::DrawFrameGraph() - { - const QColor markerColor(Qt::red); - BandwidthUsageAggregator maximumUsageAggregator; - - m_gui->areaChart->ResetChart(); - m_gui->areaChart->ConfigureHorizontalAxis("Frame", static_cast(GetAxisStartFrame()), static_cast(GetAxisEndFrame())); - - m_gui->areaChart->AddMarker(Charts::AxisType::Horizontal, static_cast(GetCurrentFrame()), markerColor); - - switch (GetDisplayDataType()) - { - case DDT_REPLICA: - for (auto replicaIter = m_replicaData.begin(); - replicaIter != m_replicaData.end(); - ++replicaIter) - { - ReplicaDataContainer* container = replicaIter->second; - - container->GetAreaGraphPlotHelper().Reset(); - PlotChartDataForFrames(container); - } - break; - case DDT_CHUNK: - for (auto chunkIter = m_replicaChunkTypeData.begin(); - chunkIter != m_replicaChunkTypeData.end(); - ++chunkIter) - { - ReplicaChunkTypeDataContainer* container = chunkIter->second; - - container->GetAreaGraphPlotHelper().Reset(); - PlotChartDataForFrames(container); - } - break; - default: - AZ_Assert(false,"ERROR: Unknown display data type"); - break; - } - } - - void ReplicaDataView::SignalDialogClosed(QDialog* dialog) - { - if (dialog == m_overallReplicaDetailView) - { - m_overallReplicaDetailView = nullptr; - return; - } - - for (AZStd::vector< ReplicaDetailView* >::iterator dialogIter = m_spawnedReplicaDetailViews.begin(); - dialogIter != m_spawnedReplicaDetailViews.end(); - ++dialogIter) - { - if ((*dialogIter) == dialog) - { - m_spawnedReplicaDetailViews.erase(dialogIter); - return; - } - } - - for (AZStd::vector< ReplicaChunkTypeDetailView* >::iterator dialogIter = m_spawnedChunkDetailViews.begin(); - dialogIter != m_spawnedChunkDetailViews.end(); - ++dialogIter) - { - if ((*dialogIter) == dialog) - { - m_spawnedChunkDetailViews.erase(dialogIter); - return; - } - } - } - - unsigned int ReplicaDataView::GetDataViewIndex() const - { - return m_dataViewIndex; - } - - void ReplicaDataView::ApplySettingsFromWorkspace(WorkspaceSettingsProvider* settingsProvider) - { - AZStd::string workspaceStateStr = AZStd::string::format(DATA_VIEW_WORKSPACE_FORMAT, GetDataViewIndex()); - AZ::u32 workspaceStateCRC = AZ::Crc32(workspaceStateStr.c_str()); - - if (m_persistentState) - { - ReplicaDataViewSavedState* workspace = settingsProvider->FindSetting(workspaceStateCRC); - - if (workspace) - { - m_persistentState->CopyStateFrom(workspace); - } - } - } - - void ReplicaDataView::ActivateWorkspaceSettings(WorkspaceSettingsProvider* settingsProvider) - { - (void)settingsProvider; - - ApplyPersistentState(); - } - - void ReplicaDataView::SaveSettingsToWorkspace(WorkspaceSettingsProvider* settingsProvider) - { - AZStd::string workspaceStateStr = AZStd::string::format(DATA_VIEW_WORKSPACE_FORMAT, GetDataViewIndex()); - AZ::u32 workspaceStateCRC = AZ::Crc32(workspaceStateStr.c_str()); - - if (m_persistentState) - { - ReplicaDataViewSavedState* workspace = settingsProvider->CreateSetting(workspaceStateCRC); - - if (workspace) - { - workspace->CopyStateFrom(m_persistentState.get()); - } - } - } - - void ReplicaDataView::ApplyPersistentState() - { - if (m_persistentState) - { - m_gui->dataSelectionComboBox->setCurrentIndex(m_persistentState->m_displayDataType); - m_gui->bandwidthUsageComboBox->setCurrentIndex(m_persistentState->m_bandwidthUsageDisplayType); - m_gui->tableFilterComboBox->setCurrentIndex(m_persistentState->m_tableFilterType); - - m_gui->displayRange->setValue(m_persistentState->m_displayRange); - - SetupTableView(); - FrameChanged(GetCurrentFrame()); - } - } - - void ReplicaDataView::Reflect(AZ::ReflectContext* context) - { - AZ::SerializeContext* serialize = azrtti_cast(context); - if (serialize) - { - ReplicaDataViewSavedState::Reflect(context); - ReplicaDataViewTableModelSavedState::Reflect(context); - ReplicaDataViewSplitterSavedState::Reflect(context); - - BaseDetailViewSplitterSavedState::Reflect(context); - BaseDetailViewTreeSavedState::Reflect(context); - } - } - - void ReplicaDataView::ReplicaSelectionChanged(const QItemSelection& selected, const QItemSelection& deselected) - { - if (GetDisplayDataType() != DDT_REPLICA) - { - return; - } - - if (!selected.indexes().empty()) - { - for (const QModelIndex& selectedIndex : selected.indexes()) - { - AZ::u64 replicaId = m_replicaTypeTableView.GetReplicaIdFromIndex(selectedIndex); - ReplicaDataContainer* container = FindReplicaData(replicaId); - - if (container != nullptr) - { - container->SetSelected(true); - - const bool isHighlighted = true; - container->GetAreaGraphPlotHelper().SetHighlighted(isHighlighted); - } - } - } - - if (!deselected.empty()) - { - for (const QModelIndex& deselectedIndex : deselected.indexes()) - { - AZ::u64 replicaId = m_replicaTypeTableView.GetReplicaIdFromIndex(deselectedIndex); - ReplicaDataContainer* container = FindReplicaData(replicaId); - - if (container != nullptr) - { - container->SetSelected(false); - - const bool isHighlighted = false; - container->GetAreaGraphPlotHelper().SetHighlighted(isHighlighted); - } - } - } - } - - void ReplicaDataView::ChunkSelectionChanged(const QItemSelection& selected, const QItemSelection& deselected) - { - if (GetDisplayDataType() != DDT_CHUNK) - { - return; - } - - if (!selected.indexes().empty()) - { - for (const QModelIndex& selectedIndex : selected.indexes()) - { - const char* chunkType = m_replicaChunkTypeTableView.GetReplicaChunkTypeFromIndex(selectedIndex); - ReplicaChunkTypeDataContainer* container = FindReplicaChunkTypeData(chunkType); - - if (container != nullptr) - { - container->SetSelected(true); - - const bool isHighlighted = true; - container->GetAreaGraphPlotHelper().SetHighlighted(isHighlighted); - } - } - } - - if (!deselected.empty()) - { - AZStd::unordered_set rowSets; - for (const QModelIndex& deselectedIndex : deselected.indexes()) - { - const char* chunkType = m_replicaChunkTypeTableView.GetReplicaChunkTypeFromIndex(deselectedIndex); - ReplicaChunkTypeDataContainer* container = FindReplicaChunkTypeData(chunkType); - - if (container != nullptr) - { - container->SetSelected(false); - - const bool isHighlighted = false; - container->GetAreaGraphPlotHelper().SetHighlighted(isHighlighted); - } - } - } - } - - void ReplicaDataView::OnDisplayRangeChanged(int displayRange) - { - ReplicaOperationTelemetryEvent displayRangeEvent; - displayRangeEvent.SetMetric("DisplayRange", displayRange); - displayRangeEvent.Log(); - - m_persistentState->m_displayRange = displayRange; - FrameChanged(GetCurrentFrame()); - } - - void ReplicaDataView::HideAll() - { - SetAllEnabled(false); - } - - void ReplicaDataView::ShowAll() - { - SetAllEnabled(true); - } - - void ReplicaDataView::SetAllEnabled(bool enabled) - { - switch (GetDisplayDataType()) - { - case DDT_REPLICA: - { - for (AZ::u64 replicaId : m_activeReplicaIds) - { - ReplicaDataContainer* dataContainer = m_replicaData[replicaId]; - dataContainer->SetEnabled(enabled); - dataContainer->GetAreaGraphPlotHelper().SetEnabled(enabled); - } - - m_replicaTypeTableView.layoutChanged(); - break; - } - case DDT_CHUNK: - { - for (AZStd::string chunkType : m_activeChunkTypes) - { - ReplicaChunkTypeDataContainer* dataContainer = m_replicaChunkTypeData[chunkType]; - dataContainer->SetEnabled(enabled); - dataContainer->GetAreaGraphPlotHelper().SetEnabled(enabled); - } - - m_replicaChunkTypeTableView.layoutChanged(); - break; - } - default: - AZ_Assert(false, "Unknown Display Data Type"); - break; - } - } - - void ReplicaDataView::HideSelected() - { - SetSelectedEnabled(false); - } - - void ReplicaDataView::ShowSelected() - { - SetSelectedEnabled(true); - } - - void ReplicaDataView::SetSelectedEnabled(bool enabled) - { - switch (GetDisplayDataType()) - { - case DDT_REPLICA: - { - for (AZ::u64 replicaId : m_activeReplicaIds) - { - ReplicaDataContainer* dataContainer = m_replicaData[replicaId]; - - if (dataContainer->IsSelected()) - { - dataContainer->SetEnabled(enabled); - } - } - - m_replicaTypeTableView.layoutChanged(); - break; - } - case DDT_CHUNK: - { - for (AZStd::string chunkType : m_activeChunkTypes) - { - ReplicaChunkTypeDataContainer* dataContainer = m_replicaChunkTypeData[chunkType]; - - if (dataContainer->IsSelected()) - { - dataContainer->SetEnabled(enabled); - } - } - - m_replicaChunkTypeTableView.layoutChanged(); - break; - } - default: - AZ_Assert(false, "Unknown Data Display Type"); - break; - } - - m_replicaChunkTypeTableView.layoutChanged(); - RefreshGraph(); - } - - void ReplicaDataView::UpdateDisplay(const QModelIndex& startIndex, const QModelIndex& endIndex) - { - (void)startIndex; - (void)endIndex; - - RefreshGraph(); - } - - void ReplicaDataView::RefreshGraph() - { - DrawFrameGraph(); - } - - void ReplicaDataView::OnCellClicked(const QModelIndex& index) - { - if (!index.isValid()) - { - return; - } - - switch (GetDisplayDataType()) - { - case DDT_REPLICA: - if (index.column() == ReplicaTableViewModel::CD_INSPECT) - { - InspectReplica(index.row()); - } - break; - case DDT_CHUNK: - if (index.column() == ReplicaChunkTypeTableViewModel::CD_INSPECT) - { - InspectChunkType(index.row()); - } - break; - default: - AZ_Assert(false, "ERROR: Unknown Display Data Type"); - break; - } - } - - void ReplicaDataView::OnDoubleClicked(const QModelIndex& index) - { - if (!index.isValid()) - { - return; - } - - switch (GetDisplayDataType()) - { - case DDT_REPLICA: - { - if (index.column() != ReplicaTableViewModel::CD_INSPECT) - { - AZ::u64 replicaId = m_replicaTypeTableView.GetReplicaIdFromIndex(index); - - ReplicaDataContainer* dataContainer = FindReplicaData(replicaId); - dataContainer->SetEnabled(!dataContainer->IsEnabled()); - dataContainer->GetAreaGraphPlotHelper().SetEnabled(dataContainer->IsEnabled()); - } - break; - } - case DDT_CHUNK: - { - if (index.column() != ReplicaChunkTypeTableViewModel::CD_INSPECT) - { - const char* chunkType = m_replicaChunkTypeTableView.GetReplicaChunkTypeFromIndex(index); - - ReplicaChunkTypeDataContainer* dataContainer = FindReplicaChunkTypeData(chunkType); - dataContainer->SetEnabled(!dataContainer->IsEnabled()); - dataContainer->GetAreaGraphPlotHelper().SetEnabled(dataContainer->IsEnabled()); - } - break; - } - default: - AZ_Assert(false, "ERROR: Unknown Display Data Type"); - break; - } - } - - void ReplicaDataView::OnDataTypeChanged(int selectedIndex) - { - AZ_Error("StandaloneTools", selectedIndex > DDT_START && selectedIndex < DDT_END, "selectedIndex for DataType is out of enum range."); - - if (selectedIndex > DDT_START && selectedIndex < DDT_END) - { - m_persistentState->m_displayDataType = static_cast(selectedIndex); - ParseActiveItems(); - SetupTableView(); - RefreshGraph(); - - ReplicaOperationTelemetryEvent dataTypeChanged; - - switch (m_persistentState->m_displayDataType) - { - case DDT_CHUNK: - { - dataTypeChanged.SetAttribute("DisplayDataType", DDT_CHUNK_NAME); - break; - } - case DDT_REPLICA: - { - dataTypeChanged.SetAttribute("DisplayDataType", DDT_REPLICA_NAME); - break; - } - default: - { - dataTypeChanged.SetAttribute("Change Display Data Type", "Unknown"); - } - } - - dataTypeChanged.Log(); - } - } - - void ReplicaDataView::OnBandwidthUsageDisplayTypeChanged(int selectedIndex) - { - AZ_Error("StandaloneTools", selectedIndex > ReplicaDisplayTypes::BUDT_START && selectedIndex < ReplicaDisplayTypes::BUDT_END, "Invalid index for BandwidthUsageDisplay"); - - if (selectedIndex > ReplicaDisplayTypes::BUDT_START && selectedIndex < ReplicaDisplayTypes::BUDT_END) - { - m_persistentState->m_bandwidthUsageDisplayType = static_cast(selectedIndex); - - RefreshGraph(); - - ReplicaOperationTelemetryEvent bandwidthDisplayChanged; - - switch (m_persistentState->m_displayDataType) - { - case ReplicaDisplayTypes::BUDT_COMBINED: - { - bandwidthDisplayChanged.SetAttribute("BandwidthUsageDisplayType", ReplicaDisplayTypes::DisplayNames::BUDT_COMBINED_NAME); - break; - } - case ReplicaDisplayTypes::BUDT_SENT: - { - bandwidthDisplayChanged.SetAttribute("BandwidthUsageDisplayType", ReplicaDisplayTypes::DisplayNames::BUDT_SENT_NAME); - break; - } - case ReplicaDisplayTypes::BUDT_RECEIVED: - { - bandwidthDisplayChanged.SetAttribute("BandwidthUsageDisplayType", ReplicaDisplayTypes::DisplayNames::BUDT_RECEIVED_NAME); - break; - } - default: - { - bandwidthDisplayChanged.SetAttribute("Change Display Data Type", "Unknown"); - } - } - - bandwidthDisplayChanged.Log(); - } - } - - void ReplicaDataView::OnTableFilterTypeChanged(int selectedIndex) - { - AZ_Error("StandaloneTools", selectedIndex > TFT_START && selectedIndex < TFT_END, "Invalid index for TableFilterType"); - - if (selectedIndex > TFT_START && selectedIndex < TFT_END) - { - m_persistentState->m_tableFilterType = static_cast(selectedIndex); - RefreshTableView(); - - ReplicaOperationTelemetryEvent displayFilterChangedEvent; - - switch (m_persistentState->m_tableFilterType) - { - case TFT_NONE: - { - displayFilterChangedEvent.SetAttribute("TableFilterType", "None"); - break; - } - case TFT_ACTIVE_ONLY: - { - displayFilterChangedEvent.SetAttribute("TableFilterType", "Active Only"); - break; - } - default: - { - displayFilterChangedEvent.SetAttribute("TableFilterType", "Unknown"); - } - } - - displayFilterChangedEvent.Log(); - } - } - - void ReplicaDataView::OnShowOverallStatistics() - { - if (m_overallReplicaDetailView == nullptr) - { - m_overallReplicaDetailView = aznew OverallReplicaDetailView(this, (*m_aggregator)); - } - else - { - if (m_overallReplicaDetailView->isMinimized()) - { - m_overallReplicaDetailView->showNormal(); - } - - m_overallReplicaDetailView->raise(); - m_overallReplicaDetailView->activateWindow(); - } - } - - void ReplicaDataView::OnInspectedSeries(size_t seriesId) - { - if (m_inspectedSeries != seriesId) - { - m_inspectedSeries = seriesId; - - // This could be improved by using a map. But might not be necessary. - if (GetDisplayDataType() == DDT_REPLICA) - { - for (auto& mapPair : m_replicaData) - { - ReplicaDataContainer* container = mapPair.second; - - container->SetInspected(container->GetAreaGraphPlotHelper().IsSeries(seriesId)); - } - - m_replicaTypeTableView.layoutChanged(); - } - else if (GetDisplayDataType() == DDT_CHUNK) - { - for (auto& mapPair : m_replicaChunkTypeData) - { - ReplicaChunkTypeDataContainer* container = mapPair.second; - - container->SetInspected(container->GetAreaGraphPlotHelper().IsSeries(seriesId)); - } - - m_replicaChunkTypeTableView.layoutChanged(); - } - } - } - - void ReplicaDataView::OnSelectedSeries(size_t seriesId, int position) - { - (void)seriesId; - - EBUS_EVENT_ID(GetCaptureWindowIdentity(), DrillerCaptureWindowRequestBus, ScrubToFrameRequest, position); - } - - void ReplicaDataView::InspectReplica(int tableRow) - { - AZ::u64 replicaId = m_replicaTypeTableView.GetReplicaIdForRow(tableRow); - ReplicaDataContainer* replicaContainer = FindReplicaData(replicaId); - - ReplicaDetailView* replicaDetailView = aznew ReplicaDetailView(this, replicaContainer); - replicaDetailView->LoadSavedState(); - m_spawnedReplicaDetailViews.push_back(replicaDetailView); - } - - void ReplicaDataView::InspectChunkType(int tableRow) - { - const char* chunkType = m_replicaChunkTypeTableView.GetReplicaChunkTypeForRow(tableRow); - ReplicaChunkTypeDataContainer* chunkContainer = FindReplicaChunkTypeData(chunkType); - - ReplicaChunkTypeDetailView* replicaDetailView = aznew ReplicaChunkTypeDetailView(this, chunkContainer); - replicaDetailView->LoadSavedState(); - m_spawnedChunkDetailViews.push_back(replicaDetailView); - } - - void ReplicaDataView::RefreshTableView() - { - switch (GetDisplayDataType()) - { - case DDT_REPLICA: - m_replicaTypeTableView.RefreshView(); - break; - case DDT_CHUNK: - m_replicaChunkTypeTableView.RefreshView(); - break; - default: - break; - } - } - - void ReplicaDataView::SetupTableView() - { - m_gui->tableView->reset(); - - switch (GetDisplayDataType()) - { - case DDT_REPLICA: - SetupReplicaTableView(); - break; - case DDT_CHUNK: - SetupChunkTableView(); - break; - default: - break; - } - - RefreshTableView(); - } - - void ReplicaDataView::SetupReplicaTableView() - { - m_gui->tableView->setModel(&m_replicaTypeTableView); - m_gui->tableView->verticalHeader()->hide(); - - m_gui->tableView->horizontalHeader()->reset(); - - // I think this will fix the sizing issue, but until we update to 5.6 we don't get it! AWESOME - //m_gui->tableView->horizontalHeader()->resetDefaultSectionSize(); - - for (int i = 0; i < m_replicaTypeTableView.columnCount(); ++i) - { - m_gui->tableView->horizontalHeader()->resizeSection(i, m_gui->tableView->horizontalHeader()->defaultSectionSize()); - } - - // QT Persists the section resize mode after you call reset on the table, and on the column header. - // It's pretty special. - // Going to manually remove the information to avoid something looking really stupid. - if (ReplicaChunkTypeTableViewModel::CD_INSPECT < m_replicaTypeTableView.columnCount()) - { - m_gui->tableView->horizontalHeader()->setSectionResizeMode(ReplicaChunkTypeTableViewModel::CD_INSPECT, QHeaderView::Interactive); - } - - m_gui->tableView->horizontalHeader()->setSectionsClickable(false); - m_gui->tableView->horizontalHeader()->setSectionResizeMode(ReplicaTableViewModel::CD_INSPECT, QHeaderView::Fixed); - m_gui->tableView->horizontalHeader()->resizeSection(ReplicaTableViewModel::CD_INSPECT, INSPECT_ICON_COLUMN_SIZE); - - m_gui->tableView->setSelectionBehavior(QAbstractItemView::SelectRows); - m_gui->tableView->setAlternatingRowColors(true); - - m_gui->tableView->setItemDelegateForColumn(ReplicaTableViewModel::CD_INSPECT, new InspectIconItemDelegate(Qt::AlignCenter, m_gui->tableView)); - - QObject::connect(m_gui->tableView->selectionModel(), SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)), this, SLOT(ReplicaSelectionChanged(const QItemSelection&, const QItemSelection&))); - } - - void ReplicaDataView::SetupChunkTableView() - { - m_gui->tableView->setModel(&m_replicaChunkTypeTableView); - m_gui->tableView->verticalHeader()->hide(); - - m_gui->tableView->horizontalHeader()->reset(); - - // I think this will fix the sizing issue, but until we update to 5.6 we don't get it! AWESOME - //m_gui->tableView->horizontalHeader()->resetDefaultSectionSize(); - - for (int i = 0; i < m_replicaChunkTypeTableView.columnCount(); ++i) - { - m_gui->tableView->horizontalHeader()->resizeSection(i, m_gui->tableView->horizontalHeader()->defaultSectionSize()); - } - - // QT Persists the section resize mode after you call reset on the table, and on the column header. - // It's pretty special. - // Going to manually remove the information to avoid something looking really stupid. - if (ReplicaTableViewModel::CD_INSPECT < m_replicaChunkTypeTableView.columnCount()) - { - m_gui->tableView->horizontalHeader()->setSectionResizeMode(ReplicaTableViewModel::CD_INSPECT, QHeaderView::Interactive); - } - - m_gui->tableView->horizontalHeader()->setSectionsClickable(false); - m_gui->tableView->horizontalHeader()->setSectionResizeMode(ReplicaChunkTypeTableViewModel::CD_INSPECT, QHeaderView::Fixed); - m_gui->tableView->horizontalHeader()->resizeSection(ReplicaChunkTypeTableViewModel::CD_INSPECT, INSPECT_ICON_COLUMN_SIZE); - - m_gui->tableView->setSelectionBehavior(QAbstractItemView::SelectRows); - m_gui->tableView->setAlternatingRowColors(true); - - m_gui->tableView->setItemDelegateForColumn(ReplicaChunkTypeTableViewModel::CD_INSPECT, new InspectIconItemDelegate(Qt::AlignCenter, m_gui->tableView)); - - QObject::connect(m_gui->tableView->selectionModel(), SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)), this, SLOT(ChunkSelectionChanged(const QItemSelection&, const QItemSelection&))); - } - - void ReplicaDataView::UpdateData() - { - for (FrameNumberType frameId = GetStartFrame(); frameId <= GetEndFrame(); ++frameId) - { - ParseFrameData(frameId); - } - - ParseActiveItems(); - } - - void ReplicaDataView::ParseFrameData(FrameNumberType frameId) - { - AZ_PROFILE_FUNCTION(AzToolsFramework); - if (frameId < 0 || frameId >= m_aggregator->GetFrameCount() || m_parsedFrames.find(frameId) != m_parsedFrames.end()) - { - return; - } - - m_parsedFrames.insert(frameId); - - size_t numEvents = m_aggregator->NumOfEventsAtFrame(frameId); - - if (numEvents > 0) - { - const ReplicaDataAggregator::EventListType& events = m_aggregator->GetEvents(); - - EventNumberType startIndex = m_aggregator->GetFirstIndexAtFrame(frameId); - for (EventNumberType eventId = startIndex; eventId < static_cast(startIndex + numEvents); ++eventId) - { - const ReplicaChunkEvent* replicaChunkEvent = static_cast(events[eventId]); - - // Parsing events by ReplicaId - AZ::u64 replicaId = replicaChunkEvent->GetReplicaId(); - ReplicaDataMap::iterator replicaIter = m_replicaData.find(replicaId); - ReplicaDataContainer* replicaDataContainer = nullptr; - - if (replicaIter == m_replicaData.end()) - { - replicaDataContainer = aznew ReplicaDataContainer(replicaChunkEvent->GetReplicaName(), replicaId, GetRandomDisplayColor()); - - if (replicaDataContainer) - { - m_replicaData.insert(ReplicaDataMap::value_type(replicaId, replicaDataContainer)); - } - } - else - { - replicaDataContainer = replicaIter->second; - } - - // Parsing events by ReplicaChunkType - const AZStd::string& replicaChunkType = replicaChunkEvent->GetChunkTypeName(); - ReplicaChunkTypeDataMap::iterator replicaChunkIter = m_replicaChunkTypeData.find(replicaChunkType); - ReplicaChunkTypeDataContainer* replicaChunkDataContainer = nullptr; - - if (replicaChunkIter == m_replicaChunkTypeData.end()) - { - replicaChunkDataContainer = aznew ReplicaChunkTypeDataContainer(replicaChunkType.c_str(), GetRandomDisplayColor()); - - if (replicaChunkDataContainer) - { - m_replicaChunkTypeData.insert(ReplicaChunkTypeDataMap::value_type(replicaChunkType, replicaChunkDataContainer)); - } - } - else - { - replicaChunkDataContainer = replicaChunkIter->second; - } - - if (replicaDataContainer) - { - replicaDataContainer->ProcessReplicaChunkEvent(frameId, replicaChunkEvent); - } - - if (replicaChunkDataContainer) - { - replicaChunkDataContainer->ProcessReplicaChunkEvent(frameId, replicaChunkEvent); - } - } - } - } - - - void ReplicaDataView::ParseActiveItems() - { - switch (GetDisplayDataType()) - { - case DDT_REPLICA: - m_activeReplicaIds.clear(); - m_activeInspectedReplicaIds.clear(); - - for (AZStd::pair& replicaItem : m_replicaData) - { - ReplicaDataContainer* dataContainer = replicaItem.second; - - for (FrameNumberType frameId = GetStartFrame(); frameId <= GetEndFrame(); ++frameId) - { - if (dataContainer->HasUsageForFrame(frameId)) - { - m_activeReplicaIds.insert(replicaItem.first); - - if (dataContainer->HasUsageForFrame(GetCurrentFrame())) - { - m_activeInspectedReplicaIds.insert(replicaItem.first); - } - - break; - } - } - } - break; - case DDT_CHUNK: - m_activeChunkTypes.clear(); - m_activeInspectedChunkTypes.clear(); - - for (AZStd::pair& chunkItem : m_replicaChunkTypeData) - { - ReplicaChunkTypeDataContainer* dataContainer = chunkItem.second; - - for (FrameNumberType frameId = GetStartFrame(); frameId <= GetEndFrame(); ++frameId) - { - if (dataContainer->HasUsageForFrame(frameId)) - { - m_activeChunkTypes.insert(chunkItem.first); - - if (dataContainer->HasUsageForFrame(GetCurrentFrame())) - { - m_activeInspectedChunkTypes.insert(chunkItem.first); - } - - break; - } - } - } - break; - default: - AZ_Assert(false, "Unknown Display Data Type"); - break; - } - } - - int ReplicaDataView::GetDisplayRange() const - { - return m_persistentState->m_displayRange; - } - - ReplicaDataView::DisplayDataType ReplicaDataView::GetDisplayDataType() const - { - return static_cast(m_persistentState->m_displayDataType); - } - - ReplicaDisplayTypes::BandwidthUsageDisplayType ReplicaDataView::GetBandwidthUsageDisplayType() const - { - return static_cast(m_persistentState->m_bandwidthUsageDisplayType); - } - - ReplicaDataContainer* ReplicaDataView::FindReplicaData(AZ::u64 replicaId) const - { - ReplicaDataContainer* retVal = nullptr; - - ReplicaDataMap::const_iterator replicaIter = m_replicaData.find(replicaId); - - if (replicaIter != m_replicaData.end()) - { - retVal = replicaIter->second; - } - - return retVal; - } - - ReplicaChunkTypeDataContainer* ReplicaDataView::FindReplicaChunkTypeData(const char* chunkType) const - { - ReplicaChunkTypeDataContainer* retVal = nullptr; - - if (chunkType == nullptr) - { - return retVal; - } - - ReplicaChunkTypeDataMap::const_iterator chunkTypeIter = m_replicaChunkTypeData.find(AZStd::string(chunkType)); - - if (chunkTypeIter != m_replicaChunkTypeData.end()) - { - retVal = chunkTypeIter->second; - } - - return retVal; - } -} - diff --git a/Code/Tools/Standalone/Source/Driller/Replica/ReplicaDataView.hxx b/Code/Tools/Standalone/Source/Driller/Replica/ReplicaDataView.hxx deleted file mode 100644 index 20833fe4e5..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Replica/ReplicaDataView.hxx +++ /dev/null @@ -1,438 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef REPLICADATAVIEW_H -#define REPLICADATAVIEW_H - -#if !defined(Q_MOC_RUN) -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include "Source/Driller/DrillerMainWindowMessages.h" -#include "Source/Driller/DrillerOperationTelemetryEvent.h" - -#include "Source/Driller/StripChart.hxx" -#include "Source/Driller/AreaChart.hxx" -#include "Source/Driller/DrillerDataTypes.h" -#include "Source/Driller/Replica/ReplicaDisplayHelpers.h" -#include "Source/Driller/Replica/ReplicaDisplayTypes.h" -#include "Source/Driller/Replica/ReplicaTreeViewModel.hxx" - -#include -#include - -#include "ReplicaBandwidthChartData.h" -#endif - -namespace AZ { class ReflectContext; } - -namespace Driller -{ - class ReplicaDataAggregator; - - class ReplicaChunkDataEvent; - class ReplicaChunkReceivedDataEvent; - class ReplicaChunkSentDataEvent; - class ReplicaDataView; - class ReplicaTableViewModel; - class ReplicaDataContainer; - class ReplicaChunkTypeDataContainer; - - class ReplicaDetailView; - class ReplicaChunkTypeDetailView; - - class ReplicaDataViewSavedState; - - class OverallReplicaDetailView; - - class FormattingHelper - { - public: - static QString ReplicaID(AZ::u64 replicaId) - { - return QString("0x%1").arg(QString::number(replicaId,16).toUpper()); - } - }; - - // Icon Item Delegate - class InspectIconItemDelegate : public QStyledItemDelegate - { - Q_OBJECT - public: - explicit InspectIconItemDelegate(Qt::Alignment alignment, QObject* parent = 0) - : QStyledItemDelegate(parent) - , m_alignment(alignment) - { - - } - - void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const override - { - auto opt = option; - opt.decorationAlignment = m_alignment; - QStyledItemDelegate::paint(painter,opt,index); - } - - private: - Qt::Alignment m_alignment; - }; - - // Should be a private class, but Q_OBJECT doesn't support it. - class ReplicaTableViewModel : public QAbstractTableModel - { - Q_OBJECT - - public: - - enum ColumnDescriptor - { - CD_INDEX_FORCE = -1, - - // Ordering of this enum determines the display order. - CD_REPLICA_NAME, - CD_REPLICA_ID, - CD_TOTAL_SENT, - CD_TOTAL_RECEIVED, - CD_INSPECT, - - // Used for sizing of the TableView. Anything after this won't be displayed. - CD_COUNT, - - }; - - AZ_CLASS_ALLOCATOR(ReplicaTableViewModel, AZ::SystemAllocator, 0); - ReplicaTableViewModel(ReplicaDataView* replicaDataView); - - void RefreshView(); - - int rowCount(const QModelIndex& parentIndex = QModelIndex()) const override; - int columnCount(const QModelIndex& parentIndex = QModelIndex()) const override; - - QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; - - QVariant headerData(int section, Qt::Orientation orientation, int role) const override; - - Qt::ItemFlags flags(const QModelIndex& index) const override; - - AZ::u64 GetReplicaIdFromIndex(const QModelIndex& index) const; - AZ::u64 GetReplicaIdForRow(int row) const; - - private: - - ReplicaDataView* m_replicaDataView; - AZStd::vector m_replicaIds; - }; - - class ReplicaChunkTypeTableViewModel : public QAbstractTableModel - { - Q_OBJECT - - public: - - enum ColumnDescriptor - { - CD_INDEX_FORCE = -1, - - // Ordering of this enum determines the display order. - CD_CHUNK_TYPE, - CD_TOTAL_SENT, - CD_TOTAL_RECEIVED, - CD_INSPECT, - - CD_COUNT - }; - - AZ_CLASS_ALLOCATOR(ReplicaChunkTypeTableViewModel, AZ::SystemAllocator, 0); - - ReplicaChunkTypeTableViewModel(ReplicaDataView* replicaDataView); - - void RefreshView(); - - int rowCount(const QModelIndex& parentIndex = QModelIndex()) const override; - int columnCount(const QModelIndex& parentIndex = QModelIndex()) const override; - - QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; - - QVariant headerData(int section, Qt::Orientation orientation, int role) const override; - - Qt::ItemFlags flags(const QModelIndex& index) const override; - - const char* GetReplicaChunkTypeFromIndex(const QModelIndex& index) const; - const char* GetReplicaChunkTypeForRow(int row) const; - - private: - - ReplicaDataView* m_replicaDataView; - AZStd::vector m_replicaChunkTypes; - }; - - class ReplicaDataView - : public QDialog - , public Driller::DrillerMainWindowMessages::Bus::Handler - , public Driller::DrillerEventWindowMessages::Bus::Handler - { - Q_OBJECT - - private: - - friend class ReplicaDataViewSavedState; - friend class ReplicaDataViewConfigurationDialog; - - friend class ReplicaChunkTypeTableViewModel; - friend class ReplicaChunkTypeDetailView; - - friend class ReplicaTableViewModel; - friend class ReplicaDetailView; - - enum DisplayDataType - { - DDT_START = -1, - - DDT_REPLICA, - DDT_CHUNK, - - DDT_END - }; - - enum TableFilterType - { - TFT_START = -1, - - TFT_NONE, - TFT_ACTIVE_ONLY, - - TFT_END - }; - - static const char* DDT_REPLICA_NAME; - static const char* DDT_CHUNK_NAME; - - // Serialization Keys - static const char* WINDOW_STATE_FORMAT; - static const char* SPLITTER_STATE_FORMAT; - static const char* TABLE_STATE_FORMAT; - static const char* DATA_VIEW_STATE_FORMAT; - - static const char* DATA_VIEW_WORKSPACE_FORMAT; - - // Sizing keys - static const int INSPECT_ICON_COLUMN_SIZE; - - public: - - struct ChartZoomMaintainer - { - public: - ChartZoomMaintainer(); - - void GetZoomFromChart(StripChart::DataStrip& chart, Charts::AxisType axis); - void SetZoomOnChart(StripChart::DataStrip& chart, Charts::AxisType axis); - - private: - - Charts::AxisType m_axis; - float m_minValue; - float m_maxValue; - }; - - public: - - AZ_CLASS_ALLOCATOR(ReplicaDataView, AZ::SystemAllocator, 0); - - ReplicaDataView(unsigned int dataViewIndex, FrameNumberType currentFrame, const ReplicaDataAggregator* aggr); - virtual ~ReplicaDataView(); - - // MainWindow Bus Commands - void FrameChanged(FrameNumberType frame) override; - void EventFocusChanged(EventNumberType eventIndex) override; - void EventChanged(EventNumberType eventIndex) override; - - float GetAxisStartFrame() const; - FrameNumberType GetStartFrame() const; - - float GetAxisEndFrame() const; - FrameNumberType GetEndFrame() const; - - FrameNumberType GetActiveFrameCount() const; - FrameNumberType GetCurrentFrame() const; - - bool HideInactiveInspectedElements() const; - - int GetCaptureWindowIdentity() const; - unsigned int GetAverageFrameBandwidthBudget() const; - - void SignalDialogClosed(QDialog* dialog); - - unsigned int GetDataViewIndex() const; - - // Mimicing the workspace bus, but these need to be invoked manually - // by the object that creates these windows(since it creates these in response - // to these events). - void ApplySettingsFromWorkspace(WorkspaceSettingsProvider*); - void ActivateWorkspaceSettings(WorkspaceSettingsProvider*); - void SaveSettingsToWorkspace(WorkspaceSettingsProvider*); - void ApplyPersistentState(); - - static void Reflect(AZ::ReflectContext* context); - - public slots: - - void UpdateDisplay(const QModelIndex& startIndex, const QModelIndex& endIndex); - - void RefreshGraph(); - void ReplicaSelectionChanged(const QItemSelection& selected, const QItemSelection& deselected); - void ChunkSelectionChanged(const QItemSelection& selected, const QItemSelection& deselected); - void OnDisplayRangeChanged(int); - - void HideAll(); - void ShowAll(); - void SetAllEnabled(bool enabled); - - void HideSelected(); - void ShowSelected(); - void SetSelectedEnabled(bool enabled); - - void OnCellClicked(const QModelIndex& index); - void OnDoubleClicked(const QModelIndex& idnex); - - void OnDataTypeChanged(int selectedIndex); - void OnBandwidthUsageDisplayTypeChanged(int selectedIndex); - void OnTableFilterTypeChanged(int selectedIndex); - - void OnShowOverallStatistics(); - - void OnInspectedSeries(size_t seriesId); - void OnSelectedSeries(size_t seriesId, int position); - - signals: - - void DataRangeChanged(); - - private: - - void SaveOnExit(); - - void InspectReplica(int tableRow); - void InspectChunkType(int tableRow); - - void RefreshTableView(); - void SetupTableView(); - void SetupReplicaTableView(); - void SetupChunkTableView(); - - void DrawFrameGraph(); - - template - void PlotChartDataForFrames(ReplicaBandwidthChartData* chartData) - { - AreaGraphPlotHelper& areaPlotHelper = chartData->GetAreaGraphPlotHelper(); - areaPlotHelper.SetupPlotHelper(m_gui->areaChart, chartData->GetAxisName(),chartData->GetAllFrames().size()); - - if (!areaPlotHelper.IsSetup()) - { - return; - } - - areaPlotHelper.SetHighlighted(chartData->IsSelected()); - areaPlotHelper.SetEnabled(chartData->IsEnabled()); - - ReplicaDisplayTypes::BandwidthUsageDisplayType bandwidthDisplayType = GetBandwidthUsageDisplayType(); - - for (FrameNumberType frameId = GetStartFrame(); frameId <= GetEndFrame(); ++frameId) - { - size_t sentDataUsage = chartData->GetSentUsageForFrame(frameId); - size_t receivedDataUsage = chartData->GetReceivedUsageForFrame(frameId); - - switch (bandwidthDisplayType) - { - case ReplicaDisplayTypes::BUDT_COMBINED: - areaPlotHelper.PlotBatchedData(frameId, static_cast(sentDataUsage + receivedDataUsage)); - break; - case ReplicaDisplayTypes::BUDT_SENT: - areaPlotHelper.PlotBatchedData(frameId, static_cast(sentDataUsage)); - break; - case ReplicaDisplayTypes::BUDT_RECEIVED: - areaPlotHelper.PlotBatchedData(frameId, static_cast(receivedDataUsage)); - break; - default: - AZ_Error("Standalone Tools", false, "Unknown bandwidth display type."); - break; - } - } - } - - void InitializeData(); - void UpdateData(); - void ParseFrameData(FrameNumberType frameId); - void ParseActiveItems(); - - int GetDisplayRange() const; - DisplayDataType GetDisplayDataType() const; - ReplicaDisplayTypes::BandwidthUsageDisplayType GetBandwidthUsageDisplayType() const; - - ReplicaDataContainer* FindReplicaData(AZ::u64 replicaId) const; - ReplicaChunkTypeDataContainer* FindReplicaChunkTypeData(const char* chunkType) const; - - typedef AZStd::unordered_map ReplicaDataMap; - typedef AZStd::unordered_set ReplicaIdSet; - - typedef AZStd::unordered_map ReplicaChunkTypeDataMap; - typedef AZStd::unordered_set ReplicaChunkTypeSet; - - // Used for ordering in the table view/quick mapping of Row -> ReplicaID - ReplicaDataMap m_replicaData; - ReplicaIdSet m_activeReplicaIds; - ReplicaIdSet m_activeInspectedReplicaIds; - ReplicaTableViewModel m_replicaTypeTableView; - - ReplicaChunkTypeDataMap m_replicaChunkTypeData; - ReplicaChunkTypeSet m_activeChunkTypes; - ReplicaChunkTypeSet m_activeInspectedChunkTypes; - ReplicaChunkTypeTableViewModel m_replicaChunkTypeTableView; - - unsigned int m_dataViewIndex; - size_t m_inspectedSeries; - - AZ::u32 m_windowStateCRC; - AZ::u32 m_splitterStateCRC; - AZ::u32 m_tableViewCRC; - AZ::u32 m_dataViewCRC; - - int m_aggregatorIdentity; - const ReplicaDataAggregator* m_aggregator; - - FrameNumberType m_startFrame; - FrameNumberType m_endFrame; - FrameNumberType m_currentFrame; - - AZStd::unordered_set< FrameNumberType > m_parsedFrames; - - OverallReplicaDetailView* m_overallReplicaDetailView; - AZStd::vector< ReplicaDetailView* > m_spawnedReplicaDetailViews; - AZStd::vector< ReplicaChunkTypeDetailView* > m_spawnedChunkDetailViews; - - // Information about the window that we might want to save out - AZStd::intrusive_ptr m_persistentState; - - DrillerWindowLifepsanTelemetry m_lifespanTelemetry; - - Ui::ReplicaDataView* m_gui; - }; -} - -#endif // REPLICADATAVIEW_H diff --git a/Code/Tools/Standalone/Source/Driller/Replica/ReplicaDataViewConfigDialog.ui b/Code/Tools/Standalone/Source/Driller/Replica/ReplicaDataViewConfigDialog.ui deleted file mode 100644 index 567eed74e4..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Replica/ReplicaDataViewConfigDialog.ui +++ /dev/null @@ -1,106 +0,0 @@ - - - ReplicaDataViewConfigDialog - - - - 0 - 0 - 322 - 89 - - - - Replica Data View Configuration - - - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - 5 - - - 5 - - - 0 - - - 5 - - - 0 - - - - - Controls the number of frames displayed on the Replica Data View and Replica Detail View. - - - Display Range - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - 99999 - - - - - - - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - Remove Inactive Replica's From Inspected Frame View - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - diff --git a/Code/Tools/Standalone/Source/Driller/Replica/ReplicaDetailView.cpp b/Code/Tools/Standalone/Source/Driller/Replica/ReplicaDetailView.cpp deleted file mode 100644 index 0e653e982b..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Replica/ReplicaDetailView.cpp +++ /dev/null @@ -1,346 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include -#include - -#include "ReplicaDetailView.h" -#include - -#include "ReplicaDataAggregator.hxx" -#include "ReplicaUsageDataContainers.h" - - -namespace Driller -{ - /////////////////////////// - // ReplicaDetailViewModel - /////////////////////////// - - ReplicaDetailViewModel::ReplicaDetailViewModel(ReplicaDetailView* detailView) - : BaseDetailTreeViewModel(detailView) - { - } - - int ReplicaDetailViewModel::columnCount(const QModelIndex& parentIndex) const - { - (void)parentIndex; - - return static_cast(CD_COUNT); - } - - QVariant ReplicaDetailViewModel::data(const QModelIndex& index, int role) const - { - const BaseDisplayHelper* baseDisplay = static_cast(index.internalPointer()); - - if (role == Qt::BackgroundRole) - { - if (baseDisplay->m_inspected) - { - return QVariant::fromValue(QColor(94, 94, 178, 255)); - } - } - else - { - switch (index.column()) - { - case CD_DISPLAY_NAME: - if (role == Qt::DecorationRole) - { - if (baseDisplay->HasIcon()) - { - return baseDisplay->GetIcon(); - } - } - else if (role == Qt::DisplayRole) - { - return baseDisplay->GetDisplayName(); - } - break; - case CD_TOTAL_SENT: - if (role == Qt::DisplayRole) - { - return QString::number(baseDisplay->m_bandwidthUsageAggregator.m_bytesSent); - } - else if (role == Qt::TextAlignmentRole) - { - return QVariant(Qt::AlignCenter); - } - break; - case CD_TOTAL_RECEIVED: - if (role == Qt::DisplayRole) - { - return QString::number(baseDisplay->m_bandwidthUsageAggregator.m_bytesReceived); - } - else if (role == Qt::TextAlignmentRole) - { - return QVariant(Qt::AlignCenter); - } - break; - case CD_RPC_COUNT: - if (role == Qt::DisplayRole) - { - if (azrtti_istypeof(baseDisplay)) - { - size_t count = 0; - - for (BaseDisplayHelper* displayHelper : baseDisplay->GetChildren()) - { - count += displayHelper->GetChildren().size(); - } - - return QString::number(count); - } - else if (azrtti_istypeof(baseDisplay)) - { - return QString::number(baseDisplay->GetChildren().size()); - } - } - break; - default: - AZ_Assert(false,"Unknown column index %i",index.column()); - break; - } - } - - return QVariant(); - } - - - QVariant ReplicaDetailViewModel::headerData(int section, Qt::Orientation orientation, int role) const - { - if (role == Qt::DisplayRole) - { - if (orientation == Qt::Horizontal) - { - switch (section) - { - case CD_DISPLAY_NAME: - return QString("Display Name"); - case CD_TOTAL_SENT: - return QString("Sent Bytes"); - case CD_TOTAL_RECEIVED: - return QString("Received Bytes"); - case CD_RPC_COUNT: - return QString("RPC Count"); - default: - AZ_Assert(false, "Unknown section index %i", section); - break; - } - } - } - - return QVariant(); - } - - ////////////////////// - // ReplicaDetailView - ////////////////////// - ReplicaDetailView::ReplicaDetailView(ReplicaDataView* replicaDataView, ReplicaDataContainer* dataContainer) - : BaseDetailView(replicaDataView) - , m_inspectedSeries(AreaChart::AreaChart::k_invalidSeriesId) - , m_replicaData(dataContainer) - , m_replicaDetailView(this) - , m_lifespanTelemetry("ReplicaDetailView") - { - QString replicaName = QString("%1 (%2)").arg(QString(dataContainer->GetReplicaName())).arg(FormattingHelper::ReplicaID(dataContainer->GetReplicaId())); - - show(); - raise(); - activateWindow(); - setFocus(); - - setWindowTitle(QString("%1's ReplicaChunk Breakdown - %2").arg(replicaName).arg(replicaDataView->m_aggregator->GetInspectionFileName())); - - m_gui->replicaName->setText(replicaName); - - m_gui->aggregationTypeComboBox->addItem(QString("Replica Chunk")); - - if (m_gui->aggregationTypeComboBox->count() == 1) - { - m_gui->aggregationTypeComboBox->setEditable(false); - m_gui->aggregationTypeComboBox->setEnabled(false); - } - - QObject::connect((&m_replicaDetailView), SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)), this, SLOT(UpdateDisplay(const QModelIndex&, const QModelIndex&))); - QObject::connect(m_gui->aggregationTypeComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(DisplayModeChanged(int))); - QObject::connect(m_gui->bandwidthUsageDisplayType, SIGNAL(currentIndexChanged(int)), this, SLOT(BandwidthDisplayUsageTypeChanged(int))); - QObject::connect(m_gui->graphDetailType, SIGNAL(currentIndexChanged(int)), this, SLOT(GraphDetailChanged(int))); - - DisplayModeChanged(static_cast(DisplayMode::Active)); - } - - ReplicaDetailView::~ReplicaDetailView() - { - for (ChunkDetailDisplayMap::iterator displayIter = m_typeDisplayMapping.begin(); - displayIter != m_typeDisplayMapping.end(); - ++displayIter) - { - delete displayIter->second; - } - } - - const ReplicaBandwidthChartData::FrameMap& ReplicaDetailView::GetFrameData() const - { - return m_replicaData->GetAllFrames(); - } - - BaseDetailDisplayHelper* ReplicaDetailView::FindDetailDisplay(const AZ::u32& chunkIndex) - { - BaseDetailDisplayHelper* retVal = nullptr; - - ChunkDetailDisplayMap::iterator displayIter = m_typeDisplayMapping.find(chunkIndex); - - if (displayIter != m_typeDisplayMapping.end()) - { - retVal = displayIter->second; - } - - return retVal; - } - - const BaseDetailDisplayHelper* ReplicaDetailView::FindDetailDisplay(const AZ::u32& chunkIndex) const - { - const BaseDetailDisplayHelper* retVal = nullptr; - - ChunkDetailDisplayMap::const_iterator displayIter = m_typeDisplayMapping.find(chunkIndex); - - if (displayIter != m_typeDisplayMapping.end()) - { - retVal = displayIter->second; - } - - return retVal; - } - - void ReplicaDetailView::InitializeDisplayData() - { - m_activeIds.clear(); - m_activeInspectedIds.clear(); - - const ReplicaDataContainer::FrameMap& frameMap = m_replicaData->GetAllFrames(); - - for (FrameNumberType currentFrame = m_replicaDataView->GetStartFrame(); currentFrame <= m_replicaDataView->GetEndFrame(); ++currentFrame) - { - ReplicaDataContainer::FrameMap::const_iterator frameIter = frameMap.find(currentFrame); - - if (frameIter == frameMap.end()) - { - continue; - } - - const ReplicaDataContainer::BandwidthUsageMap* usageMap = frameIter->second; - - for (ReplicaDataContainer::BandwidthUsageMap::const_iterator usageIter = usageMap->begin(); - usageIter != usageMap->end(); - ++usageIter) - { - ReplicaChunkBandwidthUsage* bandwidthUsage = static_cast(usageIter->second); - - ChunkDetailDisplayMap::iterator displayIter = m_typeDisplayMapping.find(bandwidthUsage->GetChunkIndex()); - - ReplicaChunkDetailDisplayHelper* chunkTypeDisplay = nullptr; - - if (displayIter == m_typeDisplayMapping.end()) - { - chunkTypeDisplay = aznew ReplicaChunkDetailDisplayHelper(bandwidthUsage->GetChunkTypeName(), bandwidthUsage->GetChunkIndex()); - - if (chunkTypeDisplay) - { - m_typeDisplayMapping.insert(AZStd::make_pair(bandwidthUsage->GetChunkIndex(), chunkTypeDisplay)); - } - } - else - { - chunkTypeDisplay = displayIter->second; - } - - // Consider sending along an overall descriptor of the replcia so we can easily setup the display instead - // of iterating blindly over our detail information trying to get a sense of what the thing is. - if (chunkTypeDisplay) - { - if (currentFrame == m_replicaDataView->GetCurrentFrame()) - { - m_activeInspectedIds.insert(chunkTypeDisplay->GetChunkIndex()); - } - - if (m_activeIds.insert(chunkTypeDisplay->GetChunkIndex()).second) - { - chunkTypeDisplay->GetDataSetDisplayHelper()->ClearActiveDisplay(); - chunkTypeDisplay->GetRPCDisplayHelper()->ClearActiveDisplay(); - } - - const ReplicaChunkBandwidthUsage::UsageAggregationMap& dataSetUsage = bandwidthUsage->GetDataTypeUsageAggregation(BandwidthUsage::DataType::DATA_SET); - - for (const auto& usagePair : dataSetUsage) - { - const BandwidthUsage& currentUsage = usagePair.second; - chunkTypeDisplay->SetupDataSet(currentUsage.m_index, currentUsage.m_identifier.c_str()); - } - - const ReplicaChunkBandwidthUsage::UsageAggregationMap& rpcUsage = bandwidthUsage->GetDataTypeUsageAggregation(BandwidthUsage::DataType::REMOTE_PROCEDURE_CALL); - - for (const auto& usagePair : rpcUsage) - { - const BandwidthUsage& currentUsage = usagePair.second; - chunkTypeDisplay->SetupRPC(currentUsage.m_index, currentUsage.m_identifier.c_str()); - } - } - } - } - } - - void ReplicaDetailView::LayoutChanged() - { - m_replicaDetailView.layoutChanged(); - } - - void ReplicaDetailView::OnSetupTreeView() - { - m_gui->treeView->setModel(&m_replicaDetailView); - ShowTreeFrame(m_replicaDataView->GetCurrentFrame()); - } - - void ReplicaDetailView::ShowTreeFrame(FrameNumberType frameId) - { - m_replicaDetailView.RefreshView(frameId); - } - - AZ::u32 ReplicaDetailView::CreateWindowGeometryCRC() - { - return AZ::Crc32("REPLICA_DETAIL_VIEW_WINDOW_STATE"); - } - - AZ::u32 ReplicaDetailView::CreateSplitterStateCRC() - { - return AZ::Crc32("REPLICA_DETAIL_VIEW_SPLITTER_STATE"); - } - - AZ::u32 ReplicaDetailView::CreateTreeStateCRC() - { - return AZ::Crc32("REPLICA_DETAIL_VIEW_TREE_STATE"); - } - - void ReplicaDetailView::OnInspectedSeries(size_t seriesId) - { - if (m_inspectedSeries != seriesId) - { - m_inspectedSeries = seriesId; - - // TODO: Handle expanding the tree and scrolling to the selected value. - for (auto& mapPair : m_typeDisplayMapping) - { - BaseDetailDisplayHelper* displayHelper = mapPair.second; - - displayHelper->m_inspected = displayHelper->m_areaGraphPlotHelper.IsSeries(m_inspectedSeries); - } - - m_replicaDetailView.layoutChanged(); - } - } -} diff --git a/Code/Tools/Standalone/Source/Driller/Replica/ReplicaDetailView.h b/Code/Tools/Standalone/Source/Driller/Replica/ReplicaDetailView.h deleted file mode 100644 index 136da9003c..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Replica/ReplicaDetailView.h +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef DRILLER_REPLICA_REPLICADETAILVIEW_H -#define DRILLER_REPLICA_REPLICADETAILVIEW_H - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include "Source/Driller/DrillerMainWindowMessages.h" -#include "Source/Driller/StripChart.hxx" -#include "Source/Driller/Replica/ReplicaDataView.hxx" -#include "Source/Driller/Replica/ReplicaDisplayHelpers.h" - -#include "Source/Driller/Replica/BaseDetailView.h" - -namespace Ui -{ - class ReplicaDetailView; -} - -namespace AZ { class ReflectContext; } - -namespace Driller -{ - class ReplicaDetailView; - class ReplicaChunkBandwidthUsage; - - class ReplicaDetailViewModel - : public BaseDetailTreeViewModel - { - public: - enum ColumnDescriptor - { - CD_INDEX_FORCE = -1, - - // Ordering of this enum determines the display order - CD_DISPLAY_NAME, - CD_TOTAL_SENT, - CD_TOTAL_RECEIVED, - CD_RPC_COUNT, - - // Used for sizing of the TableView. Anything after this won't be displayed. - CD_COUNT - }; - - AZ_CLASS_ALLOCATOR(ReplicaDetailViewModel, AZ::SystemAllocator, 0); - ReplicaDetailViewModel(ReplicaDetailView* detailView); - - int columnCount(const QModelIndex& parentIndex = QModelIndex()) const override; - - QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; - QVariant headerData(int section, Qt::Orientation orientation, int role) const override; - }; - - class ReplicaDetailView - : public BaseDetailView - { - typedef AZStd::unordered_map ChunkDetailDisplayMap; - - friend class ReplicaDetailViewModel; - - public: - AZ_CLASS_ALLOCATOR(ReplicaDetailView, AZ::SystemAllocator, 0); - - ReplicaDetailView(ReplicaDataView* replicaDataView, ReplicaDataContainer* dataContainer); - ~ReplicaDetailView(); - - const ReplicaBandwidthChartData::FrameMap& GetFrameData() const override; - BaseDetailDisplayHelper* FindDetailDisplay(const AZ::u32& chunkIndex) override; - const BaseDetailDisplayHelper* FindDetailDisplay(const AZ::u32& chunkIndex) const override; - - protected: - - void InitializeDisplayData() override; - - void LayoutChanged() override; - void OnSetupTreeView() override; - void ShowTreeFrame(FrameNumberType frameId) override; - - AZ::u32 CreateWindowGeometryCRC() override; - AZ::u32 CreateSplitterStateCRC() override; - AZ::u32 CreateTreeStateCRC() override; - - void OnInspectedSeries(size_t seriesId) override; - - private: - - size_t m_inspectedSeries; - - ChunkDetailDisplayMap m_typeDisplayMapping; - ReplicaDataContainer* m_replicaData; - - ReplicaDetailViewModel m_replicaDetailView; - - DrillerWindowLifepsanTelemetry m_lifespanTelemetry; - }; -} - -#endif diff --git a/Code/Tools/Standalone/Source/Driller/Replica/ReplicaDisplayHelpers.cpp b/Code/Tools/Standalone/Source/Driller/Replica/ReplicaDisplayHelpers.cpp deleted file mode 100644 index 0fad38a2ea..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Replica/ReplicaDisplayHelpers.cpp +++ /dev/null @@ -1,568 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include -#include -#include -#include - -#include "Source/Driller/Replica/ReplicaDisplayHelpers.h" - -#include "Source/Driller/StripChart.hxx" - -#include -#include - -namespace Driller -{ - QColor GetRandomDisplayColor() - { - static AZ::SimpleLcgRandom s_randomGenerator(AZStd::chrono::system_clock::now().time_since_epoch().count()); - // Narrowing the range to avoid excessively dark colors - return QColor(50 + s_randomGenerator.GetRandom() % 206, 50 + s_randomGenerator.GetRandom() % 206, 50 + s_randomGenerator.GetRandom() % 206); - } - - ////////////////////// - // BaseDisplayHelper - ////////////////////// - - BaseDisplayHelper::BaseDisplayHelper() - : m_graphEnabled(true) - , m_selected(false) - , m_inspected(false) - , m_color(GetRandomDisplayColor()) - , m_areaGraphPlotHelper(m_color) - , m_sentGraphPlot(m_color) - , m_iconEnabled(true) - , m_parent(nullptr) - { - QPixmap pixmap(16, 16); - QPainter painter(&pixmap); - painter.setBrush(m_color); - painter.drawRect(0, 0, 16, 16); - - m_icon.addPixmap(pixmap); - } - - BaseDisplayHelper::~BaseDisplayHelper() - { - for (BaseDisplayHelper* helper : m_children) - { - // Can't remove objects from the tree display since it messes with the - // index ordering. So if we get into this error, just keep it there, but we won't delete it. - if (helper->m_parent == this) - { - delete helper; - } - } - - m_children.clear(); - } - - void BaseDisplayHelper::Reset() - { - m_graphEnabled = true; - m_selected = false; - - for (BaseDisplayHelper* helper : m_children) - { - helper->Reset(); - } - - OnReset(); - ResetGraphConfiguration(); - ResetBandwidthUsage(); - } - - void BaseDisplayHelper::ResetGraphConfiguration() - { - m_areaGraphPlotHelper.Reset(); - - for (BaseDisplayHelper* helper : m_children) - { - helper->ResetGraphConfiguration(); - } - - OnResetGraphConfiguration(); - } - - void BaseDisplayHelper::ResetBandwidthUsage() - { - m_bandwidthUsageAggregator.Reset(); - - for (BaseDisplayHelper* helper : m_children) - { - helper->ResetBandwidthUsage(); - } - - OnResetBandwidthUsage(); - } - - int BaseDisplayHelper::AddChild(BaseDisplayHelper* baseDisplayHelper) - { - if (baseDisplayHelper == nullptr) - { - return -1; - } - - AZ_Assert(baseDisplayHelper->m_parent == nullptr, "Adding Leaf node to two parents in tree."); - - int index = static_cast(m_children.size()); - m_children.push_back(baseDisplayHelper); - - baseDisplayHelper->m_parent = this; - - return index; - } - - void BaseDisplayHelper::DetachChild(BaseDisplayHelper* baseDisplayHelper) - { - if (baseDisplayHelper == nullptr) - { - return; - } - - AZ_Error("BaseDisplayHelper", baseDisplayHelper->m_parent == this, "Detaching a leaf node from the wrong parent."); - - if (baseDisplayHelper->m_parent == this) - { - for (AZStd::vector< BaseDisplayHelper* >::iterator displayIter = m_children.begin(); - displayIter != m_children.end(); - ++displayIter) - { - if ((*displayIter) == baseDisplayHelper) - { - baseDisplayHelper->m_parent = nullptr; - m_children.erase(displayIter); - break; - } - } - } - } - - void BaseDisplayHelper::InspectSeries(size_t seriesId) - { - m_inspected = m_areaGraphPlotHelper.IsSeries(seriesId); - - for (BaseDisplayHelper* child : m_children) - { - child->InspectSeries(seriesId); - } - } - - BaseDisplayHelper* BaseDisplayHelper::FindChildByRow(int row) - { - BaseDisplayHelper* retVal = nullptr; - - if (row >= 0 && row < m_children.size()) - { - retVal = m_children[row]; - } - - return retVal; - } - - const BaseDisplayHelper* BaseDisplayHelper::FindChildByRow(int row) const - { - const BaseDisplayHelper* retVal = nullptr; - - if (row >= 0 && row < m_children.size()) - { - retVal = m_children[row]; - } - - return retVal; - } - - size_t BaseDisplayHelper::GetTreeRowCount() const - { - return m_children.size(); - } - - int BaseDisplayHelper::GetChildIndex(const BaseDisplayHelper* helper) const - { - int index = -1; - - for (size_t i = 0; i < m_children.size(); ++i) - { - if (m_children[i] == helper) - { - index = static_cast(i); - break; - } - } - - return index; - } - - void BaseDisplayHelper::SetIconEnabled(bool iconEnabled) - { - m_iconEnabled = iconEnabled; - } - - bool BaseDisplayHelper::HasIcon() const - { - return m_iconEnabled; - } - - const QIcon& BaseDisplayHelper::GetIcon() const - { - if (m_graphEnabled) - { - return m_icon; - } - else - { - static QIcon s_blackIcon; - static bool s_doOnce = true; - - if (s_doOnce) - { - s_doOnce = false; - - QPixmap pixmap(16, 16); - QPainter painter(&pixmap); - painter.setBrush(Qt::black); - painter.drawRect(0, 0, 16, 16); - - s_blackIcon.addPixmap(pixmap); - } - - return s_blackIcon; - } - } - - const AZStd::vector< BaseDisplayHelper* >& BaseDisplayHelper::GetChildren() const - { - return m_children; - } - - const BaseDisplayHelper* BaseDisplayHelper::GetParent() const - { - return m_parent; - } - - void BaseDisplayHelper::DetachAllChildren() - { - for (BaseDisplayHelper* helper : m_children) - { - helper->m_parent = nullptr; - } - - m_children.clear(); - } - - void BaseDisplayHelper::OnReset() - { - } - - void BaseDisplayHelper::OnResetGraphConfiguration() - { - } - - void BaseDisplayHelper::OnResetBandwidthUsage() - { - } - - ///////////////////////// - // DataSetDisplayHelper - ///////////////////////// - - DataSetDisplayHelper::DataSetDisplayHelper(size_t dataSetIndex) - : KeyedDisplayHelper(dataSetIndex) - { - } - - void DataSetDisplayHelper::SetDisplayName(const char* displayName) - { - if (displayName) - { - m_dataSetName = displayName; - } - else - { - m_dataSetName.clear(); - } - } - - const char* DataSetDisplayHelper::GetDisplayName() const - { - return m_dataSetName.c_str(); - } - - ///////////////////// - // RPCDisplayHelper - ///////////////////// - - /////////////////////////////// - // RPCInvokationDisplayHelper - /////////////////////////////// - - RPCDisplayHelper::RPCInvokationDisplayHelper::RPCInvokationDisplayHelper(const AZStd::string& rpcName, int counter) - { - SetIconEnabled(false); - m_rpcName = AZStd::string::format("%s_%i",rpcName.c_str(),counter); - } - - const char* RPCDisplayHelper::RPCInvokationDisplayHelper::GetDisplayName() const - { - return m_rpcName.c_str(); - } - - RPCDisplayHelper::RPCDisplayHelper(size_t rpcIndex) - : KeyedDisplayHelper(rpcIndex) - { - } - - void RPCDisplayHelper::AddInvokation(const BandwidthUsage& bandwidthUsage) - { - m_bandwidthUsageAggregator.m_bytesSent += bandwidthUsage.m_usageAggregator.m_bytesSent; - m_bandwidthUsageAggregator.m_bytesReceived += bandwidthUsage.m_usageAggregator.m_bytesReceived; - - RPCInvokationDisplayHelper* invokationDisplayHelper = aznew RPCInvokationDisplayHelper(m_rpcName,static_cast(GetChildren().size())); - - invokationDisplayHelper->m_bandwidthUsageAggregator.m_bytesSent += bandwidthUsage.m_usageAggregator.m_bytesSent; - invokationDisplayHelper->m_bandwidthUsageAggregator.m_bytesReceived += bandwidthUsage.m_usageAggregator.m_bytesReceived; - - AddChild(invokationDisplayHelper); - } - - void RPCDisplayHelper::SetDisplayName(const char* displayName) - { - m_rpcName = displayName; - } - - const char* RPCDisplayHelper::GetDisplayName() const - { - return m_rpcName.c_str(); - } - - void RPCDisplayHelper::OnResetBandwidthUsage() - { - DetachAllChildren(); - } - - //////////////////////////// - // BaseDetailDisplayHelper - //////////////////////////// - - BaseDetailDisplayHelper::BaseDetailDisplayHelper() - : m_rpcDisplayFilter(aznew RPCDisplayFilter()) - , m_dataSetDisplayFilter(aznew DataSetDisplayFilter()) - { - AddChild(m_rpcDisplayFilter); - AddChild(m_dataSetDisplayFilter); - } - - BaseDetailDisplayHelper::~BaseDetailDisplayHelper() - { - m_rpcDisplayFilter = nullptr; - m_dataSetDisplayFilter = nullptr; - } - - RPCDisplayHelper* BaseDetailDisplayHelper::FindRPC(size_t rpcIndex) - { - AZ_Error("BaseDetailDisplayHelper", m_rpcDisplayFilter->HasDisplayHelperForKey(rpcIndex), "Invalid RPC Index"); - return m_rpcDisplayFilter->FindDisplayHelperFromKey(rpcIndex); - } - - const RPCDisplayHelper* BaseDetailDisplayHelper::FindRPC(size_t rpcIndex) const - { - return m_rpcDisplayFilter->FindDisplayHelperFromKey(rpcIndex); - } - - void BaseDetailDisplayHelper::SetupRPC(size_t index, const char* rpcName) - { - if (!m_rpcDisplayFilter->HasDisplayHelperForKey(index)) - { - RPCDisplayHelper* rpcDisplayHelper = m_rpcDisplayFilter->CreateDisplayHelperFromKey(index); - rpcDisplayHelper->SetDisplayName(rpcName); - } - } - - void BaseDetailDisplayHelper::AddRPCUsage(const BandwidthUsage& bandwidthUsage) - { - m_bandwidthUsageAggregator.m_bytesSent += bandwidthUsage.m_usageAggregator.m_bytesSent; - m_bandwidthUsageAggregator.m_bytesReceived += bandwidthUsage.m_usageAggregator.m_bytesReceived; - - m_rpcDisplayFilter->m_bandwidthUsageAggregator.m_bytesSent += bandwidthUsage.m_usageAggregator.m_bytesSent; - m_rpcDisplayFilter->m_bandwidthUsageAggregator.m_bytesReceived += bandwidthUsage.m_usageAggregator.m_bytesReceived; - - RPCDisplayHelper* rpcDisplay = FindRPC(bandwidthUsage.m_index); - - if (rpcDisplay) - { - rpcDisplay->AddInvokation(bandwidthUsage); - } - } - - RPCDisplayFilter* BaseDetailDisplayHelper::GetRPCDisplayHelper() - { - return m_rpcDisplayFilter; - } - - DataSetDisplayHelper* BaseDetailDisplayHelper::FindDataSet(size_t dataSetIndex) - { - AZ_Error("BaseDetailDisplayHelper", m_dataSetDisplayFilter->HasDisplayHelperForKey(dataSetIndex), "Invalid DataSetIndex"); - return m_dataSetDisplayFilter->FindDisplayHelperFromKey(dataSetIndex); - } - - const DataSetDisplayHelper* BaseDetailDisplayHelper::FindDataSet(size_t dataSetIndex) const - { - return m_dataSetDisplayFilter->FindDisplayHelperFromKey(dataSetIndex); - } - - void BaseDetailDisplayHelper::SetupDataSet(size_t dataSetIndex, const char* dataSetName) - { - if (!m_dataSetDisplayFilter->HasDisplayHelperForKey(dataSetIndex)) - { - DataSetDisplayHelper* displayHelper = m_dataSetDisplayFilter->CreateDisplayHelperFromKey(dataSetIndex); - displayHelper->SetDisplayName(dataSetName); - } - } - - void BaseDetailDisplayHelper::AddDataSetUsage(const BandwidthUsage& bandwidthUsage) - { - m_bandwidthUsageAggregator.m_bytesSent += bandwidthUsage.m_usageAggregator.m_bytesSent; - m_bandwidthUsageAggregator.m_bytesReceived += bandwidthUsage.m_usageAggregator.m_bytesReceived; - - m_dataSetDisplayFilter->m_bandwidthUsageAggregator.m_bytesSent += bandwidthUsage.m_usageAggregator.m_bytesSent; - m_dataSetDisplayFilter->m_bandwidthUsageAggregator.m_bytesReceived += bandwidthUsage.m_usageAggregator.m_bytesReceived; - - DataSetDisplayHelper* dataSetDisplay = FindDataSet(bandwidthUsage.m_index); - - if (dataSetDisplay) - { - dataSetDisplay->m_bandwidthUsageAggregator.m_bytesSent += bandwidthUsage.m_usageAggregator.m_bytesSent; - dataSetDisplay->m_bandwidthUsageAggregator.m_bytesReceived += bandwidthUsage.m_usageAggregator.m_bytesReceived; - } - } - - DataSetDisplayFilter* BaseDetailDisplayHelper::GetDataSetDisplayHelper() - { - return m_dataSetDisplayFilter; - } - - - //////////////////////////////////// - // ReplicaChunkDetailDisplayHelper - //////////////////////////////////// - - ReplicaChunkDetailDisplayHelper::ReplicaChunkDetailDisplayHelper(const char* chunkTypeName, AZ::u32 chunkIndex) - : m_chunkTypeName(chunkTypeName) - , m_chunkIndex(chunkIndex) - { - } - - AZ::u32 ReplicaChunkDetailDisplayHelper::GetChunkIndex() const - { - return m_chunkIndex; - } - - const char* ReplicaChunkDetailDisplayHelper::GetChunkTypeName() const - { - return m_chunkTypeName.c_str(); - } - - const char* ReplicaChunkDetailDisplayHelper::GetDisplayName() const - { - return GetChunkTypeName(); - } - - /////////////////////////////// - // ReplicaDetailDisplayHelper - /////////////////////////////// - - ReplicaDetailDisplayHelper::ReplicaDetailDisplayHelper(const char* replicaName, AZ::u64 replicaId) - : m_replicaName(replicaName) - , m_replicaId(replicaId) - { - } - - AZ::u64 ReplicaDetailDisplayHelper::GetReplicaId() const - { - return m_replicaId; - } - - const char* ReplicaDetailDisplayHelper::GetReplicaName() const - { - return m_replicaName.c_str(); - } - - const char* ReplicaDetailDisplayHelper::GetDisplayName() const - { - return GetReplicaName(); - } - - ////////////////////////////////////// - // OverallReplicaDetailDisplayHelper - ////////////////////////////////////// - - OverallReplicaDetailDisplayHelper::OverallReplicaDetailDisplayHelper(const char* replicaName, AZ::u64 replicaId) - : m_replicaName(replicaName) - , m_replicaId(replicaId) - { - } - - OverallReplicaDetailDisplayHelper::~OverallReplicaDetailDisplayHelper() - { - DetachAllChildren(); - - for (auto& mapPair : m_replicaChunks) - { - delete mapPair.second; - } - } - - AZ::u64 OverallReplicaDetailDisplayHelper::GetReplicaId() const - { - return m_replicaId; - } - - const char* OverallReplicaDetailDisplayHelper::GetReplicaName() const - { - return m_replicaName.c_str(); - } - - const char* OverallReplicaDetailDisplayHelper::GetDisplayName() const - { - return GetReplicaName(); - } - - ReplicaChunkDetailDisplayHelper* OverallReplicaDetailDisplayHelper::CreateReplicaChunkDisplayHelper(const AZStd::string& chunkName, AZ::u32 chunkIndex) - { - ReplicaChunkDetailDisplayHelper* displayHelper = nullptr; - - auto chunkIter = m_replicaChunks.find(chunkIndex); - - AZ_Error("OverallReplicaDetailDisplayHelper", chunkIter == m_replicaChunks.end(), "Trying to create two replica chunks with the same chunk index for a given replica."); - - if (chunkIter == m_replicaChunks.end()) - { - displayHelper = aznew ReplicaChunkDetailDisplayHelper(chunkName.c_str(), chunkIndex); - m_replicaChunks.emplace(chunkIndex, displayHelper); - - AddChild(displayHelper); - } - - return displayHelper; - } - - ReplicaChunkDetailDisplayHelper* OverallReplicaDetailDisplayHelper::FindReplicaChunk(AZ::u32 chunkIndex) - { - ReplicaChunkDetailDisplayHelper* detailDisplayHelper = nullptr; - - auto chunkIter = m_replicaChunks.find(chunkIndex); - if (chunkIter != m_replicaChunks.end()) - { - detailDisplayHelper = chunkIter->second; - } - - return detailDisplayHelper; - } -} diff --git a/Code/Tools/Standalone/Source/Driller/Replica/ReplicaDisplayHelpers.h b/Code/Tools/Standalone/Source/Driller/Replica/ReplicaDisplayHelpers.h deleted file mode 100644 index 61407bd208..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Replica/ReplicaDisplayHelpers.h +++ /dev/null @@ -1,512 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef DRILLER_REPLICA_REPLICADISPLAYHELPERS_H -#define DRILLER_REPLICA_REPLICADISPLAYHELPERS_H - -#include -#include -#include -#include - -#include -#include -#include - -#include -#include - -// QModelIndex -#include - -#include "Source/Driller/DrillerDataTypes.h" -#include "Source/Driller/Replica/ReplicaBandwidthChartData.h" - -namespace StripChart -{ - class DataStrip; -} - -namespace Driller -{ - QColor GetRandomDisplayColor(); - - // Combo TreeView/Graph Display - class BaseDisplayHelper; - - class BaseDisplayHelper - { - public: - AZ_CLASS_ALLOCATOR(BaseDisplayHelper, AZ::SystemAllocator, 0); - AZ_RTTI(BaseDisplayHelper, "{8F84783A-B924-4081-9F6E-51524071B7BB}"); - - BaseDisplayHelper(); - virtual ~BaseDisplayHelper(); - - void Reset(); - void ResetGraphConfiguration(); - void ResetBandwidthUsage(); - - virtual int AddChild(BaseDisplayHelper* baseDisplayHelper); - virtual void DetachChild(BaseDisplayHelper* baseDisplayHelper); - - void InspectSeries(size_t seriesId); - - virtual BaseDisplayHelper* FindChildByRow(int row); - virtual const BaseDisplayHelper* FindChildByRow(int row) const; - virtual size_t GetTreeRowCount() const; - - virtual int GetChildIndex(const BaseDisplayHelper* helper) const; - - virtual const char* GetDisplayName() const = 0; - - void SetIconEnabled(bool iconEnabled); - bool HasIcon() const; - const QIcon& GetIcon() const; - - const AZStd::vector< BaseDisplayHelper* >& GetChildren() const; - - const BaseDisplayHelper* GetParent() const; - - // Information needed for graphing - bool m_graphEnabled; - bool m_selected; - bool m_inspected; - - QColor m_color; - - BandwidthUsageAggregator m_bandwidthUsageAggregator; - AreaGraphPlotHelper m_areaGraphPlotHelper; - - GraphPlotHelper m_sentGraphPlot; - - protected: - - virtual void DetachAllChildren(); - - virtual void OnReset(); - virtual void OnResetGraphConfiguration(); - virtual void OnResetBandwidthUsage(); - - private: - - bool m_iconEnabled; - QIcon m_icon; - - BaseDisplayHelper* m_parent; - - AZStd::vector< BaseDisplayHelper* > m_children; - }; - - template - class KeyedDisplayHelper - : public BaseDisplayHelper - { - public: - KeyedDisplayHelper(Key key) - : m_key(key) - {} - - const Key& GetKey() const - { - return m_key; - } - - private: - Key m_key; - }; - - template - class FilteredDisplayHelper - : public BaseDisplayHelper - { - typedef AZStd::unordered_map< Key, int > KeyToIndexMapping; - public: - AZ_CLASS_ALLOCATOR(FilteredDisplayHelper, AZ::SystemAllocator, 0); - - FilteredDisplayHelper(const char* displayName) - : m_displayName(displayName) - { - } - - virtual ~FilteredDisplayHelper() - { - DetachAllChildren(); - - for (auto& mapPair : m_displayHelperMap) - { - delete mapPair.second; - } - } - - const char* GetDisplayName() const override - { - return m_displayName.c_str(); - } - - int AddChild(BaseDisplayHelper* baseDisplayHelper) override - { - AZ_Assert(false, "Unsupported behavior"); - (void)baseDisplayHelper; - return -1; - } - - int GetChildIndex(const BaseDisplayHelper* helper) const override - { - const KeyedDisplayHelper* keyedHelper = static_cast*>(helper); - - const Key& key = keyedHelper->GetKey(); - - int foundIndex = -1; - - for (size_t i = 0; i < m_displayOrdering.size(); ++i) - { - if (m_displayOrdering[i] == key) - { - foundIndex = static_cast(i); - break; - } - } - - return foundIndex; - } - - bool HasDisplayHelperForKey(const Key& key) const - { - return m_keyMapping.find(key) != m_keyMapping.end(); - } - - DisplayType* CreateDisplayHelperFromKey(const Key& key) - { - DisplayType* retVal = nullptr; - - typename AZStd::unordered_map< Key, DisplayType* >::iterator helperIter = m_displayHelperMap.find(key); - - if (helperIter == m_displayHelperMap.end()) - { - retVal = aznew DisplayType(key); - m_displayHelperMap[key] = retVal; - } - else - { - retVal = m_displayHelperMap[key]; - } - - typename KeyToIndexMapping::iterator indexIter = m_keyMapping.find(key); - - if (indexIter == m_keyMapping.end()) - { - if (retVal) - { - int index = BaseDisplayHelper::AddChild(retVal); - m_keyMapping[key] = index; - } - } - - if (m_activeDisplay.insert(key).second) - { - m_displayOrdering.push_back(key); - } - - return retVal; - } - - DisplayType* FindDisplayHelperFromKey(const Key& key) - { - DisplayType* retVal = nullptr; - - typename KeyToIndexMapping::iterator indexIter = m_keyMapping.find(key); - - if (indexIter != m_keyMapping.end()) - { - retVal = static_cast(BaseDisplayHelper::FindChildByRow(indexIter->second)); - } - - return retVal; - } - - const DisplayType* FindDisplayHelperFromKey(const Key& key) const - { - const DisplayType* retVal = nullptr; - - typename KeyToIndexMapping::const_iterator indexIter = m_keyMapping.find(key); - - if (indexIter != m_keyMapping.end()) - { - retVal = static_cast(BaseDisplayHelper::FindChildByRow(indexIter->second)); - } - - return retVal; - } - - BaseDisplayHelper* FindChildByRow(int row) override - { - DisplayType* retVal = nullptr; - - if (row >= 0 && row < m_displayOrdering.size()) - { - Key key = m_displayOrdering[row]; - retVal = FindDisplayHelperFromKey(key); - } - - return retVal; - } - - const DisplayType* FindChildByRow(int row) const override - { - const DisplayType* retVal = nullptr; - - if (row >= 0 && row < m_displayOrdering.size()) - { - Key key = m_displayOrdering[row]; - retVal = FindDisplayHelperFromKey(key); - } - - return retVal; - } - - size_t GetTreeRowCount() const override - { - return m_displayOrdering.size(); - } - - void ClearActiveDisplay() - { - DetachAllChildren(); - - m_activeDisplay.clear(); - m_keyMapping.clear(); - m_displayOrdering.clear(); - } - - protected: - void OnChildActivated(BaseDisplayHelper* helper, int index) - { - const KeyedDisplayHelper* keyedHelper = static_cast*>(helper); - const Key& key = keyedHelper->GetKey(); - - m_keyMapping[key] = index; - - if (m_activeDisplay.insert(key).second) - { - m_displayOrdering.push_back(key); - } - } - - void OnChildDeactivated(BaseDisplayHelper* helper) - { - const KeyedDisplayHelper* keyedHelper = static_cast*>(helper); - const Key& key = keyedHelper->GetKey(); - - m_displayOrdering.erase(m_displayOrdering.begin() + m_keyMapping[key]); - m_keyMapping.erase(key); - m_activeDisplay.erase(key); - } - - private: - - void OnReset() override - { - m_keyMapping.clear(); - m_activeDisplay.clear(); - m_displayOrdering.clear(); - } - - void OnResetGraphConfiguration() override - { - } - - AZStd::string m_displayName; - - KeyToIndexMapping m_keyMapping; - AZStd::unordered_set< Key > m_activeDisplay; - AZStd::vector< Key > m_displayOrdering; - - AZStd::unordered_map< Key, DisplayType* > m_displayHelperMap; - }; - - class DataSetDisplayHelper - : public KeyedDisplayHelper - { - public: - AZ_CLASS_ALLOCATOR(DataSetDisplayHelper, AZ::SystemAllocator, 0); - AZ_RTTI(DataSetDisplayHelper, "{74A47E69-1DF5-40E7-A471-BF84B62182A8}", BaseDisplayHelper); - - DataSetDisplayHelper(size_t dataSetIndex); - - void SetDisplayName(const char* displayName); - const char* GetDisplayName() const override; - - private: - - AZStd::string m_dataSetName; - }; - - class DataSetDisplayFilter - : public FilteredDisplayHelper - { - public: - AZ_CLASS_ALLOCATOR(DataSetDisplayFilter, AZ::SystemAllocator, 0); - AZ_RTTI(DataSetDisplayFilter, "{C0B802CD-5551-48C0-95C2-41607D42A2E1}", BaseDisplayHelper); - - DataSetDisplayFilter() - : FilteredDisplayHelper("DataSets") - { - } - }; - - class RPCDisplayHelper - : public KeyedDisplayHelper - { - private: - class RPCInvokationDisplayHelper - : public BaseDisplayHelper - { - public: - AZ_CLASS_ALLOCATOR(RPCInvokationDisplayHelper, AZ::SystemAllocator, 0); - - RPCInvokationDisplayHelper(const AZStd::string& name, int count); - - const char* GetDisplayName() const override; - - private: - - AZStd::string m_rpcName; - }; - - public: - AZ_CLASS_ALLOCATOR(RPCDisplayHelper, AZ::SystemAllocator, 0); - AZ_RTTI(RPCDisplayHelper, "{564003A2-7880-441A-AC51-5397730C2E31}", BaseDisplayHelper); - - RPCDisplayHelper(size_t rpcName); - - void AddInvokation(const BandwidthUsage& bandwidthUsage); - - void SetDisplayName(const char* displayName); - const char* GetDisplayName() const override; - - protected: - - void OnResetBandwidthUsage() override; - - private: - - AZStd::string m_rpcName; - }; - - class RPCDisplayFilter - : public FilteredDisplayHelper - { - public: - AZ_CLASS_ALLOCATOR(DataSetDisplayFilter, AZ::SystemAllocator, 0); - AZ_RTTI(RPCDisplayFilter, "{1AF8368E-C5AF-4936-85C5-BA67E62FF871}", BaseDisplayHelper); - - RPCDisplayFilter() - : FilteredDisplayHelper("RPCs") - { - } - }; - - class BaseDetailDisplayHelper - : public BaseDisplayHelper - { - public: - AZ_CLASS_ALLOCATOR(BaseDetailDisplayHelper, AZ::SystemAllocator, 0); - AZ_RTTI(BaseDetailDisplayHelper, "{22B3809C-20A5-407B-9302-7890CEF4821D}", BaseDisplayHelper); - - BaseDetailDisplayHelper(); - virtual ~BaseDetailDisplayHelper(); - - RPCDisplayHelper* FindRPC(size_t rpcIndex); - const RPCDisplayHelper* FindRPC(size_t rpcIndex) const; - void SetupRPC(size_t rpcIndex, const char* rpcName); - void AddRPCUsage(const BandwidthUsage& currentUsage); - - RPCDisplayFilter* GetRPCDisplayHelper(); - - DataSetDisplayHelper* FindDataSet(size_t dataSetIndex); - const DataSetDisplayHelper* FindDataSet(size_t dataSetIndex) const; - void SetupDataSet(size_t dataSetIndex, const char* dataSetName); - void AddDataSetUsage(const BandwidthUsage& currentUsage); - - DataSetDisplayFilter* GetDataSetDisplayHelper(); - - protected: - - RPCDisplayFilter* m_rpcDisplayFilter; - DataSetDisplayFilter* m_dataSetDisplayFilter; - }; - - class ReplicaChunkDetailDisplayHelper - : public BaseDetailDisplayHelper - { - public: - AZ_CLASS_ALLOCATOR(ReplicaChunkDetailDisplayHelper, AZ::SystemAllocator, 0); - AZ_RTTI(ReplicaChunkDetailDisplayHelper, "{9DBE2EFE-AA89-4527-A003-1EE08B9E3DB7}", BaseDetailDisplayHelper); - - ReplicaChunkDetailDisplayHelper(const char* chunkTypeName, AZ::u32 chunkIndex); - - AZ::u32 GetChunkIndex() const; - const char* GetChunkTypeName() const; - - const char* GetDisplayName() const override; - private: - - AZStd::string m_chunkTypeName; - int m_chunkIndex; - }; - - class ReplicaDetailDisplayHelper - : public BaseDetailDisplayHelper - { - public: - AZ_CLASS_ALLOCATOR(ReplicaDetailDisplayHelper, AZ::SystemAllocator, 0); - AZ_RTTI(ReplicaDetailDisplayHelper, "{9DBE2EFE-AA89-4527-A003-1EE08B9E3DB7}", BaseDetailDisplayHelper); - - ReplicaDetailDisplayHelper(const char* replicaName, AZ::u64 replicaId); - - AZ::u64 GetReplicaId() const; - const char* GetReplicaName() const; - - const char* GetDisplayName() const override; - - private: - - AZStd::string m_replicaName; - AZ::u64 m_replicaId; - }; - - class OverallReplicaDetailDisplayHelper - : public BaseDisplayHelper - { - public: - AZ_CLASS_ALLOCATOR(OverallReplicaDetailDisplayHelper, AZ::SystemAllocator, 0); - AZ_RTTI(OverallReplicaDetailDisplayHelper, "{1CE46BA7-DA92-4C4E-8294-F5E096D14622}", BaseDisplayHelper); - - OverallReplicaDetailDisplayHelper(const char* replicaName, AZ::u64 replicaId); - ~OverallReplicaDetailDisplayHelper(); - - AZ::u64 GetReplicaId() const; - const char* GetReplicaName() const; - - const char* GetDisplayName() const override; - - bool HasReplicaChunk(int chunkIndex); - ReplicaChunkDetailDisplayHelper* CreateReplicaChunkDisplayHelper(const AZStd::string& chunkName, AZ::u32 chunkIndex); - ReplicaChunkDetailDisplayHelper* FindReplicaChunk(AZ::u32 chunkIndex); - - private: - - AZStd::string m_replicaName; - AZ::u64 m_replicaId; - - AZStd::unordered_map m_replicaChunks; - }; -} - -#endif diff --git a/Code/Tools/Standalone/Source/Driller/Replica/ReplicaDisplayTypes.cpp b/Code/Tools/Standalone/Source/Driller/Replica/ReplicaDisplayTypes.cpp deleted file mode 100644 index fcd4a3e237..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Replica/ReplicaDisplayTypes.cpp +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ -#include "Source/Driller/Replica/ReplicaDisplayTypes.h" - -namespace ReplicaDisplayTypes -{ - ///////////////// - // DisplayNames - ///////////////// - const char* DisplayNames::BUDT_SENT_NAME = "Sent"; - const char* DisplayNames::BUDT_RECEIVED_NAME = "Received"; - const char* DisplayNames::BUDT_COMBINED_NAME = "Combined"; -} diff --git a/Code/Tools/Standalone/Source/Driller/Replica/ReplicaDisplayTypes.h b/Code/Tools/Standalone/Source/Driller/Replica/ReplicaDisplayTypes.h deleted file mode 100644 index 1fdbc8651b..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Replica/ReplicaDisplayTypes.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#pragma once - -namespace ReplicaDisplayTypes -{ - enum BandwidthUsageDisplayType - { - BUDT_START = -1, - - BUDT_COMBINED, - BUDT_SENT, - BUDT_RECEIVED, - - BUDT_END - }; - - class DisplayNames - { - public: - static const char* BUDT_SENT_NAME; - static const char* BUDT_RECEIVED_NAME; - static const char* BUDT_COMBINED_NAME; - }; -} diff --git a/Code/Tools/Standalone/Source/Driller/Replica/ReplicaDrillerConfigToolbar.cpp b/Code/Tools/Standalone/Source/Driller/Replica/ReplicaDrillerConfigToolbar.cpp deleted file mode 100644 index aca8deb616..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Replica/ReplicaDrillerConfigToolbar.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "ReplicaDrillerConfigToolbar.hxx" -#include -#include - -namespace Driller -{ - ReplicaDrillerConfigToolbar::ReplicaDrillerConfigToolbar(QWidget* parent) - : QWidget(parent) - , m_gui(new Ui::ReplicaDrillerConfigToolbar) - { - m_gui->setupUi(this); - - m_gui->hideAll->setAutoDefault(false); - m_gui->hideSelected->setAutoDefault(false); - m_gui->showAll->setAutoDefault(false); - m_gui->showSelected->setAutoDefault(false); - m_gui->collapseAll->setAutoDefault(false); - m_gui->expandAll->setAutoDefault(false); - - QObject::connect(m_gui->hideAll, SIGNAL(clicked()), this, SIGNAL(hideAll())); - QObject::connect(m_gui->hideSelected, SIGNAL(clicked()), this, SIGNAL(hideSelected())); - QObject::connect(m_gui->showAll, SIGNAL(clicked()), this, SIGNAL(showAll())); - QObject::connect(m_gui->showSelected, SIGNAL(clicked()), this, SIGNAL(showSelected())); - QObject::connect(m_gui->collapseAll, SIGNAL(clicked()), this, SIGNAL(collapseAll())); - QObject::connect(m_gui->expandAll, SIGNAL(clicked()), this, SIGNAL(expandAll())); - } - - ReplicaDrillerConfigToolbar::~ReplicaDrillerConfigToolbar() - { - delete m_gui; - } - - void ReplicaDrillerConfigToolbar::enableTreeCommands(bool enabled) - { - m_gui->collapseAll->setVisible(enabled); - m_gui->expandAll->setVisible(enabled); - } -} diff --git a/Code/Tools/Standalone/Source/Driller/Replica/ReplicaDrillerConfigToolbar.hxx b/Code/Tools/Standalone/Source/Driller/Replica/ReplicaDrillerConfigToolbar.hxx deleted file mode 100644 index 92501b1ebe..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Replica/ReplicaDrillerConfigToolbar.hxx +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef DRILLER_REPLICA_REPLICADRILLERCONFIGTOOLBAR_H -#define DRILLER_REPLICA_REPLICADRILLERCONFIGTOOLBAR_H - -#if !defined(Q_MOC_RUN) -#include -#include - -#pragma once - -#include -#endif - -namespace Ui -{ - class ReplicaDrillerConfigToolbar; -} - -namespace Driller -{ - class ReplicaDrillerConfigToolbar - : public QWidget - { - Q_OBJECT - - public: - AZ_CLASS_ALLOCATOR(ReplicaDrillerConfigToolbar, AZ::SystemAllocator,0); - - explicit ReplicaDrillerConfigToolbar(QWidget* parent = nullptr); - ~ReplicaDrillerConfigToolbar(); - - void enableTreeCommands(bool enabled); - - public: - signals: - void hideSelected(); - void showSelected(); - - void hideAll(); - void showAll(); - - void collapseAll(); - void expandAll(); - - private: - - Ui::ReplicaDrillerConfigToolbar* m_gui; - }; -} - -#endif diff --git a/Code/Tools/Standalone/Source/Driller/Replica/ReplicaDrillerConfigToolbar.ui b/Code/Tools/Standalone/Source/Driller/Replica/ReplicaDrillerConfigToolbar.ui deleted file mode 100644 index 1ebeb59bd4..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Replica/ReplicaDrillerConfigToolbar.ui +++ /dev/null @@ -1,158 +0,0 @@ - - - ReplicaDrillerConfigToolbar - - - - 0 - 0 - 871 - 60 - - - - - 0 - 0 - - - - Form - - - - 2 - - - 2 - - - 2 - - - 2 - - - - - 0 - - - 8 - - - - - - 0 - 0 - - - - - 0 - 0 - - - - Hide Selected - - - - - - - - 0 - 0 - - - - Show Selected - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - Hide All - - - - - - - - 0 - 0 - - - - - 1 - 0 - - - - Show All - - - - - - - - 0 - 0 - - - - Collapse All - - - - - - - - 0 - 0 - - - - Expand Alll - - - - - - - - - Qt::Horizontal - - - - 40 - 0 - - - - - - - - - diff --git a/Code/Tools/Standalone/Source/Driller/Replica/ReplicaOperationTelemetryEvent.h b/Code/Tools/Standalone/Source/Driller/Replica/ReplicaOperationTelemetryEvent.h deleted file mode 100644 index 3eb78a8b10..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Replica/ReplicaOperationTelemetryEvent.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ -#ifndef DRILLER_REPLICA_REPLICAOPERATIONTELEMETRYEVENT_H -#define DRILLER_REPLICA_REPLICAOPERATIONTELEMETRYEVENT_H - -#include "Source/Telemetry/TelemetryEvent.h" - -namespace Driller -{ - class ReplicaOperationTelemetryEvent - : public Telemetry::TelemetryEvent - { - public: - ReplicaOperationTelemetryEvent() - : Telemetry::TelemetryEvent("ReplicaDataViewOperation") - { - } - }; -} - -#endif diff --git a/Code/Tools/Standalone/Source/Driller/Replica/ReplicaTreeViewModel.cpp b/Code/Tools/Standalone/Source/Driller/Replica/ReplicaTreeViewModel.cpp deleted file mode 100644 index 0321a64f62..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Replica/ReplicaTreeViewModel.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "Source/Driller/Replica/ReplicaTreeViewModel.hxx" -#include - -namespace Driller -{ - ReplicaTreeViewModel::ReplicaTreeViewModel(QObject* parent) - : QAbstractItemModel(parent) - { - } - - ReplicaTreeViewModel::~ReplicaTreeViewModel() - { - } - - int ReplicaTreeViewModel::rowCount(const QModelIndex& parentIndex) const - { - int rowCount = 0; - - if (!parentIndex.isValid()) - { - rowCount = GetRootRowCount(); - } - else - { - const BaseDisplayHelper* displayHelper = static_cast(parentIndex.internalPointer()); - rowCount = static_cast(displayHelper->GetTreeRowCount()); - } - - return rowCount; - } - - QModelIndex ReplicaTreeViewModel::index(int row, int column, const QModelIndex& parent) const - { - if (!parent.isValid()) - { - const BaseDisplayHelper* baseDisplayHelper = FindDisplayHelperAtRoot(row); - - if (baseDisplayHelper) - { - return createIndex(row, column, (void*)(baseDisplayHelper)); - } - else - { - return QModelIndex(); - } - } - else - { - const BaseDisplayHelper* parentHelper = static_cast(parent.internalPointer()); - const BaseDisplayHelper* displayHelper = parentHelper->FindChildByRow(row); - - if (displayHelper) - { - return createIndex(row, column, (void*)(displayHelper)); - } - else - { - AZ_Assert(false, "Invalid Tree Structure"); - } - } - - return QModelIndex(); - } - - QModelIndex ReplicaTreeViewModel::parent(const QModelIndex& index) const - { - if (index.isValid()) - { - const BaseDisplayHelper* displayHelper = static_cast(index.internalPointer()); - const BaseDisplayHelper* parent = displayHelper->GetParent(); - - if (parent) - { - return createIndex(parent->GetChildIndex(displayHelper), 0, (void*)(parent)); - } - } - - return QModelIndex(); - } -} diff --git a/Code/Tools/Standalone/Source/Driller/Replica/ReplicaTreeViewModel.hxx b/Code/Tools/Standalone/Source/Driller/Replica/ReplicaTreeViewModel.hxx deleted file mode 100644 index 743af15f53..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Replica/ReplicaTreeViewModel.hxx +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef DRILLER_REPLICA_REPLICATREEVIEWMODELS_H -#define DRILLER_REPLICA_REPLICATREEVIEWMODELS_H - -#if !defined(Q_MOC_RUN) -#include - -#include "Source/Driller/Replica/ReplicaDisplayHelpers.h" -#endif - -namespace Driller -{ - - class ReplicaTreeViewModel - : public QAbstractItemModel - { - Q_OBJECT - - protected: - ReplicaTreeViewModel(QObject* parent = nullptr); - - public: - AZ_CLASS_ALLOCATOR(ReplicaTreeViewModel,AZ::SystemAllocator,0); - - virtual ~ReplicaTreeViewModel(); - - int rowCount(const QModelIndex& parentIndex = QModelIndex()) const override; - QModelIndex index(int row, int column, const QModelIndex& parent) const; - QModelIndex parent(const QModelIndex& index) const; - - protected: - - virtual int GetRootRowCount() const = 0; - virtual const BaseDisplayHelper* FindDisplayHelperAtRoot(int row) const = 0; - }; - -} - -#endif diff --git a/Code/Tools/Standalone/Source/Driller/Replica/ReplicaUsageDataContainers.cpp b/Code/Tools/Standalone/Source/Driller/Replica/ReplicaUsageDataContainers.cpp deleted file mode 100644 index 929fb85d2c..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Replica/ReplicaUsageDataContainers.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "ReplicaUsageDataContainers.h" - -#include "Source/Driller/StripChart.hxx" -#include "ReplicaDataEvents.h" - -namespace Driller -{ - /////////////////////////////// - // ReplicaChunkBandwidthUsage - /////////////////////////////// - - ReplicaChunkBandwidthUsage::ReplicaChunkBandwidthUsage(const char* chunkTypeName, AZ::u32 chunkIndex) - : m_chunkIndex(chunkIndex) - , m_chunkTypeName(chunkTypeName) - { - } - - AZ::u32 ReplicaChunkBandwidthUsage::GetChunkIndex() const - { - return m_chunkIndex; - } - - const char* ReplicaChunkBandwidthUsage::GetChunkTypeName() const - { - return m_chunkTypeName.c_str(); - } - - ///////////////////////// - // ReplicaDataContainer - ///////////////////////// - - ReplicaDataContainer::ReplicaDataContainer(const char* replicaName, AZ::u64 replicaId, const QColor& displayColor) - : ReplicaBandwidthChartData(displayColor) - , m_replicaName(replicaName) - , m_replicaId(replicaId) - { - } - - const char* ReplicaDataContainer::GetReplicaName() const - { - return m_replicaName.c_str(); - } - - AZ::u64 ReplicaDataContainer::GetReplicaId() const - { - return m_replicaId; - } - - const char* ReplicaDataContainer::GetAxisName() const - { - return GetReplicaName(); - } - - BandwidthUsageContainer* ReplicaDataContainer::CreateBandwidthUsage(const ReplicaChunkEvent* chunkEvent) - { - return aznew ReplicaChunkBandwidthUsage(chunkEvent->GetChunkTypeName(), chunkEvent->GetReplicaChunkIndex()); - } - - AZ::u32 ReplicaDataContainer::GetKeyFromEvent(const ReplicaChunkEvent* chunkEvent) const - { - return chunkEvent->GetReplicaChunkIndex(); - } -} diff --git a/Code/Tools/Standalone/Source/Driller/Replica/ReplicaUsageDataContainers.h b/Code/Tools/Standalone/Source/Driller/Replica/ReplicaUsageDataContainers.h deleted file mode 100644 index 46f653792b..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Replica/ReplicaUsageDataContainers.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef DRILLER_REPLICA_USAGE_DATA_CONTAINER_H -#define DRILLER_REPLICA_USAGE_DATA_CONTAINER_H - -#include -#include -#include -#include -#include - -#include - -#include "ReplicaBandwidthChartData.h" - -namespace Driller -{ - class ReplicaDataAggregator; - class ReplicaDataView; - - class ReplicaChunkBandwidthUsage - : public BandwidthUsageContainer - { - public: - AZ_CLASS_ALLOCATOR(ReplicaChunkBandwidthUsage, AZ::SystemAllocator, 0); - - ReplicaChunkBandwidthUsage(const char* chunkTypeName, AZ::u32 chunkIndex); - - AZ::u32 GetChunkIndex() const; - const char* GetChunkTypeName() const; - - private: - AZStd::string m_chunkTypeName; - AZ::u32 m_chunkIndex; - }; - - class ReplicaDataContainer - : public ReplicaBandwidthChartData - { - public: - AZ_CLASS_ALLOCATOR(ReplicaDataContainer, AZ::SystemAllocator, 0); - - ReplicaDataContainer(const char* replicaName, AZ::u64 replicaId, const QColor& displayColor); - - const char* GetReplicaName() const; - AZ::u64 GetReplicaId() const; - - const char* GetAxisName() const override; - - protected: - BandwidthUsageContainer* CreateBandwidthUsage(const ReplicaChunkEvent* dataEvent) override; - AZ::u32 GetKeyFromEvent(const ReplicaChunkEvent* dataEvent) const override; - - private: - - AZStd::string m_replicaName; - AZ::u64 m_replicaId; - }; -} - -#endif diff --git a/Code/Tools/Standalone/Source/Driller/Replica/basedetailview.ui b/Code/Tools/Standalone/Source/Driller/Replica/basedetailview.ui deleted file mode 100644 index dbd5cc1912..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Replica/basedetailview.ui +++ /dev/null @@ -1,504 +0,0 @@ - - - BaseDetailView - - - - 0 - 0 - 659 - 756 - - - - Form - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - Qt::Vertical - - - 3 - - - false - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - 0 - - - 2 - - - 2 - - - 2 - - - 3 - - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - 0 - - - 5 - - - 0 - - - 5 - - - - - - 0 - 0 - - - - - 15 - 50 - false - - - - TextLabel - - - Qt::AlignCenter - - - - - - - - - - - 0 - 0 - - - - - 0 - 100 - - - - - - - - - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - 2 - - - 3 - - - 2 - - - 2 - - - - - - 0 - 55 - - - - - 16777215 - 55 - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 10 - 20 - - - - - - - - - 0 - 0 - - - - - 0 - 55 - - - - - 16777215 - 55 - - - - Display Mode - - - - 0 - - - 5 - - - 5 - - - 5 - - - 5 - - - - - - 0 - 0 - - - - - 120 - 0 - - - - - - - - - - - - 0 - 0 - - - - - 0 - 55 - - - - - 16777215 - 55 - - - - Usage Display - - - - 0 - - - 5 - - - 5 - - - 5 - - - 5 - - - - - - 0 - 0 - - - - - 100 - 0 - - - - - - - - - - - - 0 - 0 - - - - - 0 - 55 - - - - - 16777215 - 55 - - - - Graph Detail - - - - 0 - - - 5 - - - 5 - - - 5 - - - 5 - - - - - - 0 - 0 - - - - - 100 - 0 - - - - - - - - - - - - 0 - 0 - - - - - 255 - 50 - - - - - 16777215 - 55 - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - true - - - QAbstractItemView::ExtendedSelection - - - true - - - true - - - false - - - - - - - - - - - - AreaChart::AreaChart - QWidget -
Source/Driller/AreaChart.hxx
- 1 -
- - Driller::ReplicaDrillerConfigToolbar - QWidget -
Source/Driller/Replica/ReplicaDrillerConfigToolbar.hxx
- 1 -
-
- - -
diff --git a/Code/Tools/Standalone/Source/Driller/Replica/overallreplicadetailview.ui b/Code/Tools/Standalone/Source/Driller/Replica/overallreplicadetailview.ui deleted file mode 100644 index 5368dfe2a2..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Replica/overallreplicadetailview.ui +++ /dev/null @@ -1,718 +0,0 @@ - - - OverallReplicaDetailView - - - - 0 - 0 - 667 - 708 - - - - Form - - - - - - - 22 - - - - Overall Replica Statistics - - - Qt::AlignCenter - - - - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Start Frame - - - - - - - - 0 - 0 - - - - - 60 - 0 - - - - - 60 - 16777215 - - - - 99 - - - - - - - End Frame - - - - - - - - 0 - 0 - - - - - 60 - 0 - - - - - 60 - 16777215 - - - - 0 - - - 99 - - - 0 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - FPS - - - - - - - 60 - - - - - - - - - - Qt::Horizontal - - - - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - 5 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - - 90 - 0 - - - - - 16777215 - 16777215 - - - - Total Bytes Sent - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - - 80 - 16777215 - - - - true - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - - - - - - 0 - 0 - - - - - 125 - 0 - - - - Avg Bytes Sent/Frame - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 80 - 16777215 - - - - true - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 5 - 20 - - - - - - - - - 0 - 0 - - - - - 125 - 0 - - - - Avg Bytes Sent/Second - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 80 - 16777215 - - - - true - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - 5 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - - 90 - 0 - - - - - 16777215 - 16777215 - - - - Total Bytes Recv'd - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - - 80 - 16777215 - - - - true - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - - - - - - 0 - 0 - - - - - 125 - 0 - - - - Avg Bytes Recv'd/Frame - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 80 - 16777215 - - - - true - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 5 - 20 - - - - - - - - - 0 - 0 - - - - - 125 - 0 - - - - Avg Bytes Recv'd/Second - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 80 - 16777215 - - - - true - - - - - - - Qt::Horizontal - - - - 153 - 20 - - - - - - - - - - - - - - - 0 - 0 - - - - Replica Chunk Type - - - - 4 - - - 5 - - - 4 - - - 4 - - - - - - 0 - 250 - - - - true - - - QAbstractItemView::SingleSelection - - - QAbstractItemView::SelectRows - - - true - - - true - - - false - - - - - - - - - - - 0 - 0 - - - - Replica - - - - 4 - - - 5 - - - 4 - - - 4 - - - - - - 0 - 250 - - - - true - - - true - - - true - - - false - - - - - - - - - - - diff --git a/Code/Tools/Standalone/Source/Driller/Replica/replicadataview.ui b/Code/Tools/Standalone/Source/Driller/Replica/replicadataview.ui deleted file mode 100644 index 3bc5729b7f..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Replica/replicadataview.ui +++ /dev/null @@ -1,558 +0,0 @@ - - - ReplicaDataView - - - - 0 - 0 - 766 - 752 - - - - - 0 - 0 - - - - Replica Data View - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - Qt::Vertical - - - true - - - 3 - - - false - - - - - 0 - 0 - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - 0 - - - 0 - - - 0 - - - 0 - - - 5 - - - - - - 0 - 0 - - - - - 0 - 100 - - - - - - - - - - 0 - 0 - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - 5 - - - 5 - - - 5 - - - 5 - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 10 - 20 - - - - - - - - - 0 - 55 - - - - - 16777215 - 55 - - - - Qt::NoFocus - - - Show total bandwidth usage statistics for the capture - - - false - - - Overall Statistics - - - - - - - - 0 - 0 - - - - - 0 - 55 - - - - - 16777215 - 55 - - - - Top Level Type - - - - 0 - - - 5 - - - 5 - - - 5 - - - 5 - - - - - - 0 - 0 - - - - - 95 - 0 - - - - false - - - - - - - - - - - 0 - 0 - - - - - 0 - 50 - - - - - 16777215 - 50 - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - 0 - - - 0 - - - 13 - - - 0 - - - 0 - - - - - - - - - 0 - 0 - - - - - 0 - 55 - - - - - 16777215 - 55 - - - - Usage Graph Type - - - - 0 - - - 5 - - - 5 - - - 5 - - - 5 - - - - - - 0 - 0 - - - - - 95 - 0 - - - - false - - - - - - - - - - - 0 - 0 - - - - - 0 - 55 - - - - - 16777215 - 55 - - - - Table Filter - - - - 0 - - - 5 - - - 5 - - - 5 - - - 5 - - - - - - 0 - 0 - - - - - 95 - 0 - - - - - - - - - - - - 0 - 0 - - - - - 0 - 55 - - - - - 16777215 - 55 - - - - Display Range - - - - 0 - - - 5 - - - 5 - - - 5 - - - 5 - - - - - - 0 - 0 - - - - - 95 - 0 - - - - 0 - - - 99999 - - - - - - - - - - - 0 - 0 - - - - - 175 - 0 - - - - - 16777215 - 55 - - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 0 - 20 - - - - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - true - - - - - - - - - - - - AreaChart::AreaChart - QWidget -
Source/Driller/AreaChart.hxx
- 1 -
- - Driller::ReplicaDrillerConfigToolbar - QWidget -
Source/Driller/Replica/ReplicaDrillerConfigToolbar.hxx
- 1 -
-
- - - - -
diff --git a/Code/Tools/Standalone/Source/Driller/StripChart.cpp b/Code/Tools/Standalone/Source/Driller/StripChart.cpp deleted file mode 100644 index 56bc15af39..0000000000 --- a/Code/Tools/Standalone/Source/Driller/StripChart.cpp +++ /dev/null @@ -1,991 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include - -#include "StripChart.hxx" -#include -#include "DrillerMainWindowMessages.h" - -#include "ChartNumberFormats.h" -#include - -#include -#include -#include -#include - -namespace StripChart -{ - int DataStrip::s_invalidChannelId = -1; - - ////////////////////////////////////////////////////////////////////////// - DataStrip::DataStrip(QWidget* parent, Qt::WindowFlags flags) - : QWidget(parent, flags) - , m_Axis(nullptr) - , m_DependentAxis(nullptr) - , m_InsetL(56) - , m_InsetR(16) - , m_InsetT(16) - , m_InsetB(24) - , m_IsDragging(false) - , m_InBatchMode(false) - , m_ZoomLimit(15) - , m_MarkerPosition(0) - , m_MarkerColor(Qt::white) - , m_ptrFormatter(nullptr) - , m_MouseWasDragged(false) - , m_bLeftDown(false) - , m_isDataDirty(true) - { - this->setStyleSheet(QString("QToolTip { border: 1px solid white; padding: 1px; background: black; color: white; }")); - setMouseTracking(true); - } - - DataStrip::~DataStrip() - { - delete m_Axis; - delete m_DependentAxis; - } - - void DataStrip::SetAxisTextFormatter(Charts::QAbstractAxisFormatter* target) - { - if (m_ptrFormatter) - { - disconnect(m_ptrFormatter, SIGNAL(destroyed(QObject*)), this, SLOT(OnDestroyAxisFormatter(QObject*))); - } - - m_ptrFormatter = target; - if (m_ptrFormatter) - { - connect(m_ptrFormatter, SIGNAL(destroyed(QObject*)), this, SLOT(OnDestroyAxisFormatter(QObject*))); - } - } - - void DataStrip::OnDestroyAxisFormatter(QObject* pDestroyed) - { - if ((QObject*)pDestroyed == (QObject*)m_ptrFormatter) - { - m_ptrFormatter = nullptr; // signals will disconnect automatically. - } - } - - void DataStrip::Reset() - { - delete m_Axis; - m_Axis = nullptr; - - delete m_DependentAxis; - m_DependentAxis = nullptr; - - m_Channels.clear(); - } - - void DataStrip::SetDataDirty() - { - m_isDataDirty = true; - update(); - } - - void DataStrip::SetZoomLimit(float limit) - { - m_ZoomLimit = limit; - } - - int DataStrip::AddChannel(QString name) - { - int id = (int)m_Channels.size(); - m_Channels.push_back(); - m_Channels[id].SetName(name); - m_Channels[id].SetID(id); - m_Channels[id].m_Data.reserve(65536); - - return id; - } - - void DataStrip::SetChannelColor(int channelID, QColor color) - { - if (IsValidChannelId(channelID)) - { - m_Channels[channelID].SetColor(color); - } - } - void DataStrip::SetChannelStyle(int channelID, Channel::ChannelStyle style) - { - if (IsValidChannelId(channelID)) - { - m_Channels[channelID].SetStyle(style); - } - } - - void DataStrip::SetChannelHighlight(int channelID, bool highlight) - { - if (IsValidChannelId(channelID)) - { - m_Channels[channelID].SetHighlight(highlight); - update(); - } - } - - void DataStrip::SetChannelSampleHighlight(int channelID, AZ::u64 sampleID, bool highlight) - { - if (IsValidChannelId(channelID)) - { - m_Channels[channelID].SetHighlightedSample(highlight, sampleID); - update(); - } - } - - void DataStrip::SetViewFull() - { - m_Axis->SetViewFull(); - m_DependentAxis->SetViewFull(); - update(); - } - - void DataStrip::SetLockRight(bool tf) - { - if (m_Axis) - { - m_Axis->SetLockedRight(tf); - } - update(); - } - void DataStrip::SetMarkerColor(QColor qc) - { - m_MarkerColor = qc; - update(); - } - void DataStrip::SetMarkerPosition(float qposn) - { - m_MarkerPosition = qposn; - update(); - } - - void DataStrip::AddData(int channelID, AZ::u64 sampleID, float h, float v) - { - AZ_Error("Standalone Tools", !m_InBatchMode, "AddData should not called during a BatchData session."); - - if (IsValidChannelId(channelID)) - { - m_Channels[channelID].m_Data.push_back(Channel::Sample(sampleID, h, v)); - - m_Axis->AddAxisRange(h); - if (m_DependentAxis) - { - m_DependentAxis->AddAxisRange(v); - } - update(); - } - } - - void DataStrip::StartBatchDataAdd() - { - m_InBatchMode = true; - } - - void DataStrip::AddBatchedData(int channelId, AZ::u64 sampleId, float h, float v) - { - AZ_Error("StandaloneTools", m_InBatchMode, "AddBatchedData should only be called during a BatchData session."); - - if (IsValidChannelId(channelId)) - { - m_Channels[channelId].m_Data.push_back(Channel::Sample(sampleId, h, v)); - } - } - - void DataStrip::EndBatchDataAdd() - { - if (m_InBatchMode) - { - m_InBatchMode = false; - update(); - } - } - - void DataStrip::ClearData(int channelID) - { - if (IsValidChannelId(channelID)) - { - m_Channels[channelID].m_Data.clear(); - } - } - - void DataStrip::ClearAxisRange() - { - m_Axis->Clear(); - if (m_DependentAxis) - { - m_DependentAxis->Clear(); - } - } - - bool DataStrip::AddAxis(QString label, float minimum, float maximum, bool lockedZoom, bool lockedRange) - { - Charts::Axis* a = nullptr; - - if (!m_Axis) - { - a = m_Axis = aznew Charts::Axis(); - } - else if (!m_DependentAxis) - { - a = m_DependentAxis = aznew Charts::Axis(); - } - else - { - AZ_Assert(false, "ERROR: Creating 3 axis's for a single graph."); - } - - if (a) - { - a->SetLabel(label); - a->SetLockedZoom(lockedZoom); - a->SetAxisRange(minimum, maximum); - a->SetWindowMin(minimum); - a->SetWindowMax(maximum); - a->SetLockedRange(lockedRange); - update(); - } - - return a != nullptr; - } - - bool DataStrip::GetAxisRange(Charts::AxisType whichAxis, float& minValue, float& maxValue) - { - bool foundAxis = false; - - Charts::Axis* axis = nullptr; - switch (whichAxis) - { - case Charts::AxisType::Horizontal: - axis = m_Axis; - break; - case Charts::AxisType::Vertical: - axis = m_DependentAxis; - break; - default: - AZ_Assert(false, "ERROR: Invalid Axis(%i) given to GetAxisRange", whichAxis); - break; - } - - - - if (axis) - { - foundAxis = true; - minValue = axis->GetRangeMin(); - maxValue = axis->GetRangeMax(); - } - - return foundAxis; - } - - bool DataStrip::GetWindowRange(Charts::AxisType whichAxis, float& minValue, float& maxValue) - { - bool foundAxis = false; - - Charts::Axis* axis = nullptr; - switch (whichAxis) - { - - case Charts::AxisType::Horizontal: - axis = m_Axis; - break; - case Charts::AxisType::Vertical: - axis = m_DependentAxis; - break; - default: - AZ_Assert(false, "ERROR: Invalid Axis(%i) given to GetWindowRange", whichAxis); - break; - } - - if (axis) - { - foundAxis = true; - minValue = axis->GetWindowMin(); - maxValue = axis->GetWindowMax(); - } - - return foundAxis; - } - - void DataStrip::SetWindowRange(Charts::AxisType whichAxis, float minValue, float maxValue) - { - Charts::Axis* axis = nullptr; - switch (whichAxis) - { - case Charts::AxisType::Horizontal: - axis = m_Axis; - break; - case Charts::AxisType::Vertical: - axis = m_DependentAxis; - break; - default: - AZ_Assert(false, "ERROR: Invalid Axis(%i) given to SetWindowRange", whichAxis); - break; - } - - if (axis) - { - axis->SetAxisRange(minValue, maxValue); - } - } - - void DataStrip::AddWindowRange(Charts::AxisType whichAxis, float minValue, float maxValue) - { - Charts::Axis* axis = nullptr; - switch (whichAxis) - { - case Charts::AxisType::Horizontal: - axis = m_Axis; - break; - case Charts::AxisType::Vertical: - axis = m_DependentAxis; - break; - default: - AZ_Assert(false, "ERROR: Invalid Axis(%i) given to SetWindowRange", whichAxis); - break; - } - - if (axis) - { - axis->AddAxisRange(minValue); - axis->AddAxisRange(maxValue); - } - } - - void DataStrip::Drag(Charts::Axis* axis, int deltaX, int deltaY) - { - if (!axis->GetLockedRange() && !axis->GetLockedRight()) - { - if (axis->GetWindowMin() + deltaX > axis->GetRangeMin() && axis->GetWindowMax() + deltaX < axis->GetRangeMax()) - { - axis->SetAutoWindow(false); - axis->UpdateWindowRange((float)deltaX); - } - } - - Drag(m_DependentAxis, deltaY); - } - - void DataStrip::Drag(Charts::Axis* axis, int deltaY) - { - if (!axis->GetLockedRange() && !axis->GetLockedRight()) - { - axis->SetAutoWindow(false); - axis->UpdateWindowRange((float)deltaY); - } - } - - QPoint DataStrip::TransformHoriz(Charts::Axis* axis, float h) - { - QPoint pt(0, 0); - - if (axis) - { - //if ((v >= axis->m_WindowMin) && (v <= axis->m_WindowMax)) - { - float fullRange = fabs(axis->GetWindowRange()); - - float ratio = float(h - axis->GetWindowMin()) / fullRange; - pt.setX(m_Inset.left() + int((float(m_Inset.width()) * ratio))); - } - } - - return pt; - } - - QPoint DataStrip::TransformVert(Charts::Axis* axis, float v) - { - QPoint pt(0, 0); - - if (axis) - { - //if ((v >= axis->m_WindowMin) && (v <= axis->m_WindowMax)) - { - float fullRange = fabs(axis->GetWindowRange()); - - float ratio = float(v - axis->GetWindowMin()) / fullRange; - pt.setY(m_Inset.bottom() - int((float(m_Inset.height()) * ratio))); - } - } - - return pt; - } - - TransformResult DataStrip::Transform(Charts::Axis* axis, float h, float v, QPoint& outPt) - { - TransformResult tr = INVALID_RANGE; - QPoint pt(0, 0); - - if (axis) - { - if (h < axis->GetWindowMin()) - { - tr = OUTSIDE_LEFT; - pt.setX(m_Inset.left()); - } - else if (h > axis->GetWindowMax()) - { - tr = OUTSIDE_RIGHT; - pt.setX(m_Inset.right()); - } - else - { - tr = INSIDE_RANGE; - - if (axis->GetWindowMax() != axis->GetWindowMin()) - { - float fullRange = fabs(axis->GetWindowMax() - axis->GetWindowMin()); - float ratio = float(h - axis->GetWindowMin()) / fullRange; - pt.setX(m_Inset.left() + int((float(m_Inset.width()) * ratio))); - pt += TransformVert(m_DependentAxis, v); - } - else - { - pt.setX(m_Inset.left() + m_Inset.width() / 2); - } - } - } - - outPt = pt; - return tr; - } - - void DataStrip::wheelEvent(QWheelEvent* event) - { - int numDegrees = event->angleDelta().y() / 8; - int numSteps = numDegrees / 15; - // +step := zoom IN - // -step := zoom OUT - QPoint zoomPt = event->position().toPoint() - m_Inset.topLeft(); - - float zoomRatioX = (float)zoomPt.x() / (float)m_Inset.width(); - float zoomRatioY = (1.0f - ((float)zoomPt.y() / (float)m_Inset.height())); // because up is higher - - // give it some grace area. This makes it so if your mouse is "close" to the edge, its basically at the edge. - if (zoomRatioX < 0.1f) - { - zoomRatioX = 0.0f; - } - - if (zoomRatioX > 0.9f) - { - zoomRatioX = 1.0f; - } - - if (zoomRatioY < 0.1f) - { - zoomRatioY = 0.0f; - } - - if (zoomRatioY > 0.9f) - { - zoomRatioY = 1.0f; - } - - // the zoom limit is the smallest possible range you'd like to represent. - - m_Axis->Zoom(zoomRatioX, (float)numSteps, m_ZoomLimit); - m_DependentAxis->Zoom(zoomRatioY, (float)numSteps, 1.0f); - - update(); - - event->accept(); - } - void DataStrip::mouseMoveEvent(QMouseEvent* event) - { - if (m_IsDragging) - { - m_MouseWasDragged = true; - - float pixelWidth = (float)m_Inset.width(); - float pixelHeight = (float)m_Inset.height(); - float domainWidth = m_Axis->GetWindowRange(); - float domainHeight = m_DependentAxis->GetWindowRange(); - float domainPerPixelX = domainWidth / pixelWidth; - float domainPerPixelY = domainHeight / pixelHeight; - - QPoint deltaPoint = event->pos() - m_DragTracker; - - float deltaInDomainX = -domainPerPixelX * (float)(deltaPoint.x()); - float deltaInDomainY = domainPerPixelY * (float)(deltaPoint.y()); - - m_Axis->Drag(deltaInDomainX); - m_DependentAxis->Drag(deltaInDomainY); - - m_DragTracker = event->pos(); - update(); - } - else if (m_bLeftDown) - { - float fullRange = fabs(m_Axis->GetWindowMax() - m_Axis->GetWindowMin()); - float ratio = (float)(event->pos().x() - m_InsetL) / (float)(width() - m_InsetL - m_InsetR); - float localValue = (fullRange * ratio) + m_Axis->GetWindowMin(); - emit onMouseLeftDragDomainValue(localValue); - } - else - { - // mouse move with no buttons -- tooltip event - bool hitsomething = false; - HitArea closestHitArea; - int minimumDistance = 10; - - for (auto iter = m_hitAreas.begin(); iter != m_hitAreas.end(); ++iter) - { - QPoint hitboxCenter = iter->m_hitBoxCenter; - - int distance = (hitboxCenter - event->pos()).manhattanLength(); - if (distance < minimumDistance) - { - closestHitArea = *iter; - hitsomething = true; - minimumDistance = distance; - } - } - - if (hitsomething) - { - emit onMouseOverDataPoint(closestHitArea.m_ptrChannel->m_channelID, closestHitArea.m_sampleID, closestHitArea.m_primaryAxisValue, closestHitArea.m_dependentAxisValue); - } - else - { - // transform the point into the window range: - QPoint localPt = event->pos() - m_Inset.topLeft(); - localPt -= m_Inset.topLeft(); - float ratioX = (float)localPt.x() / (float)m_Inset.width(); - float ratioY = (1.0f - ((float)localPt.y() / (float)m_Inset.height())); - emit onMouseOverNothing((ratioX * m_Axis->GetWindowRange()) + m_Axis->GetWindowMin(), (ratioY * m_DependentAxis->GetWindowRange()) + m_DependentAxis->GetWindowMin()); - } - } - } - void DataStrip::mousePressEvent(QMouseEvent* event) - { - if (event->button() == Qt::RightButton) - { - m_MouseWasDragged = false; - m_IsDragging = true; - m_DragTracker = event->pos(); - update(); - } - else if (event->button() == Qt::LeftButton) - { - m_bLeftDown = true; - - float fullRange = fabs(m_Axis->GetWindowMax() - m_Axis->GetWindowMin()); - float ratio = (float)(event->pos().x() - m_InsetL) / (float)(width() - m_InsetL - m_InsetR); - float localValue = (fullRange * ratio) + m_Axis->GetWindowMin(); - emit onMouseLeftDownDomainValue(localValue); - } - - event->accept(); - } - void DataStrip::mouseReleaseEvent(QMouseEvent* event) - { - if (event->button() == Qt::RightButton) - { - m_IsDragging = false; - } - else if (event->button() == Qt::LeftButton) - { - if (m_bLeftDown) - { - m_bLeftDown = false; - float fullRange = fabs(m_Axis->GetWindowMax() - m_Axis->GetWindowMin()); - float ratio = (float)(event->pos().x() - m_InsetL) / (float)(width() - m_InsetL - m_InsetR); - float localValue = (fullRange * ratio) + m_Axis->GetWindowMin(); - emit onMouseLeftUpDomainValue(localValue); - } - } - - update(); - event->accept(); - } - void DataStrip::resizeEvent(QResizeEvent* event) - { - RecalculateInset(); - event->ignore(); - } - - void DataStrip::RecalculateInset() - { - m_Inset = QRect(m_InsetL, m_InsetT, rect().width() - m_InsetL - m_InsetR, rect().height() - m_InsetT - m_InsetB); - } - - void DataStrip::AttachDataSourceWidget(QWidget* widget) - { - connect(this, SIGNAL(ProcureData(StripChart::DataStrip*)), widget, SLOT(ProvideData(StripChart::DataStrip*))); - } - - void DataStrip::paintEvent(QPaintEvent* event) - { - (void)event; - - // - // pull data from owner - // e.g. in the profiler case the ChartTimeHistory() with cached parameters should end up getting called - // ChartTimeHistory( m_cachedChart, m_cachedFrame, m_cachedFar, m_cachedColumn ); - // - if (m_isDataDirty) - { - emit ProcureData(this); - m_isDataDirty = false; - } - - QPen pen; - pen.setWidth(1); - QBrush brush; - brush.setStyle(Qt::SolidPattern); - pen.setBrush(brush); - - QPainter p(this); - p.setPen(pen); - - QFont currentFont = p.font(); - - p.fillRect(rect(), QColor(32, 32, 32, 255)); - p.fillRect(m_Inset, Qt::black); - - brush.setColor(QColor(255, 255, 0, 255)); - pen.setColor(QColor(0, 255, 255, 255)); - p.setPen(pen); - - m_hitAreas.clear(); - // HORIZ - if (m_Axis) - { - m_Axis->PaintAxis(Charts::AxisType::Horizontal, &p, rect(), m_Inset, m_ptrFormatter); - - // VERT - if (m_DependentAxis) - { - m_DependentAxis->PaintAxis(Charts::AxisType::Vertical, &p, rect(), m_Inset, m_ptrFormatter); - } - - // +-1 allows data at the outer envelope to render - p.setClipRect(m_InsetL, m_InsetT - 1, rect().width() - m_InsetR - m_InsetL, rect().height() - m_InsetB - m_InsetT + 1); - - for (Channels::iterator chiter = m_Channels.begin(); chiter != m_Channels.end(); ++chiter) - { - Channel& cptr = *chiter; - - pen.setStyle(Qt::SolidLine); - brush.setColor(chiter->m_Color); - pen.setColor(chiter->m_Color); - if (chiter->m_highlighted) - { - pen.setWidth(3); - } - else - { - pen.setWidth(1); - } - p.setPen(pen); - - switch (chiter->m_Style) - { - case Channel::STYLE_POINT: - { - auto datiter = cptr.m_Data.begin(); - while (datiter != cptr.m_Data.end()) - { - QPoint pt; - if (Transform(m_Axis, datiter->m_domainValue, datiter->m_dependentValue, pt) == INSIDE_RANGE) - { - if ((chiter->m_highlightSample) && (chiter->m_highlightedSampleID == datiter->m_sampleID)) - { - // if the channel itself wasn't highlighte we need to set the pen - if (!chiter->m_highlighted) - { - pen.setWidth(3); - p.setPen(pen); - } - - p.drawEllipse(pt, 5, 5); - - if (!chiter->m_highlighted) - { - // if the channel itself wasn't highlighted we need to restore the pen - p.setPen(pen); - pen.setWidth(1); - } - } - else - { - p.drawEllipse(pt, 3, 3); - } - - m_hitAreas.push_back(HitArea(datiter->m_domainValue, datiter->m_dependentValue, pt, &cptr, datiter->m_sampleID)); - } - ++datiter; - } - } - break; - case Channel::STYLE_PLUSMINUS: - { - auto datiter = cptr.m_Data.begin(); - while (datiter != cptr.m_Data.end()) - { - QPoint pt; - if (Transform(m_Axis, datiter->m_domainValue, datiter->m_dependentValue, pt) == INSIDE_RANGE) - { - m_hitAreas.push_back(HitArea(datiter->m_domainValue, datiter->m_dependentValue, pt, &cptr, datiter->m_sampleID)); - - int plussize = 3; - - if ((chiter->m_highlightSample) && (chiter->m_highlightedSampleID == datiter->m_sampleID)) - { - if (!chiter->m_highlighted) - { - // if the channel itself wasn't highlighte we need to set the pen - pen.setWidth(3); - p.setPen(pen); - } - plussize = 5; - } - - p.drawLine(pt.x() - plussize, pt.y(), pt.x() + plussize, pt.y()); - if (datiter->m_dependentValue > 0.0f) - { - p.drawLine(pt.x(), pt.y() - plussize, pt.x(), pt.y() + plussize); - } - - if ((chiter->m_highlightSample) && (chiter->m_highlightedSampleID == datiter->m_sampleID)) - { - if (!chiter->m_highlighted) - { - // restore pen - pen.setWidth(1); - p.setPen(pen); - } - } - } - ++datiter; - } - } - break; - case Channel::STYLE_CONNECTED_LINE: - { - auto datiter = cptr.m_Data.begin(); - auto onebehind = cptr.m_Data.begin(); - if (datiter != cptr.m_Data.end()) - { - ++datiter; - } - while (datiter != cptr.m_Data.end()) - { - QPoint pt1; - TransformResult tr1 = Transform(m_Axis, onebehind->m_domainValue, onebehind->m_dependentValue, pt1); - QPoint pt2; - TransformResult tr2 = Transform(m_Axis, datiter->m_domainValue, datiter->m_dependentValue, pt2); - - if (tr1 == INSIDE_RANGE && tr2 == INSIDE_RANGE) - { - m_hitAreas.push_back(HitArea(datiter->m_domainValue, datiter->m_dependentValue, pt2, &cptr, datiter->m_sampleID)); - - - if ((chiter->m_highlightSample) && (chiter->m_highlightedSampleID == datiter->m_sampleID)) - { - if (!chiter->m_highlighted) - { - // if the channel itself wasn't highlighted we need to set the pen - pen.setWidth(3); - p.setPen(pen); - } - - p.drawLine(pt1, pt2); - p.drawEllipse(pt2, 3, 3); - if (!chiter->m_highlighted) - { - // restore the pen - pen.setWidth(1); - p.setPen(pen); - } - } - else - { - // not highlighted.. - p.drawLine(pt1, pt2); // just draw a line - } - } - ++onebehind; - ++datiter; - } - } - break; - } - } - - pen.setStyle(Qt::SolidLine); - brush.setStyle(Qt::Dense2Pattern); - brush.setColor(m_MarkerColor); - pen.setColor(m_MarkerColor); - p.setPen(pen); - QPoint markerPt; - if (Transform(m_Axis, m_MarkerPosition, 0.0f, markerPt) == INSIDE_RANGE) - { - p.drawLine(markerPt.x(), 0, markerPt.x(), m_Inset.y() + m_Inset.height()); - } - } - } - - void DataStrip::RenderHorizCallouts(QPainter* painter) - { - float textSpaceRequired = (float)painter->fontMetrics().horizontalAdvance("9,999,999.99"); - int fontH = painter->fontMetrics().height(); - - AZStd::vector divisions; - divisions.reserve(10); - float divisionSize = m_Axis->ComputeAxisDivisions((float)m_Inset.width(), divisions, textSpaceRequired, textSpaceRequired); - - QPen dottedPen; - dottedPen.setStyle(Qt::DotLine); - dottedPen.setColor(QColor(64, 64, 64, 255)); - dottedPen.setWidth(1); - QBrush solidBrush; - QPen solidPen; - solidPen.setStyle(Qt::SolidLine); - solidPen.setColor(QColor(0, 255, 255, 255)); - solidPen.setWidth(1); - - for (auto it = divisions.begin(); it != divisions.end(); ++it) - { - float currentUnit = *it; - QPoint leftEdge = TransformHoriz(m_Axis, currentUnit); - - QPoint leftline((int)leftEdge.x(), m_Inset.bottom()); - QPoint leftend = leftline - QPoint(0, m_Inset.height()); - painter->setPen(dottedPen); - painter->drawLine(leftline, leftend); - - QString text; - if (m_ptrFormatter) - { - text = m_ptrFormatter->convertAxisValueToText(Charts::AxisType::Horizontal, currentUnit, divisions.front(), divisions.back(), divisionSize); - } - else - { - text = QString("%1").arg((AZ::s64)currentUnit); - } - - int textW = painter->fontMetrics().horizontalAdvance(text); - - painter->setPen(solidPen); - painter->drawText((int)leftEdge.x() - textW / 2, m_Inset.bottom() + fontH, text); - } - } - - void DataStrip::RenderVertCallouts(QPainter* painter) - { - if (!m_DependentAxis) - { - return; - } - - int fontH = painter->fontMetrics().height(); - - - QPen dottedPen; - dottedPen.setStyle(Qt::DotLine); - dottedPen.setColor(QColor(64, 64, 64, 255)); - dottedPen.setWidth(1); - QBrush solidBrush; - QPen solidPen; - solidPen.setStyle(Qt::SolidLine); - solidPen.setColor(QColor(0, 255, 255, 255)); - solidPen.setWidth(1); - AZStd::vector divisions; - divisions.reserve(10); - float divisionSize = m_DependentAxis->ComputeAxisDivisions((float)m_Inset.height(), divisions, fontH * 2.0f, fontH * 2.0f); - - for (auto it = divisions.begin(); it != divisions.end(); ++it) - { - float currentUnit = *it; - - // where is that in the inset? - QPoint leftEdge = TransformVert(m_DependentAxis, currentUnit); - - painter->setPen(dottedPen); - QPoint leftline(m_Inset.left(), leftEdge.y()); - QPoint leftend = leftline + QPoint(m_Inset.width(), 0); - painter->drawLine(leftline, leftend); - - QString text; - if (m_ptrFormatter) - { - text = m_ptrFormatter->convertAxisValueToText(Charts::AxisType::Vertical, currentUnit, divisions.front(), divisions.back(), divisionSize); - } - else - { - text = QString("%1").arg((AZ::s64)currentUnit); - } - - int textW = painter->fontMetrics().horizontalAdvance(text); - painter->setPen(solidPen); - painter->drawText(m_Inset.left() - textW - 2, (int)leftEdge.y() + fontH / 2, text); - } - } - - void DataStrip::DrawRotatedText(QString text, QPainter* painter, float degrees, int x, int y, float scale) - { - painter->save(); - painter->translate(x, y); - painter->scale(scale, scale); - painter->rotate(degrees); - painter->drawText(0, 0, text); - painter->restore(); - } - - void DataStrip::ZoomExtents(Charts::AxisType axis) - { - switch (axis) - { - case Charts::AxisType::Horizontal: - if (m_Axis) - { - m_Axis->SetViewFull(); - } - break; - case Charts::AxisType::Vertical: - if (m_DependentAxis) - { - m_DependentAxis->SetViewFull(); - } - break; - default: - AZ_Assert(false, "ERROR: Unkown axis(%i) in ZoomExtents", axis); - } - } - - void DataStrip::ZoomManual(Charts::AxisType axis, float minValue, float maxValue) - { - switch (axis) - { - case Charts::AxisType::Horizontal: - if (m_Axis) - { - m_Axis->ZoomToRange(minValue, maxValue, false); - } - break; - case Charts::AxisType::Vertical: - if (m_DependentAxis) - { - m_DependentAxis->ZoomToRange(minValue, maxValue, false); - } - break; - default: - AZ_Assert(false, "ERROR: Unkown axis(%i) in ZoomExtents", axis); - } - } - - bool DataStrip::IsValidChannelId(int channelId) const - { - return channelId >= 0 && channelId < m_Channels.size(); - } -} diff --git a/Code/Tools/Standalone/Source/Driller/StripChart.hxx b/Code/Tools/Standalone/Source/Driller/StripChart.hxx deleted file mode 100644 index d6f9bc24c1..0000000000 --- a/Code/Tools/Standalone/Source/Driller/StripChart.hxx +++ /dev/null @@ -1,220 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef AZ_STRIPCHART_H -#define AZ_STRIPCHART_H - -#if !defined(Q_MOC_RUN) -#include -#include -#include -#include - -#include -#endif - -namespace Charts -{ - class Axis; -} - -namespace StripChart -{ - enum TransformResult - { - OUTSIDE_LEFT = -1, - INSIDE_RANGE = 0, - OUTSIDE_RIGHT = 1, - INVALID_RANGE = 2 - }; - - struct Channel - { - AZ_CLASS_ALLOCATOR(Channel,AZ::SystemAllocator,0); - Channel() : m_Color(QColor(255,255,0,255)), m_Style(STYLE_POINT), m_channelID(0), m_highlighted(false), m_highlightSample(false), m_highlightedSampleID(0) {} - - enum ChannelStyle - { - STYLE_POINT = 0, - STYLE_CONNECTED_LINE, - STYLE_VERTICAL_LINE, - STYLE_BAR, - STYLE_PLUSMINUS - }; - - void SetName(QString name) { m_Name = name; } - void SetColor(QColor &color) { m_Color = color; } - void SetStyle(ChannelStyle style) { m_Style = style; } - void SetHighlight(bool highlight) { m_highlighted = highlight; } - void SetHighlightedSample(bool highlight, AZ::u64 sampleID) { m_highlightedSampleID = sampleID; m_highlightSample = highlight; } - void SetID(int id) { m_channelID = id; } - - struct Sample - { - float m_domainValue; - float m_dependentValue; - AZ::u64 m_sampleID; - - Sample() : m_domainValue(0.0f), m_dependentValue(0.0f), m_sampleID(0) {} - Sample(AZ::u64 sampleID, float domain, float dependent) : - m_sampleID(sampleID), - m_domainValue(domain), - m_dependentValue(dependent) {} - }; - - int m_channelID; - QString m_Name; - AZStd::vector< Sample > m_Data; - QColor m_Color; - ChannelStyle m_Style; - bool m_highlighted; - AZ::u64 m_highlightedSampleID; - bool m_highlightSample; - }; - - class DataStrip - : public QWidget - { - Q_OBJECT; - public: - static int s_invalidChannelId; - - AZ_CLASS_ALLOCATOR(DataStrip,AZ::SystemAllocator,0); - DataStrip(QWidget* parent = NULL, Qt::WindowFlags flags = Qt::WindowFlags()); - virtual ~DataStrip(void); - - void Reset(); - - void SetChannelHighlight(int channelID, bool highlight); - void SetChannelSampleHighlight( int channelID, AZ::u64 sampleID, bool highlight); - - bool AddAxis(QString label, float minimum, float maximum, bool lockedZoom = true, bool lockedRange = false); - - void ZoomExtents(Charts::AxisType axis); - void ZoomManual(Charts::AxisType axis, float minValue, float maxValue); - - int AddChannel(QString name); - - // Use AddData when just adding a random point to the graph. This will keep all of - // the axis's in order. - void AddData(int channelID, AZ::u64 sampleID, float h, float v = 0.0f); - - // Use AddDataBatch when adding lots of data all at once, this will ignore some calls. - void StartBatchDataAdd(); - void AddBatchedData(int channelID, AZ::u64 sampleID, float h, float v = 0.0f); - void EndBatchDataAdd(); - - void ClearData(int channelID); - void ClearAxisRange(); - void SetChannelColor(int channelID, QColor color); - - void SetChannelStyle(int channelID, Channel::ChannelStyle style); - void SetViewFull(); - void SetLockRight(bool tf); - void SetZoomLimit(float limit); - - void SetMarkerColor(QColor qc); - void SetMarkerPosition(float qposn); - - bool GetAxisRange(Charts::AxisType whichAxis, float& minValue, float& maxValue); - bool GetWindowRange(Charts::AxisType whichAxis, float &minValue, float &maxValue); - // override for knowledgeable outsiders who want a different range than from the data provided via AddData(...) - void SetWindowRange(Charts::AxisType whichAxis, float minValue, float maxValue); - void AddWindowRange(Charts::AxisType whichAxis, float minValue, float maxValue); - - // you may set it to null to clear it. - // the chart will automatically uninstall the text formatter if it is destroyed - // it DOES NOT TAKE OWNERSHIP of the formatter. - void SetAxisTextFormatter(Charts::QAbstractAxisFormatter* target); - void AttachDataSourceWidget(QWidget *widget); - - void SetDataDirty(); - bool IsValidChannelId(int channelId) const; - -signals: - void onMouseOverDataPoint(int channelID, AZ::u64 sampleID, float primaryAxisValue, float dependentAxisValue); - void onMouseOverNothing(float primaryAxisValue, float dependentAxisValue); - void onMouseLeftDownDomainValue(float domainValue); - void onMouseLeftDragDomainValue(float domainValue); - void onMouseLeftUpDomainValue(float domainValue); - void ProcureData(StripChart::DataStrip*); - - protected: - virtual void wheelEvent(QWheelEvent * event); - virtual void mouseMoveEvent(QMouseEvent * event); - virtual void mousePressEvent(QMouseEvent * event); - virtual void mouseReleaseEvent(QMouseEvent * event); - virtual void resizeEvent(QResizeEvent * event); - - protected slots: - void OnDestroyAxisFormatter(QObject *pDestroyed); - - protected: - - int m_InsetL; - int m_InsetR; - int m_InsetT; - int m_InsetB; - QRect m_Inset; - float m_ZoomLimit; - bool m_bLeftDown; - bool m_isDataDirty; - - typedef AZStd::vector Channels; - Channels m_Channels; - QPoint m_DragTracker; - bool m_MouseWasDragged; - - Charts::QAbstractAxisFormatter* m_ptrFormatter; - - bool m_IsDragging; - bool m_InBatchMode; - - // axes dealt with internally as follows: - Charts::Axis* m_Axis; - Charts::Axis* m_DependentAxis; // vertical axis - // first submission = horizontal, for binary state data points - // second submission = vertical, for state with value data points - // third submission = depth, for data grids with value - - QColor m_MarkerColor; - float m_MarkerPosition; - - // internal ops - virtual void paintEvent(QPaintEvent *event); - void DrawRotatedText(QString text, QPainter *painter, float degrees, int x, int y, float scale = 1.0f); - void RenderVertCallouts(QPainter *painter); - void RenderHorizCallouts(QPainter *painter); - void RecalculateInset(); - void Drag(Charts::Axis *axis, int deltaY); - void Drag(Charts::Axis *axis, int deltaX, int deltaY); - QPoint TransformVert(Charts::Axis *axis, float v); - QPoint TransformHoriz(Charts::Axis *axis, float h); - TransformResult Transform(Charts::Axis *axis, float h, float v, QPoint &outQPoint); - - class HitArea - { - public: - AZ_CLASS_ALLOCATOR(HitArea, AZ::SystemAllocator, 0); - Channel *m_ptrChannel; - AZ::u64 m_sampleID; - float m_primaryAxisValue; - float m_dependentAxisValue; - QPoint m_hitBoxCenter; - HitArea() : m_ptrChannel(NULL), m_primaryAxisValue(0.0f), m_dependentAxisValue(0.0f) {} - HitArea(float x, float y, QPoint hitBoxCenter, Channel* pChannel, AZ::u64 sampleID) : - m_hitBoxCenter(hitBoxCenter), m_primaryAxisValue(x), m_dependentAxisValue(y), m_ptrChannel(pChannel), m_sampleID(sampleID) {} - }; - - typedef AZStd::vector HitAreaContainer; - HitAreaContainer m_hitAreas; - }; - -} - -#endif //AZ_STRIPCHART_H diff --git a/Code/Tools/Standalone/Source/Driller/Trace/TraceDrillerDialog.cpp b/Code/Tools/Standalone/Source/Driller/Trace/TraceDrillerDialog.cpp deleted file mode 100644 index 63e9de9b1e..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Trace/TraceDrillerDialog.cpp +++ /dev/null @@ -1,487 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "TraceDrillerDialog.hxx" -#include "TraceMessageDataAggregator.hxx" -#include -#include "TraceMessageEvents.h" - -#include -#include -#include -#include -#include - -#include -#include -#include - -namespace Driller -{ - class TraceDrillerDialogSavedState - : public AZ::UserSettings - { - public: - AZ_RTTI(TraceDrillerDialogSavedState, "{81955B84-077D-4A87-B562-7A9633736BE4}", AZ::UserSettings); - AZ_CLASS_ALLOCATOR(TraceDrillerDialogSavedState, AZ::SystemAllocator, 0); - - AZStd::string m_windowFilter; - AZStd::string m_textFilter; - - TraceDrillerDialogSavedState() {} - - static void Reflect(AZ::ReflectContext* context) - { - AZ::SerializeContext* serialize = azrtti_cast(context); - if (serialize) - { - serialize->Class() - ->Field("m_windowFilter", &TraceDrillerDialogSavedState::m_windowFilter) - ->Field("m_textFilter", &TraceDrillerDialogSavedState::m_textFilter) - ->Version(1); - } - } - }; - - // Qt supports A "filter proxy model" - // you have a normal model - // and then you wrap that model in a filter proxy model. - // this allows you to filter the inner model and feed the outer (filtered) model to the view. - - // this particular filter model lets you specify search criteria in the Window or the Message field - class TraceFilterModel - : public QSortFilterProxyModel - { - public: - AZ_CLASS_ALLOCATOR(TraceFilterModel, AZ::SystemAllocator, 0); - int m_windowColumn; - int m_messageColumn; - - QString m_currentWindowFilter; - QString m_currentMessageFilter; - - TraceFilterModel(int windowColumn, int messageColumn, QObject* pParent) - : QSortFilterProxyModel(pParent) - { - m_windowColumn = windowColumn; - m_messageColumn = messageColumn; - } - - void UpdateWindowFilter(const QString& newFilter) - { - if (newFilter.compare(m_currentWindowFilter) != 0) - { - if (m_windowColumn >= 0) - { - m_currentWindowFilter = newFilter; - invalidateFilter(); - } - } - } - - void UpdateMessageFilter(const QString& newFilter) - { - if (newFilter.compare(m_currentMessageFilter) != 0) - { - if (m_messageColumn >= 0) - { - m_currentMessageFilter = newFilter; - invalidateFilter(); - } - } - } - - - protected: - virtual bool filterAcceptsRow(int source_row, const QModelIndex& /*source parent*/) const - { - QAbstractItemModel* ptrModel = sourceModel(); - - if (!ptrModel) - { - return true; - } - - if (m_currentWindowFilter.size() > 0) - { - QString sourceData = ptrModel->data(ptrModel->index(source_row, m_windowColumn), Qt::DisplayRole).toString(); - if (!sourceData.contains(m_currentWindowFilter, Qt::CaseInsensitive)) - { - return false; - } - } - - if (m_currentMessageFilter.size() > 0) - { - QString sourceData = ptrModel->data(ptrModel->index(source_row, m_messageColumn), Qt::DisplayRole).toString(); - if (!sourceData.contains(m_currentMessageFilter, Qt::CaseInsensitive)) - { - return false; - } - } - - return true; - } - }; - - TraceDrillerDialog::TraceDrillerDialog(TraceMessageDataAggregator* data, int profilerIndex, QWidget* pParent) - : QDialog(pParent) - , m_viewIndex(profilerIndex) - , m_lifespanTelemetry("TraceDataView") - { - setAttribute(Qt::WA_DeleteOnClose, true); - - m_uiLoaded = azcreate(Ui::TraceDrillerDialog, ()); - m_uiLoaded->setupUi(this); - setWindowFlags((this->windowFlags() | Qt::WindowMaximizeButtonHint | Qt::WindowMinimizeButtonHint) & ~(Qt::WindowContextHelpButtonHint)); - - setWindowTitle(data->GetDialogTitle()); - - TraceDrillerLogTab* tabView = aznew TraceDrillerLogTab(this); - - this->layout()->addWidget(tabView); - - m_ptrOriginalModel = aznew TraceDrillerLogModel(data, this); - m_ptrFilter = aznew TraceFilterModel(tabView->GetWindowColumn(), tabView->GetMessageColumn(), this); - m_ptrFilter->setSourceModel(m_ptrOriginalModel); - tabView->ConnectModelToView(m_ptrFilter); - - connect(data, SIGNAL(destroyed(QObject*)), this, SLOT(OnDataDestroyed())); - - connect(m_ptrFilter, SIGNAL(rowsAboutToBeInserted(const QModelIndex &, int, int)), tabView, SLOT(rowsAboutToBeInserted())); - connect(m_ptrFilter, SIGNAL(rowsInserted(const QModelIndex &, int, int)), tabView, SLOT(rowsInserted())); - connect(m_uiLoaded->windowFilterText, SIGNAL(textChanged(const QString &)), this, SLOT(onTextChangeWindowFilter(const QString&))); - connect(m_uiLoaded->messageFilterText, SIGNAL(textChanged(const QString &)), this, SLOT(onTextChangeMessageFilter(const QString&))); - - connect(m_ptrFilter, SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, SLOT(UpdateSummary())); - connect(m_ptrFilter, SIGNAL(rowsRemoved(const QModelIndex &, int, int)), this, SLOT(UpdateSummary())); - connect(m_ptrFilter, SIGNAL(modelReset()), this, SLOT(UpdateSummary())); - connect(m_ptrOriginalModel, SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, SLOT(UpdateSummary())); - connect(m_ptrOriginalModel, SIGNAL(rowsRemoved(const QModelIndex &, int, int)), this, SLOT(UpdateSummary())); - connect(m_ptrOriginalModel, SIGNAL(modelReset()), this, SLOT(UpdateSummary())); - - AZStd::string windowStateStr = AZStd::string::format("TRACE DRILLER DATA VIEW WINDOW STATE %i", m_viewIndex); - m_windowStateCRC = AZ::Crc32(windowStateStr.c_str()); - AZStd::intrusive_ptr windowState = AZ::UserSettings::Find(m_windowStateCRC, AZ::UserSettings::CT_GLOBAL); - if (windowState) - { - windowState->RestoreGeometry(this); - } - - AZStd::string filterStateStr = AZStd::string::format("TRACE DRILLER DIALOG SAVED STATE %i", m_viewIndex); - m_filterStateCRC = AZ::Crc32(filterStateStr.c_str()); - m_persistentState = AZ::UserSettings::Find(m_filterStateCRC, AZ::UserSettings::CT_GLOBAL); - ApplyPersistentState(); - UpdateSummary(); - } - - TraceDrillerDialog::~TraceDrillerDialog() - { - SaveOnExit(); - azdestroy(m_uiLoaded); - } - - void TraceDrillerDialog::ApplyPersistentState() - { - if (m_persistentState) - { - // the bridge between our AZStd::string storage and QT's own string type - QString windowFilter(m_persistentState->m_windowFilter.c_str()); - QString textFilter(m_persistentState->m_textFilter.c_str()); - - m_uiLoaded->windowFilterText->setText(windowFilter); - m_uiLoaded->messageFilterText->setText(textFilter); - } - } - - void TraceDrillerDialog::SaveOnExit() - { - AZStd::intrusive_ptr pState = AZ::UserSettings::CreateFind(m_windowStateCRC, AZ::UserSettings::CT_GLOBAL); - pState->CaptureGeometry(this); - - AZStd::intrusive_ptr newState = AZ::UserSettings::CreateFind(m_filterStateCRC, AZ::UserSettings::CT_GLOBAL); - if (newState) - { - newState->m_windowFilter = m_ptrFilter->m_currentWindowFilter.toUtf8().data(); - newState->m_textFilter = m_ptrFilter->m_currentMessageFilter.toUtf8().data(); - } - } - void TraceDrillerDialog::hideEvent(QHideEvent* evt) - { - QDialog::hideEvent(evt); - } - void TraceDrillerDialog::closeEvent(QCloseEvent* evt) - { - QDialog::closeEvent(evt); - } - void TraceDrillerDialog::OnDataDestroyed() - { - deleteLater(); - } - - void TraceDrillerDialog::onTextChangeWindowFilter(const QString& newText) - { - m_ptrFilter->UpdateWindowFilter(newText); - UpdateSummary(); - } - - void TraceDrillerDialog::onTextChangeMessageFilter(const QString& newText) - { - m_ptrFilter->UpdateMessageFilter(newText); - UpdateSummary(); - } - - void TraceDrillerDialog::UpdateSummary() - { - int filterRows = m_ptrFilter->rowCount(); - int originalRows = m_ptrOriginalModel->rowCount(); - - if (!m_uiLoaded->windowFilterText->text().isEmpty() || !m_uiLoaded->messageFilterText->text().isEmpty()) - { - m_uiLoaded->summaryLabel->setText(QString("%1 / %2\nEvent(s)").arg(filterRows).arg(originalRows)); - } - else - { - m_uiLoaded->summaryLabel->setText(QString("%1\nEvent(s)").arg(originalRows)); - } - } - - void TraceDrillerDialog::ApplySettingsFromWorkspace(WorkspaceSettingsProvider* provider) - { - AZStd::string workspaceStateStr = AZStd::string::format("TRACE DRILLER DIALOG WORKSPACE STATE %i", m_viewIndex); - AZ::u32 workspaceStateCRC = AZ::Crc32(workspaceStateStr.c_str()); - - if (m_persistentState) - { - TraceDrillerDialogSavedState* workspace = provider->FindSetting(workspaceStateCRC); - if (workspace) - { - m_persistentState->m_windowFilter = workspace->m_windowFilter; - m_persistentState->m_textFilter = workspace->m_textFilter; - } - } - } - void TraceDrillerDialog::ActivateWorkspaceSettings(WorkspaceSettingsProvider*) - { - ApplyPersistentState(); - } - void TraceDrillerDialog::SaveSettingsToWorkspace(WorkspaceSettingsProvider* provider) - { - AZStd::string workspaceStateStr = AZStd::string::format("TRACE DRILLER DIALOG WORKSPACE STATE %i", m_viewIndex); - AZ::u32 workspaceStateCRC = AZ::Crc32(workspaceStateStr.c_str()); - - if (m_persistentState) - { - TraceDrillerDialogSavedState* workspace = provider->CreateSetting(workspaceStateCRC); - if (workspace) - { - workspace->m_windowFilter = m_ptrFilter->m_currentWindowFilter.toUtf8().data(); - workspace->m_textFilter = m_ptrFilter->m_currentMessageFilter.toUtf8().data(); - } - } - } - - void TraceDrillerDialog::Reflect(AZ::ReflectContext* context) - { - AZ::SerializeContext* serialize = azrtti_cast(context); - if (serialize) - { - TraceDrillerDialogSavedState::Reflect(context); - } - } - - ////////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////////// - // TraceDrillerLogTab - ////////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////////// - TraceDrillerLogTab::TraceDrillerLogTab(QWidget* pParent) - : BaseLogView(pParent) - , m_isScrollAfterInsert(true) - { - setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); - } - - TraceDrillerLogTab::~TraceDrillerLogTab() - { - } - - void TraceDrillerLogTab::rowsAboutToBeInserted() - { - m_isScrollAfterInsert = IsAtMaxScroll(); - } - - void TraceDrillerLogTab::rowsInserted() - { - if (m_isScrollAfterInsert) - { - m_ptrLogView->scrollToBottom(); - } - } - - ////////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////////// - // TraceDrillerLogModel - ////////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////////// - TraceDrillerLogModel::TraceDrillerLogModel(TraceMessageDataAggregator* data, QObject* pParent) - : QAbstractTableModel(pParent) - , m_data(data) - , m_lastShownEvent(-1) - { - connect(data, SIGNAL(OnDataCurrentEventChanged()), this, SLOT(OnDataCurrentEventChanged())); - connect(data, SIGNAL(OnDataAddEvent()), this, SLOT(OnDataAddEvent())); - - // cache Icons! - m_criticalIcon = QApplication::style()->standardIcon(QStyle::SP_MessageBoxCritical); - m_errorIcon = QApplication::style()->standardIcon(QStyle::SP_MessageBoxCritical); - m_warningIcon = QApplication::style()->standardIcon(QStyle::SP_MessageBoxWarning); - m_informationIcon = QApplication::style()->standardIcon(QStyle::SP_MessageBoxInformation); - - m_lastShownEvent = m_data->GetCurrentEvent(); - } - - TraceDrillerLogModel::~TraceDrillerLogModel() - { - } - - void TraceDrillerLogModel::OnDataCurrentEventChanged() - { - AZ::s64 currentEvent = m_data->GetCurrentEvent(); - // NOTE: we add +1 to all events, because we are EXECUTING the current event (so it must be shown) - if (m_lastShownEvent > currentEvent) - { - // remove rows - beginRemoveRows(QModelIndex(), (int)currentEvent + 1, (int)m_lastShownEvent); - endRemoveRows(); - } - else - { - // add rows - beginInsertRows(QModelIndex(), (int)m_lastShownEvent + 1, (int)currentEvent); - endInsertRows(); - } - m_lastShownEvent = currentEvent; - } - - void TraceDrillerLogModel::OnDataAddEvent() - { - } - - int TraceDrillerLogModel::rowCount(const QModelIndex&) const - { - AZ::s64 currentEvent = m_data->GetCurrentEvent(); - return (int)currentEvent + 1; - } - int TraceDrillerLogModel::columnCount(const QModelIndex&) const - { - return 3; // icon + window + message; - } - Qt::ItemFlags TraceDrillerLogModel::flags(const QModelIndex& index) const - { - if (!index.isValid()) - { - return Qt::ItemIsEnabled; - } - - if (index.column() == 2) // the 3rd column (message) is "editable" - { - return QAbstractItemModel::flags(index) | Qt::ItemIsEditable; - } - - return QAbstractItemModel::flags(index); - } - - QVariant TraceDrillerLogModel::data(const QModelIndex& index, int role) const - { - using namespace AZ::Debug; - - TraceMessageEvent* event = static_cast(m_data->GetEvents().at(index.row())); - if (role == AzToolsFramework::LogPanel::RichTextRole) // the renderer is asking whether this cell is rich text or not. Return a true or false. - { - return /*m_Lines[index.row()].m_bIsRichText*/ false; - } - else if (role == Qt::DecorationRole) // the renderer is asking whether or not we want to display an icon in this cell. Return an icon or null. - { - if (index.column() == 0) - { - switch (event->GetEventType()) - { - case TraceMessageEvent::ET_ASSERT: - return m_criticalIcon; - case TraceMessageEvent::ET_ERROR: - return m_errorIcon; - case TraceMessageEvent::ET_WARNING: - return m_warningIcon; - case TraceMessageEvent::ET_PRINTF: - return m_informationIcon; - case TraceMessageEvent::ET_EXCEPTION: - return QVariant(); - break; - } - } - } - else if (role == Qt::DisplayRole) // the renderer wants to know what text to show in this cell. Return a string or null - { - if (index.column() == 0) // icon has no text - { - return QVariant(QString()); - } - else if (index.column() == 1) // window - { - return QVariant(event->m_window); - } - else if (index.column() == 2) // message - { - return QVariant(QString(event->m_message).trimmed()); - } - } - else if (role == Qt::BackgroundRole) // the renderer wants to know what the background color of this cell should be. REturn a color or null (to use default) - { - switch (event->GetEventType()) - { - case TraceMessageEvent::ET_ASSERT: - return QVariant(QColor::fromRgb(255, 0, 0)); - break; - case TraceMessageEvent::ET_ERROR: - return QVariant(QColor::fromRgb(255, 192, 192)); - break; - case TraceMessageEvent::ET_WARNING: - return QVariant(QColor::fromRgb(255, 255, 192)); - break; - case TraceMessageEvent::ET_PRINTF: - return QVariant(); - break; - case TraceMessageEvent::ET_EXCEPTION: - return QVariant(); - break; - } - } - else if (role == Qt::ForegroundRole) // the renderer wants to know what the text color of this cell should be.REturn a color or null. - { - switch (event->GetEventType()) - { - case TraceMessageEvent::ET_PRINTF: - return QVariant(QColor::fromRgb(0, 0, 0)); - break; - case TraceMessageEvent::ET_ERROR: - return QVariant(QColor::fromRgb(64, 0, 0)); - break; - case TraceMessageEvent::ET_WARNING: - return QVariant(QColor::fromRgb(64, 64, 0)); - break; - case TraceMessageEvent::ET_EXCEPTION: - return QVariant(); - break; - } - } - return QVariant(); - } -} - -#include diff --git a/Code/Tools/Standalone/Source/Driller/Trace/TraceDrillerDialog.hxx b/Code/Tools/Standalone/Source/Driller/Trace/TraceDrillerDialog.hxx deleted file mode 100644 index 36105065a9..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Trace/TraceDrillerDialog.hxx +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef TRACEDRILLERDIALOG_H -#define TRACEDRILLERDIALOG_H - -#pragma once - -#if !defined(Q_MOC_RUN) -#include -#include -#include - -#include - -#include "Source/Driller/DrillerMainWindowMessages.h" -#include "Source/Driller/DrillerOperationTelemetryEvent.h" -#endif - -namespace Ui { - class TraceDrillerDialog; -} // namespace Ui - -namespace AZ { class ReflectContext; } - -namespace Driller -{ - class TraceFilterModel; - class TraceMessageDataAggregator; - class TraceDrillerLogModel; - class TraceDrillerDialogSavedState; - - class TraceDrillerDialog - : public QDialog - { - Q_OBJECT - public: - AZ_CLASS_ALLOCATOR(TraceDrillerDialog, AZ::SystemAllocator, 0); - - TraceDrillerDialog(TraceMessageDataAggregator* data, int profilerIndex, QWidget *pParent = NULL); - virtual ~TraceDrillerDialog(); - - // NB: These three methods mimic the workspace bus. - // Because the ProfilerDataAggregator can't know to open these DataView windows - // until after the EBUS message has gone out, the owning aggregator must - // first create these windows and then pass along the provider manually - void ApplySettingsFromWorkspace(WorkspaceSettingsProvider*); - void ActivateWorkspaceSettings(WorkspaceSettingsProvider*); - void SaveSettingsToWorkspace(WorkspaceSettingsProvider*); - - void SaveOnExit(); - virtual void closeEvent(QCloseEvent *evt); - virtual void hideEvent(QHideEvent *evt); - - void ApplyPersistentState(); - - AZ::u32 m_windowStateCRC; - AZ::u32 m_filterStateCRC; - int m_viewIndex; - - // persistent state is used as if they were internal variables, - // though they reside in a storage class - // this lasts for the entire lifetime of this object - AZStd::intrusive_ptr m_persistentState; - - public slots: - void OnDataDestroyed(); - void onTextChangeWindowFilter(const QString &); - void onTextChangeMessageFilter(const QString &); - - void UpdateSummary(); - - protected: - DrillerWindowLifepsanTelemetry m_lifespanTelemetry; - - Ui::TraceDrillerDialog* m_uiLoaded; - TraceFilterModel* m_ptrFilter; - TraceDrillerLogModel* m_ptrOriginalModel; - - public: - static void Reflect(AZ::ReflectContext* context); - }; - - class TraceDrillerLogTab : public AzToolsFramework::LogPanel::BaseLogView - { - Q_OBJECT; - public: - AZ_CLASS_ALLOCATOR(TraceDrillerLogTab, AZ::SystemAllocator, 0); - - TraceDrillerLogTab(QWidget *pParent = NULL); - virtual ~TraceDrillerLogTab(); - - // return -1 for any of these to indicate that your data has no such column. - // make sure your model has the same semantics! - virtual int GetIconColumn() { return 0; } - virtual int GetWindowColumn() { return 1; } - virtual int GetMessageColumn() { return 2; } // you may not return -1 for this one. - virtual int GetTimeColumn() { return -1; } - - using AzToolsFramework::LogPanel::BaseLogView::rowsInserted; - - public slots: - void rowsAboutToBeInserted(); - void rowsInserted (); - - protected: - - bool m_isScrollAfterInsert; - }; - - class TraceDrillerLogModel : public QAbstractTableModel - { - Q_OBJECT; - public: - AZ_CLASS_ALLOCATOR(TraceDrillerLogModel, AZ::SystemAllocator, 0); - - //////////////////////////////////////////////////////////////////////////////////////////////// - // QAbstractTableModel - virtual int rowCount(const QModelIndex& index = QModelIndex()) const; - virtual int columnCount(const QModelIndex& index = QModelIndex()) const; - virtual Qt::ItemFlags flags(const QModelIndex &index) const; - virtual QVariant data(const QModelIndex& index, int role) const; - //////////////////////////////////////////////////////////////////////////////////////////////// - - TraceDrillerLogModel(TraceMessageDataAggregator* data, QObject *pParent = NULL); - virtual ~TraceDrillerLogModel(); - - public slots: - void OnDataCurrentEventChanged(); - void OnDataAddEvent(); - - protected: - TraceMessageDataAggregator* m_data; - AZ::s64 m_lastShownEvent; - QIcon m_criticalIcon; - QIcon m_errorIcon; - QIcon m_warningIcon; - QIcon m_informationIcon; - - - }; - - -} - -#endif diff --git a/Code/Tools/Standalone/Source/Driller/Trace/TraceDrillerDialog.ui b/Code/Tools/Standalone/Source/Driller/Trace/TraceDrillerDialog.ui deleted file mode 100644 index 229539a92e..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Trace/TraceDrillerDialog.ui +++ /dev/null @@ -1,124 +0,0 @@ - - - TraceDrillerDialog - - - - 0 - 0 - 544 - 250 - - - - - 0 - 250 - - - - Trace Message Driller - - - true - - - - - - - - Window Filter - - - - - - - - 0 - 0 - - - - - 120 - 0 - - - - Window Name - - - - - - - Qt::Horizontal - - - QSizePolicy::MinimumExpanding - - - - 20 - 20 - - - - - - - - Message Filter - - - - - - - - 0 - 0 - - - - - 120 - 0 - - - - Message - - - - - - - - 0 - 0 - - - - - 95 - 0 - - - - - - - Qt::AlignCenter - - - - - - - - - - diff --git a/Code/Tools/Standalone/Source/Driller/Trace/TraceMessageDataAggregator.cpp b/Code/Tools/Standalone/Source/Driller/Trace/TraceMessageDataAggregator.cpp deleted file mode 100644 index 64c389daa1..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Trace/TraceMessageDataAggregator.cpp +++ /dev/null @@ -1,220 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "TraceMessageDataAggregator.hxx" -#include - -#include "TraceDrillerDialog.hxx" -#include "TraceMessageEvents.h" -#include -#include -#include -#include - -namespace Driller -{ - class TraceMessageDataAggregatorSavedState - : public AZ::UserSettings - { - public: - AZ_RTTI(TraceMessageDataAggregatorSavedState, "{48FADE93-10C0-48BE-96FA-44EFE49D8ED3}", AZ::UserSettings); - AZ_CLASS_ALLOCATOR(TraceMessageDataAggregatorSavedState, AZ::SystemAllocator, 0); - TraceMessageDataAggregatorSavedState() - : m_activeViewCount(0) - {} - - int m_activeViewCount; - - static void Reflect(AZ::ReflectContext* context) - { - AZ::SerializeContext* serialize = azrtti_cast(context); - if (serialize) - { - serialize->Class() - ->Field("m_activeViewCount", &TraceMessageDataAggregatorSavedState::m_activeViewCount) - ->Version(2); - } - } - }; - - - TraceMessageDataAggregator::TraceMessageDataAggregator(int identity) - : Aggregator(identity) - , m_dataView(nullptr) - { - m_parser.SetAggregator(this); - - m_persistentState = AZ::UserSettings::CreateFind(AZ_CRC("TRACE MESSAGE DATA AGGREGATOR SAVED STATE", 0xa4996e1f), AZ::UserSettings::CT_GLOBAL); - AZ_Assert(m_persistentState, "Persistent State is NULL?"); - } - - float TraceMessageDataAggregator::ValueAtFrame(FrameNumberType frame) - { - return NumOfEventsAtFrame(frame) > 0 ? 1.0f : -1.0f; - } - - QColor TraceMessageDataAggregator::GetColor() const - { - return QColor(0, 255, 0); - } - - QString TraceMessageDataAggregator::GetName() const - { - return "Trace messages"; - } - - QString TraceMessageDataAggregator::GetChannelName() const - { - return ChannelName(); - } - - QString TraceMessageDataAggregator::GetDescription() const - { - return "All trace messages"; - } - - QString TraceMessageDataAggregator::GetToolTip() const - { - return "Logged Messages from Application"; - } - - AZ::Uuid TraceMessageDataAggregator::GetID() const - { - return AZ::Uuid("{368D6FB2-9A92-4DFE-8DB4-4F106194BA6F}"); - } - - QWidget* TraceMessageDataAggregator::DrillDownRequest(FrameNumberType frame) - { - (void)frame; - - if (m_dataView) - { - m_dataView->deleteLater(); - OnDataViewDestroyed(m_dataView); - m_dataView = nullptr; - } - - TraceDrillerDialog* dv = aznew TraceDrillerDialog(this, (1024 * GetIdentity()) + 0); - dv->show(); - m_dataView = dv; - - connect(dv, SIGNAL(destroyed(QObject*)), this, SLOT(OnDataViewDestroyed(QObject*))); - ++m_persistentState->m_activeViewCount; - - return dv; - } - void TraceMessageDataAggregator::OptionsRequest() - { - } - void TraceMessageDataAggregator::OnDataViewDestroyed(QObject* dataView) - { - if (dataView == m_dataView) - { - m_dataView = nullptr; - --m_persistentState->m_activeViewCount; - } - } - - void TraceMessageDataAggregator::ApplySettingsFromWorkspace(WorkspaceSettingsProvider* provider) - { - TraceMessageDataAggregatorSavedState* workspace = provider->FindSetting(AZ_CRC("TRACE MESSAGE DATA AGGREGATOR WORKSPACE", 0xff055f40)); - if (workspace) - { - m_persistentState->m_activeViewCount = workspace->m_activeViewCount; - } - } - void TraceMessageDataAggregator::ActivateWorkspaceSettings(WorkspaceSettingsProvider* provider) - { - TraceMessageDataAggregatorSavedState* workspace = provider->FindSetting(AZ_CRC("TRACE MESSAGE DATA AGGREGATOR WORKSPACE", 0xff055f40)); - if (workspace) - { - // kill all existing data view windows in preparation of opening the workspace specified ones - delete m_dataView; - - // the internal count should be 0 from the above house cleaning - // and incremented back up from the workspace instantiations - m_persistentState->m_activeViewCount = 0; - for (int i = 0; i < workspace->m_activeViewCount; ++i) - { - // driller must be created at (frame > 0) for it to have a valid tree to display - TraceDrillerDialog* dataView = qobject_cast(DrillDownRequest(1)); - if (dataView) - { - // apply will overlay the workspace settings on top of the local user settings - dataView->ApplySettingsFromWorkspace(provider); - // activate will do the heavy lifting - dataView->ActivateWorkspaceSettings(provider); - } - } - } - } - - void TraceMessageDataAggregator::SaveSettingsToWorkspace(WorkspaceSettingsProvider* provider) - { - TraceMessageDataAggregatorSavedState* workspace = provider->CreateSetting(AZ_CRC("TRACE MESSAGE DATA AGGREGATOR WORKSPACE", 0xff055f40)); - if (workspace) - { - workspace->m_activeViewCount = m_persistentState->m_activeViewCount; - - if (m_dataView) - { - qobject_cast(m_dataView)->SaveSettingsToWorkspace(provider); - } - } - } - - - // emit all annotations that match the provider's filter, given the start and end frame: - void TraceMessageDataAggregator::EmitAllAnnotationsForFrameRange(int startFrameInclusive, int endFrameInclusive, AnnotationsProvider* ptrProvider) - { - for (; startFrameInclusive <= endFrameInclusive; ++startFrameInclusive) - { - AZ::s64 startEvent = m_frameToEventIndex[startFrameInclusive]; - AZ::s64 endEvent = startEvent + NumOfEventsAtFrame(startFrameInclusive); - - for (AZ::s64 i = startEvent; i < endEvent; ++i) - { - TraceMessageEvent* event = static_cast(m_events[i]); - if (ptrProvider->IsChannelEnabled(event->m_windowCRC)) - { - ptrProvider->AddAnnotation(Driller::Annotation(m_events[i]->GetGlobalEventId(), startFrameInclusive, event->m_message, event->m_window)); - } - } - } - } - - // emit all channels that you are aware of existing within that frame range (You may emit duplicate channels, they will be ignored) - void TraceMessageDataAggregator::EmitAnnotationChannelsForFrameRange(int startFrameInclusive, int endFrameInclusive, AnnotationsProvider* ptrProvider) - { - for (; startFrameInclusive <= endFrameInclusive; ++startFrameInclusive) - { - AZ::s64 startEvent = m_frameToEventIndex[startFrameInclusive]; - AZ::s64 endEvent = startEvent + NumOfEventsAtFrame(startFrameInclusive); - - for (AZ::s64 i = startEvent; i < endEvent; ++i) - { - TraceMessageEvent* event = static_cast(m_events[i]); - ptrProvider->NotifyOfChannelExistence(event->m_window); - } - } - } - - void TraceMessageDataAggregator::Reflect(AZ::ReflectContext* context) - { - AZ::SerializeContext* serialize = azrtti_cast(context); - if (serialize) - { - TraceMessageDataAggregatorSavedState::Reflect(context); - TraceDrillerDialog::Reflect(context); - - serialize->Class() - ->Version(1) - ->SerializeWithNoData(); - } - } -} // namespace Driller diff --git a/Code/Tools/Standalone/Source/Driller/Trace/TraceMessageDataAggregator.hxx b/Code/Tools/Standalone/Source/Driller/Trace/TraceMessageDataAggregator.hxx deleted file mode 100644 index 266432b904..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Trace/TraceMessageDataAggregator.hxx +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef DRILLER_TRACE_MESSAGE_DATAAGGREGATOR_H -#define DRILLER_TRACE_MESSAGE_DATAAGGREGATOR_H - -#if !defined(Q_MOC_RUN) -#include "Source/Driller/DrillerAggregator.hxx" -#include "Source/Driller/DrillerAggregatorOptions.hxx" - -#include "TraceMessageDataParser.h" - -#include -#endif - -namespace AZ { class ReflectContext; } - -namespace Driller -{ - class TraceMessageDataAggregatorSavedState; - - /** - * Trace message driller data aggregator. - */ - class TraceMessageDataAggregator : public Aggregator - { - Q_OBJECT; - TraceMessageDataAggregator(const TraceMessageDataAggregator&) = delete; - public: - AZ_RTTI(TraceMessageDataAggregator, "{CA33E0B0-6E16-4D8C-B3D0-C833AC8574C6}"); - AZ_CLASS_ALLOCATOR(TraceMessageDataAggregator,AZ::SystemAllocator,0); - - TraceMessageDataAggregator(int identity = 0); - - static AZ::u32 DrillerId() { return TraceMessageHandlerParser::GetDrillerId(); } - virtual AZ::u32 GetDrillerId() const { return DrillerId(); } - - static const char* ChannelName() { return "Logging"; } - AZ::Crc32 GetChannelId() const override { return AZ::Crc32(ChannelName()); } - - virtual AZ::Debug::DrillerHandlerParser* GetDrillerDataParser() { return &m_parser; } - - virtual void ApplySettingsFromWorkspace(WorkspaceSettingsProvider*); - virtual void ActivateWorkspaceSettings(WorkspaceSettingsProvider*); - virtual void SaveSettingsToWorkspace(WorkspaceSettingsProvider*); - - ////////////////////////////////////////////////////////////////////////// - // Aggregator - - // emit all annotations that match the provider's filter, given the start and end frame: - virtual void EmitAllAnnotationsForFrameRange( int startFrameInclusive, int endFrameInclusive , AnnotationsProvider* ptrProvider); - - // emit all channels that you are aware of existing within that frame range (You may emit duplicate channels, they will be ignored) - virtual void EmitAnnotationChannelsForFrameRange( int startFrameInclusive, int endFrameInclusive , AnnotationsProvider* ptrProvider); - - public slots: - float ValueAtFrame( FrameNumberType frame ) override; - QColor GetColor() const override; - QString GetName() const override; - QString GetChannelName() const override; - QString GetDescription() const override; - QString GetToolTip() const override; - AZ::Uuid GetID() const override; - QWidget* DrillDownRequest(FrameNumberType frame) override; - void OptionsRequest() override; - virtual void OnDataViewDestroyed(QObject*); - - public: - TraceMessageHandlerParser m_parser; ///< Parser for this aggregator - - QObject* m_dataView; - AZStd::intrusive_ptr m_persistentState; - - public: - static void Reflect(AZ::ReflectContext* context); - }; - -} - -#endif diff --git a/Code/Tools/Standalone/Source/Driller/Trace/TraceMessageDataParser.cpp b/Code/Tools/Standalone/Source/Driller/Trace/TraceMessageDataParser.cpp deleted file mode 100644 index 9d2981cafc..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Trace/TraceMessageDataParser.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "TraceMessageDataParser.h" -#include "TraceMessageDataAggregator.hxx" -#include "TraceMessageEvents.h" - -namespace Driller -{ - AZ::Debug::DrillerHandlerParser* TraceMessageHandlerParser::OnEnterTag(AZ::u32 tagName) - { - AZ_Assert(m_data, "You must set a valid aggregator before we can process the data!"); - if (tagName == AZ_CRC("OnPrintf", 0xd4b5c294)) - { - m_data->AddEvent(aznew TraceMessageEvent(TraceMessageEvent::ET_PRINTF)); - return this; - } - else if (tagName == AZ_CRC("OnWarning", 0x7d90abea)) - { - m_data->AddEvent(aznew TraceMessageEvent(TraceMessageEvent::ET_WARNING)); - return this; - } - else if (tagName == AZ_CRC("OnError", 0x4993c634)) - { - m_data->AddEvent(aznew TraceMessageEvent(TraceMessageEvent::ET_ERROR)); - return this; - } - return nullptr; - } - - void TraceMessageHandlerParser::OnData(const AZ::Debug::DrillerSAXParser::Data& dataNode) - { - AZ_Assert(m_data, "You must set a valid aggregator before we can process the data!"); - if (dataNode.m_name == AZ_CRC("Window", 0x8be4f9dd)) - { - TraceMessageEvent* event = static_cast(m_data->GetEvents().back()); - event->m_window = dataNode.ReadPooledString(); - event->ComputeCRC(); - } - if (dataNode.m_name == AZ_CRC("Message", 0xb6bd307f)) - { - TraceMessageEvent* event = static_cast(m_data->GetEvents().back()); - event->m_message = dataNode.ReadPooledString(); - } - else if (dataNode.m_name == AZ_CRC("OnAssert", 0xb74db4ce)) - { - TraceMessageEvent* event = aznew TraceMessageEvent(TraceMessageEvent::ET_ASSERT); - event->m_window = "System"; - event->m_message = dataNode.ReadPooledString(); - event->m_windowCRC = AZ_CRC("System", 0xc94d118b); - m_data->AddEvent(event); - } - else if (dataNode.m_name == AZ_CRC("OnException", 0xfe457d12)) - { - TraceMessageEvent* event = aznew TraceMessageEvent(TraceMessageEvent::ET_EXCEPTION); - event->m_window = "System"; - event->m_message = dataNode.ReadPooledString(); - event->m_windowCRC = AZ_CRC("System", 0xc94d118b); - m_data->AddEvent(event); - } - } -} // namespace Driller diff --git a/Code/Tools/Standalone/Source/Driller/Trace/TraceMessageDataParser.h b/Code/Tools/Standalone/Source/Driller/Trace/TraceMessageDataParser.h deleted file mode 100644 index f2ef934288..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Trace/TraceMessageDataParser.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef DRILLER_TRACE_MESSAGE_PARSER_H -#define DRILLER_TRACE_MESSAGE_PARSER_H - -#include - -namespace Driller -{ - class TraceMessageDataAggregator; - - class TraceMessageHandlerParser - : public AZ::Debug::DrillerHandlerParser - { - public: - TraceMessageHandlerParser() - : m_data(nullptr) - { - } - - static AZ::u32 GetDrillerId() { return AZ_CRC("TraceMessagesDriller", 0xa61d1b00); } - void SetAggregator(TraceMessageDataAggregator* data) { m_data = data; } - - // AZ::Debug::DrillerHandlerParser - virtual AZ::Debug::DrillerHandlerParser* OnEnterTag(AZ::u32 tagName); - virtual void OnData(const AZ::Debug::DrillerSAXParser::Data& dataNode); - - protected: - TraceMessageDataAggregator* m_data; - }; -} - -#endif diff --git a/Code/Tools/Standalone/Source/Driller/Trace/TraceMessageEvents.h b/Code/Tools/Standalone/Source/Driller/Trace/TraceMessageEvents.h deleted file mode 100644 index 7188c59f2d..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Trace/TraceMessageEvents.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#pragma once - -#include "Source/Driller/DrillerEvent.h" - -#include - -namespace Driller -{ - class TraceMessageEvent - : public DrillerEvent - { - public: - enum EventType - { - ET_ASSERT, - ET_EXCEPTION, - ET_ERROR, - ET_WARNING, - ET_PRINTF, - }; - - AZ_CLASS_ALLOCATOR(TraceMessageEvent, AZ::SystemAllocator, 0) - - TraceMessageEvent(EventType eventType) - : DrillerEvent(eventType) - , m_window(nullptr) - , m_message(nullptr) - , m_windowCRC(0) - {} - - void ComputeCRC() - { - if (m_window) - { - m_windowCRC = AZ::Crc32(m_window); - } - else - { - m_windowCRC = 0; - } - } - - // no stepping as we can just traverse the list of events - virtual void StepForward(Aggregator* data) { (void)data; } - virtual void StepBackward(Aggregator* data) { (void)data; } - - const char* m_window; ///< Name of the message window - const char* m_message; - AZ::u32 m_windowCRC; // so that we dont constantly take a penalty of CRCing for every event when we do the annotations - }; -} diff --git a/Code/Tools/Standalone/Source/Driller/Trace/TraceOperationTelemetryEvent.h b/Code/Tools/Standalone/Source/Driller/Trace/TraceOperationTelemetryEvent.h deleted file mode 100644 index 10ad51e76b..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Trace/TraceOperationTelemetryEvent.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ -#ifndef DRILLER_TRACE_TRACEOPERATIONTELEMETRYEVENT_H -#define DRILLER_TRACE_TRACEOPERATIONTELEMETRYEVENT_H - -#include "Telemetry/TelemetryEvent.h" - -namespace Driller -{ - class TraceOperationTelemetryEvent - : public Telemetry::TelemetryEvent - { - public: - TraceOperationTelemetryEvent() - : Telemetry::TelemetryEvent("TraceDataViewOperation") - { - } - }; -} - -#endif diff --git a/Code/Tools/Standalone/Source/Driller/Unsupported/UnsupportedDataAggregator.cpp b/Code/Tools/Standalone/Source/Driller/Unsupported/UnsupportedDataAggregator.cpp deleted file mode 100644 index 53bdc4fcd1..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Unsupported/UnsupportedDataAggregator.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "UnsupportedDataAggregator.hxx" -#include - -#include "UnsupportedEvents.h" - -#include - -namespace Driller -{ - UnsupportedDataAggregator::UnsupportedDataAggregator(AZ::u32 drillerId) - : m_parser(drillerId) - , Aggregator(0) - { - m_parser.SetAggregator(this); - } - - float UnsupportedDataAggregator::ValueAtFrame(FrameNumberType frame) - { - const float maxEventsPerFrame = 500.0f; - float numEventsPerFrame = static_cast(NumOfEventsAtFrame(frame)); - return AZStd::GetMin(numEventsPerFrame / maxEventsPerFrame, 1.0f) * 2.0f - 1.0f; - } - - QColor UnsupportedDataAggregator::GetColor() const - { - return QColor(40, 40, 40); - } - - QString UnsupportedDataAggregator::GetName() const - { - char buf[64]; - azsnprintf(buf, AZ_ARRAY_SIZE(buf), "Id: 0x%08x", m_parser.GetDrillerId()); - return buf; - } - - QString UnsupportedDataAggregator::GetChannelName() const - { - return ChannelName(); - } - - QString UnsupportedDataAggregator::GetDescription() const - { - return QString("Unsupported driller"); - } - - QString UnsupportedDataAggregator::GetToolTip() const - { - return QString("Unknown Driller"); - } - - AZ::Uuid UnsupportedDataAggregator::GetID() const - { - return AZ::Uuid("{368D6FB2-9A92-4DFE-8DB4-4F106194BA6F}"); - } - - QWidget* UnsupportedDataAggregator::DrillDownRequest(FrameNumberType frame) - { - (void)frame; - return NULL; - } - void UnsupportedDataAggregator::OptionsRequest() - { - } -} // namespace Driller diff --git a/Code/Tools/Standalone/Source/Driller/Unsupported/UnsupportedDataAggregator.hxx b/Code/Tools/Standalone/Source/Driller/Unsupported/UnsupportedDataAggregator.hxx deleted file mode 100644 index ec3ea9dbab..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Unsupported/UnsupportedDataAggregator.hxx +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef DRILLER_UNSUPPORTED_DATAAGGREGATOR_H -#define DRILLER_UNSUPPORTED_DATAAGGREGATOR_H - -#if !defined(Q_MOC_RUN) -#include "Source/Driller/DrillerAggregator.hxx" -#include "Source/Driller/DrillerAggregatorOptions.hxx" - -#include "UnsupportedDataParser.h" - -#include -#endif - -namespace Driller -{ - /** - * Unsupported driller data drilling aggregator. - */ - class UnsupportedDataAggregator : public Aggregator - { - Q_OBJECT; - public: - AZ_CLASS_ALLOCATOR(UnsupportedDataAggregator,AZ::SystemAllocator,0); - - UnsupportedDataAggregator(AZ::u32 drillerId); - - virtual AZ::u32 GetDrillerId() const { return m_parser.GetDrillerId(); } - virtual AZ::Debug::DrillerHandlerParser* GetDrillerDataParser() { return &m_parser; } - - static const char* ChannelName() { return "Unsupported"; } - AZ::Crc32 GetChannelId() const override { return AZ::Crc32(ChannelName()); } - - virtual void ApplySettingsFromWorkspace(WorkspaceSettingsProvider*){} - virtual void ActivateWorkspaceSettings(WorkspaceSettingsProvider*){} - virtual void SaveSettingsToWorkspace(WorkspaceSettingsProvider*){} - - ////////////////////////////////////////////////////////////////////////// - // Aggregator - public slots: - float ValueAtFrame( FrameNumberType frame ) override; - QColor GetColor() const override; - QString GetName() const override; - QString GetChannelName() const override; - QString GetDescription() const override; - QString GetToolTip() const override; - AZ::Uuid GetID() const override; - QWidget* DrillDownRequest(FrameNumberType frame) override; - void OptionsRequest() override; - - public: - UnsupportedHandlerParser m_parser; ///< Parser for this aggregator - }; - -} - -#endif diff --git a/Code/Tools/Standalone/Source/Driller/Unsupported/UnsupportedDataParser.cpp b/Code/Tools/Standalone/Source/Driller/Unsupported/UnsupportedDataParser.cpp deleted file mode 100644 index 110b274d6c..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Unsupported/UnsupportedDataParser.cpp +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "UnsupportedDataParser.h" -#include "UnsupportedDataAggregator.hxx" -#include "UnsupportedEvents.h" - -namespace Driller -{ - AZ::Debug::DrillerHandlerParser* UnsupportedHandlerParser::OnEnterTag(AZ::u32 tagName) - { - AZ_Assert(m_data, "You must set a valid aggregator before we can process the data!"); - m_data->AddEvent(aznew UnsupportedEvent(tagName)); - return nullptr; - } -} // namespace Driller diff --git a/Code/Tools/Standalone/Source/Driller/Unsupported/UnsupportedDataParser.h b/Code/Tools/Standalone/Source/Driller/Unsupported/UnsupportedDataParser.h deleted file mode 100644 index 6e02dfecb4..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Unsupported/UnsupportedDataParser.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef DRILLER_UNSUPPORTED_PARSER_H -#define DRILLER_UNSUPPORTED_PARSER_H - -#include - -namespace Driller -{ - class UnsupportedDataAggregator; - - class UnsupportedHandlerParser - : public AZ::Debug::DrillerHandlerParser - { - public: - UnsupportedHandlerParser(AZ::u32 drillerId) - : DrillerHandlerParser(false) - , m_drillerId(drillerId) - , m_data(nullptr) - { - } - - AZ::u32 GetDrillerId() const { return m_drillerId; } - void SetAggregator(UnsupportedDataAggregator* data) { m_data = data; } - - // AZ::Debug::DrillerHandlerParser - virtual AZ::Debug::DrillerHandlerParser* OnEnterTag(AZ::u32 tagName); - - protected: - AZ::u32 m_drillerId; - UnsupportedDataAggregator* m_data; - }; -} - -#endif diff --git a/Code/Tools/Standalone/Source/Driller/Unsupported/UnsupportedEvents.h b/Code/Tools/Standalone/Source/Driller/Unsupported/UnsupportedEvents.h deleted file mode 100644 index c4338e927c..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Unsupported/UnsupportedEvents.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef DRILLER_UNSUPPORTED_EVENTS_H -#define DRILLER_UNSUPPORTED_EVENTS_H - -#include "Source/Driller/DrillerEvent.h" - -namespace Driller -{ - class UnsupportedEvent - : public DrillerEvent - { - public: - AZ_CLASS_ALLOCATOR(UnsupportedEvent, AZ::SystemAllocator, 0) - - UnsupportedEvent(unsigned int eventId) - : DrillerEvent(eventId) {} - - // no stepping - virtual void StepForward(Aggregator* data) { (void)data; } - virtual void StepBackward(Aggregator* data) { (void)data; } - }; -} - -#endif diff --git a/Code/Tools/Standalone/Source/Driller/Workspaces/Workspace.cpp b/Code/Tools/Standalone/Source/Driller/Workspaces/Workspace.cpp deleted file mode 100644 index 591fdd3922..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Workspaces/Workspace.cpp +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include "Workspace.h" - -namespace Driller -{ - // this is called when the settings are loaded from file. Since the root element is just a workspace settings provider object, - // we verify the cast and return it: - static void OnObjectLoaded(void* classPtr, const AZ::Uuid& classId, const AZ::SerializeContext* sc, WorkspaceSettingsProvider** target) - { - AZ_Assert(classPtr, "classPtr is NULL!"); - AZ_Assert(target, "You must pass the target to OnObjectLoaded"); - WorkspaceSettingsProvider* container = sc->Cast(classPtr, classId); - AZ_Assert(container, "Failed to cast classPtr to WorkspaceSettingsProvider!"); - - *target = container; - } - - // remember to delete your setting objects on shutdown, since you own them! - WorkspaceSettingsProvider::~WorkspaceSettingsProvider() - { - for (auto it = m_WorkspaceSaveData.begin(); it != m_WorkspaceSaveData.end(); ++it) - { - delete it->second; - } - } - - /// Given a filename, attempt to deserialize a WorkspaceSettingsProvider object from it, using the DH objectstream: - WorkspaceSettingsProvider* WorkspaceSettingsProvider::CreateFromFile(const AZStd::string& filename) - { - using namespace AZ; - - SerializeContext* sc = NULL; - EBUS_EVENT_RESULT(sc, ComponentApplicationBus, GetSerializeContext); - AZ_Assert(sc, "Can't retrieve application's serialization context!"); - - WorkspaceSettingsProvider* resultItem = NULL; - IO::FileIOStream readStream(filename.c_str(), AZ::IO::OpenMode::ModeRead); - if (readStream.IsOpen()) - { - ObjectStream::ClassReadyCB readyCB(AZStd::bind(&OnObjectLoaded, AZStd::placeholders::_1, AZStd::placeholders::_2, AZStd::placeholders::_3, &resultItem)); - if (!ObjectStream::LoadBlocking(&readStream, *sc, readyCB)) - { - AZ_TracePrintf("Driller", "
Failed to deserialize the workspace file: '%s'
", filename.c_str()); - } - } - else - { - AZ_TracePrintf("Driller", "
Failed to open the given filename in order to read it in as a workspace: '%s'
", filename.c_str()); - } - - // use the serializer to consume filename. - return resultItem; - } - - /// serializes this object into the given filename for later retrieval. - bool WorkspaceSettingsProvider::WriteToFile(const AZStd::string& filename) - { - using namespace AZ; - - SerializeContext* sc = NULL; - EBUS_EVENT_RESULT(sc, ComponentApplicationBus, GetSerializeContext); - AZ_Assert(sc, "Can't retrieve application's serialization context!"); - - /// note: Will probably throw an error if it fails. Should check all these things before we call in here. - IO::FileIOStream writeStream(filename.c_str(), AZ::IO::OpenMode::ModeWrite); - - if (!writeStream.IsOpen()) - { - // (will have already called AZ_Error) - return false; - } - - ObjectStream* objStream = ObjectStream::Create(&writeStream, *sc, ObjectStream::ST_XML); - bool writtenOk = objStream->WriteClass(this); - if (!writtenOk) - { - AZ_TracePrintf("Driller", "
Failed to write the workspace object to the workspace file: '%s'
", filename.c_str()); - return false; - } - bool streamOk = objStream->Finalize(); - if (!streamOk) - { - AZ_TracePrintf("Driller", "
Failed to finalize the workspace file: '%s'
", filename.c_str()); - return false; - } - - return true; - } - - void WorkspaceSettingsProvider::Reflect(AZ::ReflectContext* context) - { - AZ::SerializeContext* serialize = azrtti_cast(context); - if (serialize) - { - serialize->Class() - ->Version(2) - ->Field("m_WorkspaceSaveData", &WorkspaceSettingsProvider::m_WorkspaceSaveData); - } - } -} diff --git a/Code/Tools/Standalone/Source/Driller/Workspaces/Workspace.h b/Code/Tools/Standalone/Source/Driller/Workspaces/Workspace.h deleted file mode 100644 index c4fe606490..0000000000 --- a/Code/Tools/Standalone/Source/Driller/Workspaces/Workspace.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#pragma once - -#include -#include -#include - -namespace Driller -{ - /** - * The purpose of the WorkspaceSettingsProvider is to save and restore a workspace. - * the workspace can then be used to restore a view of data at a later time, given a file containing that workspace data. - * It is generally overlayed on top of the data it is replacing. - */ - class WorkspaceSettingsProvider - { - public: - AZ_RTTI(WorkspaceSettingsProvider, "{E0BFC3FF-B040-49C3-B618-F2C1B7D45230}"); - AZ_CLASS_ALLOCATOR(WorkspaceSettingsProvider, AZ::SystemAllocator, 0); - - /// The main means of interaction: Creating from a given file name (full path) and reading it back from it. - /// Could return NULL if it fails - static WorkspaceSettingsProvider* CreateFromFile(const AZStd::string& filename); - - /// Will return false if it fails. - bool WriteToFile(const AZStd::string& filename); - - /// Convenience function - casts what it finds to T. returns null if it cannot find that setting. - template - T* FindSetting(AZ::u32 key) - { - auto it = m_WorkspaceSaveData.find(key); - if (it == m_WorkspaceSaveData.end()) - { - return NULL; - } - - return AZ::RttiCast(it->second); - } - - /// Convenience function - creates a new T, will always succeed unless critical out of memory error or exception. - template - T* CreateSetting(AZ::u32 key) - { - AZ::UserSettings* oldSetting = FindSetting(key); - if (oldSetting != NULL) - { - AZ_WarningOnce("Driller", false, "A workspace save data is being written to a save file even though that CRC key already exists: 0x%08x - should not occur\n", key); - m_WorkspaceSaveData.erase(key); - delete oldSetting; - } - - T* newSetting = aznew T(); - m_WorkspaceSaveData[key] = newSetting; - return newSetting; - } - - static void Reflect(AZ::ReflectContext* context); - virtual ~WorkspaceSettingsProvider(); - - protected: - - // we internally store our data in a map of CRC name to pointer. - typedef AZStd::unordered_map SavedWorkspaceMap; - SavedWorkspaceMap m_WorkspaceSaveData; - }; -} diff --git a/Code/Tools/Standalone/Source/ProfilerApplication.cpp b/Code/Tools/Standalone/Source/ProfilerApplication.cpp deleted file mode 100644 index b42c5a21a1..0000000000 --- a/Code/Tools/Standalone/Source/ProfilerApplication.cpp +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "ProfilerApplication.h" - -#include -#include - -namespace Driller -{ - void Application::RegisterCoreComponents() - { - StandaloneTools::BaseApplication::RegisterCoreComponents(); - - Driller::Context::CreateDescriptor(); - RegisterComponentDescriptor(AzFramework::TargetManagementComponent::CreateDescriptor()); - } - - void Application::CreateApplicationComponents() - { - StandaloneTools::BaseApplication::CreateApplicationComponents(); - EnsureComponentCreated(Driller::Context::RTTI_Type()); - EnsureComponentCreated(AzFramework::TargetManagementComponent::RTTI_Type()); - } - - void Application::SetSettingsRegistrySpecializations(AZ::SettingsRegistryInterface::Specializations& specializations) - { - StandaloneTools::BaseApplication::SetSettingsRegistrySpecializations(specializations); - specializations.Append("driller"); - } -} diff --git a/Code/Tools/Standalone/Source/ProfilerApplication.h b/Code/Tools/Standalone/Source/ProfilerApplication.h deleted file mode 100644 index b55f426da9..0000000000 --- a/Code/Tools/Standalone/Source/ProfilerApplication.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#pragma once - -#include - -namespace Driller -{ - class Application - : public StandaloneTools::BaseApplication - { - public: - Application(int &argc, char **argv) : BaseApplication(argc, argv) {} - - protected: - void RegisterCoreComponents() override; - void CreateApplicationComponents() override; - void SetSettingsRegistrySpecializations(AZ::SettingsRegistryInterface::Specializations& specializations) override; - }; -} diff --git a/Code/Tools/Standalone/profiler_files.cmake b/Code/Tools/Standalone/profiler_files.cmake deleted file mode 100644 index 7106c1b646..0000000000 --- a/Code/Tools/Standalone/profiler_files.cmake +++ /dev/null @@ -1,190 +0,0 @@ -# -# Copyright (c) Contributors to the Open 3D Engine Project. -# For complete copyright and license terms please see the LICENSE at the root of this distribution. -# -# SPDX-License-Identifier: Apache-2.0 OR MIT -# -# - -set(FILES - Source/ProfilerApplication.h - Source/ProfilerApplication.cpp - Source/Editor/ProfilerEditor.h - Source/Editor/ProfilerEditor.cpp - Source/Driller/Axis.cpp - Source/Driller/Axis.hxx - Source/Driller/AreaChart.cpp - Source/Driller/AreaChart.hxx - Source/Driller/ChannelConfigurationDialog.cpp - Source/Driller/ChannelConfigurationDialog.hxx - Source/Driller/ChannelConfigurationWidget.cpp - Source/Driller/ChannelConfigurationWidget.hxx - Source/Driller/ChannelControl.cpp - Source/Driller/ChannelControl.hxx - Source/Driller/ChannelControl.ui - Source/Driller/ChannelProfilerWidget.cpp - Source/Driller/ChannelProfilerWidget.hxx - Source/Driller/ChannelProfilerWidget.ui - Source/Driller/ChannelDataView.cpp - Source/Driller/ChannelDataView.hxx - Source/Driller/ChartNumberFormats.cpp - Source/Driller/ChartNumberFormats.h - Source/Driller/ChartTypes.cpp - Source/Driller/ChartTypes.hxx - Source/Driller/CollapsiblePanel.cpp - Source/Driller/CollapsiblePanel.hxx - Source/Driller/CollapsiblePanel.ui - Source/Driller/CombinedEventsControl.cpp - Source/Driller/CombinedEventsControl.hxx - Source/Driller/CustomizeCSVExportWidget.cpp - Source/Driller/CustomizeCSVExportWidget.hxx - Source/Driller/CSVExportSettings.h - Source/Driller/DoubleListSelector.cpp - Source/Driller/DoubleListSelector.hxx - Source/Driller/DoubleListSelector.ui - Source/Driller/DrillerAggregator.cpp - Source/Driller/DrillerAggregator.hxx - Source/Driller/DrillerAggregatorOptions.hxx - Source/Driller/DrillerCaptureWindow.cpp - Source/Driller/DrillerCaptureWindow.hxx - Source/Driller/DrillerCaptureWindow.ui - Source/Driller/DrillerContext.cpp - Source/Driller/DrillerContext.h - Source/Driller/DrillerContextInterface.h - Source/Driller/DrillerDataContainer.cpp - Source/Driller/DrillerDataContainer.h - Source/Driller/DrillerDataTypes.h - Source/Driller/DrillerEvent.cpp - Source/Driller/DrillerEvent.h - Source/Driller/DrillerMainChannelsView.ui - Source/Driller/DrillerMainWindow.cpp - Source/Driller/DrillerMainWindow.hxx - Source/Driller/DrillerMainWindow.ui - Source/Driller/DrillerMainWindowMessages.cpp - Source/Driller/DrillerMainWindowMessages.h - Source/Driller/DrillerNetworkMessages.h - Source/Driller/DrillerOperationTelemetryEvent.cpp - Source/Driller/DrillerOperationTelemetryEvent.h - Source/Driller/FilteredListView.cpp - Source/Driller/FilteredListView.hxx - Source/Driller/FilteredListView.ui - Source/Driller/GenericCustomizeCSVExportWidget.cpp - Source/Driller/GenericCustomizeCSVExportWidget.hxx - Source/Driller/GenericCustomizeCSVExportWidget.ui - Source/Driller/RacetrackChart.cpp - Source/Driller/RacetrackChart.hxx - Source/Driller/StripChart.cpp - Source/Driller/StripChart.hxx - Source/Driller/Annotations/AnnotationHeaderView.cpp - Source/Driller/Annotations/AnnotationHeaderView.hxx - Source/Driller/Annotations/AnnotationHeaderView.ui - Source/Driller/Annotations/Annotations.cpp - Source/Driller/Annotations/Annotations.hxx - Source/Driller/Annotations/AnnotationsDataView.cpp - Source/Driller/Annotations/AnnotationsDataView.hxx - Source/Driller/Annotations/AnnotationsDataView_Events.cpp - Source/Driller/Annotations/AnnotationsDataView_Events.hxx - Source/Driller/Annotations/AnnotationsHeaderView_Events.cpp - Source/Driller/Annotations/AnnotationsHeaderView_Events.hxx - Source/Driller/Annotations/ConfigureAnnotationsDialog.ui - Source/Driller/Annotations/ConfigureAnnotationsWindow.cpp - Source/Driller/Annotations/ConfigureAnnotationsWindow.hxx - Source/Driller/Carrier/CarrierDataAggregator.cpp - Source/Driller/Carrier/CarrierDataAggregator.hxx - Source/Driller/Carrier/CarrierDataEvents.h - Source/Driller/Carrier/CarrierDataParser.cpp - Source/Driller/Carrier/CarrierDataParser.h - Source/Driller/Carrier/CarrierDataView.cpp - Source/Driller/Carrier/CarrierDataView.hxx - Source/Driller/Carrier/CarrierDataView.ui - Source/Driller/Carrier/CarrierOperationTelemetryEvent.h - Source/Driller/EventTrace/EventTraceDataAggregator.cpp - Source/Driller/EventTrace/EventTraceDataAggregator.h - Source/Driller/EventTrace/EventTraceDataParser.cpp - Source/Driller/EventTrace/EventTraceDataParser.h - Source/Driller/EventTrace/EventTraceEvents.h - Source/Driller/Memory/MemoryDataAggregator.cpp - Source/Driller/Memory/MemoryDataAggregator.hxx - Source/Driller/Memory/MemoryDataParser.cpp - Source/Driller/Memory/MemoryDataParser.h - Source/Driller/Memory/MemoryDataView.cpp - Source/Driller/Memory/MemoryDataView.hxx - Source/Driller/Memory/MemoryDataView.ui - Source/Driller/Memory/MemoryEvents.cpp - Source/Driller/Memory/MemoryEvents.h - Source/Driller/Profiler/ProfilerDataAggregator.cpp - Source/Driller/Profiler/ProfilerDataAggregator.hxx - Source/Driller/Profiler/ProfilerDataPanel.cpp - Source/Driller/Profiler/ProfilerDataPanel.hxx - Source/Driller/Profiler/ProfilerDataParser.cpp - Source/Driller/Profiler/ProfilerDataParser.h - Source/Driller/Profiler/ProfilerDataView.cpp - Source/Driller/Profiler/ProfilerDataView.hxx - Source/Driller/Profiler/ProfilerDataView.ui - Source/Driller/Profiler/ProfilerEvents.cpp - Source/Driller/Profiler/ProfilerEvents.h - Source/Driller/Profiler/ProfilerOperationTelemetryEvent.h - Source/Driller/Rendering/VRAM/VRAMDataAggregator.cpp - Source/Driller/Rendering/VRAM/VRAMDataAggregator.hxx - Source/Driller/Rendering/VRAM/VRAMDataParser.cpp - Source/Driller/Rendering/VRAM/VRAMDataParser.h - Source/Driller/Rendering/VRAM/VRAMEvents.cpp - Source/Driller/Rendering/VRAM/VRAMEvents.h - Source/Driller/Replica/BaseDetailViewSavedState.h - Source/Driller/Replica/BaseDetailViewQObject.cpp - Source/Driller/Replica/BaseDetailViewQObject.hxx - Source/Driller/Replica/BaseDetailView.inl - Source/Driller/Replica/BaseDetailView.h - Source/Driller/Replica/basedetailview.ui - Source/Driller/Replica/OverallReplicaDetailView.cpp - Source/Driller/Replica/OverallReplicaDetailView.hxx - Source/Driller/Replica/overallreplicadetailview.ui - Source/Driller/Replica/ReplicaBandwidthChartData.cpp - Source/Driller/Replica/ReplicaBandwidthChartData.h - Source/Driller/Replica/ReplicaChunkTypeDetailView.cpp - Source/Driller/Replica/ReplicaChunkTypeDetailView.h - Source/Driller/Replica/ReplicaChunkUsageDataContainers.cpp - Source/Driller/Replica/ReplicaChunkUsageDataContainers.h - Source/Driller/Replica/ReplicaDataAggregator.cpp - Source/Driller/Replica/ReplicaDataAggregator.hxx - Source/Driller/Replica/ReplicaDataAggregatorConfigurationPanel.cpp - Source/Driller/Replica/ReplicaDataAggregatorConfigurationPanel.hxx - Source/Driller/Replica/ReplicaDataAggregatorConfigurationPanel.ui - Source/Driller/Replica/ReplicaDataEvents.h - Source/Driller/Replica/ReplicaDataParser.cpp - Source/Driller/Replica/ReplicaDataParser.h - Source/Driller/Replica/ReplicaDataView.cpp - Source/Driller/Replica/ReplicaDataView.hxx - Source/Driller/Replica/replicadataview.ui - Source/Driller/Replica/ReplicaDataViewConfigDialog.ui - Source/Driller/Replica/ReplicaDetailView.cpp - Source/Driller/Replica/ReplicaDetailView.h - Source/Driller/Replica/ReplicaDisplayHelpers.cpp - Source/Driller/Replica/ReplicaDisplayHelpers.h - Source/Driller/Replica/ReplicaDisplayTypes.cpp - Source/Driller/Replica/ReplicaDisplayTypes.h - Source/Driller/Replica/ReplicaDrillerConfigToolbar.cpp - Source/Driller/Replica/ReplicaDrillerConfigToolbar.hxx - Source/Driller/Replica/ReplicaDrillerConfigToolbar.ui - Source/Driller/Replica/ReplicaOperationTelemetryEvent.h - Source/Driller/Replica/ReplicaTreeViewModel.cpp - Source/Driller/Replica/ReplicaTreeViewModel.hxx - Source/Driller/Replica/ReplicaUsageDataContainers.cpp - Source/Driller/Replica/ReplicaUsageDataContainers.h - Source/Driller/Trace/TraceDrillerDialog.cpp - Source/Driller/Trace/TraceDrillerDialog.hxx - Source/Driller/Trace/TraceDrillerDialog.ui - Source/Driller/Trace/TraceMessageDataAggregator.cpp - Source/Driller/Trace/TraceMessageDataAggregator.hxx - Source/Driller/Trace/TraceMessageDataParser.cpp - Source/Driller/Trace/TraceMessageDataParser.h - Source/Driller/Trace/TraceMessageEvents.h - Source/Driller/Trace/TraceOperationTelemetryEvent.h - Source/Driller/Unsupported/UnsupportedDataAggregator.cpp - Source/Driller/Unsupported/UnsupportedDataAggregator.hxx - Source/Driller/Unsupported/UnsupportedDataParser.cpp - Source/Driller/Unsupported/UnsupportedDataParser.h - Source/Driller/Unsupported/UnsupportedEvents.h - Source/Driller/Workspaces/Workspace.cpp - Source/Driller/Workspaces/Workspace.h -) diff --git a/Gems/Atom/Feature/Common/Code/Source/SkinnedMesh/SkinnedMeshInputBuffers.cpp b/Gems/Atom/Feature/Common/Code/Source/SkinnedMesh/SkinnedMeshInputBuffers.cpp index 4229416066..b84d4347a7 100644 --- a/Gems/Atom/Feature/Common/Code/Source/SkinnedMesh/SkinnedMeshInputBuffers.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/SkinnedMesh/SkinnedMeshInputBuffers.cpp @@ -23,6 +23,8 @@ #include #include +AZ_DECLARE_BUDGET(AzRender); + namespace AZ { namespace Render diff --git a/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/Base.h b/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/Base.h index 71b1326fd0..9e1ec4585e 100644 --- a/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/Base.h +++ b/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/Base.h @@ -8,12 +8,14 @@ #pragma once #include +#include #include #include #include #include #include +AZ_DECLARE_BUDGET(RHI); namespace UnitTest { diff --git a/Gems/Atom/RHI/Code/Include/Atom/RHI/Factory.h b/Gems/Atom/RHI/Code/Include/Atom/RHI/Factory.h index 11f28e7a94..e0f03df9d7 100644 --- a/Gems/Atom/RHI/Code/Include/Atom/RHI/Factory.h +++ b/Gems/Atom/RHI/Code/Include/Atom/RHI/Factory.h @@ -9,12 +9,15 @@ #include #include +#include #include #if defined(USE_RENDERDOC) #include #endif +AZ_DECLARE_BUDGET(RHI); + namespace AZ { namespace RHI diff --git a/Gems/Atom/RHI/Code/Include/Atom/RHI/RHISystemInterface.h b/Gems/Atom/RHI/Code/Include/Atom/RHI/RHISystemInterface.h index 277b974641..6a9650e0a1 100644 --- a/Gems/Atom/RHI/Code/Include/Atom/RHI/RHISystemInterface.h +++ b/Gems/Atom/RHI/Code/Include/Atom/RHI/RHISystemInterface.h @@ -8,12 +8,15 @@ #pragma once +#include #include #include #include #include #include +AZ_DECLARE_BUDGET(RHI); + namespace AZ { namespace RHI diff --git a/Gems/Atom/RHI/Code/Source/RHI/AsyncWorkQueue.cpp b/Gems/Atom/RHI/Code/Source/RHI/AsyncWorkQueue.cpp index a32301276e..52021fa736 100644 --- a/Gems/Atom/RHI/Code/Source/RHI/AsyncWorkQueue.cpp +++ b/Gems/Atom/RHI/Code/Source/RHI/AsyncWorkQueue.cpp @@ -9,6 +9,8 @@ #include +AZ_DECLARE_BUDGET(RHI); + namespace AZ { namespace RHI @@ -126,7 +128,7 @@ namespace AZ return; } - AZ_PROFILE_FUNCTION(AzRender); + AZ_PROFILE_FUNCTION(RHI); AZStd::unique_lock lock(m_waitWorkItemMutex); m_waitWorkItemCondition.wait(lock, [&]() {return HasFinishedWork(workHandle); }); diff --git a/Gems/Atom/RHI/Code/Source/RHI/CommandQueue.cpp b/Gems/Atom/RHI/Code/Source/RHI/CommandQueue.cpp index 2474967dab..15621c7f2b 100644 --- a/Gems/Atom/RHI/Code/Source/RHI/CommandQueue.cpp +++ b/Gems/Atom/RHI/Code/Source/RHI/CommandQueue.cpp @@ -22,7 +22,7 @@ namespace AZ ResultCode CommandQueue::Init(Device& device, const CommandQueueDescriptor& descriptor) { - AZ_PROFILE_FUNCTION(AzRender); + AZ_PROFILE_FUNCTION(RHI); #if defined (AZ_RHI_ENABLE_VALIDATION) if (IsInitialized()) @@ -116,7 +116,7 @@ namespace AZ //run a command { - AZ_PROFILE_SCOPE(AzRender, "RHI::CommandQueue - Execute Command"); + AZ_PROFILE_SCOPE(RHI, "CommandQueue - Execute Command"); command(GetNativeQueue()); } } diff --git a/Gems/Atom/RHI/Code/Source/RHI/Fence.cpp b/Gems/Atom/RHI/Code/Source/RHI/Fence.cpp index 868d2e3317..b35260caca 100644 --- a/Gems/Atom/RHI/Code/Source/RHI/Fence.cpp +++ b/Gems/Atom/RHI/Code/Source/RHI/Fence.cpp @@ -81,7 +81,7 @@ namespace AZ return ResultCode::InvalidOperation; } - AZ_PROFILE_FUNCTION(AzRender); + AZ_PROFILE_FUNCTION(RHI); WaitOnCpuInternal(); return ResultCode::Success; } diff --git a/Gems/Atom/RHI/Code/Source/RHI/FrameScheduler.cpp b/Gems/Atom/RHI/Code/Source/RHI/FrameScheduler.cpp index 0793c1ffd0..0b8c6ad9ce 100644 --- a/Gems/Atom/RHI/Code/Source/RHI/FrameScheduler.cpp +++ b/Gems/Atom/RHI/Code/Source/RHI/FrameScheduler.cpp @@ -137,7 +137,7 @@ namespace AZ ResultCode FrameScheduler::ImportScopeProducer(ScopeProducer& scopeProducer) { - AZ_PROFILE_FUNCTION(AzRender); + AZ_PROFILE_FUNCTION(RHI); if (!ValidateIsProcessing()) { @@ -216,7 +216,7 @@ namespace AZ void FrameScheduler::PrepareProducers() { - AZ_PROFILE_FUNCTION(AzRender); + AZ_PROFILE_FUNCTION(RHI); AZ_ATOM_PROFILE_FUNCTION("RHI", "FrameScheduler: PrepareProducers"); for (ScopeProducer* scopeProducer : m_scopeProducers) @@ -237,7 +237,7 @@ namespace AZ void FrameScheduler::CompileProducers() { - AZ_PROFILE_FUNCTION(AzRender); + AZ_PROFILE_FUNCTION(RHI); AZ_ATOM_PROFILE_FUNCTION("RHI", "FrameScheduler: CompileProducers"); for (ScopeProducer* scopeProducer : m_scopeProducers) @@ -249,12 +249,12 @@ namespace AZ void FrameScheduler::CompileShaderResourceGroups() { - AZ_PROFILE_FUNCTION(AzRender); + AZ_PROFILE_FUNCTION(RHI); AZ_ATOM_PROFILE_FUNCTION("RHI", "FrameScheduler: CompileShaderResourceGroups"); // Execute all queued resource invalidations, which will mark SRG's for compilation. { - AZ_PROFILE_SCOPE(AzRender, "Invalidate Resources"); + AZ_PROFILE_SCOPE(RHI, "Invalidate Resources"); ResourceInvalidateBus::ExecuteQueuedEvents(); } @@ -322,7 +322,7 @@ namespace AZ void FrameScheduler::BuildRayTracingShaderTables() { - AZ_PROFILE_FUNCTION(AzRender); + AZ_PROFILE_FUNCTION(RHI); AZ_ATOM_PROFILE_FUNCTION("RHI", "FrameScheduler: BuildRayTracingShaderTables"); for (auto rayTracingShaderTable : m_rayTracingShaderTablesToBuild) @@ -341,7 +341,7 @@ namespace AZ ResultCode FrameScheduler::BeginFrame() { - AZ_PROFILE_FUNCTION(AzRender); + AZ_PROFILE_FUNCTION(RHI); AZ_ATOM_PROFILE_FUNCTION("RHI", "FrameScheduler: BeginFrame"); if (!ValidateIsInitialized()) @@ -376,7 +376,7 @@ namespace AZ ResultCode FrameScheduler::EndFrame() { - AZ_PROFILE_FUNCTION(AzRender); + AZ_PROFILE_FUNCTION(RHI); AZ_ATOM_PROFILE_FUNCTION("RHI", "FrameScheduler: EndFrame"); if (Validation::IsEnabled()) @@ -417,13 +417,13 @@ namespace AZ void FrameScheduler::ExecuteContextInternal(FrameGraphExecuteGroup& group, uint32_t index) { - AZ_PROFILE_FUNCTION(AzRender); + AZ_PROFILE_FUNCTION(RHI); FrameGraphExecuteContext* executeContext = group.BeginContext(index); { ScopeProducer* scopeProducer = FindScopeProducer(executeContext->GetScopeId()); - AZ_PROFILE_SCOPE(AzRender, "ScopeProducer: %s", scopeProducer->GetScopeId().GetCStr()); + AZ_PROFILE_SCOPE(RHI, "ScopeProducer: %s", scopeProducer->GetScopeId().GetCStr()); scopeProducer->BuildCommandList(*executeContext); } @@ -432,7 +432,7 @@ namespace AZ void FrameScheduler::ExecuteGroupInternal(AZ::Job* parentJob, uint32_t groupIndex) { - AZ_PROFILE_FUNCTION(AzRender); + AZ_PROFILE_FUNCTION(RHI); AZ_ATOM_PROFILE_FUNCTION("RHI", "FrameScheduler: ExecuteGroupInternal"); FrameGraphExecuteGroup* executeGroup = m_frameGraphExecuter->BeginGroup(groupIndex); @@ -475,7 +475,7 @@ namespace AZ void FrameScheduler::Execute(JobPolicy overrideJobPolicy) { - AZ_PROFILE_FUNCTION(AzRender); + AZ_PROFILE_FUNCTION(RHI); AZ_ATOM_PROFILE_FUNCTION("RHI", "FrameScheduler: Execute"); const uint32_t groupCount = m_frameGraphExecuter->GetGroupCount(); diff --git a/Gems/Atom/RHI/Code/Source/RHI/PipelineStateCache.cpp b/Gems/Atom/RHI/Code/Source/RHI/PipelineStateCache.cpp index 69eee86108..c9609edcf5 100644 --- a/Gems/Atom/RHI/Code/Source/RHI/PipelineStateCache.cpp +++ b/Gems/Atom/RHI/Code/Source/RHI/PipelineStateCache.cpp @@ -272,7 +272,7 @@ namespace AZ const PipelineState* PipelineStateCache::AcquirePipelineState(PipelineLibraryHandle handle, const PipelineStateDescriptor& descriptor) { - AZ_PROFILE_FUNCTION(AzRender); + AZ_PROFILE_FUNCTION(RHI); if (handle.IsNull()) { diff --git a/Gems/Atom/RHI/Code/Source/RHI/RHISystem.cpp b/Gems/Atom/RHI/Code/Source/RHI/RHISystem.cpp index 8f8b7677fd..ed755c538a 100644 --- a/Gems/Atom/RHI/Code/Source/RHI/RHISystem.cpp +++ b/Gems/Atom/RHI/Code/Source/RHI/RHISystem.cpp @@ -19,6 +19,8 @@ #include #include +AZ_DEFINE_BUDGET(RHI); + namespace AZ { namespace RHI @@ -193,11 +195,11 @@ namespace AZ void RHISystem::FrameUpdate(FrameGraphCallback frameGraphCallback) { - AZ_PROFILE_FUNCTION(AzRender); + AZ_PROFILE_FUNCTION(RHI); AZ_ATOM_PROFILE_FUNCTION("RHI", "RHISystem: FrameUpdate"); { - AZ_PROFILE_SCOPE(AzRender, "main per-frame work"); + AZ_PROFILE_SCOPE(RHI, "main per-frame work"); m_frameScheduler.BeginFrame(); frameGraphCallback(m_frameScheduler); diff --git a/Gems/Atom/RHI/DX12/Code/Source/RHI/AsyncUploadQueue.cpp b/Gems/Atom/RHI/DX12/Code/Source/RHI/AsyncUploadQueue.cpp index 81e52d6d3f..e9beb55314 100644 --- a/Gems/Atom/RHI/DX12/Code/Source/RHI/AsyncUploadQueue.cpp +++ b/Gems/Atom/RHI/DX12/Code/Source/RHI/AsyncUploadQueue.cpp @@ -152,21 +152,21 @@ namespace AZ m_copyQueue->QueueCommand([=](void* commandQueue) { - AZ_PROFILE_SCOPE(AzRender, "Upload Buffer"); + AZ_PROFILE_SCOPE(RHI, "Upload Buffer"); size_t pendingByteOffset = 0; size_t pendingByteCount = byteCount; ID3D12CommandQueue* dx12CommandQueue = static_cast(commandQueue); while (pendingByteCount > 0) { - AZ_PROFILE_SCOPE(AzRender, "Upload Buffer Chunk"); + AZ_PROFILE_SCOPE(RHI, "Upload Buffer Chunk"); FramePacket* framePacket = BeginFramePacket(); const size_t bytesToCopy = AZStd::min(pendingByteCount, m_descriptor.m_stagingSizeInBytes); { - AZ_PROFILE_SCOPE(AzRender, "Copy CPU buffer"); + AZ_PROFILE_SCOPE(RHI, "Copy CPU buffer"); memcpy(framePacket->m_stagingResourceData, sourceData + pendingByteOffset, bytesToCopy); } @@ -196,7 +196,7 @@ namespace AZ AsyncUploadQueue::FramePacket* AsyncUploadQueue::BeginFramePacket() { - AZ_PROFILE_FUNCTION(AzRender); + AZ_PROFILE_FUNCTION(RHI); AZ_Assert(!m_recordingFrame, "The previous frame packet isn't ended"); FramePacket* framePacket = &m_framePackets[m_frameIndex]; @@ -212,7 +212,7 @@ namespace AZ void AsyncUploadQueue::EndFramePacket(ID3D12CommandQueue* commandQueue) { - AZ_PROFILE_FUNCTION(AzRender); + AZ_PROFILE_FUNCTION(RHI); AZ_Assert(m_recordingFrame, "The frame packet wasn't started. You need to call StartFramePacket first."); AssertSuccess(m_commandList->Close()); @@ -229,7 +229,7 @@ namespace AZ // [GFX TODO][ATOM-4205] Stage/Upload 3D streaming images more efficiently. uint64_t AsyncUploadQueue::QueueUpload(const RHI::StreamingImageExpandRequest& request, uint32_t residentMip) { - AZ_PROFILE_FUNCTION(AzRender); + AZ_PROFILE_FUNCTION(RHI); uint64_t fenceValue = m_uploadFence.Increment(); @@ -243,7 +243,7 @@ namespace AZ m_copyQueue->QueueCommand([=](void* commandQueue) { - AZ_PROFILE_SCOPE(AzRender, "Upload Image"); + AZ_PROFILE_SCOPE(RHI, "Upload Image"); ID3D12CommandQueue* dx12CommandQueue = static_cast(commandQueue); FramePacket* framePacket = BeginFramePacket(); @@ -314,7 +314,7 @@ namespace AZ // Copy subresource data to staging memory. { - AZ_PROFILE_SCOPE(AzRender, "Copy CPU image"); + AZ_PROFILE_SCOPE(RHI, "Copy CPU image"); uint8_t* stagingDataStart = framePacket->m_stagingResourceData + framePacket->m_dataOffset; const uint8_t* subresourceSliceDataStart = static_cast(subresource.m_data) + (depth * subresourceSlicePitch); @@ -385,7 +385,7 @@ namespace AZ // Copy subresource data to staging memory { - AZ_PROFILE_SCOPE(AzRender, "Copy CPU image"); + AZ_PROFILE_SCOPE(RHI, "Copy CPU image"); for (uint32_t row = startRow; row < endRow; row++) { uint8_t* stagingDataStart = framePacket->m_stagingResourceData + framePacket->m_dataOffset; @@ -476,7 +476,7 @@ namespace AZ void AsyncUploadQueue::WaitForUpload(uint64_t fenceValue) { - AZ_PROFILE_FUNCTION(AzRender); + AZ_PROFILE_FUNCTION(RHI); if (!IsUploadFinished(fenceValue)) { @@ -490,7 +490,7 @@ namespace AZ void AsyncUploadQueue::ProcessCallbacks(uint64_t fenceValue) { - AZ_PROFILE_FUNCTION(AzRender); + AZ_PROFILE_FUNCTION(RHI); AZStd::lock_guard lock(m_callbackMutex); while (m_callbacks.size() > 0 && m_callbacks.front().second <= fenceValue) { @@ -504,7 +504,7 @@ namespace AZ { m_copyQueue->QueueCommand([=](void* commandQueue) { - AZ_PROFILE_SCOPE(AzRender, "QueueTileMapping"); + AZ_PROFILE_SCOPE(RHI, "QueueTileMapping"); ID3D12CommandQueue* dx12CommandQueue = static_cast(commandQueue); const uint32_t tileCount = request.m_sourceRegionSize.NumTiles; diff --git a/Gems/Atom/RHI/DX12/Code/Source/RHI/CommandListBase.cpp b/Gems/Atom/RHI/DX12/Code/Source/RHI/CommandListBase.cpp index a8ae753294..c5c71a9f43 100644 --- a/Gems/Atom/RHI/DX12/Code/Source/RHI/CommandListBase.cpp +++ b/Gems/Atom/RHI/DX12/Code/Source/RHI/CommandListBase.cpp @@ -33,7 +33,7 @@ namespace AZ void CommandListBase::Reset(ID3D12CommandAllocator* commandAllocator) { - AZ_PROFILE_FUNCTION(AzRender); + AZ_PROFILE_FUNCTION(RHI); AZ_Assert(m_queuedBarriers.empty(), "Unflushed barriers in command list."); m_commandList->Reset(commandAllocator, nullptr); @@ -95,7 +95,7 @@ namespace AZ { if (m_queuedBarriers.size()) { - AZ_PROFILE_FUNCTION(AzRenderDetailed); + AZ_PROFILE_FUNCTION(RHI); m_commandList->ResourceBarrier((UINT)m_queuedBarriers.size(), m_queuedBarriers.data()); m_queuedBarriers.clear(); diff --git a/Gems/Atom/RHI/DX12/Code/Source/RHI/CommandQueue.cpp b/Gems/Atom/RHI/DX12/Code/Source/RHI/CommandQueue.cpp index b73228e717..afd0eb8074 100644 --- a/Gems/Atom/RHI/DX12/Code/Source/RHI/CommandQueue.cpp +++ b/Gems/Atom/RHI/DX12/Code/Source/RHI/CommandQueue.cpp @@ -110,7 +110,7 @@ namespace AZ { QueueCommand([this, &fence](void* commandQueue) { - AZ_PROFILE_SCOPE(AzRender, "SignalFence"); + AZ_PROFILE_SCOPE(RHI, "SignalFence"); ID3D12CommandQueue* dx12CommandQueue = static_cast(commandQueue); dx12CommandQueue->Signal(fence.Get(), fence.GetPendingValue()); }); @@ -138,7 +138,7 @@ namespace AZ QueueCommand([=](void* commandQueue) { - AZ_PROFILE_SCOPE(AzRender, "ExecuteWork"); + AZ_PROFILE_SCOPE(RHI, "ExecuteWork"); AZ_PROFILE_RHI_VARIABLE(m_lastExecuteDuration); static const uint32_t CommandListCountMax = 128; @@ -195,7 +195,7 @@ namespace AZ void CommandQueue::UpdateTileMappings(CommandList& commandList) { - AZ_PROFILE_FUNCTION(AzRender); + AZ_PROFILE_FUNCTION(RHI); for (const CommandList::TileMapRequest& request : commandList.GetTileMapRequests()) { const uint32_t tileCount = request.m_sourceRegionSize.NumTiles; @@ -229,7 +229,7 @@ namespace AZ void CommandQueue::WaitForIdle() { - AZ_PROFILE_FUNCTION(AzRender); + AZ_PROFILE_FUNCTION(RHI); Fence fence; fence.Init(m_device.get(), RHI::FenceState::Reset); diff --git a/Gems/Atom/RHI/DX12/Code/Source/RHI/CommandQueueContext.cpp b/Gems/Atom/RHI/DX12/Code/Source/RHI/CommandQueueContext.cpp index f35f66f3e8..96d621df59 100644 --- a/Gems/Atom/RHI/DX12/Code/Source/RHI/CommandQueueContext.cpp +++ b/Gems/Atom/RHI/DX12/Code/Source/RHI/CommandQueueContext.cpp @@ -101,7 +101,7 @@ namespace AZ void CommandQueueContext::WaitForIdle() { - AZ_PROFILE_FUNCTION(AzRender); + AZ_PROFILE_FUNCTION(RHI); for (uint32_t hardwareQueueIdx = 0; hardwareQueueIdx < RHI::HardwareQueueClassCount; ++hardwareQueueIdx) { if (m_commandQueues[hardwareQueueIdx]) @@ -113,10 +113,10 @@ namespace AZ void CommandQueueContext::Begin() { - AZ_PROFILE_FUNCTION(AzRender); + AZ_PROFILE_FUNCTION(RHI); { - AZ_PROFILE_SCOPE(AzRender, "Clearing Command Queue Timers"); + AZ_PROFILE_SCOPE(RHI, "Clearing Command Queue Timers"); for (const RHI::Ptr& commandQueue : m_commandQueues) { commandQueue->ClearTimers(); @@ -131,7 +131,7 @@ namespace AZ void CommandQueueContext::End() { - AZ_PROFILE_FUNCTION(AzRender); + AZ_PROFILE_FUNCTION(RHI); AZ_ATOM_PROFILE_FUNCTION("DX12", "CommandQueueContext: End"); QueueGpuSignals(m_frameFences[m_currentFrameIndex]); @@ -145,7 +145,7 @@ namespace AZ m_currentFrameIndex = (m_currentFrameIndex + 1) % aznumeric_cast(m_frameFences.size()); { - AZ_PROFILE_SCOPE(AzRender, "Wait and Reset Fence"); + AZ_PROFILE_SCOPE(RHI, "Wait and Reset Fence"); AZ_ATOM_PROFILE_TIME_GROUP_REGION("DX12", "CommandQueueContext: Wait on Fences"); FenceEvent event("FrameFence"); diff --git a/Gems/Atom/RHI/DX12/Code/Source/RHI/Fence.cpp b/Gems/Atom/RHI/DX12/Code/Source/RHI/Fence.cpp index 6244089d93..10d8abee6d 100644 --- a/Gems/Atom/RHI/DX12/Code/Source/RHI/Fence.cpp +++ b/Gems/Atom/RHI/DX12/Code/Source/RHI/Fence.cpp @@ -60,7 +60,7 @@ namespace AZ { if (fenceValue > GetCompletedValue()) { - AZ_PROFILE_SCOPE(AzRender, "Fence Wait: %s", fenceEvent.GetName()); + AZ_PROFILE_SCOPE(RHI, "Fence Wait: %s", fenceEvent.GetName()); m_fence->SetEventOnCompletion(fenceValue, fenceEvent.m_EventHandle); WaitForSingleObject(fenceEvent.m_EventHandle, INFINITE); } diff --git a/Gems/Atom/RHI/DX12/Code/Source/RHI/StreamingImagePool.cpp b/Gems/Atom/RHI/DX12/Code/Source/RHI/StreamingImagePool.cpp index 11863cb70b..add7364056 100644 --- a/Gems/Atom/RHI/DX12/Code/Source/RHI/StreamingImagePool.cpp +++ b/Gems/Atom/RHI/DX12/Code/Source/RHI/StreamingImagePool.cpp @@ -144,7 +144,7 @@ namespace AZ #ifdef AZ_RHI_USE_TILED_RESOURCES { - AZ_PROFILE_SCOPE(AzRender, "StreamImagePool::CreateHeap"); + AZ_PROFILE_SCOPE(RHI, "StreamImagePool::CreateHeap"); CD3DX12_HEAP_DESC heapDesc(descriptor.m_budgetInBytes, D3D12_HEAP_TYPE_DEFAULT, 0, D3D12_HEAP_FLAG_DENY_BUFFERS | D3D12_HEAP_FLAG_DENY_RT_DS_TEXTURES); diff --git a/Gems/Atom/RHI/Metal/Code/Source/RHI/CommandQueue.cpp b/Gems/Atom/RHI/Metal/Code/Source/RHI/CommandQueue.cpp index 4bde063d63..d151a11ec1 100644 --- a/Gems/Atom/RHI/Metal/Code/Source/RHI/CommandQueue.cpp +++ b/Gems/Atom/RHI/Metal/Code/Source/RHI/CommandQueue.cpp @@ -114,7 +114,7 @@ namespace AZ //Autoreleasepool is to ensure that the driver is not leaking memory related to the command buffer and encoder @autoreleasepool { - AZ_PROFILE_SCOPE(AzRender, "ExecuteWork"); + AZ_PROFILE_SCOPE(RHI, "ExecuteWork"); AZ_PROFILE_RHI_VARIABLE(m_lastExecuteDuration); if (request.m_signalFenceValue > 0) diff --git a/Gems/Atom/RHI/Metal/Code/Source/RHI/CommandQueueContext.cpp b/Gems/Atom/RHI/Metal/Code/Source/RHI/CommandQueueContext.cpp index f0ec98be89..7f0c535383 100644 --- a/Gems/Atom/RHI/Metal/Code/Source/RHI/CommandQueueContext.cpp +++ b/Gems/Atom/RHI/Metal/Code/Source/RHI/CommandQueueContext.cpp @@ -79,7 +79,7 @@ namespace AZ void CommandQueueContext::End() { - AZ_PROFILE_FUNCTION(AzRender); + AZ_PROFILE_FUNCTION(RHI); QueueGpuSignals(m_frameFences[m_currentFrameIndex]); for (uint32_t hardwareQueueIdx = 0; hardwareQueueIdx < RHI::HardwareQueueClassCount; ++hardwareQueueIdx) @@ -91,7 +91,7 @@ namespace AZ m_currentFrameIndex = (m_currentFrameIndex + 1) % aznumeric_cast(m_frameFences.size()); { - AZ_PROFILE_SCOPE(AzRender, "Wait and Reset Fence"); + AZ_PROFILE_SCOPE(RHI, "Wait and Reset Fence"); AZ_ATOM_PROFILE_TIME_GROUP_REGION("RHI", "CommandQueueContext: Wait on Fences"); //Synchronize the CPU with the GPU by waiting on the fence until signalled by the GPU. CPU can only go upto diff --git a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/AsyncUploadQueue.cpp b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/AsyncUploadQueue.cpp index 8f44abccef..69c3d3cc20 100644 --- a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/AsyncUploadQueue.cpp +++ b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/AsyncUploadQueue.cpp @@ -96,7 +96,7 @@ namespace AZ uploadFence->Init(device, RHI::FenceState::Reset); CommandQueue::Command command = [=, &device](void* queue) { - AZ_PROFILE_SCOPE(AzRender, "Upload Buffer"); + AZ_PROFILE_SCOPE(RHI, "Upload Buffer"); size_t pendingByteOffset = 0; size_t pendingByteCount = byteCount; FramePacket* framePacket = nullptr; @@ -110,7 +110,7 @@ namespace AZ while (pendingByteCount > 0) { - AZ_PROFILE_SCOPE(AzRender, "Upload Buffer Chunk"); + AZ_PROFILE_SCOPE(RHI, "Upload Buffer Chunk"); framePacket = BeginFramePacket(vulkanQueue); const size_t bytesToCopy = AZStd::min(pendingByteCount, m_descriptor.m_stagingSizeInBytes); @@ -181,7 +181,7 @@ namespace AZ CommandQueue::Command command = [=, &device](void* queue) { - AZ_PROFILE_SCOPE(AzRender, "Upload Image"); + AZ_PROFILE_SCOPE(RHI, "Upload Image"); Queue* vulkanQueue = static_cast(queue); FramePacket* framePacket = BeginFramePacket(vulkanQueue); @@ -257,7 +257,7 @@ namespace AZ // Copy subresource data to staging memory. { - AZ_PROFILE_SCOPE(AzRender, "Copy CPU image"); + AZ_PROFILE_SCOPE(RHI, "Copy CPU image"); uint8_t* stagingDataStart = reinterpret_cast(framePacket->m_stagingBuffer->GetBufferMemoryView()->Map(RHI::HostMemoryAccess::Write)) + framePacket->m_dataOffset; for (uint32_t row = 0; row < subresourceLayout.m_rowCount; ++row) { @@ -332,7 +332,7 @@ namespace AZ // Copy subresource data to staging memory. { - AZ_PROFILE_SCOPE(AzRender, "Copy CPU image"); + AZ_PROFILE_SCOPE(RHI, "Copy CPU image"); uint8_t* stagingDataStart = reinterpret_cast(framePacket->m_stagingBuffer->GetBufferMemoryView()->Map(RHI::HostMemoryAccess::Write)); stagingDataStart += framePacket->m_dataOffset; @@ -458,7 +458,7 @@ namespace AZ AsyncUploadQueue::FramePacket* AsyncUploadQueue::BeginFramePacket(Queue* queue) { - AZ_PROFILE_FUNCTION(AzRender); + AZ_PROFILE_FUNCTION(RHI); AZ_Assert(!m_recordingFrame, "The previous frame packet isn't ended."); auto& device = static_cast(GetDevice()); @@ -478,7 +478,7 @@ namespace AZ void AsyncUploadQueue::EndFramePacket(Queue* queue, Semaphore* semaphoreToSignal /*=nullptr*/) { - AZ_PROFILE_FUNCTION(AzRender); + AZ_PROFILE_FUNCTION(RHI); AZ_Assert(m_recordingFrame, "The frame packet wasn't started. You need to call StartFramePacket first."); m_commandList->EndCommandBuffer(); @@ -644,7 +644,7 @@ namespace AZ void AsyncUploadQueue::ProcessCallback(const RHI::AsyncWorkHandle& handle) { - AZ_PROFILE_FUNCTION(AzRender); + AZ_PROFILE_FUNCTION(RHI); AZStd::unique_lock lock(m_callbackListMutex); auto findIter = m_callbackList.find(handle); if (findIter != m_callbackList.end()) diff --git a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/CommandQueue.cpp b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/CommandQueue.cpp index 6929b63ac4..bfce4dfb33 100644 --- a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/CommandQueue.cpp +++ b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/CommandQueue.cpp @@ -54,7 +54,7 @@ namespace AZ const ExecuteWorkRequest& request = static_cast(rhiRequest); QueueCommand([=](void* queue) { - AZ_PROFILE_SCOPE(AzRender, "ExecuteWork"); + AZ_PROFILE_SCOPE(RHI, "ExecuteWork"); AZ_PROFILE_RHI_VARIABLE(m_lastExecuteDuration); Queue* vulkanQueue = static_cast(queue); diff --git a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/CommandQueueContext.cpp b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/CommandQueueContext.cpp index f31132f039..39f0ac9d58 100644 --- a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/CommandQueueContext.cpp +++ b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/CommandQueueContext.cpp @@ -42,7 +42,7 @@ namespace AZ void CommandQueueContext::End() { - AZ_PROFILE_FUNCTION(AzRender); + AZ_PROFILE_FUNCTION(RHI); for (auto& commandQueue : m_commandQueues) { @@ -54,7 +54,7 @@ namespace AZ m_currentFrameIndex = (m_currentFrameIndex + 1) % GetFrameCount(); { - AZ_PROFILE_SCOPE(AzRender, "Wait on Fences"); + AZ_PROFILE_SCOPE(RHI, "Wait on Fences"); AZ_ATOM_PROFILE_FUNCTION("RHI", "CommandQueueContext: Wait on Fences"); FencesPerQueue& nextFences = m_frameFences[m_currentFrameIndex]; @@ -79,7 +79,7 @@ namespace AZ void CommandQueueContext::WaitForIdle() { - AZ_PROFILE_FUNCTION(AzRender); + AZ_PROFILE_FUNCTION(RHI); for (auto& commandQueue : m_commandQueues) { commandQueue->WaitForIdle(); diff --git a/Gems/Atom/RPI/Code/Include/Atom/RPI.Public/Base.h b/Gems/Atom/RPI/Code/Include/Atom/RPI.Public/Base.h index 5c39bc3656..a88c640c19 100644 --- a/Gems/Atom/RPI/Code/Include/Atom/RPI.Public/Base.h +++ b/Gems/Atom/RPI/Code/Include/Atom/RPI.Public/Base.h @@ -14,10 +14,14 @@ #include #include #include +#include #include #include #include +AZ_DECLARE_BUDGET(AzRender); +AZ_DECLARE_BUDGET(RPI); + namespace AZ { namespace RHI @@ -67,3 +71,4 @@ namespace AZ } // namespace RPI } // namespace AZ + diff --git a/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/Base.h b/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/Base.h index c62a9439ea..6126f14e4a 100644 --- a/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/Base.h +++ b/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/Base.h @@ -7,12 +7,15 @@ */ #pragma once +#include #include #include #include #include +AZ_DECLARE_BUDGET(RPI); + namespace UnitTest { class RPITestFixture; diff --git a/Gems/Atom/RPI/Code/Source/RPI.Public/Culling.cpp b/Gems/Atom/RPI/Code/Source/RPI.Public/Culling.cpp index 54163f830b..98b3ab6f5f 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Public/Culling.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Public/Culling.cpp @@ -299,7 +299,7 @@ namespace AZ //work function void Process() override { - AZ_PROFILE_FUNCTION(AzRender); + AZ_PROFILE_FUNCTION(RPI); const View::UsageFlags viewFlags = m_jobData->m_view->GetUsageFlags(); const RHI::DrawListMask drawListMask = m_jobData->m_view->GetDrawListMask(); @@ -312,7 +312,7 @@ namespace AZ bool nodeIsContainedInFrustum = ShapeIntersection::Contains(m_jobData->m_frustum, nodeData.m_bounds); #ifdef AZ_CULL_PROFILE_VERBOSE - AZ_PROFILE_SCOPE(AzRender, "process node (view: %s, skip fine cull: %d", + AZ_PROFILE_SCOPE(RPI, "process node (view: %s, skip fine cull: %d", m_view->GetName().GetCStr(), nodeIsContainedInFrustum ? 1 : 0); #endif @@ -385,7 +385,7 @@ namespace AZ if (m_jobData->m_debugCtx->m_debugDraw && (m_jobData->m_view->GetName() == m_jobData->m_debugCtx->m_currentViewSelectionName)) { - AZ_PROFILE_SCOPE(AzRender, "debug draw culling"); + AZ_PROFILE_SCOPE(RPI, "debug draw culling"); AuxGeomDrawPtr auxGeomPtr = AuxGeomFeatureProcessorInterface::GetDrawQueueForScene(m_jobData->m_scene); if (auxGeomPtr) @@ -507,7 +507,7 @@ namespace AZ void CullingScene::ProcessCullables(const Scene& scene, View& view, AZ::Job& parentJob) { - AZ_PROFILE_SCOPE(AzRender, "CullingScene::ProcessCullables() - %s", view.GetName().GetCStr()); + AZ_PROFILE_SCOPE(RPI, "CullingScene::ProcessCullables() - %s", view.GetName().GetCStr()); const Matrix4x4& worldToClip = view.GetWorldToClipMatrix(); Frustum frustum = Frustum::CreateFromMatrixColumnMajor(worldToClip); @@ -598,7 +598,7 @@ namespace AZ auto nodeVisitorLambda = [this, jobData, &parentJob, &frustum, &worklist](const AzFramework::IVisibilityScene::NodeData& nodeData) -> void { - AZ_PROFILE_SCOPE(AzRender, "nodeVisitorLambda()"); + AZ_PROFILE_SCOPE(RPI, "nodeVisitorLambda()"); AZ_Assert(nodeData.m_entries.size() > 0, "should not get called with 0 entries"); AZ_Assert(worklist.size() < worklist.capacity(), "we should always have room to push a node on the queue"); @@ -645,7 +645,7 @@ namespace AZ uint32_t AddLodDataToView(const Vector3& pos, const Cullable::LodData& lodData, RPI::View& view) { #ifdef AZ_CULL_PROFILE_DETAILED - AZ_PROFILE_FUNCTION(AzRender); + AZ_PROFILE_FUNCTION(RPI); #endif const Matrix4x4& viewToClip = view.GetViewToClipMatrix(); @@ -663,7 +663,7 @@ namespace AZ auto addLodToDrawPacket = [&](const Cullable::LodData::Lod& lod) { #ifdef AZ_CULL_PROFILE_VERBOSE - AZ_PROFILE_SCOPE(AzRender, "add draw packets: %zu", lod.m_drawPackets.size()); + AZ_PROFILE_SCOPE(RPI, "add draw packets: %zu", lod.m_drawPackets.size()); #endif numVisibleDrawPackets += static_cast(lod.m_drawPackets.size()); //don't want to pay the cost of aznumeric_cast<> here so using static_cast<> instead for (const RHI::DrawPacket* drawPacket : lod.m_drawPackets) diff --git a/Gems/Atom/RPI/Code/Source/RPI.Public/Material/Material.cpp b/Gems/Atom/RPI/Code/Source/RPI.Public/Material/Material.cpp index 1de6776d9c..c0c187f2bc 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Public/Material/Material.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Public/Material/Material.cpp @@ -310,7 +310,7 @@ namespace AZ if (NeedsCompile() && CanCompile()) { - AZ_PROFILE_BEGIN(AzRender, "Material::Compile() Processing Functors"); + AZ_PROFILE_BEGIN(RPI, "Material::Compile() Processing Functors"); for (const Ptr& functor : m_materialAsset->GetMaterialFunctors()) { if (functor) diff --git a/Gems/Atom/RPI/Code/Source/RPI.Public/MeshDrawPacket.cpp b/Gems/Atom/RPI/Code/Source/RPI.Public/MeshDrawPacket.cpp index 7fd7133cee..2d876fd6ad 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Public/MeshDrawPacket.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Public/MeshDrawPacket.cpp @@ -124,7 +124,7 @@ namespace AZ bool MeshDrawPacket::DoUpdate(const Scene& parentScene) { - AZ_PROFILE_FUNCTION(AzRender); + AZ_PROFILE_FUNCTION(RPI); const ModelLod::Mesh& mesh = m_modelLod->GetMeshes()[m_modelLodMeshIndex]; if (!m_material) @@ -155,7 +155,7 @@ namespace AZ auto appendShader = [&](const ShaderCollection::Item& shaderItem) { - AZ_PROFILE_SCOPE(AzRender, "appendShader()"); + AZ_PROFILE_SCOPE(RPI, "appendShader()"); // Skip the shader item without creating the shader instance // if the mesh is not going to be rendered based on the draw tag @@ -256,7 +256,7 @@ namespace AZ Data::Instance drawSrg; if (drawSrgLayout) { - AZ_PROFILE_SCOPE(AzRender, "create drawSrg"); + AZ_PROFILE_SCOPE(RPI, "create drawSrg"); // If the DrawSrg exists we must create and bind it, otherwise the CommandList will fail validation for SRG being null drawSrg = RPI::ShaderResourceGroup::Create(shader->GetAsset(), shader->GetSupervariantIndex(), drawSrgLayout->GetName()); diff --git a/Gems/Atom/RPI/Code/Source/RPI.Public/Model/Model.cpp b/Gems/Atom/RPI/Code/Source/RPI.Public/Model/Model.cpp index 0cbcdbf5f4..6fd313e27f 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Public/Model/Model.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Public/Model/Model.cpp @@ -42,7 +42,7 @@ namespace AZ Data::Instance Model::CreateInternal(const Data::Asset& modelAsset) { - AZ_PROFILE_FUNCTION(AzRender); + AZ_PROFILE_FUNCTION(RPI); Data::Instance model = aznew Model(); const RHI::ResultCode resultCode = model->Init(modelAsset); @@ -56,7 +56,7 @@ namespace AZ RHI::ResultCode Model::Init(const Data::Asset& modelAsset) { - AZ_PROFILE_FUNCTION(AzRender); + AZ_PROFILE_FUNCTION(RPI); m_lods.resize(modelAsset->GetLodAssets().size()); @@ -107,7 +107,7 @@ namespace AZ { if (m_isUploadPending) { - AZ_PROFILE_SCOPE(AzRender, "Model::WaitForUpload - %s", GetDatabaseName()); + AZ_PROFILE_SCOPE(RPI, "Model::WaitForUpload - %s", GetDatabaseName()); for (const Data::Instance& lod : m_lods) { lod->WaitForUpload(); @@ -128,7 +128,7 @@ namespace AZ bool Model::LocalRayIntersection(const AZ::Vector3& rayStart, const AZ::Vector3& rayDir, float& distanceNormalized, AZ::Vector3& normal) const { - AZ_PROFILE_FUNCTION(AzRender); + AZ_PROFILE_FUNCTION(RPI); if (!GetModelAsset()) { @@ -171,7 +171,7 @@ namespace AZ float& distanceNormalized, AZ::Vector3& normal) const { - AZ_PROFILE_FUNCTION(AzRender); + AZ_PROFILE_FUNCTION(RPI); const AZ::Vector3 clampedScale = nonUniformScale.GetMax(AZ::Vector3(AZ::MinTransformScale)); const AZ::Transform inverseTM = modelTransform.GetInverse(); diff --git a/Gems/Atom/RPI/Code/Source/RPI.Public/Model/ModelLod.cpp b/Gems/Atom/RPI/Code/Source/RPI.Public/Model/ModelLod.cpp index cfe0d08270..04fa004228 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Public/Model/ModelLod.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Public/Model/ModelLod.cpp @@ -264,7 +264,7 @@ namespace AZ const MaterialModelUvOverrideMap& materialModelUvMap, const MaterialUvNameMap& materialUvNameMap) const { - AZ_PROFILE_FUNCTION(AzRender); + AZ_PROFILE_FUNCTION(RPI); streamBufferViewsOut.clear(); @@ -366,7 +366,7 @@ namespace AZ const MaterialModelUvOverrideMap& materialModelUvMap, const MaterialUvNameMap& materialUvNameMap) const { - AZ_PROFILE_FUNCTION(AzRender); + AZ_PROFILE_FUNCTION(RPI); const Mesh& mesh = m_meshes[meshIndex]; diff --git a/Gems/Atom/RPI/Code/Source/RPI.Public/Model/ModelLodUtils.cpp b/Gems/Atom/RPI/Code/Source/RPI.Public/Model/ModelLodUtils.cpp index 0fe035dd85..ef9521d23c 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Public/Model/ModelLodUtils.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Public/Model/ModelLodUtils.cpp @@ -27,7 +27,7 @@ namespace AZ ModelLodIndex SelectLod(const View* view, const Vector3& position, const Model& model, ModelLodIndex lodOverride) { - AZ_PROFILE_FUNCTION(AzRender); + AZ_PROFILE_FUNCTION(RPI); ModelLodIndex lodIndex; if (model.GetLodCount() == 1) { diff --git a/Gems/Atom/RPI/Code/Source/RPI.Public/Pass/PassSystem.cpp b/Gems/Atom/RPI/Code/Source/RPI.Public/Pass/PassSystem.cpp index 64ab7fdd96..a8feeb1047 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Public/Pass/PassSystem.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Public/Pass/PassSystem.cpp @@ -189,7 +189,7 @@ namespace AZ void PassSystem::BuildPasses() { m_state = PassSystemState::BuildingPasses; - AZ_PROFILE_FUNCTION(AzRender); + AZ_PROFILE_FUNCTION(RPI); AZ_ATOM_PROFILE_FUNCTION("RPI", "PassSystem: BuildPassAttachments"); m_passHierarchyChanged = m_passHierarchyChanged || !m_buildPassList.empty(); @@ -239,7 +239,7 @@ namespace AZ void PassSystem::InitializePasses() { m_state = PassSystemState::InitializingPasses; - AZ_PROFILE_FUNCTION(AzRender); + AZ_PROFILE_FUNCTION(RPI); AZ_ATOM_PROFILE_FUNCTION("RPI", "PassSystem: BuildPassAttachments"); m_passHierarchyChanged = m_passHierarchyChanged || !m_initializePassList.empty(); @@ -286,7 +286,7 @@ namespace AZ return; } - AZ_PROFILE_FUNCTION(AzRender); + AZ_PROFILE_FUNCTION(RPI); PassValidationResults validationResults; m_rootPass->Validate(validationResults); @@ -307,7 +307,7 @@ namespace AZ void PassSystem::FrameUpdate(RHI::FrameGraphBuilder& frameGraphBuilder) { - AZ_PROFILE_FUNCTION(AzRender); + AZ_PROFILE_FUNCTION(RPI); AZ_ATOM_PROFILE_FUNCTION("RPI", "PassSystem: FrameUpdate"); ResetFrameStatistics(); diff --git a/Gems/Atom/RPI/Code/Source/RPI.Public/Pass/RasterPass.cpp b/Gems/Atom/RPI/Code/Source/RPI.Public/Pass/RasterPass.cpp index d37002eb6b..51cbc82f2b 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Public/Pass/RasterPass.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Public/Pass/RasterPass.cpp @@ -216,7 +216,7 @@ namespace AZ void RasterPass::CompileResources(const RHI::FrameGraphCompileContext& context) { - AZ_PROFILE_FUNCTION(AzRender); + AZ_PROFILE_FUNCTION(RPI); if (m_shaderResourceGroup == nullptr) { @@ -230,7 +230,7 @@ namespace AZ void RasterPass::BuildCommandListInternal(const RHI::FrameGraphExecuteContext& context) { - AZ_PROFILE_FUNCTION(AzRender); + AZ_PROFILE_FUNCTION(RPI); RHI::CommandList* commandList = context.GetCommandList(); diff --git a/Gems/Atom/RPI/Code/Source/RPI.Public/RPISystem.cpp b/Gems/Atom/RPI/Code/Source/RPI.Public/RPISystem.cpp index 5eb9bd2d46..a9028627a0 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Public/RPISystem.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Public/RPISystem.cpp @@ -36,6 +36,9 @@ #include +AZ_DEFINE_BUDGET(AzRender); +AZ_DEFINE_BUDGET(RPI); + // This will cause the RPI System to print out global state (like the current pass hierarchy) when an assert is hit // This is useful for rendering engineers debugging a crash in the RPI/RHI layers #define AZ_RPI_PRINT_GLOBAL_STATE_ON_ASSERT 0 @@ -270,7 +273,7 @@ namespace AZ return; } - AZ_PROFILE_FUNCTION(AzRender); + AZ_PROFILE_FUNCTION(RPI); AZ_ATOM_PROFILE_FUNCTION("RPI", "RPISystem: RenderTick"); // Query system update is to increment the frame count diff --git a/Gems/Atom/RPI/Code/Source/RPI.Public/RenderPipeline.cpp b/Gems/Atom/RPI/Code/Source/RPI.Public/RenderPipeline.cpp index a552ac86f2..6d974a074f 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Public/RenderPipeline.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Public/RenderPipeline.cpp @@ -377,7 +377,7 @@ namespace AZ void RenderPipeline::OnStartFrame(const TickTimeInfo& tick) { - AZ_PROFILE_FUNCTION(AzRender); + AZ_PROFILE_FUNCTION(RPI); m_lastRenderStartTime = tick.m_currentGameTime; diff --git a/Gems/Atom/RPI/Code/Source/RPI.Public/Scene.cpp b/Gems/Atom/RPI/Code/Source/RPI.Public/Scene.cpp index 26fdae1c54..82d53d8bc3 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Public/Scene.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Public/Scene.cpp @@ -400,7 +400,7 @@ namespace AZ AZ_ATOM_PROFILE_FUNCTION("RPI", "Scene: PrepareRender"); { - AZ_PROFILE_SCOPE(AzRender, "WaitForSimulationCompletion"); + AZ_PROFILE_SCOPE(RPI, "WaitForSimulationCompletion"); AZ_ATOM_PROFILE_TIME_GROUP_REGION("RPI", "WaitForSimulationCompletion"); WaitAndCleanCompletionJob(m_simulationCompletion); } @@ -408,7 +408,7 @@ namespace AZ SceneNotificationBus::Event(GetId(), &SceneNotification::OnBeginPrepareRender); { - AZ_PROFILE_SCOPE(AzRender, "m_srgCallback"); + AZ_PROFILE_SCOPE(RPI, "m_srgCallback"); AZ_ATOM_PROFILE_TIME_GROUP_REGION("RPI", "ShaderResourceGroupCallback: SrgCallback"); // Set values for scene srg if (m_srg && m_srgCallback) @@ -484,7 +484,7 @@ namespace AZ } { - AZ_PROFILE_SCOPE(AzRender, "CollectDrawPackets"); + AZ_PROFILE_SCOPE(RPI, "CollectDrawPackets"); AZ_ATOM_PROFILE_TIME_GROUP_REGION("RPI", "CollectDrawPackets"); AZ::JobCompletion* collectDrawPacketsCompletion = aznew AZ::JobCompletion(); @@ -534,7 +534,7 @@ namespace AZ } { - AZ_PROFILE_BEGIN(AzRender, "FinalizeDrawLists"); + AZ_PROFILE_BEGIN(RPI, "FinalizeDrawLists"); AZ_ATOM_PROFILE_TIME_GROUP_REGION("RPI", "FinalizeDrawLists"); if (jobPolicy == RHI::JobPolicy::Serial) { diff --git a/Gems/Atom/RPI/Code/Source/RPI.Public/Shader/Metrics/ShaderMetricsSystem.cpp b/Gems/Atom/RPI/Code/Source/RPI.Public/Shader/Metrics/ShaderMetricsSystem.cpp index 8df5648432..9e633077e7 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Public/Shader/Metrics/ShaderMetricsSystem.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Public/Shader/Metrics/ShaderMetricsSystem.cpp @@ -113,7 +113,7 @@ namespace AZ return; } - AZ_PROFILE_FUNCTION(AzRender); + AZ_PROFILE_FUNCTION(RPI); AZStd::lock_guard lock(m_metricsMutex); diff --git a/Gems/Atom/RPI/Code/Source/RPI.Public/Shader/Shader.cpp b/Gems/Atom/RPI/Code/Source/RPI.Public/Shader/Shader.cpp index f6dcd02804..3b546d192a 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Public/Shader/Shader.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Public/Shader/Shader.cpp @@ -297,7 +297,7 @@ namespace AZ const ShaderVariant& Shader::GetVariant(const ShaderVariantId& shaderVariantId) { - AZ_PROFILE_FUNCTION(AzRender); + AZ_PROFILE_FUNCTION(RPI); Data::Asset shaderVariantAsset = m_asset->GetVariant(shaderVariantId, m_supervariantIndex); if (!shaderVariantAsset || shaderVariantAsset->IsRootVariant()) { @@ -314,14 +314,14 @@ namespace AZ ShaderVariantSearchResult Shader::FindVariantStableId(const ShaderVariantId& shaderVariantId) const { - AZ_PROFILE_FUNCTION(AzRender); + AZ_PROFILE_FUNCTION(RPI); ShaderVariantSearchResult variantSearchResult = m_asset->FindVariantStableId(shaderVariantId); return variantSearchResult; } const ShaderVariant& Shader::GetVariant(ShaderVariantStableId shaderVariantStableId) { - AZ_PROFILE_FUNCTION(AzRender); + AZ_PROFILE_FUNCTION(RPI); if (!shaderVariantStableId.IsValid() || shaderVariantStableId == ShaderAsset::RootShaderVariantStableId) { diff --git a/Gems/Atom/RPI/Code/Source/RPI.Public/View.cpp b/Gems/Atom/RPI/Code/Source/RPI.Public/View.cpp index f1f25e3303..436aa0d538 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Public/View.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Public/View.cpp @@ -237,7 +237,7 @@ namespace AZ void View::FinalizeDrawLists() { - AZ_PROFILE_FUNCTION(AzRender); + AZ_PROFILE_FUNCTION(RPI); m_drawListContext.FinalizeLists(); SortFinalizedDrawLists(); } diff --git a/Gems/Atom/RPI/Code/Source/RPI.Reflect/Model/ModelAsset.cpp b/Gems/Atom/RPI/Code/Source/RPI.Reflect/Model/ModelAsset.cpp index e1da50d2fb..8230c57e15 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Reflect/Model/ModelAsset.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Reflect/Model/ModelAsset.cpp @@ -96,7 +96,7 @@ namespace AZ const AZ::Vector3& rayStart, const AZ::Vector3& rayDir, bool allowBruteForce, float& distanceNormalized, AZ::Vector3& normal) const { - AZ_PROFILE_FUNCTION(AzRender); + AZ_PROFILE_FUNCTION(RPI); if (!m_modelTriangleCount) { diff --git a/Gems/Atom/RPI/Code/Source/RPI.Reflect/Shader/ShaderAsset.cpp b/Gems/Atom/RPI/Code/Source/RPI.Reflect/Shader/ShaderAsset.cpp index adeb564675..25fe2a566e 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Reflect/Shader/ShaderAsset.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Reflect/Shader/ShaderAsset.cpp @@ -172,7 +172,7 @@ namespace AZ Data::Asset ShaderAsset::GetVariant( const ShaderVariantId& shaderVariantId, SupervariantIndex supervariantIndex) { - AZ_PROFILE_FUNCTION(AzRender); + AZ_PROFILE_FUNCTION(RPI); auto variantFinder = AZ::Interface::Get(); AZ_Assert(variantFinder, "The IShaderVariantFinder doesn't exist"); @@ -189,7 +189,7 @@ namespace AZ ShaderVariantSearchResult ShaderAsset::FindVariantStableId(const ShaderVariantId& shaderVariantId) { - AZ_PROFILE_FUNCTION(AzRender); + AZ_PROFILE_FUNCTION(RPI); uint32_t dynamicOptionCount = aznumeric_cast(GetShaderOptionGroupLayout()->GetShaderOptions().size()); ShaderVariantSearchResult variantSearchResult{RootShaderVariantStableId, dynamicOptionCount }; diff --git a/Gems/Atom/RPI/Code/Source/RPI.Reflect/Shader/ShaderVariantTreeAsset.cpp b/Gems/Atom/RPI/Code/Source/RPI.Reflect/Shader/ShaderVariantTreeAsset.cpp index b4a0e2e068..f17a144adb 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Reflect/Shader/ShaderVariantTreeAsset.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Reflect/Shader/ShaderVariantTreeAsset.cpp @@ -72,7 +72,7 @@ namespace AZ ShaderVariantSearchResult ShaderVariantTreeAsset::FindVariantStableId(const ShaderOptionGroupLayout* shaderOptionGroupLayout, const ShaderVariantId& shaderVariantId) const { - AZ_PROFILE_FUNCTION(AzRender); + AZ_PROFILE_FUNCTION(RPI); struct NodeToVisit { diff --git a/Gems/AudioSystem/Code/Source/Engine/AudioSystem.cpp b/Gems/AudioSystem/Code/Source/Engine/AudioSystem.cpp index af1dfedfaa..4e0a5b3baf 100644 --- a/Gems/AudioSystem/Code/Source/Engine/AudioSystem.cpp +++ b/Gems/AudioSystem/Code/Source/Engine/AudioSystem.cpp @@ -17,6 +17,7 @@ #include #include +AZ_DEFINE_BUDGET(Audio); namespace Audio { diff --git a/Gems/AudioSystem/Code/Source/Engine/AudioSystem.h b/Gems/AudioSystem/Code/Source/Engine/AudioSystem.h index da3b8053b5..1d8f8fb286 100644 --- a/Gems/AudioSystem/Code/Source/Engine/AudioSystem.h +++ b/Gems/AudioSystem/Code/Source/Engine/AudioSystem.h @@ -13,6 +13,7 @@ #include #include +#include #include #include @@ -22,6 +23,8 @@ #define PROVIDE_GETNAME_SUPPORT +AZ_DECLARE_BUDGET(Audio); + namespace Audio { // Forward declarations. diff --git a/Gems/Blast/Code/Source/Components/BlastFamilyComponent.cpp b/Gems/Blast/Code/Source/Components/BlastFamilyComponent.cpp index ec6e7bbbb9..9b61ee0dbe 100644 --- a/Gems/Blast/Code/Source/Components/BlastFamilyComponent.cpp +++ b/Gems/Blast/Code/Source/Components/BlastFamilyComponent.cpp @@ -187,7 +187,7 @@ namespace Blast void BlastFamilyComponent::Activate() { - AZ_PROFILE_FUNCTION(System); + AZ_PROFILE_FUNCTION(Physics); AZ_Assert(m_blastAsset.GetId().IsValid(), "BlastFamilyComponent created with invalid blast asset."); @@ -199,7 +199,7 @@ namespace Blast void BlastFamilyComponent::Deactivate() { - AZ_PROFILE_FUNCTION(System); + AZ_PROFILE_FUNCTION(Physics); // cleanup collision handlers for (auto& itr : m_collisionHandlers) diff --git a/Gems/Blast/Code/Source/Components/BlastSystemComponent.cpp b/Gems/Blast/Code/Source/Components/BlastSystemComponent.cpp index 711d3a0087..58324422db 100644 --- a/Gems/Blast/Code/Source/Components/BlastSystemComponent.cpp +++ b/Gems/Blast/Code/Source/Components/BlastSystemComponent.cpp @@ -112,7 +112,7 @@ namespace Blast void BlastSystemComponent::Activate() { - AZ_PROFILE_FUNCTION(System); + AZ_PROFILE_FUNCTION(Physics); auto blastAssetHandler = aznew BlastAssetHandler(); blastAssetHandler->Register(); m_assetHandlers.emplace_back(blastAssetHandler); @@ -141,7 +141,7 @@ namespace Blast void BlastSystemComponent::Deactivate() { - AZ_PROFILE_FUNCTION(System); + AZ_PROFILE_FUNCTION(Physics); CrySystemEventBus::Handler::BusDisconnect(); AZ::TickBus::Handler::BusDisconnect(); BlastSystemRequestBus::Handler::BusDisconnect(); diff --git a/Gems/ExpressionEvaluation/Code/Source/ExpressionEvaluationSystemComponent.cpp b/Gems/ExpressionEvaluation/Code/Source/ExpressionEvaluationSystemComponent.cpp index c55385595b..1a72f30e7c 100644 --- a/Gems/ExpressionEvaluation/Code/Source/ExpressionEvaluationSystemComponent.cpp +++ b/Gems/ExpressionEvaluation/Code/Source/ExpressionEvaluationSystemComponent.cpp @@ -18,6 +18,8 @@ #include #include +AZ_DEFINE_BUDGET(ExpressionEvaluation); + namespace ExpressionEvaluation { namespace StructuralParsers diff --git a/Gems/LyShine/Code/Source/LyShine.cpp b/Gems/LyShine/Code/Source/LyShine.cpp index 694a9665a8..a3beefe924 100644 --- a/Gems/LyShine/Code/Source/LyShine.cpp +++ b/Gems/LyShine/Code/Source/LyShine.cpp @@ -377,8 +377,6 @@ void CLyShine::SetViewportSize(AZ::Vector2 viewportSize) //////////////////////////////////////////////////////////////////////////////////////////////////// void CLyShine::Update(float deltaTimeInSeconds) { - FRAME_PROFILER(__FUNCTION__, gEnv->pSystem, PROFILE_UI); - if (!m_uiRenderer->IsReady()) { return; @@ -408,8 +406,6 @@ void CLyShine::Update(float deltaTimeInSeconds) //////////////////////////////////////////////////////////////////////////////////////////////////// void CLyShine::Render() { - FRAME_PROFILER(__FUNCTION__, gEnv->pSystem, PROFILE_UI); - if (AZ::RHI::IsNullRenderer()) { return; @@ -587,8 +583,6 @@ AZ::Vector2 CLyShine::GetUiCursorPosition() //////////////////////////////////////////////////////////////////////////////////////////////////// bool CLyShine::OnInputChannelEventFiltered(const AzFramework::InputChannel& inputChannel) { - FUNCTION_PROFILER(GetISystem(), PROFILE_ACTION); - // disable UI inputs when console is open except for a primary release // if we ignore the primary release when there is an active interactable then it will miss its release // which leaves it in a bad state. E.g. a drag operation will be left in flight and not properly @@ -624,8 +618,6 @@ bool CLyShine::OnInputChannelEventFiltered(const AzFramework::InputChannel& inpu //////////////////////////////////////////////////////////////////////////////////////////////////// bool CLyShine::OnInputTextEventFiltered(const AZStd::string& textUTF8) { - FUNCTION_PROFILER(GetISystem(), PROFILE_ACTION); - if (gEnv->pConsole->GetStatus()) // disable UI inputs when console is open { return false; diff --git a/Gems/NvCloth/Code/Include/NvCloth/ICloth.h b/Gems/NvCloth/Code/Include/NvCloth/ICloth.h index e72c0ffe3a..6f40f06f02 100644 --- a/Gems/NvCloth/Code/Include/NvCloth/ICloth.h +++ b/Gems/NvCloth/Code/Include/NvCloth/ICloth.h @@ -8,12 +8,15 @@ #pragma once +#include #include #include #include #include +AZ_DECLARE_BUDGET(Cloth); + namespace NvCloth { class IClothConfigurator; diff --git a/Gems/NvCloth/Code/Source/System/Cloth.cpp b/Gems/NvCloth/Code/Source/System/Cloth.cpp index c71d1bd584..6cebebbf26 100644 --- a/Gems/NvCloth/Code/Source/System/Cloth.cpp +++ b/Gems/NvCloth/Code/Source/System/Cloth.cpp @@ -20,6 +20,8 @@ #include #include +AZ_DEFINE_BUDGET(Cloth); + namespace NvCloth { namespace Internal diff --git a/Gems/PhysX/Code/Source/System/PhysXSystem.cpp b/Gems/PhysX/Code/Source/System/PhysXSystem.cpp index ebdfc5d417..3fa81172f5 100644 --- a/Gems/PhysX/Code/Source/System/PhysXSystem.cpp +++ b/Gems/PhysX/Code/Source/System/PhysXSystem.cpp @@ -21,6 +21,8 @@ #define ENABLE_PHYSX_TIMESTEP_WARNING #endif +AZ_DEFINE_BUDGET(Physics); + namespace PhysX { AZ_CLASS_ALLOCATOR_IMPL(PhysXSystem, AZ::SystemAllocator, 0); diff --git a/Gems/ScriptEvents/Code/Source/ScriptEventsSystemComponent.cpp b/Gems/ScriptEvents/Code/Source/ScriptEventsSystemComponent.cpp index 3d8f69de10..773d5d2255 100644 --- a/Gems/ScriptEvents/Code/Source/ScriptEventsSystemComponent.cpp +++ b/Gems/ScriptEvents/Code/Source/ScriptEventsSystemComponent.cpp @@ -26,6 +26,8 @@ #include #include +AZ_DEFINE_BUDGET(ScriptCanvas); + namespace ScriptEvents { void ScriptEventsSystemComponent::Reflect(AZ::ReflectContext* context) diff --git a/Gems/ScriptEvents/Code/Source/ScriptEventsSystemComponent.h b/Gems/ScriptEvents/Code/Source/ScriptEventsSystemComponent.h index 792d337c7f..64a0e49bca 100644 --- a/Gems/ScriptEvents/Code/Source/ScriptEventsSystemComponent.h +++ b/Gems/ScriptEvents/Code/Source/ScriptEventsSystemComponent.h @@ -20,6 +20,8 @@ #include #include +AZ_DECLARE_BUDGET(ScriptCanvas); + namespace ScriptEvents { class ScriptEventsSystemComponent From 5e04c3737ffdec3e3b710968b8d7b835c91885e1 Mon Sep 17 00:00:00 2001 From: Jeremy Ong Date: Mon, 23 Aug 2021 12:44:21 -0600 Subject: [PATCH 067/131] Add preliminary budget tracking system and remove driller integration Signed-off-by: Jeremy Ong --- Code/Framework/AzCore/AzCore/AzCoreModule.cpp | 3 - .../AzCore/Component/ComponentApplication.cpp | 39 +- .../AzCore/Component/ComponentApplication.h | 11 +- .../Component/ComponentApplicationBus.h | 5 - Code/Framework/AzCore/AzCore/Debug/Budget.cpp | 48 +- Code/Framework/AzCore/AzCore/Debug/Budget.h | 47 +- .../AzCore/AzCore/Debug/BudgetTracker.cpp | 61 ++ .../AzCore/AzCore/Debug/BudgetTracker.h | 38 + .../AzCore/AzCore/Debug/BudgetsComponent.cpp | 29 - .../AzCore/AzCore/Debug/BudgetsComponent.h | 31 - .../AzCore/AzCore/Debug/Profiler.cpp | 10 - Code/Framework/AzCore/AzCore/Debug/Profiler.h | 23 +- .../UnitTest/MockComponentApplication.h | 1 - .../AzCore/AzCore/azcore_files.cmake | 4 +- .../AzCore/Tests/BehaviorContextFixture.h | 1 - Code/Framework/AzCore/Tests/Driller.cpp | 698 ----------------- Code/Framework/AzCore/Tests/Serialization.cpp | 1 - .../AzCore/Tests/azcoretests_files.cmake | 1 - .../AzFramework/Application/Application.cpp | 3 - .../AzFramework/AzFrameworkModule.cpp | 2 - .../Driller/DrillToFileComponent.cpp | 197 ----- .../Driller/DrillToFileComponent.h | 74 -- .../AzFramework/Driller/DrillerConsoleAPI.h | 79 -- .../Driller/RemoteDrillerInterface.cpp | 740 ------------------ .../Driller/RemoteDrillerInterface.h | 217 ----- .../AzFramework/azframework_files.cmake | 5 - .../Application/GameApplication.cpp | 15 - .../AzGameFramework/AzGameFrameworkModule.cpp | 11 +- .../Core/EditorFrameworkApplication.cpp | 5 - .../Tests/ComponentAddRemove.cpp | 1 - Code/Legacy/CrySystem/SystemInit.cpp | 44 -- .../source/utils/applicationManager.cpp | 2 - .../Tests/Containers/SceneBehaviorTests.cpp | 1 - .../Code/Tests/AWSClientAuthGemMock.h | 1 - .../Code/Tests/ImageProcessing_Test.cpp | 1 - .../Source/RPI.Public/Material/Material.cpp | 2 +- .../Atom/RPI/Code/Source/RPI.Public/Scene.cpp | 4 +- .../Code/Tests.Builders/BuilderTestFixture.h | 1 - .../Tests/Common/AssetManagerTestFixture.h | 1 - .../Components/BlastSystemComponent.cpp | 2 +- .../Code/Tests/Builders/SliceBuilderTests.cpp | 1 - .../Code/Include/NvCloth/IFabricCooker.h | 3 + .../Code/Source/System/SystemComponent.cpp | 2 +- .../Code/Source/System/PhysXSdkCallbacks.cpp | 2 +- .../Include/ScriptCanvas/Core/EBusHandler.h | 3 + .../Code/Include/ScriptCanvas/Core/Node.cpp | 2 + .../Code/Include/ScriptCanvas/Data/Data.h | 2 + .../Execution/RuntimeComponent.cpp | 2 + .../Internal/Nodes/StringFormatted.cpp | 2 + .../Code/Tests/ScriptCanvasBuilderTests.cpp | 1 - 50 files changed, 191 insertions(+), 2288 deletions(-) create mode 100644 Code/Framework/AzCore/AzCore/Debug/BudgetTracker.cpp create mode 100644 Code/Framework/AzCore/AzCore/Debug/BudgetTracker.h delete mode 100644 Code/Framework/AzCore/AzCore/Debug/BudgetsComponent.cpp delete mode 100644 Code/Framework/AzCore/AzCore/Debug/BudgetsComponent.h delete mode 100644 Code/Framework/AzCore/Tests/Driller.cpp delete mode 100644 Code/Framework/AzFramework/AzFramework/Driller/DrillToFileComponent.cpp delete mode 100644 Code/Framework/AzFramework/AzFramework/Driller/DrillToFileComponent.h delete mode 100644 Code/Framework/AzFramework/AzFramework/Driller/DrillerConsoleAPI.h delete mode 100644 Code/Framework/AzFramework/AzFramework/Driller/RemoteDrillerInterface.cpp delete mode 100644 Code/Framework/AzFramework/AzFramework/Driller/RemoteDrillerInterface.h diff --git a/Code/Framework/AzCore/AzCore/AzCoreModule.cpp b/Code/Framework/AzCore/AzCore/AzCoreModule.cpp index db89598b6e..c60ea1bd72 100644 --- a/Code/Framework/AzCore/AzCore/AzCoreModule.cpp +++ b/Code/Framework/AzCore/AzCore/AzCoreModule.cpp @@ -10,7 +10,6 @@ // Component includes #include -#include #include #include #include @@ -36,7 +35,6 @@ namespace AZ JsonSystemComponent::CreateDescriptor(), AssetManagerComponent::CreateDescriptor(), UserSettingsComponent::CreateDescriptor(), - Debug::BudgetsComponent::CreateDescriptor(), SliceComponent::CreateDescriptor(), SliceSystemComponent::CreateDescriptor(), SliceMetadataInfoComponent::CreateDescriptor(), @@ -54,7 +52,6 @@ namespace AZ { return AZ::ComponentTypeList { - azrtti_typeid(), azrtti_typeid(), azrtti_typeid(), azrtti_typeid(), diff --git a/Code/Framework/AzCore/AzCore/Component/ComponentApplication.cpp b/Code/Framework/AzCore/AzCore/Component/ComponentApplication.cpp index 5c59ebc6ae..39b90a165b 100644 --- a/Code/Framework/AzCore/AzCore/Component/ComponentApplication.cpp +++ b/Code/Framework/AzCore/AzCore/Component/ComponentApplication.cpp @@ -593,6 +593,8 @@ namespace AZ CreateOSAllocator(); CreateSystemAllocator(); + m_budgetTracker.Init(); + // This can be moved to the ComponentApplication constructor if need be // This is reading the *.setreg files using SystemFile and merging the settings // to the settings registry. @@ -624,8 +626,6 @@ namespace AZ m_eventLogger->Start(outputPath.Native(), baseFileName); } - CreateDrillers(); - Sfmt::Create(); CreateReflectionManager(); @@ -745,12 +745,6 @@ namespace AZ ComponentApplicationBus::Handler::BusDisconnect(); TickRequestBus::Handler::BusDisconnect(); - if (m_drillerManager) - { - Debug::DrillerManager::Destroy(m_drillerManager); - m_drillerManager = nullptr; - } - m_eventLogger->Stop(); // Clear the descriptor to deallocate all strings (owned by ModuleDescriptor) @@ -898,31 +892,6 @@ namespace AZ allocatorManager.FinalizeConfiguration(); } - //========================================================================= - // CreateDrillers - // [2/20/2013] - //========================================================================= - void ComponentApplication::CreateDrillers() - { - // Create driller manager and register drillers if requested - if (m_descriptor.m_enableDrilling) - { - m_drillerManager = Debug::DrillerManager::Create(); - // Memory driller is responsible for tracking allocations. - // Tracking type and overhead is determined by app configuration. - - // Only one MemoryDriller is supported at a time - // Only create the memory driller if there is no handlers connected to the MemoryDrillerBus - if (!Debug::MemoryDrillerBus::HasHandlers()) - { - m_drillerManager->Register(aznew Debug::MemoryDriller); - } - // Trace messages driller will consume resources only when started. - m_drillerManager->Register(aznew Debug::TraceMessagesDriller); - m_drillerManager->Register(aznew Debug::EventTraceDriller); - } - } - void ComponentApplication::MergeSettingsToRegistry(SettingsRegistryInterface& registry) { SettingsRegistryInterface::Specializations specializations; @@ -1413,10 +1382,6 @@ namespace AZ EBUS_EVENT(TickBus, OnTick, m_deltaTime, ScriptTimePoint(now)); } } - if (m_drillerManager) - { - m_drillerManager->FrameUpdate(); - } } //========================================================================= diff --git a/Code/Framework/AzCore/AzCore/Component/ComponentApplication.h b/Code/Framework/AzCore/AzCore/Component/ComponentApplication.h index d2da86c368..609b683836 100644 --- a/Code/Framework/AzCore/AzCore/Component/ComponentApplication.h +++ b/Code/Framework/AzCore/AzCore/Component/ComponentApplication.h @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -225,11 +226,6 @@ namespace AZ /// Returns the path to the folder the executable is in. const char* GetExecutableFolder() const override { return m_exeDirectory.c_str(); } - - /// Returns pointer to the driller manager if it's enabled, otherwise NULL. - Debug::DrillerManager* GetDrillerManager() override { return m_drillerManager; } - ////////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////////// /// TickRequestBus float GetTickDeltaTime() override; @@ -324,9 +320,6 @@ namespace AZ /// Create the system allocator using the data in the m_descriptor void CreateSystemAllocator(); - /// Create the drillers - void CreateDrillers(); - virtual void MergeSettingsToRegistry(SettingsRegistryInterface& registry); //! Sets the specializations that will be used when loading the Settings Registry. Extend this in derived @@ -409,7 +402,7 @@ namespace AZ char m_commandLineBuffer[AZ_MAX_PATH_LEN]; char* m_commandLineBufferAddress{ m_commandLineBuffer }; - Debug::DrillerManager* m_drillerManager{ nullptr }; + AZ::Debug::BudgetTracker m_budgetTracker; StartupParameters m_startupParameters; diff --git a/Code/Framework/AzCore/AzCore/Component/ComponentApplicationBus.h b/Code/Framework/AzCore/AzCore/Component/ComponentApplicationBus.h index 1e4a9082f7..0c0977384a 100644 --- a/Code/Framework/AzCore/AzCore/Component/ComponentApplicationBus.h +++ b/Code/Framework/AzCore/AzCore/Component/ComponentApplicationBus.h @@ -187,11 +187,6 @@ namespace AZ //! @return a pointer to the name of the path that contains the application's executable. virtual const char* GetExecutableFolder() const = 0; - //! Returns a pointer to the driller manager, if driller is enabled. - //! The driller manager manages all active driller sessions and driller factories. - //! @return A pointer to the driller manager. If driller is not enabled, this function returns null. - virtual Debug::DrillerManager* GetDrillerManager() = 0; - //! ResolveModulePath is called whenever LoadDynamicModule wants to resolve a module in order to actually load it. //! You can override this if you need to load modules from a different path or hijack module loading in some other way. //! If you do, ensure that you use platform-specific conventions to do so, as this is called by multiple platforms. diff --git a/Code/Framework/AzCore/AzCore/Debug/Budget.cpp b/Code/Framework/AzCore/AzCore/Debug/Budget.cpp index 1337ca5a31..5f17752f2a 100644 --- a/Code/Framework/AzCore/AzCore/Debug/Budget.cpp +++ b/Code/Framework/AzCore/AzCore/Debug/Budget.cpp @@ -10,6 +10,7 @@ #include #include +#include AZ_DEFINE_BUDGET(AzCore); AZ_DEFINE_BUDGET(Editor); @@ -21,25 +22,46 @@ AZ_DEFINE_BUDGET(Animation); namespace AZ::Debug { - // Global container for all registered budgets - class BudgetRegistry + struct BudgetImpl { - public: - static BudgetRegistry& Instance() - { - } - - private: + AZ_CLASS_ALLOCATOR(BudgetImpl, AZ::SystemAllocator, 0); + // TODO: Budget implementation for tracking budget wall time per-core, memory, etc. }; - void Budget::ResetAll() - { - } - Budget::Budget(const char* name) : m_name{ name } , m_crc{ Crc32(name) } { - // TODO: Register budget with singleton budget registry + m_impl = aznew BudgetImpl; + } + + Budget::~Budget() + { + if (m_impl) + { + delete m_impl; + } + } + + // TODO:Budgets Methods below are stubbed pending future work to both update budget data and visualize it + + void Budget::PerFrameReset() + { + } + + void Budget::BeginProfileRegion() + { + } + + void Budget::EndProfileRegion() + { + } + + void Budget::TrackAllocation(uint64_t) + { + } + + void Budget::UntrackAllocation(uint64_t) + { } } // namespace AZ::Debug diff --git a/Code/Framework/AzCore/AzCore/Debug/Budget.h b/Code/Framework/AzCore/AzCore/Debug/Budget.h index 89b3fa10b3..ce11469f81 100644 --- a/Code/Framework/AzCore/AzCore/Debug/Budget.h +++ b/Code/Framework/AzCore/AzCore/Debug/Budget.h @@ -7,9 +7,8 @@ */ #pragma once -#include -#include #include +#include #pragma warning(push) // This warning must be disabled because Budget::Get may not have an implementation if this file is transitively included @@ -24,9 +23,6 @@ namespace AZ::Debug class Budget final { public: - // Invoked once at the start of the frame to reset per-frame counters - static void ResetAll(); - // If you encounter a linker error complaining that this function is not defined, you have likely forgotten to either // define or declare the budget used in a profile or memory marker. See AZ_DEFINE_BUDGET and AZ_DECLARE_BUDGET below // for usage. @@ -34,6 +30,13 @@ namespace AZ::Debug static Budget* Get(); explicit Budget(const char* name); + ~Budget(); + + void PerFrameReset(); + void BeginProfileRegion(); + void EndProfileRegion(); + void TrackAllocation(uint64_t bytes); + void UntrackAllocation(uint64_t bytes); const char* Name() const { @@ -48,11 +51,14 @@ namespace AZ::Debug private: const char* m_name; uint32_t m_crc; + struct BudgetImpl* m_impl = nullptr; }; } // namespace AZ::Debug #pragma warning(pop) -#define AZ_BUDGET_NAME(name) AzBudget##name +// Budgets are registered and retrieved using the proxy type specialization of Budget::Get. The type itself has no declaration/definition +// other than this forward type pointer declaration +#define AZ_BUDGET_PROXY_TYPE(name) class AzBudget##name* // Usage example: // In a single C++ source file: @@ -62,45 +68,26 @@ namespace AZ::Debug // AZ_DECLARE_BUDGET(AzCore); // // The budget is usable in the same file it was defined without needing an additional declaration - -// Implementation notes: -// Every budget definition is declared in static storage along with the environment variable and mutex. This imposes a slight -// memory overhead in the data segment only in instances where the same static module defining a budget is linked against multiple -// DLLs, however, this simplifies the implementation and works regardless of whether the budget is defined in a static or dynamic -// library. When loading the budget, a relaxed load is sufficient because Environment::CreateVariable internally locks and returns -// the element found if the environment variable was already created (skipping construction in the process). Thus, the budget pointer -// will reference the statically stored budget for the first thread that grabs the lock. #define AZ_DEFINE_BUDGET(name) \ template<> \ - ::AZ::Debug::Budget* ::AZ::Debug::Budget::Get() \ + ::AZ::Debug::Budget* ::AZ::Debug::Budget::Get() \ { \ - static ::AZStd::mutex s_azBudgetMutex##name; \ - static ::AZ::EnvironmentVariable<::AZ::Debug::Budget*> s_azBudgetEnv##name; \ - static ::AZ::Debug::Budget s_azBudget##name{ #name }; \ static ::AZStd::atomic<::AZ::Debug::Budget*> budget; \ - ::AZ::Debug::Budget* out = budget.load(AZStd::memory_order_relaxed); \ + ::AZ::Debug::Budget* out = budget.load(AZStd::memory_order_acquire); \ if (out) \ { \ return out; \ } \ else \ { \ - { \ - AZStd::scoped_lock lock{ s_azBudgetMutex##name }; \ - if (!s_azBudgetEnv##name) \ - { \ - s_azBudgetEnv##name = ::AZ::Environment::CreateVariable<::AZ::Debug::Budget*>("budgetEnv" #name, &s_azBudget##name); \ - } \ - } \ - out = *s_azBudgetEnv##name; \ - budget = out; \ - return out; \ + budget.store(&::AZ::Debug::BudgetTracker::GetBudgetFromEnvironment(#name), AZStd::memory_order_release); \ + return budget; \ } \ } // If using a budget defined in a different C++ source file, add AZ_DECLARE_BUDGET(yourBudget); somewhere in your source file at namespace // scope Alternatively, AZ_DECLARE_BUDGET can be used in a header to declare the budget for use across any users of the header -#define AZ_DECLARE_BUDGET(name) extern template ::AZ::Debug::Budget* ::AZ::Debug::Budget::Get() +#define AZ_DECLARE_BUDGET(name) extern template ::AZ::Debug::Budget* ::AZ::Debug::Budget::Get() // Declare budgets that are core engine budgets, or may be shared/needed across multiple external gems // You should NOT need to declare user-space or budgets with isolated usage here. Prefer declaring them local to the module(s) that use diff --git a/Code/Framework/AzCore/AzCore/Debug/BudgetTracker.cpp b/Code/Framework/AzCore/AzCore/Debug/BudgetTracker.cpp new file mode 100644 index 0000000000..c58c92deb2 --- /dev/null +++ b/Code/Framework/AzCore/AzCore/Debug/BudgetTracker.cpp @@ -0,0 +1,61 @@ +/* + * Copyright (c) Contributors to the Open 3D Engine Project. + * For complete copyright and license terms please see the LICENSE at the root of this distribution. + * + * SPDX-License-Identifier: Apache-2.0 OR MIT + * + */ + +#include + +#include +#include +#include +#include +#include + +namespace AZ::Debug +{ + constexpr static const char* BudgetTrackerEnvName = "budgetTrackerEnv"; + + struct BudgetTrackerImpl + { + AZ_CLASS_ALLOCATOR(BudgetTrackerImpl, AZ::SystemAllocator, 0); + + AZStd::unordered_map m_budgets; + }; + + Budget& BudgetTracker::GetBudgetFromEnvironment(const char* budgetName) + { + return (*Environment::FindVariable(BudgetTrackerEnvName))->GetBudget(budgetName); + } + + BudgetTracker::~BudgetTracker() + { + if (m_impl) + { + delete m_impl; + } + } + + void BudgetTracker::Init() + { + AZ_Assert(!m_impl, "BudgetTracker::Init called more than once"); + + m_impl = aznew BudgetTrackerImpl; + m_envVar = Environment::CreateVariable(BudgetTrackerEnvName, this); + } + + Budget& BudgetTracker::GetBudget(const char* budgetName) + { + AZStd::scoped_lock lock{ m_mutex }; + + auto it = m_impl->m_budgets.find(budgetName); + if (it == m_impl->m_budgets.end()) + { + it = m_impl->m_budgets.emplace(budgetName, budgetName).first; + } + + return it->second; + } +} // namespace AZ::Debug diff --git a/Code/Framework/AzCore/AzCore/Debug/BudgetTracker.h b/Code/Framework/AzCore/AzCore/Debug/BudgetTracker.h new file mode 100644 index 0000000000..bd4953c545 --- /dev/null +++ b/Code/Framework/AzCore/AzCore/Debug/BudgetTracker.h @@ -0,0 +1,38 @@ +/* + * Copyright (c) Contributors to the Open 3D Engine Project. + * For complete copyright and license terms please see the LICENSE at the root of this distribution. + * + * SPDX-License-Identifier: Apache-2.0 OR MIT + * + */ + +#pragma once + +#include +#include + +namespace AZ::Debug +{ + class Budget; + + class BudgetTracker + { + public: + static Budget& GetBudgetFromEnvironment(const char* budgetName); + + ~BudgetTracker(); + + void Init(); + + Budget& GetBudget(const char* budgetName); + + private: + AZStd::mutex m_mutex; + AZ::EnvironmentVariable m_envVar; + + // The BudgetTracker is likely included in proportionally high number of files throughout the + // engine, so indirection is used here to avoid imposing excessive recompilation in periods + // while the budget system is iterated on. + struct BudgetTrackerImpl* m_impl = nullptr; + }; +} // namespace AZ::Debug diff --git a/Code/Framework/AzCore/AzCore/Debug/BudgetsComponent.cpp b/Code/Framework/AzCore/AzCore/Debug/BudgetsComponent.cpp deleted file mode 100644 index d61694b6ff..0000000000 --- a/Code/Framework/AzCore/AzCore/Debug/BudgetsComponent.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#include - -namespace AZ::Debug -{ - void BudgetsComponent::Reflect(AZ::ReflectContext*) - { - } - - BudgetsComponent::BudgetsComponent() - { - } - - BudgetsComponent::~BudgetsComponent() - { - } - - void BudgetsComponent::Init() - { - } - - void BudgetsComponent::Activate() - { - } - - void BudgetsComponent::Deactivate() - { - } - -} // namespace AZ::Debug diff --git a/Code/Framework/AzCore/AzCore/Debug/BudgetsComponent.h b/Code/Framework/AzCore/AzCore/Debug/BudgetsComponent.h deleted file mode 100644 index 31790cb642..0000000000 --- a/Code/Framework/AzCore/AzCore/Debug/BudgetsComponent.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#pragma once - -#include - -namespace AZ::Debug -{ - class BudgetsComponent : public Component - { - public: - AZ_COMPONENT(AZ::Debug::BudgetsComponent, "{52063706-5B36-4B24-A781-B49AFDBB5BC5}"); - - static void Reflect(AZ::ReflectContext* context); - - BudgetsComponent(); - ~BudgetsComponent() override; - - void Init() override; - void Activate() override; - void Deactivate() override; - - private: - }; -} // namespace AZ::Debug diff --git a/Code/Framework/AzCore/AzCore/Debug/Profiler.cpp b/Code/Framework/AzCore/AzCore/Debug/Profiler.cpp index eb9158ad56..0bb92b923d 100644 --- a/Code/Framework/AzCore/AzCore/Debug/Profiler.cpp +++ b/Code/Framework/AzCore/AzCore/Debug/Profiler.cpp @@ -8,13 +8,3 @@ #include -#include - -namespace AZ::Debug -{ - uint32_t ProfileScope::GetSystemID(const char* system) - { - // TODO: stable ids for registered budgets - return AZ::Crc32(system); - } -} // namespace AZ::Debug diff --git a/Code/Framework/AzCore/AzCore/Debug/Profiler.h b/Code/Framework/AzCore/AzCore/Debug/Profiler.h index 3d88fb784c..a24c5af052 100644 --- a/Code/Framework/AzCore/AzCore/Debug/Profiler.h +++ b/Code/Framework/AzCore/AzCore/Debug/Profiler.h @@ -29,15 +29,15 @@ #define AZ_PROFILE_SCOPE(budget, ...) \ ::AZ::Debug::ProfileScope AZ_JOIN(azProfileScope, __LINE__) \ { \ - *::AZ::Debug::Budget::Get(), __VA_ARGS__ \ + *::AZ::Debug::Budget::Get(), __VA_ARGS__ \ } #define AZ_PROFILE_FUNCTION(category) AZ_PROFILE_SCOPE(category, AZ_FUNCTION_SIGNATURE) // Prefer using the scoped macros which automatically end the event (AZ_PROFILE_SCOPE/AZ_PROFILE_FUNCTION) #define AZ_PROFILE_BEGIN(budget, ...) \ - ::AZ::Debug::ProfileScope::BeginRegion(*::AZ::Debug::Budget::Get(), __VA_ARGS__) -#define AZ_PROFILE_END() ::AZ::Debug::ProfileScope::EndRegion() + ::AZ::Debug::ProfileScope::BeginRegion(*::AZ::Debug::Budget::Get(), __VA_ARGS__) +#define AZ_PROFILE_END(budget) ::AZ::Debug::ProfileScope::EndRegion(*::AZ::Debug::Budget::Get()) #endif // AZ_PROFILER_MACRO_DISABLE @@ -63,26 +63,25 @@ namespace AZ::Debug class ProfileScope { public: - static uint32_t GetSystemID(const char* system); - template - static void BeginRegion( - [[maybe_unused]] const Budget& budget, [[maybe_unused]] const char* eventName, [[maybe_unused]] T const&... args) + static void BeginRegion([[maybe_unused]] Budget& budget, [[maybe_unused]] const char* eventName, [[maybe_unused]] T const&... args) { #if !defined(_RELEASE) // TODO: Verification that the supplied system name corresponds to a known budget #if defined(USE_PIX) PIXBeginEvent(PIX_COLOR_INDEX(budget.Crc() & 0xff), eventName, args...); #endif + budget.BeginProfileRegion(); // TODO: injecting instrumentation for other profilers // NOTE: external profiler registration won't occur inline in a header necessarily in this manner, but the exact mechanism // will be introduced in a future PR #endif } - static void EndRegion() + static void EndRegion([[maybe_unused]] Budget& budget) { #if !defined(_RELEASE) + budget.EndProfileRegion(); #if defined(USE_PIX) PIXEndEvent(); #endif @@ -90,15 +89,19 @@ namespace AZ::Debug } template - ProfileScope(const Budget& budget, char const* eventName, T const&... args) + ProfileScope(Budget& budget, char const* eventName, T const&... args) + : m_budget{ budget } { BeginRegion(budget, eventName, args...); } ~ProfileScope() { - EndRegion(); + EndRegion(m_budget); } + + private: + Budget& m_budget; }; } // namespace AZ::Debug diff --git a/Code/Framework/AzCore/AzCore/UnitTest/MockComponentApplication.h b/Code/Framework/AzCore/AzCore/UnitTest/MockComponentApplication.h index a23414700a..8f069da9dd 100644 --- a/Code/Framework/AzCore/AzCore/UnitTest/MockComponentApplication.h +++ b/Code/Framework/AzCore/AzCore/UnitTest/MockComponentApplication.h @@ -44,7 +44,6 @@ namespace UnitTest MOCK_CONST_METHOD0(GetAppRoot, const char* ()); MOCK_CONST_METHOD0(GetEngineRoot, const char* ()); MOCK_CONST_METHOD0(GetExecutableFolder, const char* ()); - MOCK_METHOD0(GetDrillerManager, AZ::Debug::DrillerManager* ()); MOCK_CONST_METHOD1(QueryApplicationType, void(AZ::ApplicationTypeQuery&)); }; } // namespace UnitTest diff --git a/Code/Framework/AzCore/AzCore/azcore_files.cmake b/Code/Framework/AzCore/AzCore/azcore_files.cmake index 85b15b3e3d..745054855b 100644 --- a/Code/Framework/AzCore/AzCore/azcore_files.cmake +++ b/Code/Framework/AzCore/AzCore/azcore_files.cmake @@ -95,8 +95,8 @@ set(FILES Debug/AssetTrackingTypes.h Debug/Budget.h Debug/Budget.cpp - Debug/BudgetsComponent.h - Debug/BudgetsComponent.cpp + Debug/BudgetTracker.h + Debug/BudgetTracker.cpp Debug/LocalFileEventLogger.h Debug/LocalFileEventLogger.cpp Debug/IEventLogger.h diff --git a/Code/Framework/AzCore/Tests/BehaviorContextFixture.h b/Code/Framework/AzCore/Tests/BehaviorContextFixture.h index f6a8d8430c..1895f2e35b 100644 --- a/Code/Framework/AzCore/Tests/BehaviorContextFixture.h +++ b/Code/Framework/AzCore/Tests/BehaviorContextFixture.h @@ -62,7 +62,6 @@ namespace UnitTest const char* GetAppRoot() const override { return nullptr; } const char* GetEngineRoot() const override { return nullptr; } const char* GetExecutableFolder() const override { return nullptr; } - AZ::Debug::DrillerManager* GetDrillerManager() override { return nullptr; } void EnumerateEntities(const EntityCallback& /*callback*/) override {} void QueryApplicationType(AZ::ApplicationTypeQuery& /*appType*/) const override {} //// diff --git a/Code/Framework/AzCore/Tests/Driller.cpp b/Code/Framework/AzCore/Tests/Driller.cpp deleted file mode 100644 index e135a23808..0000000000 --- a/Code/Framework/AzCore/Tests/Driller.cpp +++ /dev/null @@ -1,698 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ -#include - -#include - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -//#define AZ_CORE_DRILLER_COMPARE_TEST -#if defined(AZ_CORE_DRILLER_COMPARE_TEST) -# include -# include -# include -#endif - -#include - -using namespace AZ; -using namespace AZ::Debug; - -namespace UnitTest -{ - /** - * MyDriller event bus... - */ - class MyDrillerInterface - : public AZ::Debug::DrillerEBusTraits - { - public: - virtual ~MyDrillerInterface() {} - // define one event X - virtual void OnEventX(int data) = 0; - // define a string event - virtual void OnStringEvent() = 0; - }; - - class MyDrillerCommandInterface - : public AZ::Debug::DrillerEBusTraits - { - public: - virtual ~MyDrillerCommandInterface() {} - - virtual class MyDrilledObject* RequestDrilledObject() = 0; - }; - - typedef AZ::EBus MyDrillerBus; - typedef AZ::EBus MyDrillerCommandBus; - - class MyDrilledObject - : public MyDrillerCommandBus::Handler - { - int i; - public: - MyDrilledObject() - : i(0) - { - BusConnect(); - } - - ~MyDrilledObject() override - { - BusDisconnect(); - } - ////////////////////////////////////////////////////////////////////////// - // MyDrillerCommandBus - MyDrilledObject* RequestDrilledObject() override - { - return this; - } - ////////////////////////////////////////////////////////////////////////// - void OnEventX() - { - EBUS_EVENT(MyDrillerBus, OnEventX, i); - ++i; - } - - void OnStringEvent() - { - EBUS_DBG_EVENT(MyDrillerBus, OnStringEvent); - } - }; - - - /** - * My driller implements the driller interface and an handles the MyDrillerBus events... - */ - class MyDriller - : public Driller - , public MyDrillerBus::Handler - { - bool m_isDetailedCapture; - class MyDrilledObject* drilledObject; - typedef vector::type ParamArrayType; - ParamArrayType m_params; - public: - AZ_CLASS_ALLOCATOR(MyDriller, OSAllocator, 0); - - const char* GroupName() const override { return "TestDrillers"; } - const char* GetName() const override { return "MyTestDriller"; } - const char* GetDescription() const override { return "MyTestDriller description...."; } - int GetNumParams() const override { return static_cast(m_params.size()); } - const Param* GetParam(int index) const override { return &m_params[index]; } - - MyDriller() - : m_isDetailedCapture(false) - , drilledObject(NULL) - { - Param isDetailed; - isDetailed.desc = "IsDetailedDrill"; - isDetailed.name = AZ_CRC("IsDetailedDrill", 0x2155cef2); - isDetailed.type = Param::PT_BOOL; - isDetailed.value = 0; - m_params.push_back(isDetailed); - } - - void Start(const Param* params = NULL, int numParams = 0) override - { - m_isDetailedCapture = m_params[0].value != 0; - if (params) - { - for (int i = 0; i < numParams; i++) - { - if (params[i].name == m_params[0].name) - { - m_isDetailedCapture = params[i].value != 0; - } - } - } - - EBUS_EVENT_RESULT(drilledObject, MyDrillerCommandBus, RequestDrilledObject); - AZ_TEST_ASSERT(drilledObject != NULL); /// Make sure we have our object by the time we started the driller - - m_output->BeginTag(AZ_CRC("MyDriller", 0xc3b7dceb)); - m_output->Write(AZ_CRC("OnStart", 0x8b372fca), m_isDetailedCapture); - // write drilled object initial state - m_output->EndTag(AZ_CRC("MyDriller", 0xc3b7dceb)); - - BusConnect(); - } - void Stop() override - { - drilledObject = NULL; - m_output->BeginTag(AZ_CRC("MyDriller", 0xc3b7dceb)); - m_output->Write(AZ_CRC("OnStop", 0xf6701caa), m_isDetailedCapture); - m_output->EndTag(AZ_CRC("MyDriller", 0xc3b7dceb)); - BusDisconnect(); - } - - void OnEventX(int data) override - { - void* ptr = AZ_INVALID_POINTER; - float f = 3.2f; - m_output->BeginTag(AZ_CRC("MyDriller", 0xc3b7dceb)); - m_output->Write(AZ_CRC("EventX", 0xc4558ec2), data); - m_output->Write(AZ_CRC("Pointer", 0x320468a8), ptr); - m_output->Write(AZ_CRC("Float", 0xc9a55e95), f); - m_output->EndTag(AZ_CRC("MyDriller", 0xc3b7dceb)); - } - - void OnStringEvent() override - { - m_output->BeginTag(AZ_CRC("MyDriller", 0xc3b7dceb)); - m_output->BeginTag(AZ_CRC("StringEvent", 0xd1e005df)); - m_output->Write(AZ_CRC("StringOne", 0x56efb231), "This is copied string"); - m_output->Write(AZ_CRC("StringTwo", 0x3d49bea6), "This is referenced string", false); // don't copy the string if we use string pool, this will be faster as we don't delete the string - m_output->EndTag(AZ_CRC("StringEvent", 0xd1e005df)); - m_output->EndTag(AZ_CRC("MyDriller", 0xc3b7dceb)); - } - }; - - /** - * - */ - class FileStreamDrillerTest - : public AllocatorsFixture - { - DrillerManager* m_drillerManager = nullptr; - MyDriller* m_driller = nullptr; - public: - void SetUp() override - { - AllocatorsFixture::SetUp(); - - m_drillerManager = DrillerManager::Create(); - m_driller = aznew MyDriller; - // Register driller descriptor - m_drillerManager->Register(m_driller); - // check that our driller descriptor is registered - AZ_TEST_ASSERT(m_drillerManager->GetNumDrillers() == 1); - } - - void TearDown() override - { - // remove our driller descriptor - m_drillerManager->Unregister(m_driller); - AZ_TEST_ASSERT(m_drillerManager->GetNumDrillers() == 0); - DrillerManager::Destroy(m_drillerManager); - - AllocatorsFixture::TearDown(); - } - - /** - * My Driller data handler. - */ - class MyDrillerHandler - : public DrillerHandlerParser - { - public: - static const bool s_isWarnOnMissingDrillers = true; - int m_lastData; - - MyDrillerHandler() - : m_lastData(-1) {} - - // From the template query - DrillerHandlerParser* FindDrillerHandler(u32 drillerId) - { - if (drillerId == AZ_CRC("MyDriller", 0xc3b7dceb)) - { - return this; - } - return NULL; - } - - DrillerHandlerParser* OnEnterTag(u32 tagName) override - { - (void)tagName; - return NULL; - } - void OnData(const DrillerSAXParser::Data& dataNode) override - { - if (dataNode.m_name == AZ_CRC("OnStart", 0x8b372fca) || dataNode.m_name == AZ_CRC("OnStop", 0xf6701caa)) - { - bool isDetailedCapture; - dataNode.Read(isDetailedCapture); - AZ_TEST_ASSERT(isDetailedCapture == true); - } - else if (dataNode.m_name == AZ_CRC("EventX", 0xc4558ec2)) - { - int data; - dataNode.Read(data); - AZ_TEST_ASSERT(data > m_lastData); - m_lastData = data; - } - else if (dataNode.m_name == AZ_CRC("Pointer", 0x320468a8)) - { - AZ::u64 pointer = 0; //< read pointers in u64 to cover all platforms - dataNode.Read(pointer); - AZ_TEST_ASSERT(pointer == 0x0badf00dul); - } - else if (dataNode.m_name == AZ_CRC("Float", 0xc9a55e95)) - { - float f; - dataNode.Read(f); - AZ_TEST_ASSERT(f == 3.2f); - } - } - }; - - ////////////////////////////////////////////////////////////////////////// - - void run() - { - // get our driller descriptor - Driller* driller = m_drillerManager->GetDriller(0); - AZ_TEST_ASSERT(driller != NULL); - AZ_TEST_ASSERT(strcmp(driller->GetName(), "MyTestDriller") == 0); - AZ_TEST_ASSERT(driller->GetNumParams() == 1); - - // read the default params and make a copy... - Driller::Param param = *driller->GetParam(0); - AZ_TEST_ASSERT(strcmp(param.desc, "IsDetailedDrill") == 0); - AZ_TEST_ASSERT(param.name == AZ_CRC("IsDetailedDrill", 0x2155cef2)); - AZ_TEST_ASSERT(param.type == Driller::Param::PT_BOOL); - // tweak the default params by enabling detailed drilling - param.value = 1; - - // create a list of driller we what to drill - DrillerManager::DrillerListType dillersToDrill; - DrillerManager::DrillerInfo di; - di.id = driller->GetId(); // set driller id - di.params.push_back(param); // set driller custom params - dillersToDrill.push_back(di); - - // open a driller output file stream - // open a driller output file stream - AZStd::string testFileName = GetTestFolderPath() + "drilltest.dat"; - DrillerOutputFileStream drillerOutputStream; - drillerOutputStream.Open(testFileName.c_str(), IO::SystemFile::SF_OPEN_CREATE | IO::SystemFile::SF_OPEN_WRITE_ONLY); - - ////////////////////////////////////////////////////////////////////////// - // Drill an object - MyDrilledObject myDrilledObject; - clock_t st = clock(); - - // start a driller session with the file stream and the list of drillers - DrillerSession* drillerSession = m_drillerManager->Start(drillerOutputStream, dillersToDrill); - // update for N frames - for (int i = 0; i < AZ_TRAIT_UNIT_TEST_DILLER_TRIGGER_EVENT_COUNT; ++i) - { - // trigger event X that we want to drill... - myDrilledObject.OnEventX(); - m_drillerManager->FrameUpdate(); - } - // stop the drillers - m_drillerManager->Stop(drillerSession); - // Stop writing and flush all data - drillerOutputStream.Close(); - AZ_Printf("Driller", "Compression time %.09f seconds\n", (double)(clock() - st) / CLOCKS_PER_SEC); - ////////////////////////////////////////////////////////////////////////// - - ////////////////////////////////////////////////////////////////////////// - // try to load the drill data - DrillerInputFileStream drillerInputStream; - drillerInputStream.Open(testFileName.c_str(), IO::SystemFile::SF_OPEN_READ_ONLY); - DrillerDOMParser dp; - AZ_TEST_ASSERT(dp.CanParse() == true); - dp.ProcessStream(drillerInputStream); - AZ_TEST_ASSERT(dp.CanParse() == true); - drillerInputStream.Close(); - - u32 startDataId = AZ_CRC("StartData", 0xecf3f53f); - u32 frameId = AZ_CRC("Frame", 0xb5f83ccd); - - ////////////////////////////////////////////////////////////////////////// - // read all data - const DrillerDOMParser::Node* root = dp.GetRootNode(); - int lastFrame = -1; - int lastData = -1; - for (DrillerDOMParser::Node::NodeListType::const_iterator iter = root->m_tags.begin(); iter != root->m_tags.end(); ++iter) - { - const DrillerDOMParser::Node* node = &*iter; - u32 name = node->m_name; - AZ_TEST_ASSERT(name == startDataId || name == frameId); - if (name == startDataId) - { - unsigned int currentPlatform; - node->GetDataRequired(AZ_CRC("Platform", 0x3952d0cb))->Read(currentPlatform); - AZ_TEST_ASSERT(currentPlatform == static_cast(AZ::g_currentPlatform)); - const DrillerDOMParser::Node* drillerNode = node->GetTag(AZ_CRC("Driller", 0xa6e1fb73)); - AZ_TEST_ASSERT(drillerNode != NULL); - AZ::u32 drillerName; - drillerNode->GetDataRequired(AZ_CRC("Name", 0x5e237e06))->Read(drillerName); - AZ_TEST_ASSERT(drillerName == m_driller->GetId()); - const DrillerDOMParser::Node* paramNode = drillerNode->GetTag(AZ_CRC("Param", 0xa4fa7c89)); - AZ_TEST_ASSERT(paramNode != NULL); - u32 paramName; - char paramDesc[128]; - int paramType; - int paramValue; - paramNode->GetDataRequired(AZ_CRC("Name", 0x5e237e06))->Read(paramName); - AZ_TEST_ASSERT(paramName == param.name); - paramNode->GetDataRequired(AZ_CRC("Description", 0x6de44026))->Read(paramDesc, AZ_ARRAY_SIZE(paramDesc)); - AZ_TEST_ASSERT(strcmp(paramDesc, param.desc) == 0); - paramNode->GetDataRequired(AZ_CRC("Type", 0x8cde5729))->Read(paramType); - AZ_TEST_ASSERT(paramType == param.type); - paramNode->GetDataRequired(AZ_CRC("Value", 0x1d775834))->Read(paramValue); - AZ_TEST_ASSERT(paramValue == param.value); - } - else - { - int curFrame; - node->GetDataRequired(AZ_CRC("FrameNum", 0x85a1a919))->Read(curFrame); - AZ_TEST_ASSERT(curFrame > lastFrame); // check order - lastFrame = curFrame; - const DrillerDOMParser::Node* myDrillerNode = node->GetTag(AZ_CRC("MyDriller", 0xc3b7dceb)); - AZ_TEST_ASSERT(myDrillerNode != NULL); - const DrillerDOMParser::Data* dataEntry; - dataEntry = myDrillerNode->GetData(AZ_CRC("EventX", 0xc4558ec2)); - if (dataEntry) - { - int data; - dataEntry->Read(data); - AZ_TEST_ASSERT(data > lastData); - lastData = data; - dataEntry = myDrillerNode->GetData(AZ_CRC("Pointer", 0x320468a8)); - AZ_TEST_ASSERT(dataEntry); - unsigned int ptr; - dataEntry->Read(ptr); - AZ_TEST_ASSERT(static_cast(ptr) == reinterpret_cast(AZ_INVALID_POINTER)); - float f; - dataEntry = myDrillerNode->GetData(AZ_CRC("Float", 0xc9a55e95)); - AZ_TEST_ASSERT(dataEntry); - dataEntry->Read(f); - AZ_TEST_ASSERT(f == 3.2f); - } - else - { - bool isDetailedCapture; - dataEntry = myDrillerNode->GetData(AZ_CRC("OnStart", 0x8b372fca)); - if (dataEntry) - { - dataEntry->Read(isDetailedCapture); - } - else - { - myDrillerNode->GetDataRequired(AZ_CRC("OnStop", 0xf6701caa))->Read(isDetailedCapture); - } - AZ_TEST_ASSERT(isDetailedCapture == true); - } - } - } - ////////////////////////////////////////////////////////////////////////// - - ////////////////////////////////////////////////////////////////////////// - // Read that with Tag Handlers - drillerInputStream.Open(testFileName.c_str(), IO::SystemFile::SF_OPEN_READ_ONLY); - - DrillerRootHandler rootHandler; - DrillerSAXParserHandler dhp(&rootHandler); - dhp.ProcessStream(drillerInputStream); - // Verify that Default templates forked fine... - AZ_TEST_ASSERT(rootHandler.m_drillerSessionInfo.m_platform == static_cast(AZ::g_currentPlatform)); - AZ_TEST_ASSERT(rootHandler.m_drillerSessionInfo.m_drillers.size() == 1); - { - const DrillerManager::DrillerInfo& dinfo = rootHandler.m_drillerSessionInfo.m_drillers.front(); - AZ_TEST_ASSERT(dinfo.id == AZ_CRC("MyTestDriller", 0x5cc4edf5)); - AZ_TEST_ASSERT(dinfo.params.size() == 1); - AZ_TEST_ASSERT(strcmp(param.desc, "IsDetailedDrill") == 0); - AZ_TEST_ASSERT(param.name == AZ_CRC("IsDetailedDrill", 0x2155cef2)); - AZ_TEST_ASSERT(param.type == Driller::Param::PT_BOOL); - // tweak the default params by enabling detailed drilling - param.value = 1; - AZ_TEST_ASSERT(dinfo.params[0].name == AZ_CRC("IsDetailedDrill", 0x2155cef2)); - AZ_TEST_ASSERT(dinfo.params[0].desc == NULL); // ignored for now - AZ_TEST_ASSERT(dinfo.params[0].type == Driller::Param::PT_BOOL); - AZ_TEST_ASSERT(dinfo.params[0].value == 1); - } - drillerInputStream.Close(); - ////////////////////////////////////////////////////////////////////////// - - ////////////////////////////////////////////////////////////////////////// - // - - ////////////////////////////////////////////////////////////////////////// - } - }; - - TEST_F(FileStreamDrillerTest, Test) - { - run(); - } - - /** - * - */ - class StringPoolDrillerTest - : public AllocatorsFixture - { - DrillerManager* m_drillerManager = nullptr; - MyDriller* m_driller = nullptr; - public: - void SetUp() override - { - AllocatorsFixture::SetUp(); - - m_drillerManager = DrillerManager::Create(); - m_driller = aznew MyDriller; - // Register driller descriptor - m_drillerManager->Register(m_driller); - // check that our driller descriptor is registered - AZ_TEST_ASSERT(m_drillerManager->GetNumDrillers() == 1); - } - - void TearDown() override - { - // remove our driller descriptor - m_drillerManager->Unregister(m_driller); - AZ_TEST_ASSERT(m_drillerManager->GetNumDrillers() == 0); - DrillerManager::Destroy(m_drillerManager); - - AllocatorsFixture::TearDown(); - } - - /** - * My Driller data handler. - */ - class MyDrillerHandler - : public DrillerHandlerParser - { - public: - static const bool s_isWarnOnMissingDrillers = true; - - MyDrillerHandler() {} - - // From the template query - DrillerHandlerParser* FindDrillerHandler(u32 drillerId) - { - if (drillerId == AZ_CRC("MyDriller", 0xc3b7dceb)) - { - return this; - } - return NULL; - } - - DrillerHandlerParser* OnEnterTag(u32 tagName) override - { - if (tagName == AZ_CRC("StringEvent", 0xd1e005df)) - { - return this; - } - return NULL; - } - void OnData(const DrillerSAXParser::Data& dataNode) override - { - if (dataNode.m_name == AZ_CRC("OnStart", 0x8b372fca) || dataNode.m_name == AZ_CRC("OnStop", 0xf6701caa)) - { - bool isDetailedCapture; - dataNode.Read(isDetailedCapture); - AZ_TEST_ASSERT(isDetailedCapture == true); - } - else if (dataNode.m_name == AZ_CRC("StringOne", 0x56efb231)) - { - // read string as a copy - char stringCopy[256]; - dataNode.Read(stringCopy, AZ_ARRAY_SIZE(stringCopy)); - AZ_TEST_ASSERT(strcmp(stringCopy, "This is copied string") == 0); - } - else if (dataNode.m_name == AZ_CRC("StringTwo", 0x3d49bea6)) - { - // read string as reference if possible, otherwise read it as a copy - const char* stringRef = dataNode.ReadPooledString(); - AZ_TEST_ASSERT(strcmp(stringRef, "This is referenced string") == 0); - } - } - }; - - void run() - { - // get our driller descriptor - Driller* driller = m_drillerManager->GetDriller(0); - Driller::Param param = *driller->GetParam(0); - param.value = 1; - // create a list of driller we what to drill - DrillerManager::DrillerListType dillersToDrill; - DrillerManager::DrillerInfo di; - di.id = driller->GetId(); // set driller id - di.params.push_back(param); // set driller custom params - dillersToDrill.push_back(di); - - MyDrilledObject myDrilledObject; - - // open a driller output file stream - AZStd::string testFileName = GetTestFolderPath() + "stringpooldrilltest.dat"; - DrillerOutputFileStream drillerOutputStream; - DrillerInputFileStream drillerInputStream; - DrillerDefaultStringPool stringPool; - DrillerSession* drillerSession; - DrillerRootHandler rootHandler; - DrillerSAXParserHandler dhp(&rootHandler); - - ////////////////////////////////////////////////////////////////////////// - // Drill an object without string pools - drillerOutputStream.Open(testFileName.c_str(), IO::SystemFile::SF_OPEN_CREATE | IO::SystemFile::SF_OPEN_WRITE_ONLY); - - // start a driller session with the file stream and the list of drillers - drillerSession = m_drillerManager->Start(drillerOutputStream, dillersToDrill); - // update for N frames - for (int i = 0; i < AZ_TRAIT_UNIT_TEST_DILLER_TRIGGER_EVENT_COUNT; ++i) - { - myDrilledObject.OnStringEvent(); - m_drillerManager->FrameUpdate(); - } - // stop the drillers - m_drillerManager->Stop(drillerSession); - // Stop writing and flush all data - drillerOutputStream.Close(); - ////////////////////////////////////////////////////////////////////////// - - ////////////////////////////////////////////////////////////////////////// - // Read all data that was written without string pool, in a stream that uses one. - drillerInputStream.Open(testFileName.c_str(), IO::SystemFile::SF_OPEN_READ_ONLY); - drillerInputStream.SetStringPool(&stringPool); - - dhp.ProcessStream(drillerInputStream); - drillerInputStream.Close(); - ////////////////////////////////////////////////////////////////////////// - - ////////////////////////////////////////////////////////////////////////// - // Drill an object without string pools - drillerOutputStream.Open(testFileName.c_str(), IO::SystemFile::SF_OPEN_CREATE | IO::SystemFile::SF_OPEN_WRITE_ONLY); - stringPool.Reset(); - drillerOutputStream.SetStringPool(&stringPool); // set the string pool on save - - // start a driller session with the file stream and the list of drillers - drillerSession = m_drillerManager->Start(drillerOutputStream, dillersToDrill); - // update for N frames - for (int i = 0; i < AZ_TRAIT_UNIT_TEST_DILLER_TRIGGER_EVENT_COUNT; ++i) - { - myDrilledObject.OnStringEvent(); - m_drillerManager->FrameUpdate(); - } - // stop the drillers - m_drillerManager->Stop(drillerSession); - // Stop writing and flush all data - drillerOutputStream.Close(); - ////////////////////////////////////////////////////////////////////////// - - ////////////////////////////////////////////////////////////////////////// - // Read all data that was written without string pool, in a stream that uses one. - stringPool.Reset(); - drillerInputStream.Open(testFileName.c_str(), IO::SystemFile::SF_OPEN_READ_ONLY); - drillerInputStream.SetStringPool(&stringPool); - - dhp.ProcessStream(drillerInputStream); - drillerInputStream.Close(); - ////////////////////////////////////////////////////////////////////////// - } - }; - - TEST_F(StringPoolDrillerTest, Test) - { - run(); - } - - /** - * - */ - class DrillFileStreamCheck - { - public: - void run() - { - // open and read drilled file - } - }; - - /** - * Driller application test - */ - TEST(DrillerApplication, Test) - { - ComponentApplication app; - - ////////////////////////////////////////////////////////////////////////// - // Create application environment code driven - ComponentApplication::Descriptor appDesc; - appDesc.m_memoryBlocksByteSize = 10 * 1024 * 1024; - appDesc.m_enableDrilling = true; - Entity* systemEntity = app.Create(appDesc); - - systemEntity->CreateComponent(); - systemEntity->CreateComponent(); // note that this component is what registers the streamer driller - - systemEntity->Init(); - systemEntity->Activate(); - - { - // open a driller output file stream - char testFileName[AZ_MAX_PATH_LEN]; - MakePathFromTestFolder(testFileName, AZ_MAX_PATH_LEN, "drillapptest.dat"); - DrillerOutputFileStream fs; - fs.Open(testFileName, IO::SystemFile::SF_OPEN_CREATE | IO::SystemFile::SF_OPEN_WRITE_ONLY); - - // create a list of driller we what to drill - DrillerManager::DrillerListType drillersToDrill; - DrillerManager::DrillerInfo di; - di.id = AZ_CRC("TraceMessagesDriller", 0xa61d1b00); - drillersToDrill.push_back(di); - di.id = AZ_CRC("MemoryDriller", 0x1b31269d); - drillersToDrill.push_back(di); - - ASSERT_NE(nullptr, app.GetDrillerManager()); - DrillerSession* drillerSession = app.GetDrillerManager()->Start(fs, drillersToDrill); - ASSERT_NE(nullptr, drillerSession); - - const int numOfFrames = 10000; - void* memory = NULL; - for (int i = 0; i < numOfFrames; ++i) - { - memory = azmalloc(rand() % 2048 + 1); - azfree(memory); - app.Tick(); - } - - app.GetDrillerManager()->Stop(drillerSession); // stop session manually - fs.Close(); // close the file with driller info - } - - app.Destroy(); - ////////////////////////////////////////////////////////////////////////// - } -} diff --git a/Code/Framework/AzCore/Tests/Serialization.cpp b/Code/Framework/AzCore/Tests/Serialization.cpp index 05b739bf5f..9ff2925472 100644 --- a/Code/Framework/AzCore/Tests/Serialization.cpp +++ b/Code/Framework/AzCore/Tests/Serialization.cpp @@ -1242,7 +1242,6 @@ namespace UnitTest const char* GetAppRoot() const override { return nullptr; } const char* GetEngineRoot() const override { return nullptr; } const char* GetExecutableFolder() const override { return nullptr; } - Debug::DrillerManager* GetDrillerManager() override { return nullptr; } void EnumerateEntities(const EntityCallback& /*callback*/) override {} void QueryApplicationType(AZ::ApplicationTypeQuery& /*appType*/) const override {} ////////////////////////////////////////////////////////////////////////// diff --git a/Code/Framework/AzCore/Tests/azcoretests_files.cmake b/Code/Framework/AzCore/Tests/azcoretests_files.cmake index b43f3b35a0..d4d107f094 100644 --- a/Code/Framework/AzCore/Tests/azcoretests_files.cmake +++ b/Code/Framework/AzCore/Tests/azcoretests_files.cmake @@ -29,7 +29,6 @@ set(FILES Console/ConsoleTests.cpp Debug.cpp DLL.cpp - Driller.cpp EBus.cpp EntityIdTests.cpp EntityTests.cpp diff --git a/Code/Framework/AzFramework/AzFramework/Application/Application.cpp b/Code/Framework/AzFramework/AzFramework/Application/Application.cpp index 27ce2e7ccb..e967fd6af1 100644 --- a/Code/Framework/AzFramework/AzFramework/Application/Application.cpp +++ b/Code/Framework/AzFramework/AzFramework/Application/Application.cpp @@ -59,7 +59,6 @@ #include #include #include -#include #include #include #include @@ -310,7 +309,6 @@ namespace AzFramework #endif azrtti_typeid(), azrtti_typeid(), - azrtti_typeid(), #if !defined(AZCORE_EXCLUDE_LUA) azrtti_typeid(), @@ -372,7 +370,6 @@ namespace AzFramework azrtti_typeid(), azrtti_typeid(), azrtti_typeid(), - azrtti_typeid(), azrtti_typeid(), azrtti_typeid(), AZ::Uuid("{624a7be2-3c7e-4119-aee2-1db2bdb6cc89}"), // ScriptDebugAgent diff --git a/Code/Framework/AzFramework/AzFramework/AzFrameworkModule.cpp b/Code/Framework/AzFramework/AzFramework/AzFrameworkModule.cpp index 912e85b8bc..c5fee7ec9a 100644 --- a/Code/Framework/AzFramework/AzFramework/AzFrameworkModule.cpp +++ b/Code/Framework/AzFramework/AzFramework/AzFrameworkModule.cpp @@ -14,7 +14,6 @@ #include #include #include -#include #include #include #include @@ -48,7 +47,6 @@ namespace AzFramework AzFramework::CreateScriptDebugAgentFactory(), AzFramework::AssetSystem::AssetSystemComponent::CreateDescriptor(), AzFramework::InputSystemComponent::CreateDescriptor(), - AzFramework::DrillerNetworkAgentComponent::CreateDescriptor(), #if !defined(AZCORE_EXCLUDE_LUA) AzFramework::ScriptComponent::CreateDescriptor(), diff --git a/Code/Framework/AzFramework/AzFramework/Driller/DrillToFileComponent.cpp b/Code/Framework/AzFramework/AzFramework/Driller/DrillToFileComponent.cpp deleted file mode 100644 index 5d4b89ab5c..0000000000 --- a/Code/Framework/AzFramework/AzFramework/Driller/DrillToFileComponent.cpp +++ /dev/null @@ -1,197 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include - -#include -#include -#include - -namespace AzFramework -{ - void DrillToFileComponent::Reflect(AZ::ReflectContext* context) - { - AZ::SerializeContext* serialize = azrtti_cast(context); - if (serialize) - { - serialize->Class() - ; - - if (serialize->FindClassData(DrillerInfo::RTTI_Type()) == nullptr) - { - serialize->Class() - ->Field("Id", &DrillerInfo::m_id) - ->Field("GroupName", &DrillerInfo::m_groupName) - ->Field("Name", &DrillerInfo::m_name) - ->Field("Description", &DrillerInfo::m_description); - } - } - } - - void DrillToFileComponent::Activate() - { - m_drillerSession = nullptr; - DrillerConsoleCommandBus::Handler::BusConnect(); - } - - void DrillToFileComponent::Deactivate() - { - DrillerConsoleCommandBus::Handler::BusDisconnect(); - StopDrillerSession(reinterpret_cast(this)); - } - - void DrillToFileComponent::WriteBinary(const void* data, unsigned int dataSize) - { - if (dataSize > 0) - { - m_frameBuffer.insert(m_frameBuffer.end(), reinterpret_cast(data), reinterpret_cast(data) + dataSize); - } - } - - void DrillToFileComponent::OnEndOfFrame() - { - AZStd::lock_guard lock(m_writerMutex); - m_writeQueue.push_back(); - m_writeQueue.back().swap(m_frameBuffer); - m_signal.notify_all(); - } - - void DrillToFileComponent::EnumerateAvailableDrillers() - { - DrillerInfoListType availableDrillers; - - AZ::Debug::DrillerManager* mgr = NULL; - EBUS_EVENT_RESULT(mgr, AZ::ComponentApplicationBus, GetDrillerManager); - if (mgr) - { - for (int i = 0; i < mgr->GetNumDrillers(); ++i) - { - AZ::Debug::Driller* driller = mgr->GetDriller(i); - AZ_Assert(driller, "DrillerManager returned a NULL driller. This is not legal!"); - availableDrillers.push_back(); - availableDrillers.back().m_id = driller->GetId(); - availableDrillers.back().m_groupName = driller->GroupName(); - availableDrillers.back().m_name = driller->GetName(); - availableDrillers.back().m_description = driller->GetDescription(); - } - } - - EBUS_EVENT(DrillerConsoleEventBus, OnDrillersEnumerated, availableDrillers); - } - - void DrillToFileComponent::StartDrillerSession(const AZ::Debug::DrillerManager::DrillerListType& requestedDrillers, AZ::u64 sessionId) - { - if (!m_drillerSession) - { - AZ_Assert(m_writeQueue.empty(), "write queue is not empty!"); - - m_sessionId = sessionId; - AZ::Debug::DrillerManager* mgr = nullptr; - EBUS_EVENT_RESULT(mgr, AZ::ComponentApplicationBus, GetDrillerManager); - if (mgr) - { - SetStringPool(&m_stringPool);; - m_drillerSession = mgr->Start(*this, requestedDrillers); - - AZStd::unique_lock signalLock(m_writerMutex); - m_isWriterEnabled = true; - AZStd::thread_desc td; - td.m_name = "DrillToFileComponent Writer Thread"; - m_writerThread = AZStd::thread(AZStd::bind(&DrillToFileComponent::AsyncWritePump, this), &td); - m_signal.wait(signalLock); - - EBUS_EVENT(DrillerConsoleEventBus, OnDrillerSessionStarted, sessionId); - } - } - } - - void DrillToFileComponent::StopDrillerSession(AZ::u64 sessionId) - { - if (sessionId == m_sessionId) - { - if (m_drillerSession) - { - AZ::Debug::DrillerManager* mgr = NULL; - EBUS_EVENT_RESULT(mgr, AZ::ComponentApplicationBus, GetDrillerManager); - if (mgr) - { - mgr->Stop(m_drillerSession); - } - m_drillerSession = nullptr; - EBUS_EVENT(DrillerConsoleEventBus, OnDrillerSessionStopped, reinterpret_cast(this)); - } - - m_isWriterEnabled = false; - if (m_writerThread.joinable()) - { - m_writerMutex.lock(); - m_signal.notify_all(); - m_writerMutex.unlock(); - m_writerThread.join(); - } - SetStringPool(nullptr); - m_stringPool.Reset(); - m_frameBuffer.clear(); // there may be pending data but we don't want to write it because it's an incomplete frame. - } - } - void DrillToFileComponent::AsyncWritePump() - { - AZStd::unique_lock signalLock(m_writerMutex); - - AZStd::basic_string, AZ::OSStdAllocator> drillerOutputPath; - - // Try the log path first - AZ::IO::FileIOBase* fileIO = AZ::IO::FileIOBase::GetInstance(); - if (fileIO) - { - const char* logLocation = fileIO->GetAlias("@log@"); - if (logLocation) - { - drillerOutputPath = logLocation; - drillerOutputPath.append("/"); - } - } - - // Try the executable path - if (drillerOutputPath.empty()) - { - EBUS_EVENT_RESULT(drillerOutputPath, AZ::ComponentApplicationBus, GetExecutableFolder); - drillerOutputPath.append("/"); - } - - drillerOutputPath.append("drillerdata.drl"); - AZ::IO::SystemFile output; - output.Open(drillerOutputPath.c_str(), AZ::IO::SystemFile::SF_OPEN_CREATE | AZ::IO::SystemFile::SF_OPEN_WRITE_ONLY); - AZ_Assert(output.IsOpen(), "Failed to open driller output file!"); - - m_signal.notify_all(); - - while (true) - { - while (!m_writeQueue.empty()) - { - AZStd::vector outBuffer; - outBuffer.swap(m_writeQueue.front()); - m_writeQueue.pop_front(); - signalLock.unlock(); - - output.Write(outBuffer.data(), outBuffer.size()); - output.Flush(); - - signalLock.lock(); - } - if (!m_isWriterEnabled) - { - break; - } - m_signal.wait(signalLock); - } - - output.Close(); - } -} // namespace AzFramework diff --git a/Code/Framework/AzFramework/AzFramework/Driller/DrillToFileComponent.h b/Code/Framework/AzFramework/AzFramework/Driller/DrillToFileComponent.h deleted file mode 100644 index c1b0ac9a65..0000000000 --- a/Code/Framework/AzFramework/AzFramework/Driller/DrillToFileComponent.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ -#pragma once - -#include - -#include -#include -#include -#include -#include -#include - -//#define ENABLE_COMPRESSION_FOR_REMOTE_DRILLER - -namespace AZ -{ - struct ClassDataReflection; -} - -namespace AzFramework -{ - /** - * Runs on the machine being drilled and is responsible for communications - * with the DrillerNetworkConsole running on the tool side as well as - * creating DrillerNetSessionStreams for each driller session being started. - */ - class DrillToFileComponent - : public AZ::Component - , public AZ::Debug::DrillerOutputStream - , public DrillerConsoleCommandBus::Handler - { - public: - AZ_COMPONENT(DrillToFileComponent, "{42BAA25D-7CEB-4A37-8BD4-4A1FE2253894}") - - ////////////////////////////////////////////////////////////////////////// - // AZ::Component - static void Reflect(AZ::ReflectContext* context); - void Activate() override; - void Deactivate() override; - ////////////////////////////////////////////////////////////////////////// - - ////////////////////////////////////////////////////////////////////////// - // DrillerOutputStream - void WriteBinary(const void* data, unsigned int dataSize) override; - void OnEndOfFrame() override; - ////////////////////////////////////////////////////////////////////////// - - ////////////////////////////////////////////////////////////////////////// - // DrillerConsoleCommandBus - void EnumerateAvailableDrillers() override; - void StartDrillerSession(const AZ::Debug::DrillerManager::DrillerListType& requestedDrillers, AZ::u64 sessionId) override; - void StopDrillerSession(AZ::u64 sessionId) override; - ////////////////////////////////////////////////////////////////////////// - - protected: - void AsyncWritePump(); - - AZ::u64 m_sessionId; - AZ::Debug::DrillerSession* m_drillerSession; - AZ::Debug::DrillerDefaultStringPool m_stringPool; - AZStd::vector m_frameBuffer; - AZStd::deque, AZ::OSStdAllocator> m_writeQueue; - AZStd::mutex m_writerMutex; - AZStd::condition_variable m_signal; - AZStd::thread m_writerThread; - bool m_isWriterEnabled; - }; -} // namespace AzFramework diff --git a/Code/Framework/AzFramework/AzFramework/Driller/DrillerConsoleAPI.h b/Code/Framework/AzFramework/AzFramework/Driller/DrillerConsoleAPI.h deleted file mode 100644 index 80bb7e3a0b..0000000000 --- a/Code/Framework/AzFramework/AzFramework/Driller/DrillerConsoleAPI.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ -#pragma once - -#include -#include -#include - -namespace AzFramework -{ - /* - * Descriptors for drillers available on the target machine. - */ - struct DrillerInfo final - { - AZ_RTTI(DrillerInfo, "{197AC318-B65C-4B36-A109-BD25422BF7D0}"); - AZ::u32 m_id; - AZStd::string m_groupName; - AZStd::string m_name; - AZStd::string m_description; - }; - - typedef AZStd::vector DrillerInfoListType; - typedef AZStd::vector DrillerListType; - - /** - * Driller clients interested in receiving notification events from the - * console should implement this interface. - */ - class DrillerConsoleEvents - : public AZ::EBusTraits - { - public: - ////////////////////////////////////////////////////////////////////////// - // EBusTraits overrides - typedef AZ::OSStdAllocator AllocatorType; - ////////////////////////////////////////////////////////////////////////// - - virtual ~DrillerConsoleEvents() {} - - // A list of available drillers has been received from the target machine. - virtual void OnDrillersEnumerated(const DrillerInfoListType& availableDrillers) = 0; - virtual void OnDrillerSessionStarted(AZ::u64 sessionId) = 0; - virtual void OnDrillerSessionStopped(AZ::u64 sessionId) = 0; - }; - typedef AZ::EBus DrillerConsoleEventBus; - - /** - * Commands can be sent to the driller through this interface. - */ - class DrillerConsoleCommands - : public AZ::EBusTraits - { - public: - ////////////////////////////////////////////////////////////////////////// - // EBusTraits overrides - typedef AZ::OSStdAllocator AllocatorType; - - // there's only one driller console instance allowed - static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single; - static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single; - ////////////////////////////////////////////////////////////////////////// - - virtual ~DrillerConsoleCommands() {} - - // Request an enumeration of available drillers from the target machine - virtual void EnumerateAvailableDrillers() = 0; - // Start a drilling session. This function is normally called internally by DrillerRemoteSession - virtual void StartDrillerSession(const AZ::Debug::DrillerManager::DrillerListType& requestedDrillers, AZ::u64 sessionId) = 0; - // Stop a drilling session. This function is normally called internally by DrillerRemoteSession - virtual void StopDrillerSession(AZ::u64 sessionId) = 0; - }; - typedef AZ::EBus DrillerConsoleCommandBus; -} // namespace AzFramework diff --git a/Code/Framework/AzFramework/AzFramework/Driller/RemoteDrillerInterface.cpp b/Code/Framework/AzFramework/AzFramework/Driller/RemoteDrillerInterface.cpp deleted file mode 100644 index 232432c8d8..0000000000 --- a/Code/Framework/AzFramework/AzFramework/Driller/RemoteDrillerInterface.cpp +++ /dev/null @@ -1,740 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace AzFramework -{ - //--------------------------------------------------------------------- - // TEMP FOR DEBUGGING ONLY!!! - //--------------------------------------------------------------------- - class DebugDrillerRemoteSession - : public DrillerRemoteSession - { - public: - AZ_CLASS_ALLOCATOR(DebugDrillerRemoteSession, AZ::OSAllocator, 0); - - DebugDrillerRemoteSession() - { - AZStd::string filename = AZStd::string::format("remotedrill_%llu", static_cast(reinterpret_cast(static_cast(this)))); - m_file.Open(filename.c_str(), AZ::IO::SystemFile::SF_OPEN_WRITE_ONLY | AZ::IO::SystemFile::SF_OPEN_CREATE); - } - - ~DebugDrillerRemoteSession() - { - m_file.Close(); - } - - virtual void ProcessIncomingDrillerData(const char* streamIdentifier, const void* data, size_t dataSize) - { - (void)streamIdentifier; - - m_file.Write(data, dataSize); - } - - virtual void OnDrillerConnectionLost() - { - delete this; - } - - AZ::IO::SystemFile m_file; - }; - //--------------------------------------------------------------------- - - /** - * These are the different synchronization messages that are used. - */ - namespace NetworkDrillerSyncMsgId - { - static const AZ::Crc32 NetDrillMsg_RequestDrillerEnum = AZ_CRC("NetDrillMsg_RequestEnum", 0x517cca25); - static const AZ::Crc32 NetDrillMsg_RequestStartSession = AZ_CRC("NetDrillMsg_RequestStartSession", 0x5238b5fe); - static const AZ::Crc32 NetDrillMsg_RequestStopSession = AZ_CRC("NetDrillMsg_RequestStopSession", 0x1abe6888); - static const AZ::Crc32 NetDrillMsg_DrillerEnum = AZ_CRC("NetDrillMsg_Enum", 0x3d0a0f76); - }; - - struct NetDrillerStartSessionRequest - : public TmMsg - { - AZ_CLASS_ALLOCATOR(NetDrillerStartSessionRequest, AZ::OSAllocator, 0); - AZ_RTTI(NetDrillerStartSessionRequest, "{FF899D61-A445-44B5-9B67-8319ACC8BB06}"); - - NetDrillerStartSessionRequest() - : TmMsg(NetworkDrillerSyncMsgId::NetDrillMsg_RequestStartSession) {} - - // TODO: Replace this with the DrillerListType from driller.h - DrillerListType m_drillerIds; - AZ::u64 m_sessionId; - }; - - struct NetDrillerStopSessionRequest - : public TmMsg - { - AZ_CLASS_ALLOCATOR(NetDrillerStopSessionRequest, AZ::OSAllocator, 0); - AZ_RTTI(NetDrillerStopSessionRequest, "{BCC6524F-287F-48D2-A21A-029215DB24DD}"); - - NetDrillerStopSessionRequest(AZ::u64 sessionId = 0) - : TmMsg(NetworkDrillerSyncMsgId::NetDrillMsg_RequestStopSession) - , m_sessionId(sessionId) {} - - AZ::u64 m_sessionId; - }; - - struct NetDrillerEnumeration - : public TmMsg - { - AZ_CLASS_ALLOCATOR(NetDrillerEnumeration, AZ::OSAllocator, 0); - AZ_RTTI(NetDrillerEnumeration, "{60E5BED2-F492-4A55-8EF6-2628CD390991}"); - - NetDrillerEnumeration() - : TmMsg(NetworkDrillerSyncMsgId::NetDrillMsg_DrillerEnum) {} - - DrillerInfoListType m_enumeration; - }; - - //--------------------------------------------------------------------- - // DrillerRemoteSession - //--------------------------------------------------------------------- - DrillerRemoteSession::DrillerRemoteSession() -#ifdef ENABLE_COMPRESSION_FOR_REMOTE_DRILLER - : m_decompressor(&AZ::AllocatorInstance::Get()) -#endif - { - } - //--------------------------------------------------------------------- - DrillerRemoteSession::~DrillerRemoteSession() - { - } - //--------------------------------------------------------------------- - void DrillerRemoteSession::StartDrilling(const DrillerListType& drillers, const char* captureFile) - { - if (captureFile) - { - m_captureFile.Open(captureFile, AZ::IO::SystemFile::SF_OPEN_CREATE | AZ::IO::SystemFile::SF_OPEN_WRITE_ONLY); - AZ_Warning("DrillerRemoteSession", m_captureFile.IsOpen(), "Failed to open %s. Driller data will not be saved.", captureFile); - } - -#ifdef ENABLE_COMPRESSION_FOR_REMOTE_DRILLER - m_decompressor.StartDecompressor(); -#endif - BusConnect(static_cast(reinterpret_cast(this))); - EBUS_EVENT(DrillerNetworkConsoleCommandBus, StartRemoteDrillerSession, drillers, this); - } - //--------------------------------------------------------------------- - void DrillerRemoteSession::StopDrilling() - { - EBUS_EVENT(DrillerNetworkConsoleCommandBus, StopRemoteDrillerSession, static_cast(reinterpret_cast(this))); - BusDisconnect(); -#ifdef ENABLE_COMPRESSION_FOR_REMOTE_DRILLER - if (m_decompressor.IsDecompressorStarted()) - { - m_decompressor.StopDecompressor(); - } -#endif - - m_captureFile.Close(); - } - //--------------------------------------------------------------------- - void DrillerRemoteSession::LoadCaptureData(const char* fileName) - { - m_captureFile.Open(fileName, AZ::IO::SystemFile::SF_OPEN_READ_ONLY); - AZ_Warning("DrillerRemoteSession", m_captureFile.IsOpen(), "Failed to open %s. No driller data could be loaded.", fileName); - if (m_captureFile.IsOpen()) - { -#ifdef ENABLE_COMPRESSION_FOR_REMOTE_DRILLER - m_decompressor.StartDecompressor(); -#endif - AZ::IO::SystemFile::SizeType bytesRemaining = m_captureFile.Length(); - AZ::IO::SystemFile::SizeType maxReadChunkSize = 1024 * 1024; - AZStd::vector readBuffer; - readBuffer.resize_no_construct(static_cast(maxReadChunkSize)); - while (bytesRemaining > 0) - { - AZ::IO::SystemFile::SizeType bytesToRead = bytesRemaining < maxReadChunkSize ? bytesRemaining : maxReadChunkSize; - if (m_captureFile.Read(bytesToRead, readBuffer.data()) != bytesToRead) - { - AZ_Warning("DrillerRemoteSession", false, "Failed reading driller data. No more driller data can be read."); - break; - } -#ifdef ENABLE_COMPRESSION_FOR_REMOTE_DRILLER - Decompress(readBuffer.data(), static_cast(bytesToRead)); - ProcessIncomingDrillerData(fileName, m_uncompressedMsgBuffer.data(), m_uncompressedMsgBuffer.size()); -#else - ProcessIncomingDrillerData(fileName, readBuffer.data(), readBuffer.size()); -#endif - bytesRemaining -= bytesToRead; - } -#ifdef ENABLE_COMPRESSION_FOR_REMOTE_DRILLER - m_decompressor.StopDecompressor(); -#endif - m_captureFile.Close(); - } - } - //--------------------------------------------------------------------- - void DrillerRemoteSession::OnReceivedMsg(TmMsgPtr msg) - { - AZ_Assert(msg->GetCustomBlob(), "Missing driller frame data!"); - - if (msg->GetCustomBlobSize() == 0) - { - return; - } - - if (m_captureFile.IsOpen()) - { - if (m_captureFile.Write(msg->GetCustomBlob(), msg->GetCustomBlobSize()) != msg->GetCustomBlobSize()) - { - AZ_Warning("DrillerRemoteSession", false, "Failed writing capture data to %s, no more data will be written out.", m_captureFile.Name()); - m_captureFile.Close(); - } - } - -#ifdef ENABLE_COMPRESSION_FOR_REMOTE_DRILLER - Decompress(msg->GetCustomBlob(), msg->GetCustomBlobSize()); - ProcessIncomingDrillerData(m_captureFile.Name(),m_uncompressedMsgBuffer.data(), m_uncompressedMsgBuffer.size()); -#else - ProcessIncomingDrillerData(m_captureFile.Name(),msg->GetCustomBlob(), msg->GetCustomBlobSize()); -#endif - } - //--------------------------------------------------------------------- - void DrillerRemoteSession::Decompress(const void* compressedBuffer, size_t compressedBufferSize) - { - m_uncompressedMsgBuffer.clear(); - if (m_uncompressedMsgBuffer.capacity() < compressedBufferSize * 10) - { - m_uncompressedMsgBuffer.reserve(compressedBufferSize * 10); - } -#if defined(ENABLE_COMPRESSION_FOR_REMOTE_DRILLER) - unsigned int compressedBytesRemaining = static_cast(compressedBufferSize); - unsigned int decompressedBytes = 0; - while (compressedBytesRemaining > 0) - { - unsigned int uncompressedBytes = c_decompressionBufferSize; - unsigned int bytesConsumed = m_decompressor.Decompress(reinterpret_cast(compressedBuffer) + decompressedBytes, compressedBytesRemaining, m_decompressionBuffer, uncompressedBytes); - decompressedBytes += bytesConsumed; - compressedBytesRemaining -= bytesConsumed; - m_uncompressedMsgBuffer.insert(m_uncompressedMsgBuffer.end(), &m_decompressionBuffer[0], &m_decompressionBuffer[uncompressedBytes]); - } -#else - m_uncompressedMsgBuffer.insert(m_uncompressedMsgBuffer.end(), &((char*)compressedBuffer)[0], &((char*)compressedBuffer)[compressedBufferSize]); -#endif - } - //--------------------------------------------------------------------- - - //--------------------------------------------------------------------- - // DrillerNetSessionStream - //--------------------------------------------------------------------- - /** - * Represents a driller session on the target machine. - * It is responsible for listening for driller events and forwarding - * them to the console machine. - */ - class DrillerNetSessionStream - : public AZ::Debug::DrillerOutputStream - , AZ::SystemTickBus::Handler - { - public: - AZ_CLASS_ALLOCATOR(DrillerNetSessionStream, AZ::OSAllocator, 0); - - DrillerNetSessionStream(AZ::u64 sessionId); - ~DrillerNetSessionStream(); - - //--------------------------------------------------------------------- - // DrillerOutputStream - //--------------------------------------------------------------------- - virtual void WriteBinary(const void* data, unsigned int dataSize); - virtual void OnEndOfFrame(); - //--------------------------------------------------------------------- - - //--------------------------------------------------------------------- - // AZ::SystemTickBus - //--------------------------------------------------------------------- - void OnSystemTick() override; - //--------------------------------------------------------------------- - - static const size_t c_defaultUncompressedBufferSize = 256 * 1024; - static const size_t c_defaultCompressedBufferSize = 32 * 1024; - static const size_t c_bufferCount = 2; - - AZ::Debug::DrillerSession* m_session; - AZ::u64 m_sessionId; - TargetInfo m_requestor; - size_t m_activeBuffer; - AZStd::vector m_uncompressedBuffer[c_bufferCount]; - AZStd::vector m_compressedBuffer[c_bufferCount]; - -#ifdef ENABLE_COMPRESSION_FOR_REMOTE_DRILLER - // Compression - AZ::ZLib m_compressor; - AZStd::fixed_vector m_compressionBuffer; -#endif - - // String Pooling - AZ::Debug::DrillerDefaultStringPool m_stringPool; - - // TEMP Debug - //AZ::IO::SystemFile m_file; - }; - - DrillerNetSessionStream::DrillerNetSessionStream(AZ::u64 sessionId) - : m_session(NULL) - , m_sessionId(sessionId) - , m_activeBuffer(0) -#ifdef ENABLE_COMPRESSION_FOR_REMOTE_DRILLER - , m_compressor(&AZ::AllocatorInstance::Get()) -#endif - { - for (size_t i = 0; i < c_bufferCount; ++i) - { - m_uncompressedBuffer[i].reserve(c_defaultUncompressedBufferSize); - m_compressedBuffer[i].reserve(c_defaultCompressedBufferSize); - } - -#ifdef ENABLE_COMPRESSION_FOR_REMOTE_DRILLER - // Level 3 compression seems to give pretty good compression at decent speed. - // Speed is paramount for us because initial driller packets can be huge and - // we need to be able to compress the data within the driller report call - // without blocking for too long. - m_compressor.StartCompressor(3); -#endif - - SetStringPool(&m_stringPool); - - AZ::SystemTickBus::Handler::BusConnect(); - } - //--------------------------------------------------------------------- - DrillerNetSessionStream::~DrillerNetSessionStream() - { -#ifdef ENABLE_COMPRESSION_FOR_REMOTE_DRILLER - m_compressor.StopCompressor(); -#endif - - // Debug - //m_file.Close(); - } - //--------------------------------------------------------------------- - void DrillerNetSessionStream::WriteBinary(const void* data, unsigned int dataSize) - { - size_t activeBuffer = m_activeBuffer; - - if (dataSize > 0) - { -#ifdef ENABLE_COMPRESSION_FOR_REMOTE_DRILLER - // Only do the compression when the buffer is full so we don't run the compression all the time - if (m_uncompressedBuffer[activeBuffer].size() + dataSize > c_defaultUncompressedBufferSize) - { - // compress - unsigned int curDataSize = static_cast(m_uncompressedBuffer[activeBuffer].size()); - unsigned int remaining = curDataSize; - while (remaining > 0) - { - unsigned int processedBytes = curDataSize - remaining; - unsigned int compressedBytes = m_compressor.Compress(m_uncompressedBuffer[activeBuffer].data() + processedBytes, remaining, m_compressionBuffer.data(), static_cast(c_defaultCompressedBufferSize)); - if (compressedBytes > 0) - { - m_compressedBuffer[activeBuffer].insert(m_compressedBuffer[activeBuffer].end(), m_compressionBuffer.data(), m_compressionBuffer.data() + compressedBytes); - } - } - m_uncompressedBuffer[activeBuffer].clear(); - } - - m_uncompressedBuffer[activeBuffer].insert(m_uncompressedBuffer[activeBuffer].end(), reinterpret_cast(data), reinterpret_cast(data) + dataSize); -#else - // Since we are not compressing, transfer the input directly into our compressed buffer - m_compressedBuffer[activeBuffer].insert(m_compressedBuffer[activeBuffer].end(), reinterpret_cast(data), reinterpret_cast(data) + dataSize); -#endif - } - } - //--------------------------------------------------------------------- - void DrillerNetSessionStream::OnEndOfFrame() - { - size_t activeBuffer = m_activeBuffer; - -#ifdef ENABLE_COMPRESSION_FOR_REMOTE_DRILLER - // Write whatever data has not yet been compressed and flush the compressor - unsigned int curDataSize = static_cast(m_uncompressedBuffer[activeBuffer].size()); - unsigned int remaining = curDataSize; - unsigned int compressedBytes = 0; - do - { - unsigned int processedBytes = curDataSize - remaining; - compressedBytes = m_compressor.Compress(m_uncompressedBuffer[activeBuffer].data() + processedBytes, remaining, m_compressionBuffer.data(), static_cast(c_defaultCompressedBufferSize), AZ::ZLib::FT_SYNC_FLUSH); - if (compressedBytes > 0) - { - m_compressedBuffer[activeBuffer].insert(m_compressedBuffer[activeBuffer].end(), m_compressionBuffer.data(), m_compressionBuffer.data() + compressedBytes); - } - } while (compressedBytes > 0 || remaining > 0); -#endif - - m_activeBuffer = (activeBuffer + 1) % 2; // switch buffers - } - //------------------------------------------------------------------------- - void DrillerNetSessionStream::OnSystemTick() - { - // The buffer index we want to send is the one we wrote to in the previous frame. - size_t bufferIndex = (m_activeBuffer + 1) % 2; - - if (m_compressedBuffer[bufferIndex].empty()) - { - return; - } - - TmMsg msg(m_sessionId); - - msg.AddCustomBlob(m_compressedBuffer[bufferIndex].data(), m_compressedBuffer[bufferIndex].size()); - EBUS_EVENT(TargetManager::Bus, SendTmMessage, m_requestor, msg); - - - // Debug - //if (!m_file.IsOpen()) - //{ - // AZStd::string filename = AZStd::string::format("localdrill_%llu", m_sessionId); - // m_file.Open(filename.c_str(), AZ::IO::SystemFile::SF_OPEN_WRITE_ONLY | AZ::IO::SystemFile::SF_OPEN_CREATE); - //} - //m_file.Write(msg.GetCustomBlob(), msg.GetCustomBlobSize()); - - // Reset buffers - m_uncompressedBuffer[bufferIndex].clear(); - m_compressedBuffer[bufferIndex].clear(); - - // Buffers may grow during exceptional circumstances. Re-shrink them to their default sizes - // so we don't keep holding on to the memory. - m_uncompressedBuffer[bufferIndex].reserve(c_defaultUncompressedBufferSize); - m_compressedBuffer[bufferIndex].reserve(c_defaultCompressedBufferSize); - } - //--------------------------------------------------------------------- - - //--------------------------------------------------------------------- - // DrillerNetworkAgent - //--------------------------------------------------------------------- - void DrillerNetworkAgentComponent::Init() - { - m_cbDrillerEnumRequest = TmMsgCallback(AZStd::bind(&DrillerNetworkAgentComponent::OnRequestDrillerEnum, this, AZStd::placeholders::_1)); - m_cbDrillerStartRequest = TmMsgCallback(AZStd::bind(&DrillerNetworkAgentComponent::OnRequestDrillerStart, this, AZStd::placeholders::_1)); - m_cbDrillerStopRequest = TmMsgCallback(AZStd::bind(&DrillerNetworkAgentComponent::OnRequestDrillerStop, this, AZStd::placeholders::_1)); - } - //--------------------------------------------------------------------- - void DrillerNetworkAgentComponent::Activate() - { - m_cbDrillerEnumRequest.BusConnect(NetworkDrillerSyncMsgId::NetDrillMsg_RequestDrillerEnum); - m_cbDrillerStartRequest.BusConnect(NetworkDrillerSyncMsgId::NetDrillMsg_RequestStartSession); - m_cbDrillerStopRequest.BusConnect(NetworkDrillerSyncMsgId::NetDrillMsg_RequestStopSession); - TargetManagerClient::Bus::Handler::BusConnect(); - } - //--------------------------------------------------------------------- - void DrillerNetworkAgentComponent::Deactivate() - { - TargetManagerClient::Bus::Handler::BusDisconnect(); - m_cbDrillerEnumRequest.BusDisconnect(NetworkDrillerSyncMsgId::NetDrillMsg_RequestDrillerEnum); - m_cbDrillerStartRequest.BusDisconnect(NetworkDrillerSyncMsgId::NetDrillMsg_RequestStartSession); - m_cbDrillerStopRequest.BusDisconnect(NetworkDrillerSyncMsgId::NetDrillMsg_RequestStopSession); - - AZ::Debug::DrillerManager* mgr = NULL; - EBUS_EVENT_RESULT(mgr, AZ::ComponentApplicationBus, GetDrillerManager); - for (size_t i = 0; i < m_activeSessions.size(); ++i) - { - if (mgr) - { - mgr->Stop(m_activeSessions[i]->m_session); - } - delete m_activeSessions[i]; - } - m_activeSessions.clear(); - } - //--------------------------------------------------------------------- - void DrillerNetworkAgentComponent::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided) - { - provided.push_back(AZ_CRC("DrillerNetworkAgentService", 0xcd2ab821)); - } - //--------------------------------------------------------------------- - void DrillerNetworkAgentComponent::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible) - { - incompatible.push_back(AZ_CRC("DrillerNetworkAgentService", 0xcd2ab821)); - } - //--------------------------------------------------------------------- - void DrillerNetworkAgentComponent::Reflect(AZ::ReflectContext* context) - { - if (AZ::SerializeContext* serializeContext = azrtti_cast(context)) - { - serializeContext->Class() - ->Version(1) - ; - - if (AZ::EditContext* editContext = serializeContext->GetEditContext()) - { - editContext->Class( - "Driller Network Agent", "Runs on the machine being drilled and communicates with tools") - ->ClassElement(AZ::Edit::ClassElements::EditorData, "") - ->Attribute(AZ::Edit::Attributes::Category, "Profiling") - ->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("System", 0xc94d118b)) - ; - } - - ReflectNetDrillerClasses(context); - } - } - //--------------------------------------------------------------------- - void DrillerNetworkAgentComponent::TargetLeftNetwork(TargetInfo info) - { - AZ::Debug::DrillerManager* mgr = NULL; - EBUS_EVENT_RESULT(mgr, AZ::ComponentApplicationBus, GetDrillerManager); - for (AZStd::vector::iterator it = m_activeSessions.begin(); it != m_activeSessions.end(); ) - { - if ((*it)->m_requestor.GetNetworkId() == info.GetNetworkId()) - { - if (mgr) - { - mgr->Stop((*it)->m_session); - } - delete *it; - it = m_activeSessions.erase(it); - } - else - { - ++it; - } - } - } - //--------------------------------------------------------------------- - void DrillerNetworkAgentComponent::OnRequestDrillerEnum(TmMsgPtr msg) - { - AZ::Debug::DrillerManager* mgr = NULL; - EBUS_EVENT_RESULT(mgr, AZ::ComponentApplicationBus, GetDrillerManager); - if (!mgr) - { - return; - } - - TargetInfo sendTo; - EBUS_EVENT_RESULT(sendTo, TargetManager::Bus, GetTargetInfo, msg->GetSenderTargetId()); - NetDrillerEnumeration drillerEnum; - for (int i = 0; i < mgr->GetNumDrillers(); ++i) - { - AZ::Debug::Driller* driller = mgr->GetDriller(i); - AZ_Assert(driller, "DrillerManager returned a NULL driller. This is not legal!"); - drillerEnum.m_enumeration.push_back(); - drillerEnum.m_enumeration.back().m_id = driller->GetId(); - drillerEnum.m_enumeration.back().m_groupName = driller->GroupName(); - drillerEnum.m_enumeration.back().m_name = driller->GetName(); - drillerEnum.m_enumeration.back().m_description = driller->GetDescription(); - } - EBUS_EVENT(TargetManager::Bus, SendTmMessage, sendTo, drillerEnum); - } - //--------------------------------------------------------------------- - void DrillerNetworkAgentComponent::OnRequestDrillerStart(TmMsgPtr msg) - { - AZ::Debug::DrillerManager* mgr = NULL; - EBUS_EVENT_RESULT(mgr, AZ::ComponentApplicationBus, GetDrillerManager); - if (!mgr) - { - return; - } - - NetDrillerStartSessionRequest* request = azdynamic_cast(msg.get()); - AZ_Assert(request, "Not a NetDrillerStartSessionRequest msg!"); - AZ::Debug::DrillerManager::DrillerListType drillers; - for (size_t i = 0; i < request->m_drillerIds.size(); ++i) - { - AZ::Debug::DrillerManager::DrillerInfo di; - di.id = request->m_drillerIds[i]; - drillers.push_back(di); - } - DrillerNetSessionStream* session = aznew DrillerNetSessionStream(request->m_sessionId); - EBUS_EVENT_RESULT(session->m_requestor, TargetManager::Bus, GetTargetInfo, msg->GetSenderTargetId()); - m_activeSessions.push_back(session); - session->m_session = mgr->Start(*session, drillers); - } - //--------------------------------------------------------------------- - void DrillerNetworkAgentComponent::OnRequestDrillerStop(TmMsgPtr msg) - { - NetDrillerStopSessionRequest* request = azdynamic_cast(msg.get()); - for (AZStd::vector::iterator it = m_activeSessions.begin(); it != m_activeSessions.end(); ++it) - { - if ((*it)->m_sessionId == request->m_sessionId) - { - AZ::Debug::DrillerManager* mgr = NULL; - EBUS_EVENT_RESULT(mgr, AZ::ComponentApplicationBus, GetDrillerManager); - if (mgr) - { - mgr->Stop((*it)->m_session); - } - delete *it; - m_activeSessions.erase(it); - return; - } - } - } - //--------------------------------------------------------------------- - - //--------------------------------------------------------------------- - // DrillerRemoteConsole - //--------------------------------------------------------------------- - void DrillerNetworkConsoleComponent::Init() - { - m_cbDrillerEnum = TmMsgCallback(AZStd::bind(&DrillerNetworkConsoleComponent::OnReceivedDrillerEnum, this, AZStd::placeholders::_1)); - } - //--------------------------------------------------------------------- - void DrillerNetworkConsoleComponent::Activate() - { - m_cbDrillerEnum.BusConnect(NetworkDrillerSyncMsgId::NetDrillMsg_DrillerEnum); - DrillerNetworkConsoleCommandBus::Handler::BusConnect(); - TargetManagerClient::Bus::Handler::BusConnect(); - } - //--------------------------------------------------------------------- - void DrillerNetworkConsoleComponent::Deactivate() - { - TargetManagerClient::Bus::Handler::BusDisconnect(); - DrillerNetworkConsoleCommandBus::Handler::BusDisconnect(); - m_cbDrillerEnum.BusDisconnect(NetworkDrillerSyncMsgId::NetDrillMsg_DrillerEnum); - - for (size_t i = 0; i < m_activeSessions.size(); ++i) - { - EBUS_EVENT(TargetManager::Bus, SendTmMessage, m_curTarget, NetDrillerStopSessionRequest(static_cast(reinterpret_cast(m_activeSessions[i])))); - m_activeSessions[i]->OnDrillerConnectionLost(); - } - m_activeSessions.clear(); - } - //--------------------------------------------------------------------- - void DrillerNetworkConsoleComponent::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided) - { - provided.push_back(AZ_CRC("DrillerNetworkConsoleService", 0x2286125d)); - } - //--------------------------------------------------------------------- - void DrillerNetworkConsoleComponent::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible) - { - incompatible.push_back(AZ_CRC("DrillerNetworkConsoleService", 0x2286125d)); - } - //--------------------------------------------------------------------- - void DrillerNetworkConsoleComponent::Reflect(AZ::ReflectContext* context) - { - AZ::SerializeContext* serialize = azrtti_cast(context); - if (serialize) - { - serialize->Class() - ->Version(1) - ; - - if (AZ::EditContext* editContext = serialize->GetEditContext()) - { - editContext->Class( - "Driller Network Console", "Runs on the tool machine and is responsible for communications with the DrillerNetworkAgent") - ->ClassElement(AZ::Edit::ClassElements::EditorData, "") - ->Attribute(AZ::Edit::Attributes::Category, "Profiling") - ->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("System", 0xc94d118b)) - ; - } - - ReflectNetDrillerClasses(context); - } - } - //--------------------------------------------------------------------- - void DrillerNetworkConsoleComponent::EnumerateAvailableDrillers() - { - EBUS_EVENT(TargetManager::Bus, SendTmMessage, m_curTarget, TmMsg(NetworkDrillerSyncMsgId::NetDrillMsg_RequestDrillerEnum)); - } - //--------------------------------------------------------------------- - void DrillerNetworkConsoleComponent::StartRemoteDrillerSession(const DrillerListType& drillers, DrillerRemoteSession* handler) - { - NetDrillerStartSessionRequest request; - request.m_drillerIds = drillers; - request.m_sessionId = static_cast(reinterpret_cast(handler)); - m_activeSessions.push_back(handler); - EBUS_EVENT(TargetManager::Bus, SendTmMessage, m_curTarget, request); - } - //--------------------------------------------------------------------- - void DrillerNetworkConsoleComponent::StopRemoteDrillerSession(AZ::u64 sessionId) - { - for (size_t i = 0; i < m_activeSessions.size(); ++i) - { - if (sessionId == static_cast(reinterpret_cast(m_activeSessions[i]))) - { - EBUS_EVENT(TargetManager::Bus, SendTmMessage, m_curTarget, NetDrillerStopSessionRequest(sessionId)); - m_activeSessions[i] = m_activeSessions.back(); - m_activeSessions.pop_back(); - } - } - } - //--------------------------------------------------------------------- - void DrillerNetworkConsoleComponent::DesiredTargetConnected(bool connected) - { - if (connected) - { - EBUS_EVENT_RESULT(m_curTarget, TargetManager::Bus, GetDesiredTarget); - EBUS_EVENT(DrillerNetworkConsoleCommandBus, EnumerateAvailableDrillers); - } - else - { - for (size_t i = 0; i < m_activeSessions.size(); ++i) - { - m_activeSessions[i]->OnDrillerConnectionLost(); - } - m_activeSessions.clear(); - EBUS_EVENT(DrillerNetworkConsoleEventBus, OnReceivedDrillerEnumeration, DrillerInfoListType()); - } - } - //--------------------------------------------------------------------- - void DrillerNetworkConsoleComponent::DesiredTargetChanged(AZ::u32 newTargetID, AZ::u32 oldTargetID) - { - (void)oldTargetID; - (void)newTargetID; - EBUS_EVENT(DrillerNetworkConsoleEventBus, OnReceivedDrillerEnumeration, DrillerInfoListType()); - for (size_t i = 0; i < m_activeSessions.size(); ++i) - { - EBUS_EVENT(TargetManager::Bus, SendTmMessage, m_curTarget, NetDrillerStopSessionRequest(static_cast(reinterpret_cast(m_activeSessions[i])))); - m_activeSessions[i]->OnDrillerConnectionLost(); - } - m_activeSessions.clear(); - } - //--------------------------------------------------------------------- - void DrillerNetworkConsoleComponent::OnReceivedDrillerEnum(TmMsgPtr msg) - { - NetDrillerEnumeration* drillerEnum = azdynamic_cast(msg.get()); - AZ_Assert(drillerEnum, "No NetDrillerEnumeration message!"); - - EBUS_EVENT(DrillerNetworkConsoleEventBus, OnReceivedDrillerEnumeration, drillerEnum->m_enumeration); - } - //--------------------------------------------------------------------- - - //--------------------------------------------------------------------- - // ReflectNetDrillerClasses - //--------------------------------------------------------------------- - void ReflectNetDrillerClasses(AZ::ReflectContext* context) - { - AZ::SerializeContext* serialize = azrtti_cast(context); - if (serialize) - { - // Assume no one else will register our classes. - if (serialize->FindClassData(DrillerInfo::RTTI_Type()) == nullptr) - { - serialize->Class() - ->Field("Id", &DrillerInfo::m_id) - ->Field("GroupName", &DrillerInfo::m_groupName) - ->Field("Name", &DrillerInfo::m_name) - ->Field("Description", &DrillerInfo::m_description); - serialize->Class() - ->Field("DrillerIds", &NetDrillerStartSessionRequest::m_drillerIds) - ->Field("SessionId", &NetDrillerStartSessionRequest::m_sessionId); - serialize->Class() - ->Field("SessionId", &NetDrillerStopSessionRequest::m_sessionId); - serialize->Class() - ->Field("Enumeration", &NetDrillerEnumeration::m_enumeration); - } - } - } - //--------------------------------------------------------------------- -} // namespace AzFramework diff --git a/Code/Framework/AzFramework/AzFramework/Driller/RemoteDrillerInterface.h b/Code/Framework/AzFramework/AzFramework/Driller/RemoteDrillerInterface.h deleted file mode 100644 index 669b308668..0000000000 --- a/Code/Framework/AzFramework/AzFramework/Driller/RemoteDrillerInterface.h +++ /dev/null @@ -1,217 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef AZFRAMEWORK_REMOTE_DRILLER_INTERFACE_H -#define AZFRAMEWORK_REMOTE_DRILLER_INTERFACE_H - -#include -#include -#include -#include -#include -#include -#include -#include - -//#define ENABLE_COMPRESSION_FOR_REMOTE_DRILLER - -namespace AZ -{ - struct ClassDataReflection; -} - -namespace AzFramework -{ - /** - * Represents a remote driller session on the tool machine. - * It is responsible for receiving and processing remote driller data. - * Driller clients should derive from this class and implement the virtual interfaces. - */ - class DrillerRemoteSession - : public TmMsgBus::Handler - { - public: - DrillerRemoteSession(); - ~DrillerRemoteSession(); - - // Called when new driller data arrives - virtual void ProcessIncomingDrillerData(const char* streamIdentifier, const void* data, size_t dataSize) = 0; - // Called when the connection to the driller is lost. The session should be deleted in response to this message - virtual void OnDrillerConnectionLost() = 0; - - // Start drilling the selected drillers as part of this session - void StartDrilling(const DrillerListType& drillers, const char* captureFile); - // Stop this drill session - void StopDrilling(); - - // Replay a previously captured driller session from file - void LoadCaptureData(const char* fileName); - - protected: - //--------------------------------------------------------------------- - // TmMsgBus - //--------------------------------------------------------------------- - virtual void OnReceivedMsg(TmMsgPtr msg); - //--------------------------------------------------------------------- - - void Decompress(const void* compressedBuffer, size_t compressedBufferSize); - - static const AZ::u32 c_decompressionBufferSize = 128 * 1024; - - AZStd::vector m_uncompressedMsgBuffer; -#ifdef ENABLE_COMPRESSION_FOR_REMOTE_DRILLER - AZ::ZLib m_decompressor; - char m_decompressionBuffer[c_decompressionBufferSize]; -#endif - AZ::IO::SystemFile m_captureFile; - }; - - /** - * Driller clients interested in receiving notification events from the - * network console should implement this interface. - */ - class DrillerNetworkConsoleEvents - : public AZ::EBusTraits - { - public: - ////////////////////////////////////////////////////////////////////////// - // EBusTraits overrides - typedef AZ::OSStdAllocator AllocatorType; - ////////////////////////////////////////////////////////////////////////// - - virtual ~DrillerNetworkConsoleEvents() {} - - // A list of available drillers has been received from the target machine. - virtual void OnReceivedDrillerEnumeration(const DrillerInfoListType& availableDrillers) = 0; - }; - typedef AZ::EBus DrillerNetworkConsoleEventBus; - - /** - * The network driller console implements this interface. - * Commands can be sent to the network console through this interface. - */ - class DrillerNetworkConsoleCommands - : public AZ::EBusTraits - { - public: - ////////////////////////////////////////////////////////////////////////// - // EBusTraits overrides - typedef AZ::OSStdAllocator AllocatorType; - - // there's only one driller console instance allowed - static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single; - static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single; - ////////////////////////////////////////////////////////////////////////// - - virtual ~DrillerNetworkConsoleCommands() {} - - // Request an enumeration of available drillers from the target machine - virtual void EnumerateAvailableDrillers() = 0; - // Start a drilling session. This function is normally called internally by DrillerRemoteSession - virtual void StartRemoteDrillerSession(const DrillerListType& drillers, DrillerRemoteSession* handler) = 0; - // Stop a drilling session. This function is normally called internally by DrillerRemoteSession - virtual void StopRemoteDrillerSession(AZ::u64 sessionId) = 0; - }; - typedef AZ::EBus DrillerNetworkConsoleCommandBus; - - class DrillerNetSessionStream; - - /** - * Runs on the machine being drilled and is responsible for communications - * with the DrillerNetworkConsole running on the tool side as well as - * creating DrillerNetSessionStreams for each driller session being started. - */ - class DrillerNetworkAgentComponent - : public AZ::Component - , public TargetManagerClient::Bus::Handler - { - public: - AZ_COMPONENT(DrillerNetworkAgentComponent, "{B587A74D-6190-4149-91CB-0EA69936BD59}") - - ////////////////////////////////////////////////////////////////////////// - // AZ::Component - virtual void Init(); - virtual void Activate(); - virtual void Deactivate(); - static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided); - static void GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible); - static void Reflect(AZ::ReflectContext* context); - ////////////////////////////////////////////////////////////////////////// - - ////////////////////////////////////////////////////////////////////////// - // TargetManagerClient - virtual void TargetLeftNetwork(TargetInfo info); - ////////////////////////////////////////////////////////////////////////// - - protected: - ////////////////////////////////////////////////////////////////////////// - // TmMsg handlers - virtual void OnRequestDrillerEnum(TmMsgPtr msg); - virtual void OnRequestDrillerStart(TmMsgPtr msg); - virtual void OnRequestDrillerStop(TmMsgPtr msg); - ////////////////////////////////////////////////////////////////////////// - - TmMsgCallback m_cbDrillerEnumRequest; - TmMsgCallback m_cbDrillerStartRequest; - TmMsgCallback m_cbDrillerStopRequest; - - AZStd::vector m_activeSessions; - }; - - /** - * Runs on the tool machine and is responsible for communications with the - * DrillerNetworkAgent. - */ - class DrillerNetworkConsoleComponent - : public AZ::Component - , public DrillerNetworkConsoleCommandBus::Handler - , public TargetManagerClient::Bus::Handler - { - public: - AZ_COMPONENT(DrillerNetworkConsoleComponent, "{78ACADA4-F2C7-4320-8E97-59DD8B9BE33A}") - - ////////////////////////////////////////////////////////////////////////// - // AZ::Component - virtual void Init(); - virtual void Activate(); - virtual void Deactivate(); - static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided); - static void GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible); - static void Reflect(AZ::ReflectContext* context); - ////////////////////////////////////////////////////////////////////////// - - ////////////////////////////////////////////////////////////////////////// - // DrillerNetworkConsoleCommandBus - virtual void EnumerateAvailableDrillers(); - virtual void StartRemoteDrillerSession(const DrillerListType& drillers, DrillerRemoteSession* handler); - virtual void StopRemoteDrillerSession(AZ::u64 sessionId); - ////////////////////////////////////////////////////////////////////////// - - ////////////////////////////////////////////////////////////////////////// - // TargetManagerClient - virtual void DesiredTargetConnected(bool connected); - virtual void DesiredTargetChanged(AZ::u32 newTargetID, AZ::u32 oldTargetID); - ////////////////////////////////////////////////////////////////////////// - - protected: - ////////////////////////////////////////////////////////////////////////// - // TmMsg handlers - virtual void OnReceivedDrillerEnum(TmMsgPtr msg); - ////////////////////////////////////////////////////////////////////////// - - typedef AZStd::vector ActiveSessionListType; - ActiveSessionListType m_activeSessions; - TargetInfo m_curTarget; - TmMsgCallback m_cbDrillerEnum; - }; - - void ReflectNetDrillerClasses(AZ::ReflectContext* context); -} // namespace AzFramework - -#endif // AZFRAMEWORK_REMOTE_DRILLER_INTERFACE_H -#pragma once diff --git a/Code/Framework/AzFramework/AzFramework/azframework_files.cmake b/Code/Framework/AzFramework/AzFramework/azframework_files.cmake index ecf0a2b4f0..87cf29ffec 100644 --- a/Code/Framework/AzFramework/AzFramework/azframework_files.cmake +++ b/Code/Framework/AzFramework/AzFramework/azframework_files.cmake @@ -123,11 +123,6 @@ set(FILES Entity/SliceGameEntityOwnershipServiceBus.h Entity/PrefabEntityOwnershipService.h Entity/PrefabEntityOwnershipService.cpp - Driller/RemoteDrillerInterface.cpp - Driller/RemoteDrillerInterface.h - Driller/DrillerConsoleAPI.h - Driller/DrillToFileComponent.h - Driller/DrillToFileComponent.cpp Components/ComponentAdapter.h Components/ComponentAdapter.inl Components/ComponentAdapterHelpers.h diff --git a/Code/Framework/AzGameFramework/AzGameFramework/Application/GameApplication.cpp b/Code/Framework/AzGameFramework/AzGameFramework/Application/GameApplication.cpp index 3750eb1420..b4d61d7ac1 100644 --- a/Code/Framework/AzGameFramework/AzGameFramework/Application/GameApplication.cpp +++ b/Code/Framework/AzGameFramework/AzGameFramework/Application/GameApplication.cpp @@ -11,8 +11,6 @@ #include #include #include -#include -#include #include #include #include @@ -37,12 +35,6 @@ namespace AzGameFramework void GameApplication::StartCommon(AZ::Entity* systemEntity) { AzFramework::Application::StartCommon(systemEntity); - - if (GetDrillerManager()) - { - GetDrillerManager()->Register(aznew GridMate::Debug::CarrierDriller()); - GetDrillerManager()->Register(aznew GridMate::Debug::ReplicaDriller()); - } } void GameApplication::MergeSettingsToRegistry(AZ::SettingsRegistryInterface& registry) @@ -92,10 +84,6 @@ namespace AzGameFramework components.emplace_back(azrtti_typeid()); #endif - // Note that this component is registered by AzFramework. - // It must be registered here instead of in the module so that existence of AzFrameworkModule is guaranteed. - components.emplace_back(azrtti_typeid()); - return components; } @@ -104,9 +92,6 @@ namespace AzGameFramework AzFramework::Application::CreateStaticModules(outModules); outModules.emplace_back(aznew AzGameFrameworkModule()); - - // have to let the metrics system know that it's ok to send back the name of the DrillerNetworkAgentComponent to Amazon as plain text, without hashing - EBUS_EVENT(AzFramework::MetricsPlainTextNameRegistrationBus, RegisterForNameSending, AZStd::vector{ azrtti_typeid() }); } void GameApplication::QueryApplicationType(AZ::ApplicationTypeQuery& appType) const diff --git a/Code/Framework/AzGameFramework/AzGameFramework/AzGameFrameworkModule.cpp b/Code/Framework/AzGameFramework/AzGameFramework/AzGameFrameworkModule.cpp index 80996a2e4a..e7da10568e 100644 --- a/Code/Framework/AzGameFramework/AzGameFramework/AzGameFrameworkModule.cpp +++ b/Code/Framework/AzGameFramework/AzGameFramework/AzGameFrameworkModule.cpp @@ -7,24 +7,15 @@ */ #include -// Component includes -#include -#include - namespace AzGameFramework { AzGameFrameworkModule::AzGameFrameworkModule() : AZ::Module() { - m_descriptors.insert(m_descriptors.end(), { - AzFramework::DrillToFileComponent::CreateDescriptor(), - }); } AZ::ComponentTypeList AzGameFrameworkModule::GetRequiredSystemComponents() const { - return AZ::ComponentTypeList{ - azrtti_typeid(), - }; + return {}; } } diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/LegacyFramework/Core/EditorFrameworkApplication.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/LegacyFramework/Core/EditorFrameworkApplication.cpp index 8df5dd93ad..5b2638da1e 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/LegacyFramework/Core/EditorFrameworkApplication.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/LegacyFramework/Core/EditorFrameworkApplication.cpp @@ -35,7 +35,6 @@ #include #include #include -#include #include @@ -484,8 +483,6 @@ namespace LegacyFramework void Application::CreateApplicationComponents() { EnsureComponentCreated(AzFramework::TargetManagementComponent::RTTI_Type()); - EnsureComponentCreated(AzFramework::DrillerNetworkConsoleComponent::RTTI_Type()); - EnsureComponentCreated(AzFramework::DrillerNetworkAgentComponent::RTTI_Type()); } void Application::CreateSystemComponents() @@ -506,8 +503,6 @@ namespace LegacyFramework ComponentApplication::RegisterCoreComponents(); RegisterComponentDescriptor(AzFramework::TargetManagementComponent::CreateDescriptor()); - RegisterComponentDescriptor(AzFramework::DrillerNetworkConsoleComponent::CreateDescriptor()); - RegisterComponentDescriptor(AzFramework::DrillerNetworkAgentComponent::CreateDescriptor()); RegisterComponentDescriptor(AzToolsFramework::Framework::CreateDescriptor()); } } diff --git a/Code/Framework/AzToolsFramework/Tests/ComponentAddRemove.cpp b/Code/Framework/AzToolsFramework/Tests/ComponentAddRemove.cpp index 3225639fff..e15f4f3cfd 100644 --- a/Code/Framework/AzToolsFramework/Tests/ComponentAddRemove.cpp +++ b/Code/Framework/AzToolsFramework/Tests/ComponentAddRemove.cpp @@ -1117,7 +1117,6 @@ namespace UnitTest const char* GetAppRoot() const override { return nullptr; } const char* GetEngineRoot() const override { return nullptr; } const char* GetExecutableFolder() const override { return nullptr; } - Debug::DrillerManager* GetDrillerManager() override { return nullptr; } void EnumerateEntities(const EntityCallback& /*callback*/) override {} void QueryApplicationType(AZ::ApplicationTypeQuery& /*appType*/) const override {} ////////////////////////////////////////////////////////////////////////// diff --git a/Code/Legacy/CrySystem/SystemInit.cpp b/Code/Legacy/CrySystem/SystemInit.cpp index b5a6265493..ebd3d91a3d 100644 --- a/Code/Legacy/CrySystem/SystemInit.cpp +++ b/Code/Legacy/CrySystem/SystemInit.cpp @@ -97,7 +97,6 @@ #include #include #include -#include #if defined(ANDROID) #include @@ -1696,46 +1695,6 @@ void CmdSetAwsLogLevel(IConsoleCmdArgs* pArgs) } } -void CmdDrillToFile(IConsoleCmdArgs* pArgs) -{ - if (azstricmp(pArgs->GetArg(0), "DrillerStop") == 0) - { - EBUS_EVENT(AzFramework::DrillerConsoleCommandBus, StopDrillerSession, AZ::Crc32("DefaultDrillerSession")); - } - else - { - if (pArgs->GetArgCount() > 1) - { - AZ::Debug::DrillerManager::DrillerListType drillersToEnable; - for (int iArg = 1; iArg < pArgs->GetArgCount(); ++iArg) - { - if (azstricmp(pArgs->GetArg(iArg), "Replica") == 0) - { - drillersToEnable.push_back(); - drillersToEnable.back().id = AZ::Crc32("ReplicaDriller"); - } - else if (azstricmp(pArgs->GetArg(iArg), "Carrier") == 0) - { - drillersToEnable.push_back(); - drillersToEnable.back().id = AZ::Crc32("CarrierDriller"); - } - else - { - CryLogAlways("Driller %s not supported.", pArgs->GetArg(iArg)); - } - } - EBUS_EVENT(AzFramework::DrillerConsoleCommandBus, StartDrillerSession, drillersToEnable, AZ::Crc32("DefaultDrillerSession")); - } - else - { - CryLogAlways("Syntax: DrillerStart [Driller1] [Driller2] [...]"); - CryLogAlways("Supported Drillers:"); - CryLogAlways(" Carrier"); - CryLogAlways(" Replica"); - } - } -} - ////////////////////////////////////////////////////////////////////////// void CSystem::CreateSystemVars() { @@ -2114,9 +2073,6 @@ void CSystem::CreateSystemVars() // By default it is now enabled. Modify system.cfg or game.cfg to disable it REGISTER_INT("sys_enableCanvasEditor", 1, VF_NULL, "Enables the UI Canvas Editor"); - REGISTER_COMMAND_DEV_ONLY("DrillerStart", CmdDrillToFile, VF_DEV_ONLY, "Start a driller capture."); - REGISTER_COMMAND_DEV_ONLY("DrillerStop", CmdDrillToFile, VF_DEV_ONLY, "Stop a driller capture."); - REGISTER_COMMAND("sys_SetLogLevel", CmdSetAwsLogLevel, 0, "Set AWS log level [0 - 6]."); } diff --git a/Code/Tools/AssetBundler/source/utils/applicationManager.cpp b/Code/Tools/AssetBundler/source/utils/applicationManager.cpp index f9b779a2d7..0887b17682 100644 --- a/Code/Tools/AssetBundler/source/utils/applicationManager.cpp +++ b/Code/Tools/AssetBundler/source/utils/applicationManager.cpp @@ -23,7 +23,6 @@ #include #include -#include #include #include #include @@ -169,7 +168,6 @@ namespace AssetBundler if (*iter == azrtti_typeid() || *iter == azrtti_typeid() || *iter == azrtti_typeid() || - *iter == azrtti_typeid() || *iter == azrtti_typeid()) { // Asset Bundler does not require the above components to be active diff --git a/Code/Tools/SceneAPI/SceneCore/Tests/Containers/SceneBehaviorTests.cpp b/Code/Tools/SceneAPI/SceneCore/Tests/Containers/SceneBehaviorTests.cpp index adcdfd3083..3bf75e2d9b 100644 --- a/Code/Tools/SceneAPI/SceneCore/Tests/Containers/SceneBehaviorTests.cpp +++ b/Code/Tools/SceneAPI/SceneCore/Tests/Containers/SceneBehaviorTests.cpp @@ -371,7 +371,6 @@ namespace AZ::SceneAPI::Containers MOCK_CONST_METHOD0(GetAppRoot, const char*()); MOCK_CONST_METHOD0(GetEngineRoot, const char*()); MOCK_CONST_METHOD0(GetExecutableFolder, const char* ()); - MOCK_METHOD0(GetDrillerManager, AZ::Debug::DrillerManager* ()); MOCK_CONST_METHOD1(QueryApplicationType, void(AZ::ApplicationTypeQuery&)); }; diff --git a/Gems/AWSClientAuth/Code/Tests/AWSClientAuthGemMock.h b/Gems/AWSClientAuth/Code/Tests/AWSClientAuthGemMock.h index 1bf80522ed..1d2e8bad42 100644 --- a/Gems/AWSClientAuth/Code/Tests/AWSClientAuthGemMock.h +++ b/Gems/AWSClientAuth/Code/Tests/AWSClientAuthGemMock.h @@ -610,7 +610,6 @@ namespace AWSClientAuthUnitTest const char* GetExecutableFolder() const override { return nullptr; } const char* GetAppRoot() const override { return nullptr; } const char* GetEngineRoot() const override { return nullptr; } - AZ::Debug::DrillerManager* GetDrillerManager() override { return nullptr; } void EnumerateEntities(const EntityCallback& /*callback*/) override {} void QueryApplicationType(AZ::ApplicationTypeQuery& /*appType*/) const override {} AZ::SerializeContext* GetSerializeContext() override diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/ImageProcessing_Test.cpp b/Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/ImageProcessing_Test.cpp index 4b28fbe4ef..6395913f7a 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/ImageProcessing_Test.cpp +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/ImageProcessing_Test.cpp @@ -114,7 +114,6 @@ namespace UnitTest const char* GetAppRoot() const override { return nullptr; } const char* GetEngineRoot() const override { return nullptr; } const char* GetExecutableFolder() const override { return nullptr; } - AZ::Debug::DrillerManager* GetDrillerManager() override { return nullptr; } void EnumerateEntities(const AZ::ComponentApplicationRequests::EntityCallback& /*callback*/) override {} void QueryApplicationType(AZ::ApplicationTypeQuery& /*appType*/) const override {} ////////////////////////////////////////////////////////////////////////// diff --git a/Gems/Atom/RPI/Code/Source/RPI.Public/Material/Material.cpp b/Gems/Atom/RPI/Code/Source/RPI.Public/Material/Material.cpp index c0c187f2bc..3b82114a69 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Public/Material/Material.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Public/Material/Material.cpp @@ -339,7 +339,7 @@ namespace AZ AZ_Error(s_debugTraceName, false, "Material functor is null."); } } - AZ_PROFILE_END(); + AZ_PROFILE_END(RPI); m_propertyDirtyFlags.reset(); diff --git a/Gems/Atom/RPI/Code/Source/RPI.Public/Scene.cpp b/Gems/Atom/RPI/Code/Source/RPI.Public/Scene.cpp index 82d53d8bc3..761ce20ee8 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Public/Scene.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Public/Scene.cpp @@ -542,7 +542,7 @@ namespace AZ { view->FinalizeDrawLists(); } - AZ_PROFILE_END(); + AZ_PROFILE_END(RPI); } else { @@ -558,7 +558,7 @@ namespace AZ finalizeDrawListsJob->SetDependent(finalizeDrawListsCompletion); finalizeDrawListsJob->Start(); } - AZ_PROFILE_END(); + AZ_PROFILE_END(RPI); WaitAndCleanCompletionJob(finalizeDrawListsCompletion); } } diff --git a/Gems/Atom/RPI/Code/Tests.Builders/BuilderTestFixture.h b/Gems/Atom/RPI/Code/Tests.Builders/BuilderTestFixture.h index 33f237e919..31c1bc6715 100644 --- a/Gems/Atom/RPI/Code/Tests.Builders/BuilderTestFixture.h +++ b/Gems/Atom/RPI/Code/Tests.Builders/BuilderTestFixture.h @@ -49,7 +49,6 @@ namespace UnitTest const char* GetAppRoot() const override { return nullptr; } const char* GetEngineRoot() const override { return nullptr; } const char* GetExecutableFolder() const override { return nullptr; } - AZ::Debug::DrillerManager* GetDrillerManager() override { return nullptr; } void EnumerateEntities(const EntityCallback& /*callback*/) override {} void QueryApplicationType(AZ::ApplicationTypeQuery& /*appType*/) const override {} // The functions we need to implement. diff --git a/Gems/Atom/RPI/Code/Tests/Common/AssetManagerTestFixture.h b/Gems/Atom/RPI/Code/Tests/Common/AssetManagerTestFixture.h index 63a5865afa..ee3ad94d4f 100644 --- a/Gems/Atom/RPI/Code/Tests/Common/AssetManagerTestFixture.h +++ b/Gems/Atom/RPI/Code/Tests/Common/AssetManagerTestFixture.h @@ -47,7 +47,6 @@ namespace UnitTest const char* GetAppRoot() const override { return nullptr; } const char* GetEngineRoot() const override { return nullptr; } const char* GetExecutableFolder() const override { return nullptr; } - AZ::Debug::DrillerManager* GetDrillerManager() override { return nullptr; } void EnumerateEntities(const EntityCallback& /*callback*/) override {} AZ::SerializeContext* GetSerializeContext() override { diff --git a/Gems/Blast/Code/Source/Components/BlastSystemComponent.cpp b/Gems/Blast/Code/Source/Components/BlastSystemComponent.cpp index 58324422db..851cb4460b 100644 --- a/Gems/Blast/Code/Source/Components/BlastSystemComponent.cpp +++ b/Gems/Blast/Code/Source/Components/BlastSystemComponent.cpp @@ -433,7 +433,7 @@ namespace Blast void BlastSystemComponent::AZBlastProfilerCallback::zoneEnd() { - AZ_PROFILE_END(); + AZ_PROFILE_END(Physics); } static void CmdToggleBlastDebugVisualization(IConsoleCmdArgs* args) diff --git a/Gems/LmbrCentral/Code/Tests/Builders/SliceBuilderTests.cpp b/Gems/LmbrCentral/Code/Tests/Builders/SliceBuilderTests.cpp index 2f8d913d9c..647a5dedef 100644 --- a/Gems/LmbrCentral/Code/Tests/Builders/SliceBuilderTests.cpp +++ b/Gems/LmbrCentral/Code/Tests/Builders/SliceBuilderTests.cpp @@ -313,7 +313,6 @@ namespace UnitTest const char* GetAppRoot() const override { return nullptr; } const char* GetEngineRoot() const override { return nullptr; } const char* GetExecutableFolder() const override { return nullptr; } - Debug::DrillerManager* GetDrillerManager() override { return nullptr; } void EnumerateEntities(const EntityCallback& /*callback*/) override {} void QueryApplicationType(AZ::ApplicationTypeQuery& /*appType*/) const override {} ////////////////////////////////////////////////////////////////////////// diff --git a/Gems/NvCloth/Code/Include/NvCloth/IFabricCooker.h b/Gems/NvCloth/Code/Include/NvCloth/IFabricCooker.h index 8428500f59..14811b2ec6 100644 --- a/Gems/NvCloth/Code/Include/NvCloth/IFabricCooker.h +++ b/Gems/NvCloth/Code/Include/NvCloth/IFabricCooker.h @@ -8,11 +8,14 @@ #pragma once +#include #include #include #include +AZ_DECLARE_BUDGET(Cloth); + namespace NvCloth { //! Interface to cook particles into fabric. diff --git a/Gems/NvCloth/Code/Source/System/SystemComponent.cpp b/Gems/NvCloth/Code/Source/System/SystemComponent.cpp index 77223ba566..3d332aa13d 100644 --- a/Gems/NvCloth/Code/Source/System/SystemComponent.cpp +++ b/Gems/NvCloth/Code/Source/System/SystemComponent.cpp @@ -125,7 +125,7 @@ namespace NvCloth } else { - AZ_PROFILE_END(); + AZ_PROFILE_END(Cloth); } } }; diff --git a/Gems/PhysX/Code/Source/System/PhysXSdkCallbacks.cpp b/Gems/PhysX/Code/Source/System/PhysXSdkCallbacks.cpp index 28981722b6..c9d4041e01 100644 --- a/Gems/PhysX/Code/Source/System/PhysXSdkCallbacks.cpp +++ b/Gems/PhysX/Code/Source/System/PhysXSdkCallbacks.cpp @@ -59,7 +59,7 @@ namespace PhysX { if (!detached) { - AZ_PROFILE_END(); + AZ_PROFILE_END(Physics); } else { diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/EBusHandler.h b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/EBusHandler.h index decb7ae9c0..9d9830f361 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/EBusHandler.h +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/EBusHandler.h @@ -8,10 +8,13 @@ #pragma once +#include #include #include "Nodeable.h" +AZ_DECLARE_BUDGET(ScriptCanvas); + struct lua_State; namespace AZ diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/Node.cpp b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/Node.cpp index 62e6369a40..4b9113d39c 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/Node.cpp +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Core/Node.cpp @@ -36,6 +36,8 @@ #include //// +AZ_DECLARE_BUDGET(ScriptCanvas); + namespace NodeCpp { enum Version diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Data/Data.h b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Data/Data.h index 9ab993fdd1..d51489d487 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Data/Data.h +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Data/Data.h @@ -26,6 +26,8 @@ #include #include +AZ_DECLARE_BUDGET(ScriptCanvas); + namespace AZ { class ReflectContext; diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Execution/RuntimeComponent.cpp b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Execution/RuntimeComponent.cpp index 89c69ee4c5..6d652136cd 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Execution/RuntimeComponent.cpp +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Execution/RuntimeComponent.cpp @@ -23,6 +23,8 @@ #define SCRIPT_CANVAS_RUNTIME_ASSET_CHECK #endif +AZ_DECLARE_BUDGET(ScriptCanvas); + namespace RuntimeComponentCpp { enum class RuntimeComponentVersion : unsigned int diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Internal/Nodes/StringFormatted.cpp b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Internal/Nodes/StringFormatted.cpp index 552e04a850..a943f167e1 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Internal/Nodes/StringFormatted.cpp +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Internal/Nodes/StringFormatted.cpp @@ -13,6 +13,8 @@ #include +AZ_DECLARE_BUDGET(ScriptCanvas); + namespace ScriptCanvas { namespace Nodes diff --git a/Gems/ScriptCanvas/Code/Tests/ScriptCanvasBuilderTests.cpp b/Gems/ScriptCanvas/Code/Tests/ScriptCanvasBuilderTests.cpp index 241d7d2df9..5b38b640ca 100644 --- a/Gems/ScriptCanvas/Code/Tests/ScriptCanvasBuilderTests.cpp +++ b/Gems/ScriptCanvas/Code/Tests/ScriptCanvasBuilderTests.cpp @@ -91,7 +91,6 @@ protected: const char* GetAppRoot() const override { return nullptr; } const char* GetEngineRoot() const override { return nullptr; } const char* GetExecutableFolder() const override { return nullptr; } - AZ::Debug::DrillerManager* GetDrillerManager() override { return nullptr; } void EnumerateEntities(const AZ::ComponentApplicationRequests::EntityCallback& /*callback*/) override {} void QueryApplicationType(AZ::ApplicationTypeQuery& /*appType*/) const override {} ////////////////////////////////////////////////////////////////////////// From c37c0cab08da9d84afeb39b77c9dcb7b5916f452 Mon Sep 17 00:00:00 2001 From: Jeremy Ong Date: Mon, 23 Aug 2021 22:09:02 -0600 Subject: [PATCH 068/131] Refactor budget definitions as named functions instead of template specializations Signed-off-by: Jeremy Ong --- .../AssetImporterDocument.cpp | 1 + .../ImporterRootDisplay.cpp | 1 + .../AzCore/Component/ComponentApplication.cpp | 2 + .../AzCore/Component/ComponentApplication.h | 6 +- Code/Framework/AzCore/AzCore/Debug/Budget.cpp | 9 +-- Code/Framework/AzCore/AzCore/Debug/Budget.h | 40 +++++-------- .../AzCore/AzCore/Debug/BudgetTracker.cpp | 43 +++++++++----- .../AzCore/AzCore/Debug/BudgetTracker.h | 11 ++-- Code/Framework/AzCore/AzCore/Debug/Profiler.h | 46 ++++----------- .../AzCore/AzCore/Debug/Profiler.inl | 57 +++++++++++++++++++ .../AzCore/AzCore/UnitTest/TestTypes.h | 1 + .../AzCore/AzCore/azcore_files.cmake | 1 + .../AzFramework/Entity/EntityContextBus.h | 3 + .../UI/PropertyEditor/PropertyEditorAPI.h | 2 - .../PropertyEditorAPI_Internals.h | 2 + .../GridMate/Tests/gridmate_test_files.cmake | 2 - Code/Legacy/CrySystem/System.cpp | 2 + .../CrySystem/SystemEventDispatcher.cpp | 1 + Gems/AudioSystem/Code/Source/Engine/ATL.cpp | 1 + .../Code/Source/Engine/AudioSystem.cpp | 2 - .../Include/NvCloth/ITangentSpaceHelper.h | 3 + Gems/PhysX/Code/Source/System/PhysXSystem.cpp | 2 - .../ScriptEventsSystemEditorComponent.cpp | 2 + 23 files changed, 145 insertions(+), 95 deletions(-) create mode 100644 Code/Framework/AzCore/AzCore/Debug/Profiler.inl diff --git a/Code/Editor/Plugins/EditorAssetImporter/AssetImporterDocument.cpp b/Code/Editor/Plugins/EditorAssetImporter/AssetImporterDocument.cpp index c7e14d9c4e..105a5b4954 100644 --- a/Code/Editor/Plugins/EditorAssetImporter/AssetImporterDocument.cpp +++ b/Code/Editor/Plugins/EditorAssetImporter/AssetImporterDocument.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include #include diff --git a/Code/Editor/Plugins/EditorAssetImporter/ImporterRootDisplay.cpp b/Code/Editor/Plugins/EditorAssetImporter/ImporterRootDisplay.cpp index 4f942a4251..2c00edbc39 100644 --- a/Code/Editor/Plugins/EditorAssetImporter/ImporterRootDisplay.cpp +++ b/Code/Editor/Plugins/EditorAssetImporter/ImporterRootDisplay.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #include ImporterRootDisplay::ImporterRootDisplay(AZ::SerializeContext* serializeContext, QWidget* parent) diff --git a/Code/Framework/AzCore/AzCore/Component/ComponentApplication.cpp b/Code/Framework/AzCore/AzCore/Component/ComponentApplication.cpp index 39b90a165b..e9e5738bd1 100644 --- a/Code/Framework/AzCore/AzCore/Component/ComponentApplication.cpp +++ b/Code/Framework/AzCore/AzCore/Component/ComponentApplication.cpp @@ -545,6 +545,8 @@ namespace AZ m_entityActivatedEvent.DisconnectAllHandlers(); m_entityDeactivatedEvent.DisconnectAllHandlers(); + m_budgetTracker.Reset(); + DestroyAllocator(); } diff --git a/Code/Framework/AzCore/AzCore/Component/ComponentApplication.h b/Code/Framework/AzCore/AzCore/Component/ComponentApplication.h index 609b683836..b2a1f0324b 100644 --- a/Code/Framework/AzCore/AzCore/Component/ComponentApplication.h +++ b/Code/Framework/AzCore/AzCore/Component/ComponentApplication.h @@ -11,8 +11,8 @@ #include #include #include -#include #include +#include #include #include #include @@ -395,6 +395,8 @@ namespace AZ // from the m_console member when it goes out of scope AZ::SettingsRegistryConsoleUtils::ConsoleFunctorHandle m_settingsRegistryConsoleFunctors; + Debug::BudgetTracker m_budgetTracker; + // this is used when no argV/ArgC is supplied. // in order to have the same memory semantics (writable, non-const) // we create a buffer that can be written to (up to AZ_MAX_PATH_LEN) and then @@ -402,8 +404,6 @@ namespace AZ char m_commandLineBuffer[AZ_MAX_PATH_LEN]; char* m_commandLineBufferAddress{ m_commandLineBuffer }; - AZ::Debug::BudgetTracker m_budgetTracker; - StartupParameters m_startupParameters; char** m_argV{ nullptr }; diff --git a/Code/Framework/AzCore/AzCore/Debug/Budget.cpp b/Code/Framework/AzCore/AzCore/Debug/Budget.cpp index 5f17752f2a..9790257ded 100644 --- a/Code/Framework/AzCore/AzCore/Debug/Budget.cpp +++ b/Code/Framework/AzCore/AzCore/Debug/Budget.cpp @@ -12,13 +12,14 @@ #include #include +AZ_DEFINE_BUDGET(Animation); +AZ_DEFINE_BUDGET(Audio); AZ_DEFINE_BUDGET(AzCore); AZ_DEFINE_BUDGET(Editor); AZ_DEFINE_BUDGET(Entity); AZ_DEFINE_BUDGET(Game); AZ_DEFINE_BUDGET(System); -AZ_DEFINE_BUDGET(Audio); -AZ_DEFINE_BUDGET(Animation); +AZ_DEFINE_BUDGET(Physics); namespace AZ::Debug { @@ -28,9 +29,9 @@ namespace AZ::Debug // TODO: Budget implementation for tracking budget wall time per-core, memory, etc. }; - Budget::Budget(const char* name) + Budget::Budget(const char* name, uint32_t crc) : m_name{ name } - , m_crc{ Crc32(name) } + , m_crc{ crc } { m_impl = aznew BudgetImpl; } diff --git a/Code/Framework/AzCore/AzCore/Debug/Budget.h b/Code/Framework/AzCore/AzCore/Debug/Budget.h index ce11469f81..376bf4cc4a 100644 --- a/Code/Framework/AzCore/AzCore/Debug/Budget.h +++ b/Code/Framework/AzCore/AzCore/Debug/Budget.h @@ -7,15 +7,9 @@ */ #pragma once -#include #include - -#pragma warning(push) -// This warning must be disabled because Budget::Get may not have an implementation if this file is transitively included -// in a source file that doesn't actually have any budgets declared in scope (via AZ_DEFINE_BUDGET or AZ_DECLARE_BUDGET). -// In this situation, the warning about internal linkage without an implementation is benign because we know that this function -// cannot be invoked from that translation unit. -#pragma warning(disable: 5046) +#include +#include namespace AZ::Debug { @@ -23,13 +17,7 @@ namespace AZ::Debug class Budget final { public: - // If you encounter a linker error complaining that this function is not defined, you have likely forgotten to either - // define or declare the budget used in a profile or memory marker. See AZ_DEFINE_BUDGET and AZ_DECLARE_BUDGET below - // for usage. - template - static Budget* Get(); - - explicit Budget(const char* name); + Budget(const char* name, uint32_t crc); ~Budget(); void PerFrameReset(); @@ -54,11 +42,12 @@ namespace AZ::Debug struct BudgetImpl* m_impl = nullptr; }; } // namespace AZ::Debug -#pragma warning(pop) -// Budgets are registered and retrieved using the proxy type specialization of Budget::Get. The type itself has no declaration/definition -// other than this forward type pointer declaration -#define AZ_BUDGET_PROXY_TYPE(name) class AzBudget##name* +// The budget is usable in the same file it was defined without needing an additional declaration. +// If you encounter a linker error complaining that this function is not defined, you have likely forgotten to either +// define or declare the budget used in a profile or memory marker. See AZ_DEFINE_BUDGET and AZ_DECLARE_BUDGET below +// for usage. +#define AZ_BUDGET_GETTER(name) GetAzBudget##name // Usage example: // In a single C++ source file: @@ -66,12 +55,10 @@ namespace AZ::Debug // // Anywhere the budget is used, the budget must be declared (either in a header or in the source file itself) // AZ_DECLARE_BUDGET(AzCore); -// -// The budget is usable in the same file it was defined without needing an additional declaration #define AZ_DEFINE_BUDGET(name) \ - template<> \ - ::AZ::Debug::Budget* ::AZ::Debug::Budget::Get() \ + ::AZ::Debug::Budget* AZ_BUDGET_GETTER(name)() \ { \ + constexpr static uint32_t crc = AZ_CRC_CE(#name); \ static ::AZStd::atomic<::AZ::Debug::Budget*> budget; \ ::AZ::Debug::Budget* out = budget.load(AZStd::memory_order_acquire); \ if (out) \ @@ -80,22 +67,23 @@ namespace AZ::Debug } \ else \ { \ - budget.store(&::AZ::Debug::BudgetTracker::GetBudgetFromEnvironment(#name), AZStd::memory_order_release); \ + budget.store(::AZ::Debug::BudgetTracker::GetBudgetFromEnvironment(#name, crc), AZStd::memory_order_release); \ return budget; \ } \ } // If using a budget defined in a different C++ source file, add AZ_DECLARE_BUDGET(yourBudget); somewhere in your source file at namespace // scope Alternatively, AZ_DECLARE_BUDGET can be used in a header to declare the budget for use across any users of the header -#define AZ_DECLARE_BUDGET(name) extern template ::AZ::Debug::Budget* ::AZ::Debug::Budget::Get() +#define AZ_DECLARE_BUDGET(name) extern ::AZ::Debug::Budget* AZ_BUDGET_GETTER(name)() // Declare budgets that are core engine budgets, or may be shared/needed across multiple external gems // You should NOT need to declare user-space or budgets with isolated usage here. Prefer declaring them local to the module(s) that use // the budget and defining them within a single module to avoid needing to recompile the entire engine. +AZ_DECLARE_BUDGET(Animation); +AZ_DECLARE_BUDGET(Audio); AZ_DECLARE_BUDGET(AzCore); AZ_DECLARE_BUDGET(Editor); AZ_DECLARE_BUDGET(Entity); AZ_DECLARE_BUDGET(Game); AZ_DECLARE_BUDGET(System); AZ_DECLARE_BUDGET(Physics); -AZ_DECLARE_BUDGET(Animation); diff --git a/Code/Framework/AzCore/AzCore/Debug/BudgetTracker.cpp b/Code/Framework/AzCore/AzCore/Debug/BudgetTracker.cpp index c58c92deb2..959f8ba3a8 100644 --- a/Code/Framework/AzCore/AzCore/Debug/BudgetTracker.cpp +++ b/Code/Framework/AzCore/AzCore/Debug/BudgetTracker.cpp @@ -10,6 +10,7 @@ #include #include +#include #include #include #include @@ -20,40 +21,54 @@ namespace AZ::Debug struct BudgetTrackerImpl { - AZ_CLASS_ALLOCATOR(BudgetTrackerImpl, AZ::SystemAllocator, 0); - AZStd::unordered_map m_budgets; }; - Budget& BudgetTracker::GetBudgetFromEnvironment(const char* budgetName) + Budget* BudgetTracker::GetBudgetFromEnvironment(const char* budgetName, uint32_t crc) { - return (*Environment::FindVariable(BudgetTrackerEnvName))->GetBudget(budgetName); + BudgetTracker* tracker = Interface::Get(); + if (tracker) + { + return &tracker->GetBudget(budgetName, crc); + } + return nullptr; } BudgetTracker::~BudgetTracker() + { + Reset(); + } + + bool BudgetTracker::Init() + { + if (Interface::Get()) + { + return false; + } + + Interface::Register(this); + m_impl = new BudgetTrackerImpl; + return true; + } + + void BudgetTracker::Reset() { if (m_impl) { + Interface::Unregister(this); delete m_impl; + m_impl = nullptr; } } - void BudgetTracker::Init() - { - AZ_Assert(!m_impl, "BudgetTracker::Init called more than once"); - - m_impl = aznew BudgetTrackerImpl; - m_envVar = Environment::CreateVariable(BudgetTrackerEnvName, this); - } - - Budget& BudgetTracker::GetBudget(const char* budgetName) + Budget& BudgetTracker::GetBudget(const char* budgetName, uint32_t crc) { AZStd::scoped_lock lock{ m_mutex }; auto it = m_impl->m_budgets.find(budgetName); if (it == m_impl->m_budgets.end()) { - it = m_impl->m_budgets.emplace(budgetName, budgetName).first; + it = m_impl->m_budgets.try_emplace(budgetName, budgetName, crc).first; } return it->second; diff --git a/Code/Framework/AzCore/AzCore/Debug/BudgetTracker.h b/Code/Framework/AzCore/AzCore/Debug/BudgetTracker.h index bd4953c545..d89d55b913 100644 --- a/Code/Framework/AzCore/AzCore/Debug/BudgetTracker.h +++ b/Code/Framework/AzCore/AzCore/Debug/BudgetTracker.h @@ -9,6 +9,7 @@ #pragma once #include +#include #include namespace AZ::Debug @@ -18,17 +19,19 @@ namespace AZ::Debug class BudgetTracker { public: - static Budget& GetBudgetFromEnvironment(const char* budgetName); + AZ_RTTI(BudgetTracker, "{E14A746D-BFFE-4C02-90FB-4699B79864A5}"); + static Budget* GetBudgetFromEnvironment(const char* budgetName, uint32_t crc); ~BudgetTracker(); - void Init(); + // Returns false if the budget tracker was already present in the environment (initialized already elsewhere) + bool Init(); + void Reset(); - Budget& GetBudget(const char* budgetName); + Budget& GetBudget(const char* budgetName, uint32_t crc); private: AZStd::mutex m_mutex; - AZ::EnvironmentVariable m_envVar; // The BudgetTracker is likely included in proportionally high number of files throughout the // engine, so indirection is used here to avoid imposing excessive recompilation in periods diff --git a/Code/Framework/AzCore/AzCore/Debug/Profiler.h b/Code/Framework/AzCore/AzCore/Debug/Profiler.h index a24c5af052..c8911a6ac4 100644 --- a/Code/Framework/AzCore/AzCore/Debug/Profiler.h +++ b/Code/Framework/AzCore/AzCore/Debug/Profiler.h @@ -29,15 +29,14 @@ #define AZ_PROFILE_SCOPE(budget, ...) \ ::AZ::Debug::ProfileScope AZ_JOIN(azProfileScope, __LINE__) \ { \ - *::AZ::Debug::Budget::Get(), __VA_ARGS__ \ + AZ_BUDGET_GETTER(budget)(), __VA_ARGS__ \ } #define AZ_PROFILE_FUNCTION(category) AZ_PROFILE_SCOPE(category, AZ_FUNCTION_SIGNATURE) // Prefer using the scoped macros which automatically end the event (AZ_PROFILE_SCOPE/AZ_PROFILE_FUNCTION) -#define AZ_PROFILE_BEGIN(budget, ...) \ - ::AZ::Debug::ProfileScope::BeginRegion(*::AZ::Debug::Budget::Get(), __VA_ARGS__) -#define AZ_PROFILE_END(budget) ::AZ::Debug::ProfileScope::EndRegion(*::AZ::Debug::Budget::Get()) +#define AZ_PROFILE_BEGIN(budget, ...) ::AZ::Debug::ProfileScope::BeginRegion(AZ_BUDGET_GETTER(budget)(), __VA_ARGS__) +#define AZ_PROFILE_END(budget) ::AZ::Debug::ProfileScope::EndRegion(AZ_BUDGET_GETTER(budget)()) #endif // AZ_PROFILER_MACRO_DISABLE @@ -64,44 +63,17 @@ namespace AZ::Debug { public: template - static void BeginRegion([[maybe_unused]] Budget& budget, [[maybe_unused]] const char* eventName, [[maybe_unused]] T const&... args) - { -#if !defined(_RELEASE) - // TODO: Verification that the supplied system name corresponds to a known budget -#if defined(USE_PIX) - PIXBeginEvent(PIX_COLOR_INDEX(budget.Crc() & 0xff), eventName, args...); -#endif - budget.BeginProfileRegion(); -// TODO: injecting instrumentation for other profilers -// NOTE: external profiler registration won't occur inline in a header necessarily in this manner, but the exact mechanism -// will be introduced in a future PR -#endif - } + static void BeginRegion([[maybe_unused]] Budget* budget, [[maybe_unused]] const char* eventName, [[maybe_unused]] T const&... args); - static void EndRegion([[maybe_unused]] Budget& budget) - { -#if !defined(_RELEASE) - budget.EndProfileRegion(); -#if defined(USE_PIX) - PIXEndEvent(); -#endif -#endif - } + static void EndRegion([[maybe_unused]] Budget* budget); template - ProfileScope(Budget& budget, char const* eventName, T const&... args) - : m_budget{ budget } - { - BeginRegion(budget, eventName, args...); - } + ProfileScope(Budget* budget, char const* eventName, T const&... args); - ~ProfileScope() - { - EndRegion(m_budget); - } + ~ProfileScope(); private: - Budget& m_budget; + Budget* m_budget; }; } // namespace AZ::Debug @@ -111,3 +83,5 @@ namespace AZ::Debug #undef LoadImage #undef GetCurrentTime #endif + +#include diff --git a/Code/Framework/AzCore/AzCore/Debug/Profiler.inl b/Code/Framework/AzCore/AzCore/Debug/Profiler.inl new file mode 100644 index 0000000000..8ca8368ce1 --- /dev/null +++ b/Code/Framework/AzCore/AzCore/Debug/Profiler.inl @@ -0,0 +1,57 @@ +/* + * Copyright (c) Contributors to the Open 3D Engine Project. + * For complete copyright and license terms please see the LICENSE at the root of this distribution. + * + * SPDX-License-Identifier: Apache-2.0 OR MIT + * + */ + +namespace AZ::Debug +{ + template + void ProfileScope::BeginRegion( + [[maybe_unused]] Budget* budget, [[maybe_unused]] const char* eventName, [[maybe_unused]] T const&... args) + { + if (!budget) + { + return; + } +#if !defined(_RELEASE) + // TODO: Verification that the supplied system name corresponds to a known budget +#if defined(USE_PIX) + PIXBeginEvent(PIX_COLOR_INDEX(budget->Crc() & 0xff), eventName, args...); +#endif + budget->BeginProfileRegion(); +// TODO: injecting instrumentation for other profilers +// NOTE: external profiler registration won't occur inline in a header necessarily in this manner, but the exact mechanism +// will be introduced in a future PR +#endif + } + + inline void ProfileScope::EndRegion([[maybe_unused]] Budget* budget) + { + if (!budget) + { + return; + } +#if !defined(_RELEASE) + budget->EndProfileRegion(); +#if defined(USE_PIX) + PIXEndEvent(); +#endif +#endif + } + + template + ProfileScope::ProfileScope(Budget* budget, char const* eventName, T const&... args) + : m_budget{ budget } + { + BeginRegion(budget, eventName, args...); + } + + inline ProfileScope::~ProfileScope() + { + EndRegion(m_budget); + } + +} // namespace AZ::Debug diff --git a/Code/Framework/AzCore/AzCore/UnitTest/TestTypes.h b/Code/Framework/AzCore/AzCore/UnitTest/TestTypes.h index eb5011bbfa..c3e3f5210a 100644 --- a/Code/Framework/AzCore/AzCore/UnitTest/TestTypes.h +++ b/Code/Framework/AzCore/AzCore/UnitTest/TestTypes.h @@ -11,6 +11,7 @@ #include #include +#include #include #include #include diff --git a/Code/Framework/AzCore/AzCore/azcore_files.cmake b/Code/Framework/AzCore/AzCore/azcore_files.cmake index 745054855b..c2ee439645 100644 --- a/Code/Framework/AzCore/AzCore/azcore_files.cmake +++ b/Code/Framework/AzCore/AzCore/azcore_files.cmake @@ -102,6 +102,7 @@ set(FILES Debug/IEventLogger.h Debug/MemoryProfiler.h Debug/Profiler.cpp + Debug/Profiler.inl Debug/Profiler.h Debug/ProfilerBus.h Debug/StackTracer.h diff --git a/Code/Framework/AzFramework/AzFramework/Entity/EntityContextBus.h b/Code/Framework/AzFramework/AzFramework/Entity/EntityContextBus.h index 49cb8db609..124c8d8f50 100644 --- a/Code/Framework/AzFramework/AzFramework/Entity/EntityContextBus.h +++ b/Code/Framework/AzFramework/AzFramework/Entity/EntityContextBus.h @@ -16,11 +16,14 @@ #ifndef AZFRAMEWORK_ENTITYCONTEXTBUS_H #define AZFRAMEWORK_ENTITYCONTEXTBUS_H +#include #include #include #include #include +AZ_DECLARE_BUDGET(AzFramework); + namespace AZ { class Entity; diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyEditorAPI.h b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyEditorAPI.h index 6f5183edaf..9ab896ab9d 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyEditorAPI.h +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyEditorAPI.h @@ -17,8 +17,6 @@ #include #include "PropertyEditorAPI_Internals.h" -AZ_DECLARE_BUDGET(AzToolsFramework); - class QWidget; class QCheckBox; class QLabel; diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyEditorAPI_Internals.h b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyEditorAPI_Internals.h index 8b53121776..ecd27baed4 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyEditorAPI_Internals.h +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyEditorAPI_Internals.h @@ -25,6 +25,8 @@ class QColor; class QString; class QPoint; +AZ_DECLARE_BUDGET(AzToolsFramework); + namespace AzToolsFramework { namespace Components diff --git a/Code/Framework/GridMate/Tests/gridmate_test_files.cmake b/Code/Framework/GridMate/Tests/gridmate_test_files.cmake index 7b2ae2e8ab..3ff67f8eda 100644 --- a/Code/Framework/GridMate/Tests/gridmate_test_files.cmake +++ b/Code/Framework/GridMate/Tests/gridmate_test_files.cmake @@ -8,7 +8,6 @@ set(FILES test_Main.cpp - TestProfiler.cpp Tests.h Session.cpp Serialize.cpp @@ -16,7 +15,6 @@ set(FILES ReplicaSmall.cpp ReplicaMedium.cpp ReplicaBehavior.cpp - Replica.cpp StreamSecureSocketDriverTests.cpp StreamSocketDriverTests.cpp CarrierStreamSocketDriverTests.cpp diff --git a/Code/Legacy/CrySystem/System.cpp b/Code/Legacy/CrySystem/System.cpp index 5c03b06a48..8c950e900c 100644 --- a/Code/Legacy/CrySystem/System.cpp +++ b/Code/Legacy/CrySystem/System.cpp @@ -22,6 +22,8 @@ #include #include #include +#include +#include #include #include #include diff --git a/Code/Legacy/CrySystem/SystemEventDispatcher.cpp b/Code/Legacy/CrySystem/SystemEventDispatcher.cpp index 525bf1a005..8e4e36b453 100644 --- a/Code/Legacy/CrySystem/SystemEventDispatcher.cpp +++ b/Code/Legacy/CrySystem/SystemEventDispatcher.cpp @@ -9,6 +9,7 @@ #include "CrySystem_precompiled.h" #include "SystemEventDispatcher.h" +#include CSystemEventDispatcher::CSystemEventDispatcher() : m_listeners(0) diff --git a/Gems/AudioSystem/Code/Source/Engine/ATL.cpp b/Gems/AudioSystem/Code/Source/Engine/ATL.cpp index ff56300b85..3122ddcbd3 100644 --- a/Gems/AudioSystem/Code/Source/Engine/ATL.cpp +++ b/Gems/AudioSystem/Code/Source/Engine/ATL.cpp @@ -13,6 +13,7 @@ #include #endif // !AUDIO_RELEASE +#include #include #include diff --git a/Gems/AudioSystem/Code/Source/Engine/AudioSystem.cpp b/Gems/AudioSystem/Code/Source/Engine/AudioSystem.cpp index 4e0a5b3baf..dfe34fb6eb 100644 --- a/Gems/AudioSystem/Code/Source/Engine/AudioSystem.cpp +++ b/Gems/AudioSystem/Code/Source/Engine/AudioSystem.cpp @@ -17,8 +17,6 @@ #include #include -AZ_DEFINE_BUDGET(Audio); - namespace Audio { extern CAudioLogger g_audioLogger; diff --git a/Gems/NvCloth/Code/Include/NvCloth/ITangentSpaceHelper.h b/Gems/NvCloth/Code/Include/NvCloth/ITangentSpaceHelper.h index 66ccd6a333..216dc6b4a5 100644 --- a/Gems/NvCloth/Code/Include/NvCloth/ITangentSpaceHelper.h +++ b/Gems/NvCloth/Code/Include/NvCloth/ITangentSpaceHelper.h @@ -8,10 +8,13 @@ #pragma once +#include #include #include +AZ_DECLARE_BUDGET(Cloth); + namespace NvCloth { //! Interface that provides a set of functions to diff --git a/Gems/PhysX/Code/Source/System/PhysXSystem.cpp b/Gems/PhysX/Code/Source/System/PhysXSystem.cpp index 3fa81172f5..ebdfc5d417 100644 --- a/Gems/PhysX/Code/Source/System/PhysXSystem.cpp +++ b/Gems/PhysX/Code/Source/System/PhysXSystem.cpp @@ -21,8 +21,6 @@ #define ENABLE_PHYSX_TIMESTEP_WARNING #endif -AZ_DEFINE_BUDGET(Physics); - namespace PhysX { AZ_CLASS_ALLOCATOR_IMPL(PhysXSystem, AZ::SystemAllocator, 0); diff --git a/Gems/ScriptEvents/Code/Source/Editor/ScriptEventsSystemEditorComponent.cpp b/Gems/ScriptEvents/Code/Source/Editor/ScriptEventsSystemEditorComponent.cpp index 548f8d137a..b7586618dd 100644 --- a/Gems/ScriptEvents/Code/Source/Editor/ScriptEventsSystemEditorComponent.cpp +++ b/Gems/ScriptEvents/Code/Source/Editor/ScriptEventsSystemEditorComponent.cpp @@ -22,6 +22,8 @@ #if defined(SCRIPTEVENTS_EDITOR) +AZ_DECLARE_BUDGET(AzToolsFramework); + namespace ScriptEventsEditor { //////////////////////////// From b466788cc43da7181bba62e2450cd517ca8d8960 Mon Sep 17 00:00:00 2001 From: jckand-amzn Date: Tue, 24 Aug 2021 16:10:36 -0500 Subject: [PATCH 069/131] Updating editor_test.py to allow for per-test null_renderer overrides Signed-off-by: jckand-amzn --- Tools/LyTestTools/ly_test_tools/o3de/editor_test.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Tools/LyTestTools/ly_test_tools/o3de/editor_test.py b/Tools/LyTestTools/ly_test_tools/o3de/editor_test.py index 0f456cee1a..4e15f32b37 100644 --- a/Tools/LyTestTools/ly_test_tools/o3de/editor_test.py +++ b/Tools/LyTestTools/ly_test_tools/o3de/editor_test.py @@ -62,8 +62,11 @@ class EditorTestBase(ABC): # Test that will be run alone in one editor class EditorSingleTest(EditorTestBase): + #- Configurable params -# # Extra cmdline arguments to supply to the editor for the test extra_cmdline_args = [] + # Whether to use null renderer, this will override use_null_renderer for the Suite if not None + use_null_renderer = None # Custom setup function, will run before the test @staticmethod @@ -584,7 +587,7 @@ class EditorTestSuite(): test_spec : EditorTestBase, cmdline_args : List[str] = []): test_cmdline_args = self.global_extra_cmdline_args + cmdline_args - if self.use_null_renderer: + if test_spec.use_null_renderer or (test_spec.use_null_renderer is None and self.use_null_renderer): test_cmdline_args += ["-rhi=null"] # Cycle any old crash report in case it wasn't cycled properly From fb39aa5b86f89c099bb55b0d97f584d226ea6462 Mon Sep 17 00:00:00 2001 From: jckand-amzn Date: Tue, 24 Aug 2021 16:14:15 -0500 Subject: [PATCH 070/131] Removing old test files Signed-off-by: jckand-amzn --- .../PythonTests/editor/test_AssetBrowser.py | 89 ------------ .../PythonTests/editor/test_AssetPicker.py | 74 ---------- .../editor/test_BasicEditorWorkflows.py | 96 ------------- .../PythonTests/editor/test_ComponentCRUD.py | 62 -------- .../Gem/PythonTests/editor/test_Docking.py | 55 -------- .../PythonTests/editor/test_InputBindings.py | 66 --------- .../Gem/PythonTests/editor/test_Menus.py | 132 ------------------ 7 files changed, 574 deletions(-) delete mode 100644 AutomatedTesting/Gem/PythonTests/editor/test_AssetBrowser.py delete mode 100644 AutomatedTesting/Gem/PythonTests/editor/test_AssetPicker.py delete mode 100644 AutomatedTesting/Gem/PythonTests/editor/test_BasicEditorWorkflows.py delete mode 100755 AutomatedTesting/Gem/PythonTests/editor/test_ComponentCRUD.py delete mode 100644 AutomatedTesting/Gem/PythonTests/editor/test_Docking.py delete mode 100755 AutomatedTesting/Gem/PythonTests/editor/test_InputBindings.py delete mode 100644 AutomatedTesting/Gem/PythonTests/editor/test_Menus.py diff --git a/AutomatedTesting/Gem/PythonTests/editor/test_AssetBrowser.py b/AutomatedTesting/Gem/PythonTests/editor/test_AssetBrowser.py deleted file mode 100644 index 6067ffd1c0..0000000000 --- a/AutomatedTesting/Gem/PythonTests/editor/test_AssetBrowser.py +++ /dev/null @@ -1,89 +0,0 @@ -""" -Copyright (c) Contributors to the Open 3D Engine Project. -For complete copyright and license terms please see the LICENSE at the root of this distribution. - -SPDX-License-Identifier: Apache-2.0 OR MIT -""" - -""" -C13660195: Asset Browser - File Tree Navigation -""" - -import os -import pytest - -# Bail on the test if ly_test_tools doesn't exist. -pytest.importorskip('ly_test_tools') -import ly_test_tools.environment.file_system as file_system -import editor_python_test_tools.hydra_test_utils as hydra - -test_directory = os.path.join(os.path.dirname(__file__), "EditorScripts") -log_monitor_timeout = 180 - - -@pytest.mark.parametrize('project', ['AutomatedTesting']) -@pytest.mark.parametrize('level', ['tmp_level']) -@pytest.mark.usefixtures("automatic_process_killer") -@pytest.mark.parametrize("launcher_platform", ['windows_editor']) -class TestAssetBrowser(object): - - @pytest.fixture(autouse=True) - def setup_teardown(self, request, workspace, project, level): - def teardown(): - file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True) - - request.addfinalizer(teardown) - - file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True) - - @pytest.mark.test_case_id("C13660195") - @pytest.mark.SUITE_periodic - def test_AssetBrowser_TreeNavigation(self, request, editor, level, launcher_platform): - expected_lines = [ - "Collapse/Expand tests: True", - "Asset visibility test: True", - "Scrollbar visibility test: True", - "AssetBrowser_TreeNavigation: result=SUCCESS" - - ] - - hydra.launch_and_validate_results( - request, - test_directory, - editor, - "AssetBrowser_TreeNavigation.py", - expected_lines, - run_python="--runpython", - cfg_args=[level], - timeout=log_monitor_timeout - ) - - @pytest.mark.test_case_id("C13660194") - @pytest.mark.SUITE_periodic - def test_AssetBrowser_SearchFiltering(self, request, editor, level, launcher_platform): - expected_lines = [ - "cedar.fbx asset is filtered in Asset Browser", - "Animation file type(s) is present in the file tree: True", - "FileTag file type(s) and Animation file type(s) is present in the file tree: True", - "FileTag file type(s) is present in the file tree after removing Animation filter: True", - ] - - unexpected_lines = [ - "Asset Browser opened: False", - "Animation file type(s) is present in the file tree: False", - "FileTag file type(s) and Animation file type(s) is present in the file tree: False", - "FileTag file type(s) is present in the file tree after removing Animation filter: False", - ] - - hydra.launch_and_validate_results( - request, - test_directory, - editor, - "AssetBrowser_SearchFiltering.py", - expected_lines, - unexpected_lines=unexpected_lines, - cfg_args=[level], - auto_test_mode=False, - run_python="--runpython", - timeout=log_monitor_timeout, - ) diff --git a/AutomatedTesting/Gem/PythonTests/editor/test_AssetPicker.py b/AutomatedTesting/Gem/PythonTests/editor/test_AssetPicker.py deleted file mode 100644 index 9fc5582e0b..0000000000 --- a/AutomatedTesting/Gem/PythonTests/editor/test_AssetPicker.py +++ /dev/null @@ -1,74 +0,0 @@ -""" -Copyright (c) Contributors to the Open 3D Engine Project. -For complete copyright and license terms please see the LICENSE at the root of this distribution. - -SPDX-License-Identifier: Apache-2.0 OR MIT -""" - -""" -C13751579: Asset Picker UI/UX -""" - -import os -import pytest - -# Bail on the test if ly_test_tools doesn't exist. -pytest.importorskip('ly_test_tools') -import ly_test_tools.environment.file_system as file_system -import editor_python_test_tools.hydra_test_utils as hydra - -test_directory = os.path.join(os.path.dirname(__file__), "EditorScripts") -log_monitor_timeout = 90 - - -@pytest.mark.parametrize('project', ['AutomatedTesting']) -@pytest.mark.parametrize('level', ['tmp_level']) -@pytest.mark.usefixtures("automatic_process_killer") -@pytest.mark.parametrize("launcher_platform", ['windows_editor']) -class TestAssetPicker(object): - - @pytest.fixture(autouse=True) - def setup_teardown(self, request, workspace, project, level): - def teardown(): - file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True) - - request.addfinalizer(teardown) - - file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True) - - @pytest.mark.test_case_id("C13751579", "C1508814") - @pytest.mark.SUITE_periodic - @pytest.mark.xfail # ATOM-15493 - def test_AssetPicker_UI_UX(self, request, editor, level, launcher_platform): - expected_lines = [ - "TestEntity Entity successfully created", - "Mesh component was added to entity", - "Entity has a Mesh component", - "Mesh Asset: Asset Picker title for Mesh: Pick ModelAsset", - "Mesh Asset: Scroll Bar is not visible before expanding the tree: True", - "Mesh Asset: Top level folder initially collapsed: True", - "Mesh Asset: Top level folder expanded: True", - "Mesh Asset: Nested folder initially collapsed: True", - "Mesh Asset: Nested folder expanded: True", - "Mesh Asset: Scroll Bar appeared after expanding tree: True", - "Mesh Asset: Nested folder collapsed: True", - "Mesh Asset: Top level folder collapsed: True", - "Mesh Asset: Expected Assets populated in the file picker: True", - "Widget Move Test: True", - "Widget Resize Test: True", - "Asset assigned for ok option: True", - "Asset assigned for enter option: True", - "AssetPicker_UI_UX: result=SUCCESS" - ] - - hydra.launch_and_validate_results( - request, - test_directory, - editor, - "AssetPicker_UI_UX.py", - expected_lines, - cfg_args=[level], - run_python="--runpython", - auto_test_mode=False, - timeout=log_monitor_timeout, - ) diff --git a/AutomatedTesting/Gem/PythonTests/editor/test_BasicEditorWorkflows.py b/AutomatedTesting/Gem/PythonTests/editor/test_BasicEditorWorkflows.py deleted file mode 100644 index 49860c8387..0000000000 --- a/AutomatedTesting/Gem/PythonTests/editor/test_BasicEditorWorkflows.py +++ /dev/null @@ -1,96 +0,0 @@ -""" -Copyright (c) Contributors to the Open 3D Engine Project. -For complete copyright and license terms please see the LICENSE at the root of this distribution. - -SPDX-License-Identifier: Apache-2.0 OR MIT -""" - -import os -import pytest - -# Bail on the test if ly_test_tools doesn't exist. -pytest.importorskip('ly_test_tools') -import ly_test_tools.environment.file_system as file_system -import ly_test_tools._internal.pytest_plugin as internal_plugin -import editor_python_test_tools.hydra_test_utils as hydra - -test_directory = os.path.join(os.path.dirname(__file__), "EditorScripts") -log_monitor_timeout = 180 - - -@pytest.mark.parametrize('project', ['AutomatedTesting']) -@pytest.mark.parametrize('level', ['tmp_level']) -@pytest.mark.usefixtures("automatic_process_killer") -@pytest.mark.parametrize("launcher_platform", ['windows_editor']) -class TestBasicEditorWorkflows(object): - - @pytest.fixture(autouse=True) - def setup_teardown(self, request, workspace, project, level): - def teardown(): - file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True) - - request.addfinalizer(teardown) - - file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True) - - @pytest.mark.test_case_id("C6351273", "C6384955", "C16929880", "C15167490", "C15167491") - @pytest.mark.SUITE_main - def test_BasicEditorWorkflows_LevelEntityComponentCRUD(self, request, editor, level, launcher_platform): - - # Skip test if running against Debug build - if "debug" in internal_plugin.build_directory: - pytest.skip("Does not execute against debug builds.") - - expected_lines = [ - "Create and load new level: True", - "New entity creation: True", - "Create entity hierarchy: True", - "Add component: True", - "Component update: True", - "Remove component: True", - "Save and Export: True", - "BasicEditorWorkflows_LevelEntityComponent: result=SUCCESS", - ] - - hydra.launch_and_validate_results( - request, - test_directory, - editor, - "BasicEditorWorkflows_LevelEntityComponentCRUD.py", - expected_lines, - cfg_args=[level], - timeout=log_monitor_timeout, - auto_test_mode=False - ) - - @pytest.mark.test_case_id("C6351273", "C6384955", "C16929880", "C15167490", "C15167491") - @pytest.mark.SUITE_main - @pytest.mark.REQUIRES_gpu - def test_BasicEditorWorkflows_GPU_LevelEntityComponentCRUD(self, request, editor, level, launcher_platform): - - # Skip test if running against Debug build - if "debug" in internal_plugin.build_directory: - pytest.skip("Does not execute against debug builds.") - - expected_lines = [ - "Create and load new level: True", - "New entity creation: True", - "Create entity hierarchy: True", - "Add component: True", - "Component update: True", - "Remove component: True", - "Save and Export: True", - "BasicEditorWorkflows_LevelEntityComponent: result=SUCCESS", - ] - - hydra.launch_and_validate_results( - request, - test_directory, - editor, - "BasicEditorWorkflows_LevelEntityComponentCRUD.py", - expected_lines, - cfg_args=[level], - timeout=log_monitor_timeout, - auto_test_mode=False, - null_renderer=False - ) diff --git a/AutomatedTesting/Gem/PythonTests/editor/test_ComponentCRUD.py b/AutomatedTesting/Gem/PythonTests/editor/test_ComponentCRUD.py deleted file mode 100755 index de09cf9ab7..0000000000 --- a/AutomatedTesting/Gem/PythonTests/editor/test_ComponentCRUD.py +++ /dev/null @@ -1,62 +0,0 @@ -""" -Copyright (c) Contributors to the Open 3D Engine Project. -For complete copyright and license terms please see the LICENSE at the root of this distribution. - -SPDX-License-Identifier: Apache-2.0 OR MIT -""" - -""" -C16929880: Add Delete Components -""" - -import os -import pytest - -# Bail on the test if ly_test_tools doesn't exist. -pytest.importorskip('ly_test_tools') -import ly_test_tools.environment.file_system as file_system -import editor_python_test_tools.hydra_test_utils as hydra - -test_directory = os.path.join(os.path.dirname(__file__), "EditorScripts") -log_monitor_timeout = 180 - - -@pytest.mark.parametrize('project', ['AutomatedTesting']) -@pytest.mark.parametrize('level', ['tmp_level']) -@pytest.mark.usefixtures("automatic_process_killer") -@pytest.mark.parametrize("launcher_platform", ['windows_editor']) -class TestComponentCRUD(object): - - @pytest.fixture(autouse=True) - def setup_teardown(self, request, workspace, project, level): - def teardown(): - file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True) - - request.addfinalizer(teardown) - - file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True) - - @pytest.mark.test_case_id("C16929880", "C16877220") - @pytest.mark.SUITE_periodic - @pytest.mark.BAT - def test_ComponentCRUD_Add_Delete_Components(self, request, editor, level, launcher_platform): - expected_lines = [ - "Entity Created", - "Box Shape found", - "Box Shape Component added: True", - "Mesh found", - "Mesh Component added: True", - "Mesh Component deleted: True", - "Mesh Component deletion undone: True", - ] - - hydra.launch_and_validate_results( - request, - test_directory, - editor, - "ComponentCRUD_Add_Delete_Components.py", - expected_lines, - cfg_args=[level], - auto_test_mode=False, - timeout=log_monitor_timeout - ) diff --git a/AutomatedTesting/Gem/PythonTests/editor/test_Docking.py b/AutomatedTesting/Gem/PythonTests/editor/test_Docking.py deleted file mode 100644 index 7d97f31710..0000000000 --- a/AutomatedTesting/Gem/PythonTests/editor/test_Docking.py +++ /dev/null @@ -1,55 +0,0 @@ -""" -Copyright (c) Contributors to the Open 3D Engine Project. -For complete copyright and license terms please see the LICENSE at the root of this distribution. - -SPDX-License-Identifier: Apache-2.0 OR MIT - -C6376081: Basic Function: Docked/Undocked Tools -""" - -import os -import pytest - -# Bail on the test if ly_test_tools doesn't exist. -pytest.importorskip('ly_test_tools') -import ly_test_tools.environment.file_system as file_system -import editor_python_test_tools.hydra_test_utils as hydra - -test_directory = os.path.join(os.path.dirname(__file__), "EditorScripts") -log_monitor_timeout = 180 - - -@pytest.mark.parametrize('project', ['AutomatedTesting']) -@pytest.mark.parametrize('level', ['tmp_level']) -@pytest.mark.usefixtures("automatic_process_killer") -@pytest.mark.parametrize("launcher_platform", ['windows_editor']) -class TestDocking(object): - - @pytest.fixture(autouse=True) - def setup_teardown(self, request, workspace, project, level): - def teardown(): - file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True) - - request.addfinalizer(teardown) - - file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True) - - @pytest.mark.test_case_id("C6376081") - @pytest.mark.SUITE_sandbox - def test_Docking_BasicDockedTools(self, request, editor, level, launcher_platform): - expected_lines = [ - "The tools are all docked together in a tabbed widget", - "Entity Outliner works when docked, can select an Entity", - "Entity Inspector works when docked, Entity name changed to DifferentName", - "Hello, world!" # This line verifies the Console is working while docked - ] - - hydra.launch_and_validate_results( - request, - test_directory, - editor, - "Docking_BasicDockedTools.py", - expected_lines, - cfg_args=[level], - timeout=log_monitor_timeout, - ) diff --git a/AutomatedTesting/Gem/PythonTests/editor/test_InputBindings.py b/AutomatedTesting/Gem/PythonTests/editor/test_InputBindings.py deleted file mode 100755 index 214fac2af4..0000000000 --- a/AutomatedTesting/Gem/PythonTests/editor/test_InputBindings.py +++ /dev/null @@ -1,66 +0,0 @@ -""" -Copyright (c) Contributors to the Open 3D Engine Project. -For complete copyright and license terms please see the LICENSE at the root of this distribution. - -SPDX-License-Identifier: Apache-2.0 OR MIT -""" - -""" -C1506881: Adding/Removing Event Groups -""" - -import os -import pytest - -# Bail on the test if ly_test_tools doesn't exist. -pytest.importorskip('ly_test_tools') -import ly_test_tools.environment.file_system as file_system -import editor_python_test_tools.hydra_test_utils as hydra - -test_directory = os.path.join(os.path.dirname(__file__), "EditorScripts") -log_monitor_timeout = 180 - - -@pytest.mark.parametrize('project', ['AutomatedTesting']) -@pytest.mark.parametrize('level', ['tmp_level']) -@pytest.mark.usefixtures("automatic_process_killer") -@pytest.mark.parametrize("launcher_platform", ['windows_editor']) -class TestInputBindings(object): - - @pytest.fixture(autouse=True) - def setup_teardown(self, request, workspace, project, level): - def teardown(): - file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True) - - request.addfinalizer(teardown) - - file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True) - - @pytest.mark.test_case_id("C1506881") - @pytest.mark.SUITE_periodic - def test_InputBindings_Add_Remove_Input_Events(self, request, editor, level, launcher_platform): - expected_lines = [ - "Asset Editor opened: True", - "New Event Groups added when + is clicked", - "Event Group deleted when the Delete button is clicked on an Event Group", - "All event groups deleted on clicking the Delete button", - "Asset Editor closed: True", - ] - - unexpected_lines = [ - "Asset Editor opened: False", - "Asset Editor closed: False", - ] - - hydra.launch_and_validate_results( - request, - test_directory, - editor, - "InputBindings_Add_Remove_Input_Events.py", - expected_lines, - unexpected_lines=unexpected_lines, - cfg_args=[level], - run_python="--runpython", - auto_test_mode=False, - timeout=log_monitor_timeout, - ) diff --git a/AutomatedTesting/Gem/PythonTests/editor/test_Menus.py b/AutomatedTesting/Gem/PythonTests/editor/test_Menus.py deleted file mode 100644 index d35fd021ee..0000000000 --- a/AutomatedTesting/Gem/PythonTests/editor/test_Menus.py +++ /dev/null @@ -1,132 +0,0 @@ -""" -Copyright (c) Contributors to the Open 3D Engine Project. -For complete copyright and license terms please see the LICENSE at the root of this distribution. - -SPDX-License-Identifier: Apache-2.0 OR MIT -""" - -import os -import pytest - -# Bail on the test if ly_test_tools doesn't exist. -pytest.importorskip('ly_test_tools') -import ly_test_tools.environment.file_system as file_system -import ly_test_tools.environment.process_utils as process_utils -import editor_python_test_tools.hydra_test_utils as hydra - -test_directory = os.path.join(os.path.dirname(__file__), "EditorScripts") -log_monitor_timeout = 180 - - -@pytest.mark.parametrize('project', ['AutomatedTesting']) -@pytest.mark.parametrize('level', ['tmp_level']) -@pytest.mark.usefixtures("automatic_process_killer") -@pytest.mark.parametrize("launcher_platform", ['windows_editor']) -class TestMenus(object): - - @pytest.fixture(autouse=True) - def setup_teardown(self, request, workspace, project, level): - def teardown(): - file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True) - process_utils.kill_processes_named("o3de", ignore_extensions=True) # Kill ProjectManager windows - - request.addfinalizer(teardown) - - file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True) - - @pytest.mark.test_case_id("C16780783", "C2174438") - @pytest.mark.SUITE_sandbox - def test_Menus_EditMenuOptions_Work(self, request, editor, level, launcher_platform): - expected_lines = [ - "Undo Action triggered", - "Redo Action triggered", - "Duplicate Action triggered", - "Delete Action triggered", - "Select All Action triggered", - "Invert Selection Action triggered", - "Toggle Pivot Location Action triggered", - "Reset Entity Transform", - "Reset Manipulator", - "Reset Transform (Local) Action triggered", - "Reset Transform (World) Action triggered", - "Hide Selection Action triggered", - "Show All Action triggered", - "Snap angle Action triggered", - "Move Action triggered", - "Rotate Action triggered", - "Scale Action triggered", - "Global Preferences Action triggered", - "Editor Settings Manager Action triggered", - "Customize Keyboard Action triggered", - "Export Keyboard Settings Action triggered", - "Import Keyboard Settings Action triggered", - "Menus_EditMenuOptions: result=SUCCESS" - ] - - hydra.launch_and_validate_results( - request, - test_directory, - editor, - "Menus_EditMenuOptions.py", - expected_lines, - cfg_args=[level], - run_python="--runpython", - timeout=log_monitor_timeout - ) - - @pytest.mark.test_case_id("C16780807") - @pytest.mark.SUITE_periodic - def test_Menus_ViewMenuOptions_Work(self, request, editor, level, launcher_platform): - expected_lines = [ - "Center on Selection Action triggered", - "Show Quick Access Bar Action triggered", - "Configure Layout Action triggered", - "Go to Position Action triggered", - "Center on Selection Action triggered", - "Go to Location Action triggered", - "Remember Location Action triggered", - "Switch Camera Action triggered", - "Show/Hide Helpers Action triggered", - "Refresh Style Action triggered", - ] - hydra.launch_and_validate_results( - request, - test_directory, - editor, - "Menus_ViewMenuOptions.py", - expected_lines, - cfg_args=[level], - run_python="--runpython", - timeout=log_monitor_timeout - ) - - @pytest.mark.test_case_id("C16780778") - @pytest.mark.SUITE_sandbox - @pytest.mark.xfail # LYN-4208 - def test_Menus_FileMenuOptions_Work(self, request, editor, level, launcher_platform): - expected_lines = [ - "New Level Action triggered", - "Open Level Action triggered", - "Import Action triggered", - "Save Action triggered", - "Save As Action triggered", - "Save Level Statistics Action triggered", - "Edit Project Settings Action triggered", - "Edit Platform Settings Action triggered", - "New Project Action triggered", - "Open Project Action triggered", - "Show Log File Action triggered", - "Resave All Slices Action triggered", - "Exit Action triggered", - ] - - hydra.launch_and_validate_results( - request, - test_directory, - editor, - "Menus_FileMenuOptions.py", - expected_lines, - cfg_args=[level], - run_python="--runpython", - timeout=log_monitor_timeout - ) From 4458a245d126c9796da6f0c011e90926eee8d64a Mon Sep 17 00:00:00 2001 From: jckand-amzn Date: Tue, 24 Aug 2021 16:19:01 -0500 Subject: [PATCH 071/131] Adding xfail marker to test run, and updating CMakeLists to point to the optimized test file Signed-off-by: jckand-amzn --- .../Gem/PythonTests/editor/CMakeLists.txt | 17 ++--------------- .../Gem/PythonTests/editor/TestSuite_Main.py | 2 ++ 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/AutomatedTesting/Gem/PythonTests/editor/CMakeLists.txt b/AutomatedTesting/Gem/PythonTests/editor/CMakeLists.txt index 18eaef287e..021be60119 100644 --- a/AutomatedTesting/Gem/PythonTests/editor/CMakeLists.txt +++ b/AutomatedTesting/Gem/PythonTests/editor/CMakeLists.txt @@ -11,7 +11,7 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS AND PAL_TRAIT_ NAME AutomatedTesting::EditorTests_Main TEST_SUITE main TEST_SERIAL - PATH ${CMAKE_CURRENT_LIST_DIR}/test_Editor_Main.py + PATH ${CMAKE_CURRENT_LIST_DIR}/TestSuite_Main.py PYTEST_MARKS "not REQUIRES_gpu" RUNTIME_DEPENDENCIES Legacy::Editor @@ -21,25 +21,12 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS AND PAL_TRAIT_ Editor ) - ly_add_pytest( - NAME AutomatedTesting::EditorTests_Periodic - TEST_SUITE periodic - TEST_SERIAL - PATH ${CMAKE_CURRENT_LIST_DIR}/test_Editor_Periodic.py - RUNTIME_DEPENDENCIES - Legacy::Editor - AZ::AssetProcessor - AutomatedTesting.Assets - COMPONENT - Editor - ) - ly_add_pytest( NAME AutomatedTesting::EditorTests_Main_GPU TEST_SUITE main TEST_SERIAL TEST_REQUIRES gpu - PATH ${CMAKE_CURRENT_LIST_DIR}/test_Editor_Main.py + PATH ${CMAKE_CURRENT_LIST_DIR}/TestSuite_Main.py PYTEST_MARKS "REQUIRES_gpu" RUNTIME_DEPENDENCIES Legacy::Editor diff --git a/AutomatedTesting/Gem/PythonTests/editor/TestSuite_Main.py b/AutomatedTesting/Gem/PythonTests/editor/TestSuite_Main.py index 4be6c22e79..4d03b1b6ac 100644 --- a/AutomatedTesting/Gem/PythonTests/editor/TestSuite_Main.py +++ b/AutomatedTesting/Gem/PythonTests/editor/TestSuite_Main.py @@ -12,6 +12,7 @@ import ly_test_tools.environment.file_system as file_system from ly_test_tools.o3de.editor_test import EditorSingleTest, EditorSharedTest, EditorParallelTest, EditorTestSuite +@pytest.mark.xfail(reason="Optimized tests are experimental, we will enable xfail and monitor them temporarily.") @pytest.mark.SUITE_main @pytest.mark.parametrize("launcher_platform", ['windows_editor']) @pytest.mark.parametrize("project", ["AutomatedTesting"]) @@ -47,6 +48,7 @@ class TestAutomationNoAutoTestMode(EditorTestSuite): from .EditorScripts import AssetPicker_UI_UX as test_module +@pytest.mark.xfail(reason="Optimized tests are experimental, we will enable xfail and monitor them temporarily.") @pytest.mark.SUITE_main @pytest.mark.parametrize("launcher_platform", ['windows_editor']) @pytest.mark.parametrize("project", ["AutomatedTesting"]) From 2f8d0298326dbc450fecd3bbfd85c8878b3578fa Mon Sep 17 00:00:00 2001 From: jckand-amzn Date: Tue, 24 Aug 2021 16:35:11 -0500 Subject: [PATCH 072/131] Moving 2 tests to sandbox that are intermittently failing on Jenkins but passing locally Signed-off-by: jckand-amzn --- .../Gem/PythonTests/editor/CMakeLists.txt | 13 +++++++++ .../PythonTests/editor/TestSuite_Sandbox.py | 27 +++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 AutomatedTesting/Gem/PythonTests/editor/TestSuite_Sandbox.py diff --git a/AutomatedTesting/Gem/PythonTests/editor/CMakeLists.txt b/AutomatedTesting/Gem/PythonTests/editor/CMakeLists.txt index 021be60119..2a296c1eca 100644 --- a/AutomatedTesting/Gem/PythonTests/editor/CMakeLists.txt +++ b/AutomatedTesting/Gem/PythonTests/editor/CMakeLists.txt @@ -36,4 +36,17 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS AND PAL_TRAIT_ Editor ) + ly_add_pytest( + NAME AutomatedTesting::EditorTests_Sandbox + TEST_SUITE sandbox + TEST_SERIAL + PATH ${CMAKE_CURRENT_LIST_DIR}/TestSuite_Sandbox.py + RUNTIME_DEPENDENCIES + Legacy::Editor + AZ::AssetProcessor + AutomatedTesting.Assets + COMPONENT + Editor + ) + endif() diff --git a/AutomatedTesting/Gem/PythonTests/editor/TestSuite_Sandbox.py b/AutomatedTesting/Gem/PythonTests/editor/TestSuite_Sandbox.py new file mode 100644 index 0000000000..d49e9e1c9b --- /dev/null +++ b/AutomatedTesting/Gem/PythonTests/editor/TestSuite_Sandbox.py @@ -0,0 +1,27 @@ +""" +Copyright (c) Contributors to the Open 3D Engine Project. +For complete copyright and license terms please see the LICENSE at the root of this distribution. + +SPDX-License-Identifier: Apache-2.0 OR MIT +""" + +import os +import pytest + +from ly_test_tools.o3de.editor_test import EditorSingleTest, EditorSharedTest, EditorParallelTest, EditorTestSuite + + +@pytest.mark.xfail(reason="Optimized tests are experimental, we will enable xfail and monitor them temporarily.") +@pytest.mark.SUITE_sandbox +@pytest.mark.parametrize("launcher_platform", ['windows_editor']) +@pytest.mark.parametrize("project", ["AutomatedTesting"]) +class TestAutomationAutoTestMode(EditorTestSuite): + + # Enable only -autotest_mode for these tests. Tests cannot run in -BatchMode due to UI interactions + global_extra_cmdline_args = ["-autotest_mode"] + + class test_Docking_BasicDockedTools(EditorSharedTest): + from .EditorScripts import Docking_BasicDockedTools as test_module + + class test_Menus_EditMenuOptions_Work(EditorSharedTest): + from .EditorScripts import Menus_EditMenuOptions as test_module From cb1d680a56a68b0e998164ed917a65f8d0a3c3b1 Mon Sep 17 00:00:00 2001 From: jckand-amzn Date: Tue, 24 Aug 2021 16:43:16 -0500 Subject: [PATCH 073/131] Removing sandbox tests from main suite Signed-off-by: jckand-amzn --- AutomatedTesting/Gem/PythonTests/editor/TestSuite_Main.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/AutomatedTesting/Gem/PythonTests/editor/TestSuite_Main.py b/AutomatedTesting/Gem/PythonTests/editor/TestSuite_Main.py index 4d03b1b6ac..9c0b99daff 100644 --- a/AutomatedTesting/Gem/PythonTests/editor/TestSuite_Main.py +++ b/AutomatedTesting/Gem/PythonTests/editor/TestSuite_Main.py @@ -67,12 +67,6 @@ class TestAutomationAutoTestMode(EditorTestSuite): class test_ComponentCRUD_Add_Delete_Components(EditorSharedTest): from .EditorScripts import ComponentCRUD_Add_Delete_Components as test_module - class test_Docking_BasicDockedTools(EditorSharedTest): - from .EditorScripts import Docking_BasicDockedTools as test_module - - class test_Menus_EditMenuOptions_Work(EditorSharedTest): - from .EditorScripts import Menus_EditMenuOptions as test_module - class test_Menus_ViewMenuOptions_Work(EditorSharedTest): from .EditorScripts import Menus_ViewMenuOptions as test_module From 26f6a714c87cc2b4655f861bc642e4b09fc8c69b Mon Sep 17 00:00:00 2001 From: chcurran <82187351+carlitosan@users.noreply.github.com> Date: Tue, 24 Aug 2021 15:14:20 -0700 Subject: [PATCH 074/131] initial fix for version scan Signed-off-by: chcurran <82187351+carlitosan@users.noreply.github.com> --- .../ScriptCanvas/Components/GraphUpgrade.h | 4 ++-- .../Tools/UpgradeTool/VersionExplorer.h | 5 ++++- .../Tools/UpgradeTool/VersionExplorer.ui | 20 +++++++++++++++++++ .../Code/Editor/View/Windows/mainwindow.ui | 1 + 4 files changed, 27 insertions(+), 3 deletions(-) diff --git a/Gems/ScriptCanvas/Code/Editor/Include/ScriptCanvas/Components/GraphUpgrade.h b/Gems/ScriptCanvas/Code/Editor/Include/ScriptCanvas/Components/GraphUpgrade.h index bf692554e5..df7fa0535f 100644 --- a/Gems/ScriptCanvas/Code/Editor/Include/ScriptCanvas/Components/GraphUpgrade.h +++ b/Gems/ScriptCanvas/Code/Editor/Include/ScriptCanvas/Components/GraphUpgrade.h @@ -88,13 +88,13 @@ namespace ScriptCanvasEditor void Enter() override { - //Log("ENTER >> %s", GetName()); + Log("ENTER >> %s", GetName()); OnEnter(); } ExitStatus Exit() override { - //Log("EXIT << %s", GetName()); + Log("EXIT << %s", GetName()); return OnExit(); } diff --git a/Gems/ScriptCanvas/Code/Editor/View/Windows/Tools/UpgradeTool/VersionExplorer.h b/Gems/ScriptCanvas/Code/Editor/View/Windows/Tools/UpgradeTool/VersionExplorer.h index 30f73dca92..73ce19e4e1 100644 --- a/Gems/ScriptCanvas/Code/Editor/View/Windows/Tools/UpgradeTool/VersionExplorer.h +++ b/Gems/ScriptCanvas/Code/Editor/View/Windows/Tools/UpgradeTool/VersionExplorer.h @@ -117,9 +117,10 @@ namespace ScriptCanvasEditor size_t m_currentAssetIndex = 0; size_t m_inspectedAssets = 0; + AZStd::vector> m_activeAssets; + IUpgradeRequests::AssetList m_assetsToInspect; IUpgradeRequests::AssetList::iterator m_inspectingAsset; - using UpgradeAssets = AZStd::vector>; UpgradeAssets m_assetsToUpgrade; UpgradeAssets::iterator m_inProgressAsset; @@ -157,5 +158,7 @@ namespace ScriptCanvasEditor bool m_overwriteAll = false; void PerformMove(AZ::Data::Asset& asset, const AZStd::string& source, const AZStd::string& target); + + void Log(const char* format, ...); }; } diff --git a/Gems/ScriptCanvas/Code/Editor/View/Windows/Tools/UpgradeTool/VersionExplorer.ui b/Gems/ScriptCanvas/Code/Editor/View/Windows/Tools/UpgradeTool/VersionExplorer.ui index d02ddd0054..3e2604dd99 100644 --- a/Gems/ScriptCanvas/Code/Editor/View/Windows/Tools/UpgradeTool/VersionExplorer.ui +++ b/Gems/ScriptCanvas/Code/Editor/View/Windows/Tools/UpgradeTool/VersionExplorer.ui @@ -321,6 +321,26 @@ + + + + Force Upgrade + + + false + + + + + + + Verbose + + + false + + + diff --git a/Gems/ScriptCanvas/Code/Editor/View/Windows/mainwindow.ui b/Gems/ScriptCanvas/Code/Editor/View/Windows/mainwindow.ui index ddb8100821..1208a55a64 100644 --- a/Gems/ScriptCanvas/Code/Editor/View/Windows/mainwindow.ui +++ b/Gems/ScriptCanvas/Code/Editor/View/Windows/mainwindow.ui @@ -128,6 +128,7 @@ + From f22ecc783028fcce46670d3684aecb9ac975fc40 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Tue, 24 Aug 2021 15:15:40 -0700 Subject: [PATCH 075/131] of course, was disabling/enabling the warning Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- cmake/Platform/Common/MSVC/Configurations_msvc.cmake | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cmake/Platform/Common/MSVC/Configurations_msvc.cmake b/cmake/Platform/Common/MSVC/Configurations_msvc.cmake index 7ee118e2f4..3a108cec4c 100644 --- a/cmake/Platform/Common/MSVC/Configurations_msvc.cmake +++ b/cmake/Platform/Common/MSVC/Configurations_msvc.cmake @@ -36,13 +36,12 @@ ly_append_configurations_options( # Disabling some warnings /wd4201 # nonstandard extension used: nameless struct/union. This actually became part of the C++11 std, MS has an open issue: https://developercommunity.visualstudio.com/t/warning-level-4-generates-a-bogus-warning-c4201-no/103064 - /wd4619 # #pragma warning : there is no warning number 'number'. Unfortunately some versions of MSVC 16.X dont filter this warning coming from external headers and Qt has a bad warning in QtCore/qvector.h(340,12) # Enabling warnings that are disabled by default from /W4 # https://docs.microsoft.com/en-us/cpp/preprocessor/compiler-warnings-that-are-off-by-default?view=vs-2019 /we4296 # 'operator': expression is always false /we4426 # optimization flags changed after including header, may be due to #pragma optimize() - /we4619 # #pragma warning: there is no warning number 'number' + #/we4619 # #pragma warning: there is no warning number 'number'. Unfortunately some versions of MSVC 16.X dont filter this warning coming from external headers and Qt has a bad warning in QtCore/qvector.h(340,12) /we4777 # 'function' : format string 'string' requires an argument of type 'type1', but variadic argument number has type 'type2 /we5031 # #pragma warning(pop): likely mismatch, popping warning state pushed in different file /we5032 # detected #pragma warning(push) with no corresponding #pragma warning(pop) From a9b4ad3486dae98adddb2fde30705fe3d54eb17a Mon Sep 17 00:00:00 2001 From: Jeremy Ong Date: Tue, 24 Aug 2021 15:06:56 -0600 Subject: [PATCH 076/131] Compile out tracker in release mode Signed-off-by: Jeremy Ong --- .../AzCore/Component/ComponentApplication.cpp | 4 +++ .../AzCore/Component/ComponentApplication.h | 2 ++ Code/Framework/AzCore/AzCore/Debug/Budget.cpp | 6 +++++ Code/Framework/AzCore/AzCore/Debug/Budget.h | 25 +++++++++---------- .../TerrainFeatureProcessor.cpp | 2 +- 5 files changed, 25 insertions(+), 14 deletions(-) diff --git a/Code/Framework/AzCore/AzCore/Component/ComponentApplication.cpp b/Code/Framework/AzCore/AzCore/Component/ComponentApplication.cpp index e9e5738bd1..383da71653 100644 --- a/Code/Framework/AzCore/AzCore/Component/ComponentApplication.cpp +++ b/Code/Framework/AzCore/AzCore/Component/ComponentApplication.cpp @@ -545,7 +545,9 @@ namespace AZ m_entityActivatedEvent.DisconnectAllHandlers(); m_entityDeactivatedEvent.DisconnectAllHandlers(); +#if !defined(_RELEASE) m_budgetTracker.Reset(); +#endif DestroyAllocator(); } @@ -595,7 +597,9 @@ namespace AZ CreateOSAllocator(); CreateSystemAllocator(); +#if !defined(_RELEASE) m_budgetTracker.Init(); +#endif // This can be moved to the ComponentApplication constructor if need be // This is reading the *.setreg files using SystemFile and merging the settings diff --git a/Code/Framework/AzCore/AzCore/Component/ComponentApplication.h b/Code/Framework/AzCore/AzCore/Component/ComponentApplication.h index b2a1f0324b..3768a75d83 100644 --- a/Code/Framework/AzCore/AzCore/Component/ComponentApplication.h +++ b/Code/Framework/AzCore/AzCore/Component/ComponentApplication.h @@ -395,7 +395,9 @@ namespace AZ // from the m_console member when it goes out of scope AZ::SettingsRegistryConsoleUtils::ConsoleFunctorHandle m_settingsRegistryConsoleFunctors; +#if !defined(_RELEASE) Debug::BudgetTracker m_budgetTracker; +#endif // this is used when no argV/ArgC is supplied. // in order to have the same memory semantics (writable, non-const) diff --git a/Code/Framework/AzCore/AzCore/Debug/Budget.cpp b/Code/Framework/AzCore/AzCore/Debug/Budget.cpp index 9790257ded..f9fe7e462a 100644 --- a/Code/Framework/AzCore/AzCore/Debug/Budget.cpp +++ b/Code/Framework/AzCore/AzCore/Debug/Budget.cpp @@ -29,6 +29,12 @@ namespace AZ::Debug // TODO: Budget implementation for tracking budget wall time per-core, memory, etc. }; + Budget::Budget(const char* name) + : m_name{ name } + , m_crc{ Crc32(name) } + { + } + Budget::Budget(const char* name, uint32_t crc) : m_name{ name } , m_crc{ crc } diff --git a/Code/Framework/AzCore/AzCore/Debug/Budget.h b/Code/Framework/AzCore/AzCore/Debug/Budget.h index 376bf4cc4a..d051ba860b 100644 --- a/Code/Framework/AzCore/AzCore/Debug/Budget.h +++ b/Code/Framework/AzCore/AzCore/Debug/Budget.h @@ -9,7 +9,6 @@ #include #include -#include namespace AZ::Debug { @@ -17,6 +16,7 @@ namespace AZ::Debug class Budget final { public: + explicit Budget(const char* name); Budget(const char* name, uint32_t crc); ~Budget(); @@ -38,7 +38,7 @@ namespace AZ::Debug private: const char* m_name; - uint32_t m_crc; + const uint32_t m_crc; struct BudgetImpl* m_impl = nullptr; }; } // namespace AZ::Debug @@ -49,6 +49,13 @@ namespace AZ::Debug // for usage. #define AZ_BUDGET_GETTER(name) GetAzBudget##name +#if defined(_RELEASE) +#define AZ_DEFINE_BUDGET(name) \ + ::AZ::Debug::Budget* AZ_BUDGET_GETTER(name)() \ + { \ + return nullptr; \ + } +#else // Usage example: // In a single C++ source file: // AZ_DEFINE_BUDGET(AzCore); @@ -59,18 +66,10 @@ namespace AZ::Debug ::AZ::Debug::Budget* AZ_BUDGET_GETTER(name)() \ { \ constexpr static uint32_t crc = AZ_CRC_CE(#name); \ - static ::AZStd::atomic<::AZ::Debug::Budget*> budget; \ - ::AZ::Debug::Budget* out = budget.load(AZStd::memory_order_acquire); \ - if (out) \ - { \ - return out; \ - } \ - else \ - { \ - budget.store(::AZ::Debug::BudgetTracker::GetBudgetFromEnvironment(#name, crc), AZStd::memory_order_release); \ - return budget; \ - } \ + static ::AZ::Debug::Budget* budget = ::AZ::Debug::BudgetTracker::GetBudgetFromEnvironment(#name, crc); \ + return budget; \ } +#endif // If using a budget defined in a different C++ source file, add AZ_DECLARE_BUDGET(yourBudget); somewhere in your source file at namespace // scope Alternatively, AZ_DECLARE_BUDGET can be used in a header to declare the budget for use across any users of the header diff --git a/Gems/Terrain/Code/Source/TerrainRenderer/TerrainFeatureProcessor.cpp b/Gems/Terrain/Code/Source/TerrainRenderer/TerrainFeatureProcessor.cpp index 5af3fd58b9..812ed3f0da 100644 --- a/Gems/Terrain/Code/Source/TerrainRenderer/TerrainFeatureProcessor.cpp +++ b/Gems/Terrain/Code/Source/TerrainRenderer/TerrainFeatureProcessor.cpp @@ -269,7 +269,7 @@ namespace Terrain void TerrainFeatureProcessor::ProcessSurfaces(const FeatureProcessor::RenderPacket& process) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzRender); + AZ_PROFILE_FUNCTION(AzRender); if (m_drawListTag.IsNull()) { From 3b424bd5450716bfe35a5bf4b72a16025e07cf43 Mon Sep 17 00:00:00 2001 From: santorac <55155825+santorac@users.noreply.github.com> Date: Tue, 24 Aug 2021 15:40:47 -0700 Subject: [PATCH 077/131] Fixed a shader hot reload issue where the new root shader variant asset was not getting saved in the Shader object during OnAssetReloaded, it was only saved during OnAssetReady. MaterialHotReloadTest 06_VerticalPattern now passes. Signed-off-by: santorac <55155825+santorac@users.noreply.github.com> --- .../RPI/Code/Source/RPI.Public/Shader/Shader.cpp | 2 ++ .../Code/Source/RPI.Reflect/Shader/ShaderAsset.cpp | 14 +++----------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/Gems/Atom/RPI/Code/Source/RPI.Public/Shader/Shader.cpp b/Gems/Atom/RPI/Code/Source/RPI.Public/Shader/Shader.cpp index f6dcd02804..4d7acb0ea4 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Public/Shader/Shader.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Public/Shader/Shader.cpp @@ -175,6 +175,8 @@ namespace AZ /// ShaderVariantFinderNotificationBus overrides void Shader::OnShaderVariantAssetReady(Data::Asset shaderVariantAsset, bool isError) { + ShaderReloadDebugTracker::ScopedSection reloadSection("{%p}->Shader::OnShaderVariantAssetReady %s", this, shaderVariantAsset.GetHint().c_str()); + AZ_Assert(shaderVariantAsset, "Reloaded ShaderVariantAsset is null"); const ShaderVariantStableId stableId = shaderVariantAsset->GetStableId(); diff --git a/Gems/Atom/RPI/Code/Source/RPI.Reflect/Shader/ShaderAsset.cpp b/Gems/Atom/RPI/Code/Source/RPI.Reflect/Shader/ShaderAsset.cpp index adeb564675..81b9705e41 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Reflect/Shader/ShaderAsset.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Reflect/Shader/ShaderAsset.cpp @@ -587,6 +587,8 @@ namespace AZ { Data::Asset shaderVariantAsset = { asset.GetAs(), AZ::Data::AssetLoadBehavior::PreLoad }; AZ_Assert(shaderVariantAsset->GetStableId() == RootShaderVariantStableId, "Was expecting to update the root variant"); + SupervariantIndex supervariantIndex = GetSupervariantIndexFromAssetId(asset.GetId()); + GetCurrentShaderApiData().m_supervariants[supervariantIndex.GetIndex()].m_rootShaderVariantAsset = asset; ShaderReloadNotificationBus::Event(GetId(), &ShaderReloadNotificationBus::Events::OnShaderAssetReinitialized, Data::Asset{ this, AZ::Data::AssetLoadBehavior::PreLoad } ); } @@ -607,17 +609,7 @@ namespace AZ // so it continues using the old ShaderVariantAsset instead of the new one. // The OnAssetReady bus function is called automatically whenever a connection to AssetBus is made, so listening to this gives // us the opportunity to assign the appropriate ShaderVariantAsset. - - ShaderReloadNotificationBus::Event(GetId(), &ShaderReloadNotificationBus::Events::OnShaderAssetReinitialized, Data::Asset{ this, AZ::Data::AssetLoadBehavior::PreLoad } ); - - Data::Asset shaderVariantAsset = { asset.GetAs(), AZ::Data::AssetLoadBehavior::PreLoad }; - AZ_Assert(shaderVariantAsset->GetStableId() == RootShaderVariantStableId, - "Was expecting to update the root variant"); - SupervariantIndex supervariantIndex = GetSupervariantIndexFromAssetId(asset.GetId()); - GetCurrentShaderApiData().m_supervariants[supervariantIndex.GetIndex()].m_rootShaderVariantAsset = asset; - - ShaderReloadNotificationBus::Event(GetId(), &ShaderReloadNotificationBus::Events::OnShaderAssetReinitialized, Data::Asset{ this, AZ::Data::AssetLoadBehavior::PreLoad } ); - + ShaderReloadDebugTracker::ScopedSection reloadSection("{%p}->ShaderAsset::OnAssetReady %s", this, asset.GetHint().c_str()); ReinitializeRootShaderVariant(asset); } From bb90c4ddfe2d495e9c00ebf1e2650c6d603a5676 Mon Sep 17 00:00:00 2001 From: Mikhail Naumov <82239319+AMZN-mnaumov@users.noreply.github.com> Date: Tue, 24 Aug 2021 15:43:26 -0700 Subject: [PATCH 078/131] Disabling RootSpawnable warning (#3427) * Disabling RootSpawnable warning Signed-off-by: Mikhail Naumov * Revert "Disabling RootSpawnable warning" This reverts commit c14e8d93945043498ab494bf608312cf5e1ad50d. Signed-off-by: Mikhail Naumov * commenting out warning Signed-off-by: Mikhail Naumov --- .../AzFramework/Spawnable/SpawnableSystemComponent.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Code/Framework/AzFramework/AzFramework/Spawnable/SpawnableSystemComponent.cpp b/Code/Framework/AzFramework/AzFramework/Spawnable/SpawnableSystemComponent.cpp index dc8bf1af30..cb1e657edd 100644 --- a/Code/Framework/AzFramework/AzFramework/Spawnable/SpawnableSystemComponent.cpp +++ b/Code/Framework/AzFramework/AzFramework/Spawnable/SpawnableSystemComponent.cpp @@ -239,10 +239,11 @@ namespace AzFramework } else if (rootSpawnableKeyType == AZ::SettingsRegistryInterface::Type::NoType) { - AZ_Warning( + // [LYN-4146] - temporarily disabled + /*AZ_Warning( "Spawnables", false, "No root spawnable assigned. The root spawnable can be assigned in the Settings Registry under the key '%s'.\n", - RootSpawnableRegistryKey); + RootSpawnableRegistryKey);*/ ReleaseRootSpawnable(); } } From cd5df6b372e6c60d9fc270d618f708049d9bc86d Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Tue, 24 Aug 2021 16:16:36 -0700 Subject: [PATCH 079/131] Some more fixes Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Code/Editor/LogFile.cpp | 3 +-- .../RPI.Builders/Model/MaterialAssetBuilderComponent.cpp | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/Code/Editor/LogFile.cpp b/Code/Editor/LogFile.cpp index 9692dd264a..62e39c8f8a 100644 --- a/Code/Editor/LogFile.cpp +++ b/Code/Editor/LogFile.cpp @@ -183,13 +183,12 @@ void CLogFile::AboutSystem() ////////////////////////////////////////////////////////////////////// // Write the system informations to the log ////////////////////////////////////////////////////////////////////// - + char szBuffer[MAX_LOGBUFFER_SIZE]; //wchar_t szCPUModel[64]; MEMORYSTATUS MemoryStatus; #endif // defined(AZ_PLATFORM_WINDOWS) || defined(AZ_PLATFORM_LINUX) #if defined(AZ_PLATFORM_WINDOWS) - char szBuffer[MAX_LOGBUFFER_SIZE]; wchar_t szLanguageBufferW[64]; DEVMODE DisplayConfig; OSVERSIONINFO OSVerInfo; diff --git a/Gems/Atom/RPI/Code/Source/RPI.Builders/Model/MaterialAssetBuilderComponent.cpp b/Gems/Atom/RPI/Code/Source/RPI.Builders/Model/MaterialAssetBuilderComponent.cpp index 4a4c2156ce..ccbdc47f7e 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Builders/Model/MaterialAssetBuilderComponent.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Builders/Model/MaterialAssetBuilderComponent.cpp @@ -253,7 +253,6 @@ namespace AZ } const auto& scene = context.m_scene; - const Uuid sourceSceneUuid = scene.GetSourceGuid(); const auto& sceneGraph = scene.GetGraph(); auto names = sceneGraph.GetNameStorage(); From 789d5904da591e3c3cdffed6368c532f736f0807 Mon Sep 17 00:00:00 2001 From: jckand-amzn Date: Tue, 24 Aug 2021 18:18:19 -0500 Subject: [PATCH 080/131] More test filename cleanup/re-org and enabled existing tests alongside optimized tests Signed-off-by: jckand-amzn --- .../Gem/PythonTests/editor/CMakeLists.txt | 55 ++++++++++++++ .../Gem/PythonTests/editor/TestSuite_Main.py | 76 ++++++------------- .../PythonTests/editor/TestSuite_Main_OLD.py | 43 ----------- .../editor/TestSuite_Main_Optimized.py | 75 ++++++++++++++++++ ..._Periodic_OLD.py => TestSuite_Periodic.py} | 8 +- .../PythonTests/editor/TestSuite_Sandbox.py | 20 ++--- .../editor/TestSuite_Sandbox_Optimized.py | 27 +++++++ 7 files changed, 191 insertions(+), 113 deletions(-) delete mode 100644 AutomatedTesting/Gem/PythonTests/editor/TestSuite_Main_OLD.py create mode 100644 AutomatedTesting/Gem/PythonTests/editor/TestSuite_Main_Optimized.py rename AutomatedTesting/Gem/PythonTests/editor/{TestSuite_Periodic_OLD.py => TestSuite_Periodic.py} (85%) create mode 100644 AutomatedTesting/Gem/PythonTests/editor/TestSuite_Sandbox_Optimized.py diff --git a/AutomatedTesting/Gem/PythonTests/editor/CMakeLists.txt b/AutomatedTesting/Gem/PythonTests/editor/CMakeLists.txt index 2a296c1eca..bf42579970 100644 --- a/AutomatedTesting/Gem/PythonTests/editor/CMakeLists.txt +++ b/AutomatedTesting/Gem/PythonTests/editor/CMakeLists.txt @@ -36,6 +36,19 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS AND PAL_TRAIT_ Editor ) + ly_add_pytest( + NAME AutomatedTesting::EditorTests_Periodic + TEST_SUITE periodic + TEST_SERIAL + PATH ${CMAKE_CURRENT_LIST_DIR}/TestSuite_Periodic.py + RUNTIME_DEPENDENCIES + Legacy::Editor + AZ::AssetProcessor + AutomatedTesting.Assets + COMPONENT + Editor + ) + ly_add_pytest( NAME AutomatedTesting::EditorTests_Sandbox TEST_SUITE sandbox @@ -49,4 +62,46 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS AND PAL_TRAIT_ Editor ) + ly_add_pytest( + NAME AutomatedTesting::EditorTests_Main_Optimized + TEST_SUITE main + TEST_SERIAL + PATH ${CMAKE_CURRENT_LIST_DIR}/TestSuite_Main_Optimized.py + PYTEST_MARKS "not REQUIRES_gpu" + RUNTIME_DEPENDENCIES + Legacy::Editor + AZ::AssetProcessor + AutomatedTesting.Assets + COMPONENT + Editor + ) + + ly_add_pytest( + NAME AutomatedTesting::EditorTests_Main_GPU_Optimized + TEST_SUITE main + TEST_SERIAL + TEST_REQUIRES gpu + PATH ${CMAKE_CURRENT_LIST_DIR}/TestSuite_Main_Optimized.py + PYTEST_MARKS "REQUIRES_gpu" + RUNTIME_DEPENDENCIES + Legacy::Editor + AZ::AssetProcessor + AutomatedTesting.Assets + COMPONENT + Editor + ) + + ly_add_pytest( + NAME AutomatedTesting::EditorTests_Sandbox_Optimized + TEST_SUITE sandbox + TEST_SERIAL + PATH ${CMAKE_CURRENT_LIST_DIR}/TestSuite_Sandbox_Optimized.py + RUNTIME_DEPENDENCIES + Legacy::Editor + AZ::AssetProcessor + AutomatedTesting.Assets + COMPONENT + Editor + ) + endif() diff --git a/AutomatedTesting/Gem/PythonTests/editor/TestSuite_Main.py b/AutomatedTesting/Gem/PythonTests/editor/TestSuite_Main.py index 9c0b99daff..26b254ae71 100644 --- a/AutomatedTesting/Gem/PythonTests/editor/TestSuite_Main.py +++ b/AutomatedTesting/Gem/PythonTests/editor/TestSuite_Main.py @@ -7,69 +7,37 @@ SPDX-License-Identifier: Apache-2.0 OR MIT import os import pytest +import sys import ly_test_tools.environment.file_system as file_system -from ly_test_tools.o3de.editor_test import EditorSingleTest, EditorSharedTest, EditorParallelTest, EditorTestSuite + +sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/../automatedtesting_shared') +from base import TestAutomationBase + + +@pytest.fixture +def remove_test_level(request, workspace, project): + file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", "tmp_level")], True, True) + + def teardown(): + file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", "tmp_level")], True, True) + + request.addfinalizer(teardown) -@pytest.mark.xfail(reason="Optimized tests are experimental, we will enable xfail and monitor them temporarily.") @pytest.mark.SUITE_main @pytest.mark.parametrize("launcher_platform", ['windows_editor']) @pytest.mark.parametrize("project", ["AutomatedTesting"]) -class TestAutomationNoAutoTestMode(EditorTestSuite): +class TestAutomation(TestAutomationBase): - # Disable -autotest_mode and -BatchMode. Tests cannot run in -BatchMode due to UI interactions, and these tests - # interact with modal dialogs - global_extra_cmdline_args = [] - - class test_BasicEditorWorkflows_LevelEntityComponentCRUD(EditorSingleTest): - # Custom teardown to remove slice asset created during test - def teardown(self, request, workspace, editor, editor_test_results, launcher_platform): - file_system.delete([os.path.join(workspace.paths.engine_root(), "AutomatedTesting", "Levels", "tmp_level")], - True, True) + def test_BasicEditorWorkflows_LevelEntityComponentCRUD(self, request, workspace, editor, launcher_platform, + remove_test_level): from .EditorScripts import BasicEditorWorkflows_LevelEntityComponentCRUD as test_module + self._run_test(request, workspace, editor, test_module, batch_mode=False, autotest_mode=False) @pytest.mark.REQUIRES_gpu - class test_BasicEditorWorkflows_GPU_LevelEntityComponentCRUD(EditorSingleTest): - # Disable null renderer - use_null_renderer = False - - # Custom teardown to remove slice asset created during test - def teardown(self, request, workspace, editor, editor_test_results, launcher_platform): - file_system.delete([os.path.join(workspace.paths.engine_root(), "AutomatedTesting", "Levels", "tmp_level")], - True, True) + def test_BasicEditorWorkflows_GPU_LevelEntityComponentCRUD(self, request, workspace, editor, launcher_platform, + remove_test_level): from .EditorScripts import BasicEditorWorkflows_LevelEntityComponentCRUD as test_module - - class test_InputBindings_Add_Remove_Input_Events(EditorSharedTest): - from .EditorScripts import InputBindings_Add_Remove_Input_Events as test_module - - @pytest.mark.skip(reason="Crashes Editor: ATOM-15493") - class test_AssetPicker_UI_UX(EditorSharedTest): - from .EditorScripts import AssetPicker_UI_UX as test_module - - -@pytest.mark.xfail(reason="Optimized tests are experimental, we will enable xfail and monitor them temporarily.") -@pytest.mark.SUITE_main -@pytest.mark.parametrize("launcher_platform", ['windows_editor']) -@pytest.mark.parametrize("project", ["AutomatedTesting"]) -class TestAutomationAutoTestMode(EditorTestSuite): - - # Enable only -autotest_mode for these tests. Tests cannot run in -BatchMode due to UI interactions - global_extra_cmdline_args = ["-autotest_mode"] - - class test_AssetBrowser_TreeNavigation(EditorSharedTest): - from .EditorScripts import AssetBrowser_TreeNavigation as test_module - - @pytest.mark.skip(reason="Crashes Editor: ATOM-15493") - class test_AssetBrowser_SearchFiltering(EditorSharedTest): - from .EditorScripts import AssetBrowser_SearchFiltering as test_module - - class test_ComponentCRUD_Add_Delete_Components(EditorSharedTest): - from .EditorScripts import ComponentCRUD_Add_Delete_Components as test_module - - class test_Menus_ViewMenuOptions_Work(EditorSharedTest): - from .EditorScripts import Menus_ViewMenuOptions as test_module - - @pytest.mark.skip(reason="Times out due to dialogs failing to dismiss: LYN-4208") - class test_Menus_FileMenuOptions_Work(EditorSharedTest): - from .EditorScripts import Menus_FileMenuOptions as test_module + self._run_test(request, workspace, editor, test_module, batch_mode=False, autotest_mode=False, + use_null_renderer=False) diff --git a/AutomatedTesting/Gem/PythonTests/editor/TestSuite_Main_OLD.py b/AutomatedTesting/Gem/PythonTests/editor/TestSuite_Main_OLD.py deleted file mode 100644 index 26b254ae71..0000000000 --- a/AutomatedTesting/Gem/PythonTests/editor/TestSuite_Main_OLD.py +++ /dev/null @@ -1,43 +0,0 @@ -""" -Copyright (c) Contributors to the Open 3D Engine Project. -For complete copyright and license terms please see the LICENSE at the root of this distribution. - -SPDX-License-Identifier: Apache-2.0 OR MIT -""" - -import os -import pytest -import sys - -import ly_test_tools.environment.file_system as file_system - -sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/../automatedtesting_shared') -from base import TestAutomationBase - - -@pytest.fixture -def remove_test_level(request, workspace, project): - file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", "tmp_level")], True, True) - - def teardown(): - file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", "tmp_level")], True, True) - - request.addfinalizer(teardown) - - -@pytest.mark.SUITE_main -@pytest.mark.parametrize("launcher_platform", ['windows_editor']) -@pytest.mark.parametrize("project", ["AutomatedTesting"]) -class TestAutomation(TestAutomationBase): - - def test_BasicEditorWorkflows_LevelEntityComponentCRUD(self, request, workspace, editor, launcher_platform, - remove_test_level): - from .EditorScripts import BasicEditorWorkflows_LevelEntityComponentCRUD as test_module - self._run_test(request, workspace, editor, test_module, batch_mode=False, autotest_mode=False) - - @pytest.mark.REQUIRES_gpu - def test_BasicEditorWorkflows_GPU_LevelEntityComponentCRUD(self, request, workspace, editor, launcher_platform, - remove_test_level): - from .EditorScripts import BasicEditorWorkflows_LevelEntityComponentCRUD as test_module - self._run_test(request, workspace, editor, test_module, batch_mode=False, autotest_mode=False, - use_null_renderer=False) diff --git a/AutomatedTesting/Gem/PythonTests/editor/TestSuite_Main_Optimized.py b/AutomatedTesting/Gem/PythonTests/editor/TestSuite_Main_Optimized.py new file mode 100644 index 0000000000..9c0b99daff --- /dev/null +++ b/AutomatedTesting/Gem/PythonTests/editor/TestSuite_Main_Optimized.py @@ -0,0 +1,75 @@ +""" +Copyright (c) Contributors to the Open 3D Engine Project. +For complete copyright and license terms please see the LICENSE at the root of this distribution. + +SPDX-License-Identifier: Apache-2.0 OR MIT +""" + +import os +import pytest + +import ly_test_tools.environment.file_system as file_system +from ly_test_tools.o3de.editor_test import EditorSingleTest, EditorSharedTest, EditorParallelTest, EditorTestSuite + + +@pytest.mark.xfail(reason="Optimized tests are experimental, we will enable xfail and monitor them temporarily.") +@pytest.mark.SUITE_main +@pytest.mark.parametrize("launcher_platform", ['windows_editor']) +@pytest.mark.parametrize("project", ["AutomatedTesting"]) +class TestAutomationNoAutoTestMode(EditorTestSuite): + + # Disable -autotest_mode and -BatchMode. Tests cannot run in -BatchMode due to UI interactions, and these tests + # interact with modal dialogs + global_extra_cmdline_args = [] + + class test_BasicEditorWorkflows_LevelEntityComponentCRUD(EditorSingleTest): + # Custom teardown to remove slice asset created during test + def teardown(self, request, workspace, editor, editor_test_results, launcher_platform): + file_system.delete([os.path.join(workspace.paths.engine_root(), "AutomatedTesting", "Levels", "tmp_level")], + True, True) + from .EditorScripts import BasicEditorWorkflows_LevelEntityComponentCRUD as test_module + + @pytest.mark.REQUIRES_gpu + class test_BasicEditorWorkflows_GPU_LevelEntityComponentCRUD(EditorSingleTest): + # Disable null renderer + use_null_renderer = False + + # Custom teardown to remove slice asset created during test + def teardown(self, request, workspace, editor, editor_test_results, launcher_platform): + file_system.delete([os.path.join(workspace.paths.engine_root(), "AutomatedTesting", "Levels", "tmp_level")], + True, True) + from .EditorScripts import BasicEditorWorkflows_LevelEntityComponentCRUD as test_module + + class test_InputBindings_Add_Remove_Input_Events(EditorSharedTest): + from .EditorScripts import InputBindings_Add_Remove_Input_Events as test_module + + @pytest.mark.skip(reason="Crashes Editor: ATOM-15493") + class test_AssetPicker_UI_UX(EditorSharedTest): + from .EditorScripts import AssetPicker_UI_UX as test_module + + +@pytest.mark.xfail(reason="Optimized tests are experimental, we will enable xfail and monitor them temporarily.") +@pytest.mark.SUITE_main +@pytest.mark.parametrize("launcher_platform", ['windows_editor']) +@pytest.mark.parametrize("project", ["AutomatedTesting"]) +class TestAutomationAutoTestMode(EditorTestSuite): + + # Enable only -autotest_mode for these tests. Tests cannot run in -BatchMode due to UI interactions + global_extra_cmdline_args = ["-autotest_mode"] + + class test_AssetBrowser_TreeNavigation(EditorSharedTest): + from .EditorScripts import AssetBrowser_TreeNavigation as test_module + + @pytest.mark.skip(reason="Crashes Editor: ATOM-15493") + class test_AssetBrowser_SearchFiltering(EditorSharedTest): + from .EditorScripts import AssetBrowser_SearchFiltering as test_module + + class test_ComponentCRUD_Add_Delete_Components(EditorSharedTest): + from .EditorScripts import ComponentCRUD_Add_Delete_Components as test_module + + class test_Menus_ViewMenuOptions_Work(EditorSharedTest): + from .EditorScripts import Menus_ViewMenuOptions as test_module + + @pytest.mark.skip(reason="Times out due to dialogs failing to dismiss: LYN-4208") + class test_Menus_FileMenuOptions_Work(EditorSharedTest): + from .EditorScripts import Menus_FileMenuOptions as test_module diff --git a/AutomatedTesting/Gem/PythonTests/editor/TestSuite_Periodic_OLD.py b/AutomatedTesting/Gem/PythonTests/editor/TestSuite_Periodic.py similarity index 85% rename from AutomatedTesting/Gem/PythonTests/editor/TestSuite_Periodic_OLD.py rename to AutomatedTesting/Gem/PythonTests/editor/TestSuite_Periodic.py index 606afa0620..969137aae4 100644 --- a/AutomatedTesting/Gem/PythonTests/editor/TestSuite_Periodic_OLD.py +++ b/AutomatedTesting/Gem/PythonTests/editor/TestSuite_Periodic.py @@ -48,17 +48,13 @@ class TestAutomation(TestAutomationBase): from .EditorScripts import ComponentCRUD_Add_Delete_Components as test_module self._run_test(request, workspace, editor, test_module, batch_mode=False) - def test_Docking_BasicDockedTools(self, request, workspace, editor, launcher_platform): - from .EditorScripts import Docking_BasicDockedTools as test_module - self._run_test(request, workspace, editor, test_module, batch_mode=False) + def test_InputBindings_Add_Remove_Input_Events(self, request, workspace, editor, launcher_platform): from .EditorScripts import InputBindings_Add_Remove_Input_Events as test_module self._run_test(request, workspace, editor, test_module, batch_mode=False, autotest_mode=False) - def test_Menus_EditMenuOptions_Work(self, request, workspace, editor, launcher_platform): - from .EditorScripts import Menus_EditMenuOptions as test_module - self._run_test(request, workspace, editor, test_module, batch_mode=False) + def test_Menus_ViewMenuOptions_Work(self, request, workspace, editor, launcher_platform): from .EditorScripts import Menus_ViewMenuOptions as test_module diff --git a/AutomatedTesting/Gem/PythonTests/editor/TestSuite_Sandbox.py b/AutomatedTesting/Gem/PythonTests/editor/TestSuite_Sandbox.py index d49e9e1c9b..98a6620d9c 100644 --- a/AutomatedTesting/Gem/PythonTests/editor/TestSuite_Sandbox.py +++ b/AutomatedTesting/Gem/PythonTests/editor/TestSuite_Sandbox.py @@ -7,21 +7,21 @@ SPDX-License-Identifier: Apache-2.0 OR MIT import os import pytest +import sys -from ly_test_tools.o3de.editor_test import EditorSingleTest, EditorSharedTest, EditorParallelTest, EditorTestSuite +sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/../automatedtesting_shared') +from base import TestAutomationBase -@pytest.mark.xfail(reason="Optimized tests are experimental, we will enable xfail and monitor them temporarily.") @pytest.mark.SUITE_sandbox @pytest.mark.parametrize("launcher_platform", ['windows_editor']) @pytest.mark.parametrize("project", ["AutomatedTesting"]) -class TestAutomationAutoTestMode(EditorTestSuite): +class TestAutomation(TestAutomationBase): - # Enable only -autotest_mode for these tests. Tests cannot run in -BatchMode due to UI interactions - global_extra_cmdline_args = ["-autotest_mode"] - - class test_Docking_BasicDockedTools(EditorSharedTest): - from .EditorScripts import Docking_BasicDockedTools as test_module - - class test_Menus_EditMenuOptions_Work(EditorSharedTest): + def test_Menus_EditMenuOptions_Work(self, request, workspace, editor, launcher_platform): from .EditorScripts import Menus_EditMenuOptions as test_module + self._run_test(request, workspace, editor, test_module, batch_mode=False) + + def test_Docking_BasicDockedTools(self, request, workspace, editor, launcher_platform): + from .EditorScripts import Docking_BasicDockedTools as test_module + self._run_test(request, workspace, editor, test_module, batch_mode=False) diff --git a/AutomatedTesting/Gem/PythonTests/editor/TestSuite_Sandbox_Optimized.py b/AutomatedTesting/Gem/PythonTests/editor/TestSuite_Sandbox_Optimized.py new file mode 100644 index 0000000000..d49e9e1c9b --- /dev/null +++ b/AutomatedTesting/Gem/PythonTests/editor/TestSuite_Sandbox_Optimized.py @@ -0,0 +1,27 @@ +""" +Copyright (c) Contributors to the Open 3D Engine Project. +For complete copyright and license terms please see the LICENSE at the root of this distribution. + +SPDX-License-Identifier: Apache-2.0 OR MIT +""" + +import os +import pytest + +from ly_test_tools.o3de.editor_test import EditorSingleTest, EditorSharedTest, EditorParallelTest, EditorTestSuite + + +@pytest.mark.xfail(reason="Optimized tests are experimental, we will enable xfail and monitor them temporarily.") +@pytest.mark.SUITE_sandbox +@pytest.mark.parametrize("launcher_platform", ['windows_editor']) +@pytest.mark.parametrize("project", ["AutomatedTesting"]) +class TestAutomationAutoTestMode(EditorTestSuite): + + # Enable only -autotest_mode for these tests. Tests cannot run in -BatchMode due to UI interactions + global_extra_cmdline_args = ["-autotest_mode"] + + class test_Docking_BasicDockedTools(EditorSharedTest): + from .EditorScripts import Docking_BasicDockedTools as test_module + + class test_Menus_EditMenuOptions_Work(EditorSharedTest): + from .EditorScripts import Menus_EditMenuOptions as test_module From decf15df2167806daaa2159e1787fd568ddabfe0 Mon Sep 17 00:00:00 2001 From: puvvadar Date: Tue, 24 Aug 2021 16:19:38 -0700 Subject: [PATCH 081/131] Move packet dispatch to return an enum that includes a pending option Signed-off-by: puvvadar --- .../AutoGen/AutoPacketDispatcher_Header.jinja | 2 +- .../AutoGen/AutoPacketDispatcher_Inline.jinja | 18 +++++++++++++---- .../ConnectionLayer/IConnectionListener.h | 4 ++-- .../AzNetworking/PacketLayer/IPacketHeader.h | 6 ++++++ .../UdpTransport/UdpConnection.cpp | 18 ++++++++--------- .../AzNetworking/UdpTransport/UdpConnection.h | 2 +- .../UdpTransport/UdpFragmentQueue.cpp | 20 +++++++++---------- .../UdpTransport/UdpFragmentQueue.h | 5 +++-- .../UdpTransport/UdpNetworkInterface.cpp | 12 ++++++++--- .../AutoGen/Multiplayer.AutoPackets.xml | 4 ++-- .../Editor/MultiplayerEditorConnection.cpp | 2 +- .../Editor/MultiplayerEditorConnection.h | 3 ++- .../Source/MultiplayerSystemComponent.cpp | 11 +++++++++- .../Code/Source/MultiplayerSystemComponent.h | 4 +++- 14 files changed, 73 insertions(+), 38 deletions(-) diff --git a/Code/Framework/AzNetworking/AzNetworking/AutoGen/AutoPacketDispatcher_Header.jinja b/Code/Framework/AzNetworking/AzNetworking/AutoGen/AutoPacketDispatcher_Header.jinja index 63442ea1eb..1e9edc56bd 100644 --- a/Code/Framework/AzNetworking/AzNetworking/AutoGen/AutoPacketDispatcher_Header.jinja +++ b/Code/Framework/AzNetworking/AzNetworking/AutoGen/AutoPacketDispatcher_Header.jinja @@ -16,7 +16,7 @@ namespace {{ xml.attrib['Name'] }} //! @param handler the handler used to handle the received packet //! @return boolean true on successful dispatch, false if the request was not handled template - bool DispatchPacket(AzNetworking::IConnection* connection, const AzNetworking::IPacketHeader& packetHeader, AzNetworking::ISerializer& serializer, HANDLER& handler); + AzNetworking::PacketDispatchResult DispatchPacket(AzNetworking::IConnection* connection, const AzNetworking::IPacketHeader& packetHeader, AzNetworking::ISerializer& serializer, HANDLER& handler); } {% endfor %} diff --git a/Code/Framework/AzNetworking/AzNetworking/AutoGen/AutoPacketDispatcher_Inline.jinja b/Code/Framework/AzNetworking/AzNetworking/AutoGen/AutoPacketDispatcher_Inline.jinja index ac659820c3..9767828f3a 100644 --- a/Code/Framework/AzNetworking/AzNetworking/AutoGen/AutoPacketDispatcher_Inline.jinja +++ b/Code/Framework/AzNetworking/AzNetworking/AutoGen/AutoPacketDispatcher_Inline.jinja @@ -2,7 +2,7 @@ namespace {{ xml.attrib['Name'] }} { template - inline bool DispatchPacket(AzNetworking::IConnection* connection, const AzNetworking::IPacketHeader& packetHeader, AzNetworking::ISerializer& serializer, HANDLER& handler) + inline AzNetworking::PacketDispatchResult DispatchPacket(AzNetworking::IConnection* connection, const AzNetworking::IPacketHeader& packetHeader, AzNetworking::ISerializer& serializer, HANDLER& handler) { switch (aznumeric_cast(packetHeader.GetPacketType())) { @@ -10,16 +10,26 @@ namespace {{ xml.attrib['Name'] }} case aznumeric_cast({{ Packet.attrib['Name'] }}::Type): { AZLOG(Debug_DispatchPackets, "Received packet %s", "{{ Packet.attrib['Name'] }}"); +{% if ('HandshakePacket' not in Packet.attrib) or (Packet.attrib['HandshakePacket'] == 'false') %} + if (!handler.IsHandshakeComplete()) + { + return AzNetworking::PacketDispatchResult::Pending; + } +{% endif %} + {{ Packet.attrib['Name'] }} packet; if (!serializer.Serialize(packet, "Packet")) { - return false; + return AzNetworking::PacketDispatchResult::Failure; + } + if(handler.HandleRequest(connection, packetHeader, packet)) + { + return AzNetworking::PacketDispatchResult::Success; } - return handler.HandleRequest(connection, packetHeader, packet); } {% endfor %} } - return false; + return AzNetworking::PacketDispatchResult::Failure; } } {% endfor %} diff --git a/Code/Framework/AzNetworking/AzNetworking/ConnectionLayer/IConnectionListener.h b/Code/Framework/AzNetworking/AzNetworking/ConnectionLayer/IConnectionListener.h index 41e79e2207..f93e7d72f6 100644 --- a/Code/Framework/AzNetworking/AzNetworking/ConnectionLayer/IConnectionListener.h +++ b/Code/Framework/AzNetworking/AzNetworking/ConnectionLayer/IConnectionListener.h @@ -45,8 +45,8 @@ namespace AzNetworking //! @param connection pointer to the connection instance generating the event //! @param packetHeader packet header of the associated payload //! @param serializer serializer instance containing the transmitted payload - //! @return boolean true to signal success, false to disconnect with a transport error - virtual bool OnPacketReceived(IConnection* connection, const IPacketHeader& packetHeader, ISerializer& serializer) = 0; + //! @return PacketDispatchResult result of the packet handling attempt + virtual PacketDispatchResult OnPacketReceived(IConnection* connection, const IPacketHeader& packetHeader, ISerializer& serializer) = 0; //! Called when a packet is deemed lost by the remote connection. //! @param connection pointer to the connection instance generating the event diff --git a/Code/Framework/AzNetworking/AzNetworking/PacketLayer/IPacketHeader.h b/Code/Framework/AzNetworking/AzNetworking/PacketLayer/IPacketHeader.h index ea9734a867..f7ca7f0166 100644 --- a/Code/Framework/AzNetworking/AzNetworking/PacketLayer/IPacketHeader.h +++ b/Code/Framework/AzNetworking/AzNetworking/PacketLayer/IPacketHeader.h @@ -15,6 +15,12 @@ namespace AzNetworking { + AZ_ENUM_CLASS(PacketDispatchResult + , Success + , Pending + , Failure + ); + AZ_ENUM_CLASS(PacketFlag , Compressed , MAX diff --git a/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpConnection.cpp b/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpConnection.cpp index 3efc6a51a8..7b451865c4 100644 --- a/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpConnection.cpp +++ b/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpConnection.cpp @@ -236,14 +236,14 @@ namespace AzNetworking return true; } - bool UdpConnection::HandleCorePacket(IConnectionListener& connectionListener, UdpPacketHeader& header, ISerializer& serializer) + PacketDispatchResult UdpConnection::HandleCorePacket(IConnectionListener& connectionListener, UdpPacketHeader& header, ISerializer& serializer) { switch (static_cast(header.GetPacketType())) { case CorePackets::PacketType::InitiateConnectionPacket: { AZLOG(NET_CorePackets, "Received core packet %s", "InitiateConnection"); - return true; + return PacketDispatchResult::Success; } break; @@ -253,7 +253,7 @@ namespace AzNetworking CorePackets::ConnectionHandshakePacket packet; if (!serializer.Serialize(packet, "Packet")) { - return false; + return PacketDispatchResult::Failure; } if (m_state != ConnectionState::Connected) @@ -264,7 +264,7 @@ namespace AzNetworking } } - return true; + return PacketDispatchResult::Success; } break; @@ -274,10 +274,10 @@ namespace AzNetworking CorePackets::TerminateConnectionPacket packet; if (!serializer.Serialize(packet, "Packet")) { - return false; + return PacketDispatchResult::Failure; } Disconnect(packet.GetDisconnectReason(), TerminationEndpoint::Remote); - return true; + return PacketDispatchResult::Success; } break; @@ -287,10 +287,10 @@ namespace AzNetworking CorePackets::HeartbeatPacket packet; if (!serializer.Serialize(packet, "Packet")) { - return false; + return PacketDispatchResult::Failure; } // Do nothing, we've already processed our ack packets - return true; + return PacketDispatchResult::Success; } break; @@ -302,6 +302,6 @@ namespace AzNetworking AZ_Assert(false, "Unhandled core packet type!"); } - return false; + return PacketDispatchResult::Failure; } } diff --git a/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpConnection.h b/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpConnection.h index 67d626d6cb..3d29cfcd23 100644 --- a/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpConnection.h +++ b/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpConnection.h @@ -131,7 +131,7 @@ namespace AzNetworking //! @param header the packet header received to process //! @param serializer the output serializer containing the transmitted packet data //! @return boolean true on successful handling of the received header - bool HandleCorePacket(IConnectionListener& listener, UdpPacketHeader& header, ISerializer& serializer); + PacketDispatchResult HandleCorePacket(IConnectionListener& listener, UdpPacketHeader& header, ISerializer& serializer); AZ_DISABLE_COPY_MOVE(UdpConnection); diff --git a/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpFragmentQueue.cpp b/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpFragmentQueue.cpp index 66fe6f30eb..fa4ee78a92 100644 --- a/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpFragmentQueue.cpp +++ b/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpFragmentQueue.cpp @@ -37,14 +37,14 @@ namespace AzNetworking return m_sequenceGenerator.GetNextSequenceId(); } - bool UdpFragmentQueue::ProcessReceivedChunk(UdpConnection* connection, IConnectionListener& connectionListener, UdpPacketHeader& header, ISerializer& serializer) + PacketDispatchResult UdpFragmentQueue::ProcessReceivedChunk(UdpConnection* connection, IConnectionListener& connectionListener, UdpPacketHeader& header, ISerializer& serializer) { AZStd::unique_ptr packet = AZStd::make_unique(); if (!serializer.Serialize(*packet, "Packet")) { AZLOG(NET_FragmentQueue, "Fragment failed serialization"); - return false; + return PacketDispatchResult::Failure; } const bool isReliable = header.GetIsReliable(); @@ -63,14 +63,14 @@ namespace AzNetworking { // Too old to process AZLOG(NET_FragmentQueue, "Fragment sequence ID is outside our tracked window"); - return false; + return PacketDispatchResult::Failure; } if (m_deliveredFragments.GetBit(static_cast(sequenceDelta))) { // Received packet is a duplicate of one already forwarded to gameplay AZLOG(NET_FragmentQueue, "Received duplicate of fragmented packet %u, discarding", static_cast(fragmentSequence)); - return true; + return PacketDispatchResult::Success; } const uint32_t chunkCount = packet->GetChunkCount(); @@ -89,7 +89,7 @@ namespace AzNetworking { // Either we disagree on the number of chunks, or chunkIndex is bigger than the expected size, bail and disconnect AZLOG(NET_FragmentQueue, "Malformed chunk metadata in fragmented packet, chunkIndex %u, chunkCount %u, reservedSize %u", chunkIndex, chunkCount, static_cast(packetFragments.size())); - return false; + return PacketDispatchResult::Failure; } packetFragments[chunkIndex] = AZStd::move(packet); @@ -105,7 +105,7 @@ namespace AzNetworking } // We haven't received all chunks required to complete this packet yet - return true; + return PacketDispatchResult::Success; } totalPacketSize += static_cast(packetFragments[index]->GetChunkBuffer().GetSize()); @@ -119,7 +119,7 @@ namespace AzNetworking if (!buffer.Resize(totalPacketSize)) { AZLOG_ERROR("Fragmented packet is too large to fit in UdpPacketEncodingBuffer"); - return false; + return PacketDispatchResult::Failure; } uint8_t* bufferPointer = buffer.GetBuffer(); @@ -141,17 +141,17 @@ namespace AzNetworking if (!header.SerializePacketFlags(networkSerializer)) { AZLOG(NET_FragmentQueue, "Reconstructed fragmented packet failed packet flags serialization"); - return false; + return PacketDispatchResult::Failure; } if (!networkISerializer.Serialize(header, "Header")) { AZLOG(NET_FragmentQueue, "Reconstructed fragmented packet failed header serialization"); - return false; + return PacketDispatchResult::Failure; } } connection->GetPacketTracker().ProcessReceived(connection, header); - bool handledPacket = false; + PacketDispatchResult handledPacket; if (header.GetPacketType() < aznumeric_cast(CorePackets::PacketType::MAX)) { handledPacket = connection->HandleCorePacket(connectionListener, header, networkSerializer); diff --git a/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpFragmentQueue.h b/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpFragmentQueue.h index 38c4df4f0e..15d4cfa10c 100644 --- a/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpFragmentQueue.h +++ b/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpFragmentQueue.h @@ -9,6 +9,7 @@ #pragma once #include +#include #include #include #include @@ -44,8 +45,8 @@ namespace AzNetworking //! @param connectionListener the connection listener for delivery of completed packets //! @param header the chunk packet header //! @param serializer the serializer containing the chunk body - //! @return boolean true if the chunk was processed, false if an error was encountered - bool ProcessReceivedChunk(UdpConnection* connection, IConnectionListener& connectionListener, UdpPacketHeader& header, ISerializer& serializer); + //! @return PacketDispatchResult result of processing the chunk + PacketDispatchResult ProcessReceivedChunk(UdpConnection* connection, IConnectionListener& connectionListener, UdpPacketHeader& header, ISerializer& serializer); private: diff --git a/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpNetworkInterface.cpp b/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpNetworkInterface.cpp index d50b20831f..983b425b60 100644 --- a/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpNetworkInterface.cpp +++ b/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpNetworkInterface.cpp @@ -277,7 +277,7 @@ namespace AzNetworking timeoutItem->UpdateTimeoutTime(startTimeMs); - bool handledPacket = false; + PacketDispatchResult handledPacket; if (header.GetPacketType() < aznumeric_cast(CorePackets::PacketType::MAX)) { handledPacket = connection->HandleCorePacket(m_connectionListener, header, packetSerializer); @@ -287,7 +287,7 @@ namespace AzNetworking handledPacket = m_connectionListener.OnPacketReceived(connection, header, packetSerializer); } - if (handledPacket) + if (handledPacket == PacketDispatchResult::Success) { connection->UpdateHeartbeat(currentTimeMs); if (connection->GetConnectionState() == ConnectionState::Connecting && !connection->GetDtlsEndpoint().IsConnecting()) @@ -299,10 +299,16 @@ namespace AzNetworking else if (m_socket->IsEncrypted() && connection->GetDtlsEndpoint().IsConnecting() && !IsHandshakePacket(connection->GetDtlsEndpoint(), header.GetPacketType())) { - // It's possible for one side to finish its half of the handshake and start sending encrypted data + // It's possible for one side to finish its half of the encryption handshake and start sending encrypted data + // This will appear as a SerializationError due to the incomplete encryption handshake // If it's not an expected unencrypted type then skip it for now continue; } + else if (handledPacket == PacketDispatchResult::Pending) + { + // If we did not handle due to a handshake pending completion, defer it + continue; + } else if (connection->GetConnectionState() != ConnectionState::Disconnecting) { connection->Disconnect(DisconnectReason::StreamError, TerminationEndpoint::Local); diff --git a/Gems/Multiplayer/Code/Source/AutoGen/Multiplayer.AutoPackets.xml b/Gems/Multiplayer/Code/Source/AutoGen/Multiplayer.AutoPackets.xml index ce8931107f..203750d761 100644 --- a/Gems/Multiplayer/Code/Source/AutoGen/Multiplayer.AutoPackets.xml +++ b/Gems/Multiplayer/Code/Source/AutoGen/Multiplayer.AutoPackets.xml @@ -7,12 +7,12 @@ - + - + diff --git a/Gems/Multiplayer/Code/Source/Editor/MultiplayerEditorConnection.cpp b/Gems/Multiplayer/Code/Source/Editor/MultiplayerEditorConnection.cpp index fc398182ef..e634cb52fc 100644 --- a/Gems/Multiplayer/Code/Source/Editor/MultiplayerEditorConnection.cpp +++ b/Gems/Multiplayer/Code/Source/Editor/MultiplayerEditorConnection.cpp @@ -168,7 +168,7 @@ namespace Multiplayer ; } - bool MultiplayerEditorConnection::OnPacketReceived(AzNetworking::IConnection* connection, const IPacketHeader& packetHeader, ISerializer& serializer) + AzNetworking::PacketDispatchResult MultiplayerEditorConnection::OnPacketReceived(AzNetworking::IConnection* connection, const IPacketHeader& packetHeader, ISerializer& serializer) { return MultiplayerEditorPackets::DispatchPacket(connection, packetHeader, serializer, *this); } diff --git a/Gems/Multiplayer/Code/Source/Editor/MultiplayerEditorConnection.h b/Gems/Multiplayer/Code/Source/Editor/MultiplayerEditorConnection.h index 8c19848db7..8f1f90cc6b 100644 --- a/Gems/Multiplayer/Code/Source/Editor/MultiplayerEditorConnection.h +++ b/Gems/Multiplayer/Code/Source/Editor/MultiplayerEditorConnection.h @@ -33,6 +33,7 @@ namespace Multiplayer MultiplayerEditorConnection(); ~MultiplayerEditorConnection() = default; + bool IsHandshakeComplete(){ return true; }; bool HandleRequest(AzNetworking::IConnection* connection, const AzNetworking::IPacketHeader& packetHeader, MultiplayerEditorPackets::EditorServerInit& packet); bool HandleRequest(AzNetworking::IConnection* connection, const AzNetworking::IPacketHeader& packetHeader, MultiplayerEditorPackets::EditorServerReady& packet); @@ -40,7 +41,7 @@ namespace Multiplayer //! @{ AzNetworking::ConnectResult ValidateConnect(const AzNetworking::IpAddress& remoteAddress, const AzNetworking::IPacketHeader& packetHeader, AzNetworking::ISerializer& serializer) override; void OnConnect(AzNetworking::IConnection* connection) override; - bool OnPacketReceived(AzNetworking::IConnection* connection, const AzNetworking::IPacketHeader& packetHeader, AzNetworking::ISerializer& serializer) override; + AzNetworking::PacketDispatchResult OnPacketReceived(AzNetworking::IConnection* connection, const AzNetworking::IPacketHeader& packetHeader, AzNetworking::ISerializer& serializer) override; void OnPacketLost(AzNetworking::IConnection* connection, AzNetworking::PacketId packetId) override; void OnDisconnect(AzNetworking::IConnection* connection, AzNetworking::DisconnectReason reason, AzNetworking::TerminationEndpoint endpoint) override; //! @} diff --git a/Gems/Multiplayer/Code/Source/MultiplayerSystemComponent.cpp b/Gems/Multiplayer/Code/Source/MultiplayerSystemComponent.cpp index b0a8350982..c36f2e0f11 100644 --- a/Gems/Multiplayer/Code/Source/MultiplayerSystemComponent.cpp +++ b/Gems/Multiplayer/Code/Source/MultiplayerSystemComponent.cpp @@ -441,6 +441,11 @@ namespace Multiplayer MultiplayerPackets::SyncConsole m_syncPacket; }; + bool MultiplayerSystemComponent::IsHandshakeComplete() + { + return m_didHandshake; + } + bool MultiplayerSystemComponent::HandleRequest ( [[maybe_unused]] AzNetworking::IConnection* connection, @@ -465,6 +470,8 @@ namespace Multiplayer if (connection->SendReliablePacket(MultiplayerPackets::Accept(InvalidHostId, sv_map))) { + m_didHandshake = true; + // Sync our console ConsoleReplicator consoleReplicator(connection); AZ::Interface::Get()->VisitRegisteredFunctors([&consoleReplicator](AZ::ConsoleFunctorBase* functor) { consoleReplicator.Visit(functor); }); @@ -480,6 +487,8 @@ namespace Multiplayer [[maybe_unused]] MultiplayerPackets::Accept& packet ) { + m_didHandshake = true; + AZ::CVarFixedString commandString = "sv_map " + packet.GetMap(); AZ::Interface::Get()->PerformCommand(commandString.c_str()); @@ -670,7 +679,7 @@ namespace Multiplayer } } - bool MultiplayerSystemComponent::OnPacketReceived(AzNetworking::IConnection* connection, const IPacketHeader& packetHeader, ISerializer& serializer) + AzNetworking::PacketDispatchResult MultiplayerSystemComponent::OnPacketReceived(AzNetworking::IConnection* connection, const IPacketHeader& packetHeader, ISerializer& serializer) { return MultiplayerPackets::DispatchPacket(connection, packetHeader, serializer, *this); } diff --git a/Gems/Multiplayer/Code/Source/MultiplayerSystemComponent.h b/Gems/Multiplayer/Code/Source/MultiplayerSystemComponent.h index e2fb7deacc..74ba2ddf34 100644 --- a/Gems/Multiplayer/Code/Source/MultiplayerSystemComponent.h +++ b/Gems/Multiplayer/Code/Source/MultiplayerSystemComponent.h @@ -76,6 +76,7 @@ namespace Multiplayer int GetTickOrder() override; //! @} + bool IsHandshakeComplete(); bool HandleRequest(AzNetworking::IConnection* connection, const AzNetworking::IPacketHeader& packetHeader, MultiplayerPackets::Connect& packet); bool HandleRequest(AzNetworking::IConnection* connection, const AzNetworking::IPacketHeader& packetHeader, MultiplayerPackets::Accept& packet); bool HandleRequest(AzNetworking::IConnection* connection, const AzNetworking::IPacketHeader& packetHeader, MultiplayerPackets::ReadyForEntityUpdates& packet); @@ -89,7 +90,7 @@ namespace Multiplayer //! @{ AzNetworking::ConnectResult ValidateConnect(const AzNetworking::IpAddress& remoteAddress, const AzNetworking::IPacketHeader& packetHeader, AzNetworking::ISerializer& serializer) override; void OnConnect(AzNetworking::IConnection* connection) override; - bool OnPacketReceived(AzNetworking::IConnection* connection, const AzNetworking::IPacketHeader& packetHeader, AzNetworking::ISerializer& serializer) override; + AzNetworking::PacketDispatchResult OnPacketReceived(AzNetworking::IConnection* connection, const AzNetworking::IPacketHeader& packetHeader, AzNetworking::ISerializer& serializer) override; void OnPacketLost(AzNetworking::IConnection* connection, AzNetworking::PacketId packetId) override; void OnDisconnect(AzNetworking::IConnection* connection, AzNetworking::DisconnectReason reason, AzNetworking::TerminationEndpoint endpoint) override; //! @} @@ -158,6 +159,7 @@ namespace Multiplayer double m_serverSendAccumulator = 0.0; float m_renderBlendFactor = 0.0f; float m_tickFactor = 0.0f; + bool m_didHandshake = false; #if !defined(AZ_RELEASE_BUILD) MultiplayerEditorConnection m_editorConnectionListener; From 082273b54334860ab952dd7c73f32f5582612b11 Mon Sep 17 00:00:00 2001 From: jckand-amzn Date: Tue, 24 Aug 2021 18:19:38 -0500 Subject: [PATCH 082/131] Whitespace cleanup Signed-off-by: jckand-amzn --- AutomatedTesting/Gem/PythonTests/editor/TestSuite_Periodic.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/AutomatedTesting/Gem/PythonTests/editor/TestSuite_Periodic.py b/AutomatedTesting/Gem/PythonTests/editor/TestSuite_Periodic.py index 969137aae4..398b64bc87 100644 --- a/AutomatedTesting/Gem/PythonTests/editor/TestSuite_Periodic.py +++ b/AutomatedTesting/Gem/PythonTests/editor/TestSuite_Periodic.py @@ -48,14 +48,10 @@ class TestAutomation(TestAutomationBase): from .EditorScripts import ComponentCRUD_Add_Delete_Components as test_module self._run_test(request, workspace, editor, test_module, batch_mode=False) - - def test_InputBindings_Add_Remove_Input_Events(self, request, workspace, editor, launcher_platform): from .EditorScripts import InputBindings_Add_Remove_Input_Events as test_module self._run_test(request, workspace, editor, test_module, batch_mode=False, autotest_mode=False) - - def test_Menus_ViewMenuOptions_Work(self, request, workspace, editor, launcher_platform): from .EditorScripts import Menus_ViewMenuOptions as test_module self._run_test(request, workspace, editor, test_module, batch_mode=False) From 2ef5e956ba102492e270010bb79001f516596b8d Mon Sep 17 00:00:00 2001 From: puvvadar Date: Tue, 24 Aug 2021 16:26:32 -0700 Subject: [PATCH 083/131] Fix a function header comment Signed-off-by: puvvadar --- .../AzNetworking/AzNetworking/UdpTransport/UdpConnection.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpConnection.h b/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpConnection.h index 3d29cfcd23..199a5a8347 100644 --- a/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpConnection.h +++ b/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpConnection.h @@ -130,7 +130,7 @@ namespace AzNetworking //! @param listener a connection listener to receive connection related events //! @param header the packet header received to process //! @param serializer the output serializer containing the transmitted packet data - //! @return boolean true on successful handling of the received header + //! @return PacketDispatchResult result of processing the core packet PacketDispatchResult HandleCorePacket(IConnectionListener& listener, UdpPacketHeader& header, ISerializer& serializer); AZ_DISABLE_COPY_MOVE(UdpConnection); From 4545e2fb33211bbb7209f4529f8f74cefb4cd7e0 Mon Sep 17 00:00:00 2001 From: lsemp3d <58790905+lsemp3d@users.noreply.github.com> Date: Tue, 24 Aug 2021 16:27:55 -0700 Subject: [PATCH 084/131] Improved layout and behavior of the SlotTypeSelector widget Signed-off-by: lsemp3d <58790905+lsemp3d@users.noreply.github.com> --- .../VariablePanel/SlotTypeSelectorWidget.ui | 206 +++++++++--------- 1 file changed, 109 insertions(+), 97 deletions(-) diff --git a/Gems/ScriptCanvas/Code/Editor/View/Widgets/VariablePanel/SlotTypeSelectorWidget.ui b/Gems/ScriptCanvas/Code/Editor/View/Widgets/VariablePanel/SlotTypeSelectorWidget.ui index 0ba609717b..aa6d3356ec 100644 --- a/Gems/ScriptCanvas/Code/Editor/View/Widgets/VariablePanel/SlotTypeSelectorWidget.ui +++ b/Gems/ScriptCanvas/Code/Editor/View/Widgets/VariablePanel/SlotTypeSelectorWidget.ui @@ -6,110 +6,122 @@ 0 0 - 278 - 316 + 294 + 265 - - - 0 - 0 - - Pick slot name/type false - - - - 0 - 0 - 278 - 278 - - - - - - - 0 - - - 10 - - - 0 - - - 10 - - - 30 - - - - - - - - Search... - - - - - - - true - - - QAbstractItemView::SingleSelection - - - QAbstractItemView::SelectRows - - - false - - - false - - - - - - - Qt::Horizontal - - - - - - - - - Type the name for your slot here... - - - - - - - - - Qt::StrongFocus - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - + + + + + 0 + + + QLayout::SetMaximumSize + + + 10 + + + 0 + + + 10 + + + 0 + + + + + Slot Name + + + + + + + + 0 + 0 + + + + Type the name for your slot here... + + + + + + + Slot Type + + + + + + + + 0 + 0 + + + + + + + Search... + + + + + + + true + + + QAbstractItemView::SingleSelection + + + QAbstractItemView::SelectRows + + + false + + + false + + + + + + + Qt::Horizontal + + + + + + + + + + Qt::StrongFocus + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + @@ -124,7 +136,7 @@ - + buttonBox accepted() From 214700a73e0fa2610e61e605a336d5937b870762 Mon Sep 17 00:00:00 2001 From: chcurran <82187351+carlitosan@users.noreply.github.com> Date: Tue, 24 Aug 2021 17:38:34 -0700 Subject: [PATCH 085/131] Finish repair for scanning for upgrade tool Signed-off-by: chcurran <82187351+carlitosan@users.noreply.github.com> --- .../Source/ElementInformationSerializer.inl | 7 +- .../Tools/UpgradeTool/VersionExplorer.cpp | 130 ++++++++++++------ .../Tools/UpgradeTool/VersionExplorer.h | 8 +- .../Data/BehaviorContextObject.cpp | 2 +- 4 files changed, 98 insertions(+), 49 deletions(-) diff --git a/Gems/ExpressionEvaluation/Code/Source/ElementInformationSerializer.inl b/Gems/ExpressionEvaluation/Code/Source/ElementInformationSerializer.inl index 8d297571ad..10b002034e 100644 --- a/Gems/ExpressionEvaluation/Code/Source/ElementInformationSerializer.inl +++ b/Gems/ExpressionEvaluation/Code/Source/ElementInformationSerializer.inl @@ -28,7 +28,7 @@ namespace AZ private: using ElementInformation = ExpressionEvaluation::ElementInformation; - static const char* EmptyAnyIdentifier; + static constexpr AZStd::string_view EmptyAnyIdentifier = "Empty AZStd::any"; static bool IsEmptyAny(const rapidjson::Value& typeId) { @@ -161,8 +161,7 @@ namespace AZ else { rapidjson::Value emptyAny; - AZStd::string emptyAnyName(EmptyAnyIdentifier); - emptyAny.SetString(emptyAnyName.c_str(), aznumeric_caster(emptyAnyName.size()), context.GetJsonAllocator()); + emptyAny.SetString(EmptyAnyIdentifier.data(), aznumeric_caster(EmptyAnyIdentifier.size()), context.GetJsonAllocator()); outputValue.AddMember ( rapidjson::StringRef(JsonSerialization::TypeIdFieldIdentifier) , AZStd::move(emptyAny) @@ -176,6 +175,4 @@ namespace AZ }; AZ_CLASS_ALLOCATOR_IMPL(ElementInformationSerializer, SystemAllocator, 0); - - const char* ElementInformationSerializer::EmptyAnyIdentifier = "Empty AZStd::any"; } diff --git a/Gems/ScriptCanvas/Code/Editor/View/Windows/Tools/UpgradeTool/VersionExplorer.cpp b/Gems/ScriptCanvas/Code/Editor/View/Windows/Tools/UpgradeTool/VersionExplorer.cpp index b9aff660f2..828f55cd0f 100644 --- a/Gems/ScriptCanvas/Code/Editor/View/Windows/Tools/UpgradeTool/VersionExplorer.cpp +++ b/Gems/ScriptCanvas/Code/Editor/View/Windows/Tools/UpgradeTool/VersionExplorer.cpp @@ -76,6 +76,21 @@ namespace ScriptCanvasEditor } + void VersionExplorer::Log(const char* format, ...) + { + if (m_ui->verbose->isChecked()) + { + char sBuffer[1024]; + va_list ArgList; + va_start(ArgList, format); + azvsnprintf(sBuffer, sizeof(sBuffer), format, ArgList); + sBuffer[sizeof(sBuffer) - 1] = '\0'; + va_end(ArgList); + + AZ_TracePrintf("Script Canvas", "%s\n", sBuffer); + } + } + void VersionExplorer::OnClose() { reject(); @@ -96,17 +111,27 @@ namespace ScriptCanvasEditor { m_inProgress = true; AZ::Data::AssetInfo& assetToUpgrade = *m_inspectingAsset; - m_currentAsset = AZ::Data::AssetManager::Instance().GetAsset(assetToUpgrade.m_assetId, assetToUpgrade.m_assetType, AZ::Data::AssetLoadBehavior::PreLoad); + Log("SystemTick::ProcessState::Scan: %s pre-blocking load hint", m_currentAsset.GetHint().c_str()); m_currentAsset.BlockUntilLoadComplete(); if (m_currentAsset.IsReady()) { // The asset is ready, grab its info m_inProgress = true; - InspectAsset(m_currentAsset); + InspectAsset(m_currentAsset, assetToUpgrade); } + else + { + m_ui->tableWidget->insertRow(static_cast(m_inspectedAssets)); + QTableWidgetItem* rowName = new QTableWidgetItem + ( tr(AZStd::string::format("Error: %s", assetToUpgrade.m_relativePath.c_str()).c_str())); - m_ui->spinner->SetText(QObject::tr("%1").arg(m_currentAsset.GetHint().c_str())); + m_ui->tableWidget->setItem(static_cast(m_inspectedAssets), static_cast(ColumnAsset), rowName); + Log("SystemTick::ProcessState::Scan: %s post-blocking load, problem loading asset", assetToUpgrade.m_relativePath.c_str()); + ++m_currentAssetIndex; + ++m_failedAssets; + ScanComplete(m_currentAsset); + } } break; @@ -148,7 +173,6 @@ namespace ScriptCanvasEditor AZ::Data::AssetManager::Instance().DispatchEvents(); AZ::SystemTickBus::ExecuteQueuedEvents(); - } // Backup @@ -297,10 +321,7 @@ namespace ScriptCanvasEditor if (graphComponent) { - if (!graphComponent->UpgradeGraph(asset)) - { - // The upgrade was skipped due to nothing to update (though if we're here, we identified that something was out of date) - } + graphComponent->UpgradeGraph(asset); } return scriptCanvasEntity; @@ -588,6 +609,12 @@ namespace ScriptCanvasEditor IUpgradeRequests* upgradeRequests = AZ::Interface::Get(); m_assetsToInspect = upgradeRequests->GetAssetsToUpgrade(); +// for (auto& entry : m_assetsToInspect) +// { +// m_activeAssets.push_back(AZ::Data::AssetManager::Instance().GetAsset +// (entry.m_assetId, entry.m_assetType, AZ::Data::AssetLoadBehavior::PreLoad)); +// } + DoScan(); } @@ -596,9 +623,14 @@ namespace ScriptCanvasEditor AZ::SystemTickBus::Handler::BusConnect(); m_state = ProcessState::Scan; + AZ::Debug::TraceMessageBus::Handler::BusConnect(); if (!m_assetsToInspect.empty()) { + m_discoveredAssets = m_assetsToInspect.size(); + m_failedAssets = 0; + m_inspectedAssets = 0; + m_ui->progressFrame->setVisible(true); m_ui->progressBar->setRange(0, aznumeric_cast(m_assetsToInspect.size())); m_ui->progressBar->setValue(0); @@ -622,14 +654,17 @@ namespace ScriptCanvasEditor DoScan(); } - void VersionExplorer::InspectAsset(AZ::Data::Asset& asset) + void VersionExplorer::InspectAsset(AZ::Data::Asset& asset, AZ::Data::AssetInfo& assetInfo) { + Log("InspectAsset: %s", asset.GetHint().c_str()); + AZ::Entity* scriptCanvasEntity = nullptr; if (asset.GetType() == azrtti_typeid()) { ScriptCanvasAsset* scriptCanvasAsset = asset.GetAs(); if (!scriptCanvasAsset) { + Log("InspectAsset: %s, AsestData failed to return ScriptCanvasAsset", asset.GetHint().c_str()); return; } @@ -640,14 +675,14 @@ namespace ScriptCanvasEditor auto graphComponent = scriptCanvasEntity->FindComponent(); AZ_Assert(graphComponent, "The Script Canvas entity must have a Graph component"); - bool onlyShowOutdatedGraphs = m_ui->onlyShowOutdated->isChecked(); + bool forceUpgrade = m_ui->forceUpgrade->isChecked(); - if (onlyShowOutdatedGraphs && graphComponent->GetVersion().IsLatest()) + if (!forceUpgrade && onlyShowOutdatedGraphs && graphComponent->GetVersion().IsLatest()) { ++m_currentAssetIndex; ScanComplete(asset); - + Log("InspectAsset: %s, is at latest", asset.GetHint().c_str()); return; } @@ -655,7 +690,7 @@ namespace ScriptCanvasEditor QTableWidgetItem* rowName = new QTableWidgetItem(tr(asset.GetHint().c_str())); m_ui->tableWidget->setItem(static_cast(m_inspectedAssets), static_cast(ColumnAsset), rowName); - if (!graphComponent->GetVersion().IsLatest()) + if (forceUpgrade || !graphComponent->GetVersion().IsLatest()) { m_assetsToUpgrade.push_back(asset); @@ -665,18 +700,19 @@ namespace ScriptCanvasEditor QPushButton* rowGoToButton = new QPushButton(this); rowGoToButton->setText("Upgrade"); rowGoToButton->setEnabled(false); - connect(rowGoToButton, &QPushButton::clicked, [this, spinner, rowGoToButton, asset] { - AZ::SystemTickBus::QueueFunction([this, rowGoToButton, spinner, asset]() { + connect(rowGoToButton, &QPushButton::clicked, [this, spinner, rowGoToButton, assetInfo] { + + AZ::SystemTickBus::QueueFunction([this, rowGoToButton, spinner, assetInfo]() { // Queue the process state change because we can't connect to the SystemTick bus in a Qt lambda - UpgradeSingle(rowGoToButton, spinner, asset); + UpgradeSingle(rowGoToButton, spinner, assetInfo); }); AZ::SystemTickBus::ExecuteQueuedEvents(); }); - m_ui->tableWidget->setCellWidget(static_cast(m_inspectedAssets), static_cast(ColumnAction), rowGoToButton); + m_ui->tableWidget->setCellWidget(static_cast(m_inspectedAssets), static_cast(ColumnAction), rowGoToButton); m_ui->tableWidget->setCellWidget(static_cast(m_inspectedAssets), static_cast(ColumnStatus), spinner); } @@ -713,37 +749,47 @@ namespace ScriptCanvasEditor ScanComplete(asset); } - void VersionExplorer::UpgradeSingle(QPushButton* rowGoToButton, AzQtComponents::StyledBusyLabel* spinner, const AZ::Data::Asset& asset) + void VersionExplorer::UpgradeSingle + ( QPushButton* rowGoToButton + , AzQtComponents::StyledBusyLabel* spinner + , AZ::Data::AssetInfo assetInfo) { - AZ::Interface::Get()->SetIsUpgrading(true); + AZ::Data::Asset asset = AZ::Data::AssetManager::Instance().GetAsset + ( assetInfo.m_assetId, assetInfo.m_assetType, AZ::Data::AssetLoadBehavior::PreLoad); - m_isUpgradingSingleGraph = true; + if (asset) + { + asset.BlockUntilLoadComplete(); - m_logs.clear(); - m_ui->textEdit->clear(); - - spinner->SetIsBusy(true); - rowGoToButton->setEnabled(false); - - m_inProgressAsset = AZStd::find_if(m_assetsToUpgrade.begin(), m_assetsToUpgrade.end(), [this, asset](const UpgradeAssets::value_type& assetToUpgrade) + if (!asset.IsReady()) { - return assetToUpgrade.GetId() == asset.GetId(); - }); + AZ::Interface::Get()->SetIsUpgrading(true); + m_isUpgradingSingleGraph = true; + m_logs.clear(); + m_ui->textEdit->clear(); + spinner->SetIsBusy(true); + rowGoToButton->setEnabled(false); - m_state = ProcessState::Upgrade; - - AZ::SystemTickBus::Handler::BusConnect(); + m_inProgressAsset = AZStd::find_if(m_assetsToUpgrade.begin(), m_assetsToUpgrade.end() + , [this, asset](const UpgradeAssets::value_type& assetToUpgrade) + { + return assetToUpgrade.GetId() == asset.GetId(); + }); + m_state = ProcessState::Upgrade; + AZ::SystemTickBus::Handler::BusConnect(); + } + } } void VersionExplorer::ScanComplete(const AZ::Data::Asset& asset) { + Log("ScanComplete: %s", asset.GetHint().c_str()); m_inProgress = false; m_ui->progressBar->setValue(aznumeric_cast(m_currentAssetIndex)); m_ui->scanButton->setEnabled(true); - + m_inspectingAsset = m_assetsToInspect.erase(m_inspectingAsset); - FlushLogs(); if (m_inspectingAsset == m_assetsToInspect.end()) @@ -755,12 +801,12 @@ namespace ScriptCanvasEditor m_ui->upgradeAllButton->setEnabled(true); } } - - asset->Release(); } void VersionExplorer::FinalizeScan() { + Log("FinalizeScan()"); + m_ui->spinner->SetIsBusy(false); m_ui->onlyShowOutdated->setEnabled(true); @@ -774,12 +820,18 @@ namespace ScriptCanvasEditor } } - QString spinnerText = QStringLiteral("Scan Complete"); if (m_assetsToUpgrade.empty()) { spinnerText.append(" - No graphs require upgrade!"); } + else + { + spinnerText.append(QString::asprintf(" - Discovered: %zu, Inspected: %zu, Failed: %zu" + , m_discoveredAssets, m_inspectedAssets, m_failedAssets)); + } + + m_ui->spinner->SetText(spinnerText); m_ui->progressBar->setVisible(false); @@ -793,11 +845,9 @@ namespace ScriptCanvasEditor UpgradeNotifications::Bus::Handler::BusDisconnect(); m_keepEditorAlive.reset(); - + m_state = ProcessState::Inactive; } - // - void VersionExplorer::FlushLogs() { if (m_logs.empty()) diff --git a/Gems/ScriptCanvas/Code/Editor/View/Windows/Tools/UpgradeTool/VersionExplorer.h b/Gems/ScriptCanvas/Code/Editor/View/Windows/Tools/UpgradeTool/VersionExplorer.h index 73ce19e4e1..9ec578bf10 100644 --- a/Gems/ScriptCanvas/Code/Editor/View/Windows/Tools/UpgradeTool/VersionExplorer.h +++ b/Gems/ScriptCanvas/Code/Editor/View/Windows/Tools/UpgradeTool/VersionExplorer.h @@ -82,7 +82,7 @@ namespace ScriptCanvasEditor void DoScan(); void ScanComplete(const AZ::Data::Asset&); - void InspectAsset(AZ::Data::Asset& asset); + void InspectAsset(AZ::Data::Asset& asset, AZ::Data::AssetInfo& assetInfo); void OnUpgradeAll(); @@ -116,8 +116,10 @@ namespace ScriptCanvasEditor bool m_inProgress = false; size_t m_currentAssetIndex = 0; size_t m_inspectedAssets = 0; + size_t m_failedAssets = 0; + size_t m_discoveredAssets = 0; - AZStd::vector> m_activeAssets; + // AZStd::vector> m_activeAssets; IUpgradeRequests::AssetList m_assetsToInspect; IUpgradeRequests::AssetList::iterator m_inspectingAsset; @@ -139,7 +141,7 @@ namespace ScriptCanvasEditor bool m_isUpgradingSingleGraph = false; - void UpgradeSingle(QPushButton* item, AzQtComponents::StyledBusyLabel* spinner, const AZ::Data::Asset& asset); + void UpgradeSingle(QPushButton* item, AzQtComponents::StyledBusyLabel* spinner, AZ::Data::AssetInfo assetInfo); void FlushLogs(); diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Data/BehaviorContextObject.cpp b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Data/BehaviorContextObject.cpp index 7bcf0b2282..412eb3ee7c 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Data/BehaviorContextObject.cpp +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/Data/BehaviorContextObject.cpp @@ -98,7 +98,7 @@ namespace ScriptCanvas void BehaviorContextObject::Deserialize(BehaviorContextObject& target, const AZ::BehaviorClass& behaviorClass, AZStd::any& source) { - target.m_object = AZStd::move(AZStd::any(AZStd::any_cast(&source), GetAnyTypeInfoObject(behaviorClass))); + target.m_object = AZStd::any(AZStd::any_cast(&source), GetAnyTypeInfoObject(behaviorClass)); target.m_flags = Owned; } From be9ad98b24c575e9738b0844a51f82224310815e Mon Sep 17 00:00:00 2001 From: chcurran <82187351+carlitosan@users.noreply.github.com> Date: Tue, 24 Aug 2021 17:46:25 -0700 Subject: [PATCH 086/131] remove commented out debugging artifacts Signed-off-by: chcurran <82187351+carlitosan@users.noreply.github.com> --- .../View/Windows/Tools/UpgradeTool/VersionExplorer.cpp | 9 --------- .../View/Windows/Tools/UpgradeTool/VersionExplorer.h | 2 -- 2 files changed, 11 deletions(-) diff --git a/Gems/ScriptCanvas/Code/Editor/View/Windows/Tools/UpgradeTool/VersionExplorer.cpp b/Gems/ScriptCanvas/Code/Editor/View/Windows/Tools/UpgradeTool/VersionExplorer.cpp index 828f55cd0f..efa7aded40 100644 --- a/Gems/ScriptCanvas/Code/Editor/View/Windows/Tools/UpgradeTool/VersionExplorer.cpp +++ b/Gems/ScriptCanvas/Code/Editor/View/Windows/Tools/UpgradeTool/VersionExplorer.cpp @@ -602,19 +602,10 @@ namespace ScriptCanvasEditor { m_assetsToUpgrade.clear(); m_assetsToInspect.clear(); - m_ui->tableWidget->setRowCount(0); m_inspectedAssets = 0; - IUpgradeRequests* upgradeRequests = AZ::Interface::Get(); m_assetsToInspect = upgradeRequests->GetAssetsToUpgrade(); - -// for (auto& entry : m_assetsToInspect) -// { -// m_activeAssets.push_back(AZ::Data::AssetManager::Instance().GetAsset -// (entry.m_assetId, entry.m_assetType, AZ::Data::AssetLoadBehavior::PreLoad)); -// } - DoScan(); } diff --git a/Gems/ScriptCanvas/Code/Editor/View/Windows/Tools/UpgradeTool/VersionExplorer.h b/Gems/ScriptCanvas/Code/Editor/View/Windows/Tools/UpgradeTool/VersionExplorer.h index 9ec578bf10..266a42e2e6 100644 --- a/Gems/ScriptCanvas/Code/Editor/View/Windows/Tools/UpgradeTool/VersionExplorer.h +++ b/Gems/ScriptCanvas/Code/Editor/View/Windows/Tools/UpgradeTool/VersionExplorer.h @@ -119,8 +119,6 @@ namespace ScriptCanvasEditor size_t m_failedAssets = 0; size_t m_discoveredAssets = 0; - // AZStd::vector> m_activeAssets; - IUpgradeRequests::AssetList m_assetsToInspect; IUpgradeRequests::AssetList::iterator m_inspectingAsset; using UpgradeAssets = AZStd::vector>; From c3e83387db98c87be98afb6a0a515120a1aa46cf Mon Sep 17 00:00:00 2001 From: Jeremy Ong Date: Tue, 24 Aug 2021 19:33:34 -0600 Subject: [PATCH 087/131] Address additional PR feedback Signed-off-by: Jeremy Ong --- Code/Framework/AzCore/AzCore/Debug/Budget.h | 2 +- Code/Framework/AzCore/AzCore/Debug/BudgetTracker.cpp | 8 ++------ Code/Framework/AzCore/AzCore/Debug/BudgetTracker.h | 4 +++- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Code/Framework/AzCore/AzCore/Debug/Budget.h b/Code/Framework/AzCore/AzCore/Debug/Budget.h index d051ba860b..4646ef8b2c 100644 --- a/Code/Framework/AzCore/AzCore/Debug/Budget.h +++ b/Code/Framework/AzCore/AzCore/Debug/Budget.h @@ -73,7 +73,7 @@ namespace AZ::Debug // If using a budget defined in a different C++ source file, add AZ_DECLARE_BUDGET(yourBudget); somewhere in your source file at namespace // scope Alternatively, AZ_DECLARE_BUDGET can be used in a header to declare the budget for use across any users of the header -#define AZ_DECLARE_BUDGET(name) extern ::AZ::Debug::Budget* AZ_BUDGET_GETTER(name)() +#define AZ_DECLARE_BUDGET(name) ::AZ::Debug::Budget* AZ_BUDGET_GETTER(name)() // Declare budgets that are core engine budgets, or may be shared/needed across multiple external gems // You should NOT need to declare user-space or budgets with isolated usage here. Prefer declaring them local to the module(s) that use diff --git a/Code/Framework/AzCore/AzCore/Debug/BudgetTracker.cpp b/Code/Framework/AzCore/AzCore/Debug/BudgetTracker.cpp index 959f8ba3a8..255a740e32 100644 --- a/Code/Framework/AzCore/AzCore/Debug/BudgetTracker.cpp +++ b/Code/Framework/AzCore/AzCore/Debug/BudgetTracker.cpp @@ -19,7 +19,7 @@ namespace AZ::Debug { constexpr static const char* BudgetTrackerEnvName = "budgetTrackerEnv"; - struct BudgetTrackerImpl + struct BudgetTracker::BudgetTrackerImpl { AZStd::unordered_map m_budgets; }; @@ -65,11 +65,7 @@ namespace AZ::Debug { AZStd::scoped_lock lock{ m_mutex }; - auto it = m_impl->m_budgets.find(budgetName); - if (it == m_impl->m_budgets.end()) - { - it = m_impl->m_budgets.try_emplace(budgetName, budgetName, crc).first; - } + auto it = m_impl->m_budgets.try_emplace(budgetName, budgetName, crc).first; return it->second; } diff --git a/Code/Framework/AzCore/AzCore/Debug/BudgetTracker.h b/Code/Framework/AzCore/AzCore/Debug/BudgetTracker.h index d89d55b913..1357bb5870 100644 --- a/Code/Framework/AzCore/AzCore/Debug/BudgetTracker.h +++ b/Code/Framework/AzCore/AzCore/Debug/BudgetTracker.h @@ -31,11 +31,13 @@ namespace AZ::Debug Budget& GetBudget(const char* budgetName, uint32_t crc); private: + struct BudgetTrackerImpl; + AZStd::mutex m_mutex; // The BudgetTracker is likely included in proportionally high number of files throughout the // engine, so indirection is used here to avoid imposing excessive recompilation in periods // while the budget system is iterated on. - struct BudgetTrackerImpl* m_impl = nullptr; + BudgetTrackerImpl* m_impl = nullptr; }; } // namespace AZ::Debug From 7fbfda037175fef7d63ed692f3636b26906b861e Mon Sep 17 00:00:00 2001 From: hultonha <82228511+hultonha@users.noreply.github.com> Date: Wed, 25 Aug 2021 09:28:41 +0100 Subject: [PATCH 088/131] Fix mouse capture behavior for Editor Viewport (#3417) * first pass of fixes for cursor capture and context menu Signed-off-by: hultonha * restore previous behavior of HandleMouseMoveEvent Signed-off-by: hultonha * tidy-up from previous cursor/input changes Signed-off-by: hultonha * add missing casts Signed-off-by: hultonha * small updates to support tests Signed-off-by: hultonha * additional tests and some tidy-up Signed-off-by: hultonha * small updates before publishing PR (comment/naming updates) Signed-off-by: hultonha * add missing parameter to MouseInteractionEvent constructor Signed-off-by: hultonha --- Code/Editor/EditorViewportSettings.cpp | 13 ++- Code/Editor/EditorViewportSettings.h | 3 + Code/Editor/EditorViewportWidget.cpp | 25 +++-- .../test_ModularViewportCameraController.cpp | 102 +++++++++++++++++- Code/Editor/ViewportManipulatorController.cpp | 20 ++-- Code/Framework/AzCore/AzCore/std/math.h | 2 + .../AzFramework/Viewport/CameraInput.cpp | 18 +++- .../AzFramework/Viewport/CameraInput.h | 1 + .../AzFramework/Viewport/CursorState.h | 19 +++- .../AzManipulatorTestFrameworkUtils.cpp | 2 +- .../Input/QtEventToAzInputManager.cpp | 57 ++++++---- .../Input/QtEventToAzInputManager.h | 9 +- .../UnitTest/AzToolsFrameworkTestHelpers.cpp | 2 +- .../Viewport/EditorContextMenu.cpp | 3 +- .../AzToolsFramework/Viewport/ViewportTypes.h | 4 +- 15 files changed, 231 insertions(+), 49 deletions(-) diff --git a/Code/Editor/EditorViewportSettings.cpp b/Code/Editor/EditorViewportSettings.cpp index 6e0ed86d2a..38831a1de4 100644 --- a/Code/Editor/EditorViewportSettings.cpp +++ b/Code/Editor/EditorViewportSettings.cpp @@ -33,6 +33,7 @@ namespace SandboxEditor constexpr AZStd::string_view CameraTranslateSmoothnessSetting = "/Amazon/Preferences/Editor/Camera/TranslateSmoothness"; constexpr AZStd::string_view CameraTranslateSmoothingSetting = "/Amazon/Preferences/Editor/Camera/TranslateSmoothing"; constexpr AZStd::string_view CameraRotateSmoothingSetting = "/Amazon/Preferences/Editor/Camera/RotateSmoothing"; + constexpr AZStd::string_view CameraCaptureCursorLookSetting = "/Amazon/Preferences/Editor/Camera/CaptureCursorLook"; constexpr AZStd::string_view CameraTranslateForwardIdSetting = "/Amazon/Preferences/Editor/Camera/CameraTranslateForwardId"; constexpr AZStd::string_view CameraTranslateBackwardIdSetting = "/Amazon/Preferences/Editor/Camera/CameraTranslateBackwardId"; constexpr AZStd::string_view CameraTranslateLeftIdSetting = "/Amazon/Preferences/Editor/Camera/CameraTranslateLeftId"; @@ -60,7 +61,7 @@ namespace SandboxEditor AZStd::remove_cvref_t GetRegistry(const AZStd::string_view setting, T&& defaultValue) { AZStd::remove_cvref_t value = AZStd::forward(defaultValue); - if (auto* registry = AZ::SettingsRegistry::Get()) + if (const auto* registry = AZ::SettingsRegistry::Get()) { registry->Get(value, setting); } @@ -281,6 +282,16 @@ namespace SandboxEditor SetRegistry(CameraTranslateSmoothingSetting, enabled); } + bool CameraCaptureCursorForLook() + { + return GetRegistry(CameraCaptureCursorLookSetting, true); + } + + void SetCameraCaptureCursorForLook(const bool capture) + { + SetRegistry(CameraCaptureCursorLookSetting, capture); + } + AzFramework::InputChannelId CameraTranslateForwardChannelId() { return AzFramework::InputChannelId( diff --git a/Code/Editor/EditorViewportSettings.h b/Code/Editor/EditorViewportSettings.h index 1aca51395f..83004d52af 100644 --- a/Code/Editor/EditorViewportSettings.h +++ b/Code/Editor/EditorViewportSettings.h @@ -86,6 +86,9 @@ namespace SandboxEditor SANDBOX_API bool CameraTranslateSmoothingEnabled(); SANDBOX_API void SetCameraTranslateSmoothingEnabled(bool enabled); + SANDBOX_API bool CameraCaptureCursorForLook(); + SANDBOX_API void SetCameraCaptureCursorForLook(bool capture); + SANDBOX_API AzFramework::InputChannelId CameraTranslateForwardChannelId(); SANDBOX_API void SetCameraTranslateForwardChannelId(AZStd::string_view cameraTranslateForwardId); diff --git a/Code/Editor/EditorViewportWidget.cpp b/Code/Editor/EditorViewportWidget.cpp index ec965cc51f..779c0093a0 100644 --- a/Code/Editor/EditorViewportWidget.cpp +++ b/Code/Editor/EditorViewportWidget.cpp @@ -104,7 +104,6 @@ AZ_CVAR( bool, ed_visibility_logTiming, false, nullptr, AZ::ConsoleFunctorFlags::Null, "Output the timing of the new IVisibilitySystem query"); -AZ_CVAR(bool, ed_showCursorCameraLook, true, nullptr, AZ::ConsoleFunctorFlags::Null, "Show the cursor when using free look with the new camera system"); EditorViewportWidget* EditorViewportWidget::m_pPrimaryViewport = nullptr; @@ -1079,13 +1078,19 @@ AZStd::shared_ptr CreateMod { const auto hideCursor = [viewportId] { - AzToolsFramework::ViewportInteraction::ViewportMouseCursorRequestBus::Event( - viewportId, &AzToolsFramework::ViewportInteraction::ViewportMouseCursorRequestBus::Events::BeginCursorCapture); + if (SandboxEditor::CameraCaptureCursorForLook()) + { + AzToolsFramework::ViewportInteraction::ViewportMouseCursorRequestBus::Event( + viewportId, &AzToolsFramework::ViewportInteraction::ViewportMouseCursorRequestBus::Events::BeginCursorCapture); + } }; const auto showCursor = [viewportId] { - AzToolsFramework::ViewportInteraction::ViewportMouseCursorRequestBus::Event( - viewportId, &AzToolsFramework::ViewportInteraction::ViewportMouseCursorRequestBus::Events::EndCursorCapture); + if (SandboxEditor::CameraCaptureCursorForLook()) + { + AzToolsFramework::ViewportInteraction::ViewportMouseCursorRequestBus::Event( + viewportId, &AzToolsFramework::ViewportInteraction::ViewportMouseCursorRequestBus::Events::EndCursorCapture); + } }; auto firstPersonRotateCamera = AZStd::make_shared(SandboxEditor::CameraFreeLookChannelId()); @@ -1094,12 +1099,10 @@ AZStd::shared_ptr CreateMod return SandboxEditor::CameraRotateSpeed(); }; - if (!ed_showCursorCameraLook) - { - // default behavior is to hide the cursor but this can be disabled (useful for remote desktop) - firstPersonRotateCamera->SetActivationBeganFn(hideCursor); - firstPersonRotateCamera->SetActivationEndedFn(showCursor); - } + // default behavior is to hide the cursor but this can be disabled (useful for remote desktop) + // note: See CaptureCursorLook in the Settings Registry + firstPersonRotateCamera->SetActivationBeganFn(hideCursor); + firstPersonRotateCamera->SetActivationEndedFn(showCursor); auto firstPersonPanCamera = AZStd::make_shared(SandboxEditor::CameraFreePanChannelId(), AzFramework::LookPan); diff --git a/Code/Editor/Lib/Tests/test_ModularViewportCameraController.cpp b/Code/Editor/Lib/Tests/test_ModularViewportCameraController.cpp index 28bc6fe3b3..7309110c4d 100644 --- a/Code/Editor/Lib/Tests/test_ModularViewportCameraController.cpp +++ b/Code/Editor/Lib/Tests/test_ModularViewportCameraController.cpp @@ -7,6 +7,7 @@ */ #include +#include #include #include #include @@ -95,10 +96,16 @@ namespace UnitTest m_controllerList->RegisterViewportContext(TestViewportId); m_inputChannelMapper = AZStd::make_unique(m_rootWidget.get(), TestViewportId); + + m_settingsRegistry = AZStd::make_unique(); + AZ::SettingsRegistry::Register(m_settingsRegistry.get()); } void TearDown() override { + AZ::SettingsRegistry::Unregister(m_settingsRegistry.get()); + m_settingsRegistry.reset(); + m_inputChannelMapper.reset(); m_controllerList->UnregisterViewportContext(TestViewportId); @@ -170,7 +177,7 @@ namespace UnitTest void RepeatDiagonalMouseMovements(const AZStd::function& deltaTimeFn) { // move to the center of the screen - auto start = QPoint(WidgetSize.width() / 2, WidgetSize.height() / 2); + const auto start = QPoint(WidgetSize.width() / 2, WidgetSize.height() / 2); MouseMove(m_rootWidget.get(), start, QPoint(0, 0)); m_controllerList->UpdateViewport({ TestViewportId, AzFramework::FloatSeconds(deltaTimeFn()), AZ::ScriptTimePoint() }); @@ -204,12 +211,15 @@ namespace UnitTest ::testing::NiceMock m_mockWindowRequests; ViewportMouseCursorRequestImpl m_viewportMouseCursorRequests; AtomToolsFramework::ModularCameraViewportContext* m_cameraViewportContextView = nullptr; + AZStd::unique_ptr m_settingsRegistry; }; const AzFramework::ViewportId ModularViewportCameraControllerFixture::TestViewportId = AzFramework::ViewportId(0); TEST_F(ModularViewportCameraControllerFixture, MouseMovementDoesNotAccumulateExcessiveDriftInModularViewportCameraWithVaryingDeltaTime) { + SandboxEditor::SetCameraCaptureCursorForLook(false); + // Given PrepareCollaborators(); @@ -242,6 +252,8 @@ namespace UnitTest ModularViewportCameraControllerDeltaTimeParamFixture, MouseMovementDoesNotAccumulateExcessiveDriftInModularViewportCameraWithFixedDeltaTime) { + SandboxEditor::SetCameraCaptureCursorForLook(false); + // Given PrepareCollaborators(); @@ -263,4 +275,92 @@ namespace UnitTest INSTANTIATE_TEST_CASE_P( All, ModularViewportCameraControllerDeltaTimeParamFixture, testing::Values(1.0f / 60.0f, 1.0f / 50.0f, 1.0f / 30.0f)); + + TEST_F(ModularViewportCameraControllerFixture, MouseMovementOrientatesCameraWhenCursorIsCaptured) + { + // Given + PrepareCollaborators(); + // ensure cursor is captured + SandboxEditor::SetCameraCaptureCursorForLook(true); + + const float deltaTime = 1.0f / 60.0f; + + // When + // move to the center of the screen + auto start = QPoint(WidgetSize.width() / 2, WidgetSize.height() / 2); + MouseMove(m_rootWidget.get(), start, QPoint(0, 0)); + m_controllerList->UpdateViewport({ TestViewportId, AzFramework::FloatSeconds(deltaTime), AZ::ScriptTimePoint() }); + + const auto mouseDelta = QPoint(5, 0); + + // initial movement to begin the camera behavior + MousePressAndMove(m_rootWidget.get(), start, mouseDelta, Qt::MouseButton::RightButton); + m_controllerList->UpdateViewport({ TestViewportId, AzFramework::FloatSeconds(deltaTime), AZ::ScriptTimePoint() }); + + // move the cursor right + for (int i = 0; i < 50; ++i) + { + MousePressAndMove(m_rootWidget.get(), start + mouseDelta, mouseDelta, Qt::MouseButton::RightButton); + m_controllerList->UpdateViewport({ TestViewportId, AzFramework::FloatSeconds(deltaTime), AZ::ScriptTimePoint() }); + } + + // move the cursor left (do an extra iteration moving left to account for the initial dead-zone) + for (int i = 0; i < 51; ++i) + { + MousePressAndMove(m_rootWidget.get(), start + mouseDelta, -mouseDelta, Qt::MouseButton::RightButton); + m_controllerList->UpdateViewport({ TestViewportId, AzFramework::FloatSeconds(deltaTime), AZ::ScriptTimePoint() }); + } + + QTest::mouseRelease(m_rootWidget.get(), Qt::MouseButton::RightButton, Qt::KeyboardModifier::NoModifier, start + mouseDelta); + m_controllerList->UpdateViewport({ TestViewportId, AzFramework::FloatSeconds(deltaTime), AZ::ScriptTimePoint() }); + + // Then + // retrieve the amount of yaw rotation + const AZ::Quaternion cameraRotation = m_cameraViewportContextView->GetCameraTransform().GetRotation(); + const auto eulerAngles = AzFramework::EulerAngles(AZ::Matrix3x3::CreateFromQuaternion(cameraRotation)); + + // camera should be back at the center (no yaw) + using ::testing::FloatNear; + EXPECT_THAT(eulerAngles.GetZ(), FloatNear(0.0f, 0.001f)); + + // Clean-up + HaltCollaborators(); + } + + TEST_F(ModularViewportCameraControllerFixture, CameraDoesNotContinueToRotateGivenNoInputWhenCaptured) + { + // Given + PrepareCollaborators(); + SandboxEditor::SetCameraCaptureCursorForLook(true); + + const float deltaTime = 1.0f / 60.0f; + + // When + // move to the center of the screen + auto start = QPoint(WidgetSize.width() / 2, WidgetSize.height() / 2); + MouseMove(m_rootWidget.get(), start, QPoint(0, 0)); + m_controllerList->UpdateViewport({ TestViewportId, AzFramework::FloatSeconds(deltaTime), AZ::ScriptTimePoint() }); + + // will move a small amount initially + const auto mouseDelta = QPoint(5, 0); + MousePressAndMove(m_rootWidget.get(), start, mouseDelta, Qt::MouseButton::RightButton); + + // ensure further updates to not continue to rotate + for (int i = 0; i < 50; ++i) + { + m_controllerList->UpdateViewport({ TestViewportId, AzFramework::FloatSeconds(deltaTime), AZ::ScriptTimePoint() }); + } + + // Then + // ensure the camera rotation is no longer the identity + const AZ::Quaternion cameraRotation = m_cameraViewportContextView->GetCameraTransform().GetRotation(); + const auto eulerAngles = AzFramework::EulerAngles(AZ::Matrix3x3::CreateFromQuaternion(cameraRotation)); + + // initial amount of rotation after first mouse move + using ::testing::FloatNear; + EXPECT_THAT(eulerAngles.GetZ(), FloatNear(-0.025f, 0.001f)); + + // Clean-up + HaltCollaborators(); + } } // namespace UnitTest diff --git a/Code/Editor/ViewportManipulatorController.cpp b/Code/Editor/ViewportManipulatorController.cpp index a67d733cf9..1766945541 100644 --- a/Code/Editor/ViewportManipulatorController.cpp +++ b/Code/Editor/ViewportManipulatorController.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -112,9 +113,9 @@ namespace SandboxEditor AzFramework::WindowRequestBus::EventResult( windowSize, event.m_windowHandle, &AzFramework::WindowRequestBus::Events::GetClientAreaSize); - auto screenPoint = AzFramework::ScreenPoint( - static_cast(position->m_normalizedPosition.GetX() * windowSize.m_width), - static_cast(position->m_normalizedPosition.GetY() * windowSize.m_height)); + const auto screenPoint = AzFramework::ScreenPoint( + aznumeric_cast(position->m_normalizedPosition.GetX() * windowSize.m_width), + aznumeric_cast(position->m_normalizedPosition.GetY() * windowSize.m_height)); m_mouseInteraction.m_mousePick.m_screenCoordinates = screenPoint; AZStd::optional ray; @@ -207,20 +208,27 @@ namespace SandboxEditor ? &InteractionBus::Events::InternalHandleMouseManipulatorInteraction : &InteractionBus::Events::InternalHandleMouseViewportInteraction; - const auto mouseInteractionEvent = [mouseInteraction, event = eventType.value(), wheelDelta] { + auto currentCursorState = AzFramework::SystemCursorState::Unknown; + AzFramework::InputSystemCursorRequestBus::EventResult( + currentCursorState, event.m_inputChannel.GetInputDevice().GetInputDeviceId(), + &AzFramework::InputSystemCursorRequestBus::Events::GetSystemCursorState); + + const auto mouseInteractionEvent = [mouseInteraction, event = eventType.value(), wheelDelta, + cursorCaptured = currentCursorState == AzFramework::SystemCursorState::ConstrainedAndHidden] + { switch (event) { case MouseEvent::Up: case MouseEvent::Down: case MouseEvent::Move: case MouseEvent::DoubleClick: - return MouseInteractionEvent(AZStd::move(mouseInteraction), event); + return MouseInteractionEvent(AZStd::move(mouseInteraction), event, cursorCaptured); case MouseEvent::Wheel: return MouseInteractionEvent(AZStd::move(mouseInteraction), wheelDelta); } AZ_Assert(false, "Unhandled MouseEvent"); - return MouseInteractionEvent(MouseInteraction{}, MouseEvent::Up); + return MouseInteractionEvent(MouseInteraction{}, MouseEvent::Up, false); }(); InteractionBus::EventResult( diff --git a/Code/Framework/AzCore/AzCore/std/math.h b/Code/Framework/AzCore/AzCore/std/math.h index 74685cb84e..03f12e6e08 100644 --- a/Code/Framework/AzCore/AzCore/std/math.h +++ b/Code/Framework/AzCore/AzCore/std/math.h @@ -22,6 +22,8 @@ namespace AZStd using std::exp2; using std::floor; using std::fmod; + using std::llround; + using std::lround; using std::pow; using std::round; using std::sin; diff --git a/Code/Framework/AzFramework/AzFramework/Viewport/CameraInput.cpp b/Code/Framework/AzFramework/AzFramework/Viewport/CameraInput.cpp index 72984f8111..fac1e45920 100644 --- a/Code/Framework/AzFramework/AzFramework/Viewport/CameraInput.cpp +++ b/Code/Framework/AzFramework/AzFramework/Viewport/CameraInput.cpp @@ -144,6 +144,7 @@ namespace AzFramework if (const auto& cursor = AZStd::get_if(&event)) { m_cursorState.SetCurrentPosition(cursor->m_position); + m_cursorState.SetCaptured(cursor->m_captured); } else if (const auto& horizontalMotion = AZStd::get_if(&event)) { @@ -790,17 +791,24 @@ namespace AzFramework const auto* position = inputChannel.GetCustomData(); AZ_Assert(position, "Expected PositionData2D but found nullptr"); - return CursorEvent{ ScreenPoint( - static_cast(position->m_normalizedPosition.GetX() * windowSize.m_width), - static_cast(position->m_normalizedPosition.GetY() * windowSize.m_height)) }; + auto currentCursorState = AzFramework::SystemCursorState::Unknown; + AzFramework::InputSystemCursorRequestBus::EventResult( + currentCursorState, inputDeviceId, &AzFramework::InputSystemCursorRequestBus::Events::GetSystemCursorState); + + const auto x = position->m_normalizedPosition.GetX() * aznumeric_cast(windowSize.m_width); + const auto y = position->m_normalizedPosition.GetY() * aznumeric_cast(windowSize.m_height); + return CursorEvent{ ScreenPoint(aznumeric_cast(AZStd::lround(x)), aznumeric_cast(AZStd::lround(y))), + currentCursorState == AzFramework::SystemCursorState::ConstrainedAndHidden }; } else if (inputChannelId == InputDeviceMouse::Movement::X) { - return HorizontalMotionEvent{ aznumeric_cast(inputChannel.GetValue()) }; + const auto x = inputChannel.GetValue(); + return HorizontalMotionEvent{ aznumeric_cast(AZStd::lround(x)) }; } else if (inputChannelId == InputDeviceMouse::Movement::Y) { - return VerticalMotionEvent{ aznumeric_cast(inputChannel.GetValue()) }; + const auto y = inputChannel.GetValue(); + return VerticalMotionEvent{ aznumeric_cast(AZStd::lround(y)) }; } else if (inputChannelId == InputDeviceMouse::Movement::Z) { diff --git a/Code/Framework/AzFramework/AzFramework/Viewport/CameraInput.h b/Code/Framework/AzFramework/AzFramework/Viewport/CameraInput.h index 0b7bbbc30d..ec383fa8ef 100644 --- a/Code/Framework/AzFramework/AzFramework/Viewport/CameraInput.h +++ b/Code/Framework/AzFramework/AzFramework/Viewport/CameraInput.h @@ -88,6 +88,7 @@ namespace AzFramework struct CursorEvent { ScreenPoint m_position; + bool m_captured = false; }; struct ScrollEvent diff --git a/Code/Framework/AzFramework/AzFramework/Viewport/CursorState.h b/Code/Framework/AzFramework/AzFramework/Viewport/CursorState.h index 704383d615..f6474a242e 100644 --- a/Code/Framework/AzFramework/AzFramework/Viewport/CursorState.h +++ b/Code/Framework/AzFramework/AzFramework/Viewport/CursorState.h @@ -21,6 +21,8 @@ namespace AzFramework [[nodiscard]] ScreenVector CursorDelta() const; //! Call this in a 'handle event' call to update the most recent cursor position. void SetCurrentPosition(const ScreenPoint& currentPosition); + //! Set whether the cursor is currently being constrained (and hidden). + void SetCaptured(bool captured); //! Call this in an 'update' call to copy the current cursor position to the last //! cursor position. void Update(); @@ -28,8 +30,14 @@ namespace AzFramework private: AZStd::optional m_lastCursorPosition; AZStd::optional m_currentCursorPosition; + bool m_captured = false; }; + inline void CursorState::SetCaptured(const bool captured) + { + m_captured = captured; + } + inline void CursorState::SetCurrentPosition(const ScreenPoint& currentPosition) { m_currentCursorPosition = currentPosition; @@ -44,9 +52,16 @@ namespace AzFramework inline void CursorState::Update() { - if (m_currentCursorPosition.has_value()) + if (!m_captured) { - m_lastCursorPosition = m_currentCursorPosition; + if (m_currentCursorPosition.has_value()) + { + m_lastCursorPosition = m_currentCursorPosition; + } + } + else + { + m_currentCursorPosition = m_lastCursorPosition; } } } // namespace AzFramework diff --git a/Code/Framework/AzManipulatorTestFramework/Source/AzManipulatorTestFrameworkUtils.cpp b/Code/Framework/AzManipulatorTestFramework/Source/AzManipulatorTestFrameworkUtils.cpp index 25aed336de..1b68a3d0cd 100644 --- a/Code/Framework/AzManipulatorTestFramework/Source/AzManipulatorTestFrameworkUtils.cpp +++ b/Code/Framework/AzManipulatorTestFramework/Source/AzManipulatorTestFrameworkUtils.cpp @@ -122,7 +122,7 @@ namespace AzManipulatorTestFramework MouseInteractionEvent CreateMouseInteractionEvent(const MouseInteraction& mouseInteraction, MouseEvent event) { - return MouseInteractionEvent(mouseInteraction, event); + return MouseInteractionEvent(mouseInteraction, event, /*captured=*/false); } void DispatchMouseInteractionEvent(const MouseInteractionEvent& event) diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Input/QtEventToAzInputManager.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Input/QtEventToAzInputManager.cpp index d39ade5527..5fcf7e11d3 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Input/QtEventToAzInputManager.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Input/QtEventToAzInputManager.cpp @@ -158,6 +158,16 @@ namespace AzToolsFramework SetImplementation(nullptr); } + void QtEventToAzInputMapper::EditorQtMouseDevice::SetSystemCursorState(const AzFramework::SystemCursorState systemCursorState) + { + m_systemCursorState = systemCursorState; + } + + AzFramework::SystemCursorState QtEventToAzInputMapper::EditorQtMouseDevice::GetSystemCursorState() const + { + return m_systemCursorState; + } + QtEventToAzInputMapper::QtEventToAzInputMapper(QWidget* sourceWidget, int syntheticDeviceId) : QObject(sourceWidget) , m_sourceWidget(sourceWidget) @@ -210,12 +220,15 @@ namespace AzToolsFramework if (m_capturingCursor != enabled) { m_capturingCursor = enabled; + if (m_capturingCursor) { + m_mouseDevice->SetSystemCursorState(AzFramework::SystemCursorState::ConstrainedAndHidden); qApp->setOverrideCursor(Qt::BlankCursor); } else { + m_mouseDevice->SetSystemCursorState(AzFramework::SystemCursorState::UnconstrainedAndVisible); qApp->restoreOverrideCursor(); } } @@ -238,10 +251,22 @@ namespace AzToolsFramework return false; } - // If our focus changes, go ahead and reset all input devices. if (eventType == QEvent::FocusIn || eventType == QEvent::FocusOut) { + // If our focus changes, go ahead and reset all input devices. HandleFocusChange(event); + + // If we focus in on the source widget and the mouse is contained in its + // bounds, refresh the cached cursor position to ensure it is up to date (this + // ensures cursor positions are refreshed correctly with context menu focus changes) + if (eventType == QEvent::FocusIn) + { + const auto widgetCursorPosition = m_sourceWidget->mapFromGlobal(QCursor::pos()); + if (m_sourceWidget->geometry().contains(widgetCursorPosition)) + { + HandleMouseMoveEvent(widgetCursorPosition); + } + } } // Map key events to input channels. // ShortcutOverride is used in lieu of KeyPress for high priority input channels like Alt @@ -249,7 +274,7 @@ namespace AzToolsFramework else if ( eventType == QEvent::Type::KeyPress || eventType == QEvent::Type::KeyRelease || eventType == QEvent::Type::ShortcutOverride) { - QKeyEvent* keyEvent = static_cast(event); + auto keyEvent = static_cast(event); HandleKeyEvent(keyEvent); } // Map mouse events to input channels. @@ -257,20 +282,20 @@ namespace AzToolsFramework eventType == QEvent::Type::MouseButtonPress || eventType == QEvent::Type::MouseButtonRelease || eventType == QEvent::Type::MouseButtonDblClick) { - QMouseEvent* mouseEvent = static_cast(event); + auto mouseEvent = static_cast(event); HandleMouseButtonEvent(mouseEvent); } // Map mouse movement to the movement input channels. // This includes SystemCursorPosition alongside Movement::X and Movement::Y. else if (eventType == QEvent::Type::MouseMove) { - QMouseEvent* mouseEvent = static_cast(event); - HandleMouseMoveEvent(mouseEvent); + auto mouseEvent = static_cast(event); + HandleMouseMoveEvent(mouseEvent->pos()); } // Map wheel events to the mouse Z movement channel. else if (eventType == QEvent::Type::Wheel) { - QWheelEvent* wheelEvent = static_cast(event); + auto wheelEvent = static_cast(event); HandleWheelEvent(wheelEvent); } @@ -345,9 +370,8 @@ namespace AzToolsFramework return QPoint{ denormalizedX, denormalizedY }; } - void QtEventToAzInputMapper::HandleMouseMoveEvent(QMouseEvent* mouseEvent) + void QtEventToAzInputMapper::HandleMouseMoveEvent(const QPoint& cursorPosition) { - const QPoint cursorPosition = mouseEvent->pos(); const QPoint cursorDelta = cursorPosition - m_previousCursorPosition; m_mouseDevice->m_cursorPositionData2D->m_normalizedPosition = WidgetPositionToNormalizedPosition(cursorPosition); @@ -357,17 +381,14 @@ namespace AzToolsFramework if (m_capturingCursor) { - // Reset our cursor position to the previous point. - const QPoint targetScreenPosition = m_sourceWidget->mapToGlobal(m_previousCursorPosition); - AzQtComponents::SetCursorPos(targetScreenPosition); - - // Even though we just set the cursor position, there are edge cases such as remote desktop that will leave - // the cursor position unchanged. For safety, we re-cache our last cursor position for delta generation. - const QPoint actualWidgetPosition = m_sourceWidget->mapFromGlobal(QCursor::pos()); - m_mouseDevice->m_cursorPositionData2D->m_normalizedPosition = WidgetPositionToNormalizedPosition(actualWidgetPosition); + // Reset our cursor position to the previous point + const QPoint screenCursorPosition = m_sourceWidget->mapToGlobal(m_previousCursorPosition); + AzQtComponents::SetCursorPos(screenCursorPosition); + } + else + { + m_previousCursorPosition = cursorPosition; } - - m_previousCursorPosition = cursorPosition; } void QtEventToAzInputMapper::HandleKeyEvent(QKeyEvent* keyEvent) diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Input/QtEventToAzInputManager.h b/Code/Framework/AzToolsFramework/AzToolsFramework/Input/QtEventToAzInputManager.h index 6e73bf4f9c..aaf3fb6295 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Input/QtEventToAzInputManager.h +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Input/QtEventToAzInputManager.h @@ -105,7 +105,14 @@ namespace AzToolsFramework public: EditorQtMouseDevice(AzFramework::InputDeviceId id); + // AzFramework::InputDeviceMouse overrides ... + void SetSystemCursorState(AzFramework::SystemCursorState systemCursorState) override; + AzFramework::SystemCursorState GetSystemCursorState() const override; + friend class QtEventToAzInputMapper; + + private: + AzFramework::SystemCursorState m_systemCursorState = AzFramework::SystemCursorState::UnconstrainedAndVisible; }; // Emits InputChannelUpdated if channel has transitioned in state (i.e. has gone from active to inactive or vice versa). @@ -122,7 +129,7 @@ namespace AzToolsFramework // Handle mouse click events. void HandleMouseButtonEvent(QMouseEvent* mouseEvent); // Handle mouse move events. - void HandleMouseMoveEvent(QMouseEvent* mouseEvent); + void HandleMouseMoveEvent(const QPoint& cursorPosition); // Handles key press / release events (or ShortcutOverride events for keys listed in m_highPriorityKeys). void HandleKeyEvent(QKeyEvent* keyEvent); // Handles mouse wheel events. diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UnitTest/AzToolsFrameworkTestHelpers.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UnitTest/AzToolsFrameworkTestHelpers.cpp index 6608e87784..8d30359562 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UnitTest/AzToolsFrameworkTestHelpers.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UnitTest/AzToolsFrameworkTestHelpers.cpp @@ -115,7 +115,7 @@ namespace UnitTest handled, AzToolsFramework::GetEntityContextId(), &EditorInteractionSystemViewportSelectionRequestBus::Events::InternalHandleMouseViewportInteraction, AzToolsFramework::ViewportInteraction::MouseInteractionEvent( - mouseInteraction, AzToolsFramework::ViewportInteraction::MouseEvent::Down)); + mouseInteraction, AzToolsFramework::ViewportInteraction::MouseEvent::Down, /*captured=*/false)); return handled; } } diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Viewport/EditorContextMenu.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Viewport/EditorContextMenu.cpp index ff13bce531..394aa3fe5c 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Viewport/EditorContextMenu.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Viewport/EditorContextMenu.cpp @@ -41,7 +41,8 @@ namespace AzToolsFramework ViewportInteraction::QPointFromScreenPoint(mouseInteraction.m_mouseInteraction.m_mousePick.m_screenCoordinates); // if the mouse hasn't moved, open the pop-up menu - if ((currentScreenCoords - contextMenu.m_clickPoint).manhattanLength() < ed_contextMenuDisplayThreshold) + if ((currentScreenCoords - contextMenu.m_clickPoint).manhattanLength() < ed_contextMenuDisplayThreshold && + !mouseInteraction.m_captured) { QWidget* parent = nullptr; ViewportInteraction::MainEditorViewportInteractionRequestBus::EventResult( diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Viewport/ViewportTypes.h b/Code/Framework/AzToolsFramework/AzToolsFramework/Viewport/ViewportTypes.h index 1cfb0dbe74..bc1d277609 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Viewport/ViewportTypes.h +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Viewport/ViewportTypes.h @@ -212,9 +212,10 @@ namespace AzToolsFramework static void Reflect(AZ::SerializeContext& context); //! Constructor to create a default MouseInteractionEvent - MouseInteractionEvent(MouseInteraction mouseInteraction, const MouseEvent mouseEvent) + MouseInteractionEvent(MouseInteraction mouseInteraction, const MouseEvent mouseEvent, const bool captured) : m_mouseInteraction(std::move(mouseInteraction)) , m_mouseEvent(mouseEvent) + , m_captured(captured) { } @@ -228,6 +229,7 @@ namespace AzToolsFramework MouseInteraction m_mouseInteraction; //!< Mouse state. MouseEvent m_mouseEvent; //!< Mouse event. + bool m_captured = false; //!< Is the mouse cursor being captured during the event. //! Special friend function to return the mouse wheel delta (scroll amount) //! if the event was of type MouseEvent::Wheel. From ebbe4b99a409fdfaa90e20fc54742be4abad6a15 Mon Sep 17 00:00:00 2001 From: puvvadar Date: Wed, 25 Aug 2021 10:21:29 -0700 Subject: [PATCH 089/131] Add const to some funcs and fix a comment Signed-off-by: puvvadar --- .../AzNetworking/UdpTransport/UdpNetworkInterface.cpp | 2 +- .../Code/Source/Editor/MultiplayerEditorConnection.h | 2 +- Gems/Multiplayer/Code/Source/MultiplayerSystemComponent.cpp | 2 +- Gems/Multiplayer/Code/Source/MultiplayerSystemComponent.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpNetworkInterface.cpp b/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpNetworkInterface.cpp index 983b425b60..c450d27dc8 100644 --- a/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpNetworkInterface.cpp +++ b/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpNetworkInterface.cpp @@ -306,7 +306,7 @@ namespace AzNetworking } else if (handledPacket == PacketDispatchResult::Pending) { - // If we did not handle due to a handshake pending completion, defer it + // If we did not handle due to a handshake pending completion, skip it continue; } else if (connection->GetConnectionState() != ConnectionState::Disconnecting) diff --git a/Gems/Multiplayer/Code/Source/Editor/MultiplayerEditorConnection.h b/Gems/Multiplayer/Code/Source/Editor/MultiplayerEditorConnection.h index 8f1f90cc6b..ca815d5c48 100644 --- a/Gems/Multiplayer/Code/Source/Editor/MultiplayerEditorConnection.h +++ b/Gems/Multiplayer/Code/Source/Editor/MultiplayerEditorConnection.h @@ -33,7 +33,7 @@ namespace Multiplayer MultiplayerEditorConnection(); ~MultiplayerEditorConnection() = default; - bool IsHandshakeComplete(){ return true; }; + bool IsHandshakeComplete() const { return true; }; bool HandleRequest(AzNetworking::IConnection* connection, const AzNetworking::IPacketHeader& packetHeader, MultiplayerEditorPackets::EditorServerInit& packet); bool HandleRequest(AzNetworking::IConnection* connection, const AzNetworking::IPacketHeader& packetHeader, MultiplayerEditorPackets::EditorServerReady& packet); diff --git a/Gems/Multiplayer/Code/Source/MultiplayerSystemComponent.cpp b/Gems/Multiplayer/Code/Source/MultiplayerSystemComponent.cpp index c36f2e0f11..6e9cd35c79 100644 --- a/Gems/Multiplayer/Code/Source/MultiplayerSystemComponent.cpp +++ b/Gems/Multiplayer/Code/Source/MultiplayerSystemComponent.cpp @@ -441,7 +441,7 @@ namespace Multiplayer MultiplayerPackets::SyncConsole m_syncPacket; }; - bool MultiplayerSystemComponent::IsHandshakeComplete() + bool MultiplayerSystemComponent::IsHandshakeComplete() const { return m_didHandshake; } diff --git a/Gems/Multiplayer/Code/Source/MultiplayerSystemComponent.h b/Gems/Multiplayer/Code/Source/MultiplayerSystemComponent.h index 74ba2ddf34..c467ed9ad9 100644 --- a/Gems/Multiplayer/Code/Source/MultiplayerSystemComponent.h +++ b/Gems/Multiplayer/Code/Source/MultiplayerSystemComponent.h @@ -76,7 +76,7 @@ namespace Multiplayer int GetTickOrder() override; //! @} - bool IsHandshakeComplete(); + bool IsHandshakeComplete() const; bool HandleRequest(AzNetworking::IConnection* connection, const AzNetworking::IPacketHeader& packetHeader, MultiplayerPackets::Connect& packet); bool HandleRequest(AzNetworking::IConnection* connection, const AzNetworking::IPacketHeader& packetHeader, MultiplayerPackets::Accept& packet); bool HandleRequest(AzNetworking::IConnection* connection, const AzNetworking::IPacketHeader& packetHeader, MultiplayerPackets::ReadyForEntityUpdates& packet); From d270031e598f2d5a8b0527bee159fa06f67b4e16 Mon Sep 17 00:00:00 2001 From: Danilo Aimini <82231674+AMZN-daimini@users.noreply.github.com> Date: Wed, 25 Aug 2021 10:37:27 -0700 Subject: [PATCH 090/131] Set allocator to the UI Editor HierarchyWidget to prevent initialization error when restoring layout Signed-off-by: Danilo Aimini <82231674+AMZN-daimini@users.noreply.github.com> --- Gems/LyShine/Code/Editor/HierarchyWidget.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Gems/LyShine/Code/Editor/HierarchyWidget.h b/Gems/LyShine/Code/Editor/HierarchyWidget.h index 324eda207b..0dbe423b38 100644 --- a/Gems/LyShine/Code/Editor/HierarchyWidget.h +++ b/Gems/LyShine/Code/Editor/HierarchyWidget.h @@ -29,6 +29,8 @@ class HierarchyWidget public: + AZ_CLASS_ALLOCATOR(HierarchyWidget, AZ::SystemAllocator, 0); + HierarchyWidget(EditorWindow* editorWindow); virtual ~HierarchyWidget(); From 6bd5cd7bde1ad1d7910fb6feb8db7e5f6d550e45 Mon Sep 17 00:00:00 2001 From: chcurran <82187351+carlitosan@users.noreply.github.com> Date: Wed, 25 Aug 2021 10:53:34 -0700 Subject: [PATCH 091/131] Fix release build warning error Signed-off-by: chcurran <82187351+carlitosan@users.noreply.github.com> --- .../Code/Source/ElementInformationSerializer.inl | 2 +- .../Code/Source/ExpressionPrimitivesSerializers.inl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gems/ExpressionEvaluation/Code/Source/ElementInformationSerializer.inl b/Gems/ExpressionEvaluation/Code/Source/ElementInformationSerializer.inl index 10b002034e..9796bbb39b 100644 --- a/Gems/ExpressionEvaluation/Code/Source/ElementInformationSerializer.inl +++ b/Gems/ExpressionEvaluation/Code/Source/ElementInformationSerializer.inl @@ -43,7 +43,7 @@ namespace AZ JsonSerializationResult::Result Load ( void* outputValue - , const Uuid& outputValueTypeId + , [[maybe_unused]] const Uuid& outputValueTypeId , const rapidjson::Value& inputValue , JsonDeserializerContext& context) override { diff --git a/Gems/ExpressionEvaluation/Code/Source/ExpressionPrimitivesSerializers.inl b/Gems/ExpressionEvaluation/Code/Source/ExpressionPrimitivesSerializers.inl index 76f43a9b82..1eaee38702 100644 --- a/Gems/ExpressionEvaluation/Code/Source/ExpressionPrimitivesSerializers.inl +++ b/Gems/ExpressionEvaluation/Code/Source/ExpressionPrimitivesSerializers.inl @@ -30,7 +30,7 @@ namespace AZ JsonSerializationResult::Result Load ( void* outputValue - , const Uuid& outputValueTypeId + , [[maybe_unused]] const Uuid& outputValueTypeId , const rapidjson::Value& inputValue , JsonDeserializerContext& context) override { From b53182fdb60950bc698cf62ccdb290627b55c577 Mon Sep 17 00:00:00 2001 From: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> Date: Wed, 25 Aug 2021 13:29:24 -0500 Subject: [PATCH 092/131] Fixed invalid variable access in register.py (#3433) * Fixed invalid variable access in register.py The register_restricted_path and register_template_path methods did not specify the parameter for project path Updated register_o3de_object_path function to pass in absolute paths to the engine or project in order to make relative paths to the registered o3de object to it. Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> * Fixed register_*_path resolve calls in register.py Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> --- scripts/o3de/o3de/register.py | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/scripts/o3de/o3de/register.py b/scripts/o3de/o3de/register.py index 5822cc926c..7db09368ec 100644 --- a/scripts/o3de/o3de/register.py +++ b/scripts/o3de/o3de/register.py @@ -290,14 +290,14 @@ def register_o3de_object_path(json_data: dict, logger.error(f'Cannot load engine.json data at path {engine_path}') return 1 - save_path = engine_path / 'engine.json' + save_path = (engine_path / 'engine.json').resolve() elif project_path: manifest_data = manifest.get_project_json_data(project_path=project_path) if not manifest_data: logger.error(f'Cannot load project.json data at path {project_path}') return 1 - save_path = project_path / 'project.json' + save_path = (project_path / 'project.json').resolve() else: manifest_data = json_data @@ -373,7 +373,8 @@ def register_external_subdirectory(json_data: dict, if not project_path: engine_path = utils.find_ancestor_dir_containing_file(pathlib.PurePath('engine.json'), external_subdir_path) return register_o3de_object_path(json_data, external_subdir_path, 'external_subdirectories', '', None, remove, - engine_path, project_path) + pathlib.Path(engine_path).resolve() if engine_path else None, + pathlib.Path(project_path).resolve() if project_path else None) def register_gem_path(json_data: dict, @@ -387,7 +388,9 @@ def register_gem_path(json_data: dict, if not project_path: engine_path = utils.find_ancestor_dir_containing_file(pathlib.PurePath('engine.json'), gem_path) return register_o3de_object_path(json_data, gem_path, 'external_subdirectories', 'gem.json', - validation.valid_o3de_gem_json, remove, engine_path, project_path) + validation.valid_o3de_gem_json, remove, + pathlib.Path(engine_path).resolve() if engine_path else None, + pathlib.Path(project_path).resolve() if project_path else None) def register_project_path(json_data: dict, @@ -400,7 +403,8 @@ def register_project_path(json_data: dict, engine_path = utils.find_ancestor_dir_containing_file(pathlib.PurePath('engine.json'), project_path) result = register_o3de_object_path(json_data, project_path, 'projects', 'project.json', - validation.valid_o3de_project_json, remove, engine_path, None) + validation.valid_o3de_project_json, remove, + pathlib.Path(engine_path).resolve() if engine_path else None) if result != 0: return result @@ -433,6 +437,7 @@ def register_project_path(json_data: dict, def register_template_path(json_data: dict, template_path: pathlib.Path, remove: bool = False, + project_path: pathlib.Path = None, engine_path: pathlib.Path = None) -> int: # If a project path or engine path has not been supplied auto detect which manifest to register the input path if not project_path and not engine_path: @@ -440,12 +445,15 @@ def register_template_path(json_data: dict, if not project_path: engine_path = utils.find_ancestor_dir_containing_file(pathlib.PurePath('engine.json'), template_path) return register_o3de_object_path(json_data, template_path, 'templates', 'template.json', - validation.valid_o3de_template_json, remove, engine_path, None) + validation.valid_o3de_template_json, remove, + pathlib.Path(engine_path).resolve() if engine_path else None, + pathlib.Path(project_path).resolve() if project_path else None) def register_restricted_path(json_data: dict, restricted_path: pathlib.Path, remove: bool = False, + project_path: pathlib.Path = None, engine_path: pathlib.Path = None) -> int: # If a project path or engine path has not been supplied auto detect which manifest to register the input path if not project_path and not engine_path: @@ -453,7 +461,9 @@ def register_restricted_path(json_data: dict, if not project_path: engine_path = utils.find_ancestor_dir_containing_file(pathlib.PurePath('engine.json'), restricted_path) return register_o3de_object_path(json_data, restricted_path, 'restricted', 'restricted.json', - validation.valid_o3de_restricted_json, remove, engine_path, None) + validation.valid_o3de_restricted_json, remove, + pathlib.Path(engine_path).resolve() if engine_path else None, + pathlib.Path(project_path).resolve() if project_path else None) def register_repo(json_data: dict, @@ -622,13 +632,13 @@ def register(engine_path: pathlib.Path = None, if not template_path: logger.error(f'Template path cannot be empty.') return 1 - result = result or register_template_path(json_data, template_path, remove, engine_path) + result = result or register_template_path(json_data, template_path, remove, project_path, engine_path) if isinstance(restricted_path, pathlib.PurePath): if not restricted_path: logger.error(f'Restricted path cannot be empty.') return 1 - result = result or register_restricted_path(json_data, restricted_path, remove, engine_path) + result = result or register_restricted_path(json_data, restricted_path, remove, project_path, engine_path) if isinstance(repo_uri, str) or isinstance(repo_uri, pathlib.PurePath): if not repo_uri: From e2acd66c46400aa058497ec70f92b1241da36b69 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Wed, 25 Aug 2021 11:37:35 -0700 Subject: [PATCH 093/131] Fixes Guid formatting Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Code/Editor/Util/GuidUtil.h | 4 ++-- Code/Framework/AzCore/AzCore/Math/Guid.h | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Code/Editor/Util/GuidUtil.h b/Code/Editor/Util/GuidUtil.h index c53589b6ca..de2bad8759 100644 --- a/Code/Editor/Util/GuidUtil.h +++ b/Code/Editor/Util/GuidUtil.h @@ -48,7 +48,7 @@ inline bool GuidUtil::IsEmpty(REFGUID guid) inline const char* GuidUtil::ToString(REFGUID guid) { static char guidString[64]; - sprintf_s(guidString, "{%.8lX-%.4X-%.4X-%.2X%.2X-%.2X%.2X%.2X%.2X%.2X%.2X}", guid.Data1, guid.Data2, guid.Data3, guid.Data4[0], guid.Data4[1], + sprintf_s(guidString, "{%.8" GUID_FORMAT_DATA1 "-%.4X-%.4X-%.2X%.2X-%.2X%.2X%.2X%.2X%.2X%.2X}", guid.Data1, guid.Data2, guid.Data3, guid.Data4[0], guid.Data4[1], guid.Data4[2], guid.Data4[3], guid.Data4[4], guid.Data4[5], guid.Data4[6], guid.Data4[7]); return guidString; } @@ -62,7 +62,7 @@ inline GUID GuidUtil::FromString(const char* guidString) guid.Data1 = 0; guid.Data2 = 0; guid.Data3 = 0; - azsscanf(guidString, "{%8lX-%4hX-%4hX-%2X%2X-%2X%2X%2X%2X%2X%2X}", + azsscanf(guidString, "{%8" GUID_FORMAT_DATA1 "-%4hX-%4hX-%2X%2X-%2X%2X%2X%2X%2X%2X}", &guid.Data1, &guid.Data2, &guid.Data3, &d[0], &d[1], &d[2], &d[3], &d[4], &d[5], &d[6], &d[7]); guid.Data4[0] = static_cast(d[0]); guid.Data4[1] = static_cast(d[1]); diff --git a/Code/Framework/AzCore/AzCore/Math/Guid.h b/Code/Framework/AzCore/AzCore/Math/Guid.h index a061858265..b1cd91716b 100644 --- a/Code/Framework/AzCore/AzCore/Math/Guid.h +++ b/Code/Framework/AzCore/AzCore/Math/Guid.h @@ -8,7 +8,9 @@ #ifndef AZ_CORE_GUID_H #define AZ_CORE_GUID_H 1 -#ifndef GUID_DEFINED +#if defined(GUID_DEFINED) +#define GUID_FORMAT_DATA1 "lX" +#else #define GUID_DEFINED typedef struct _GUID { _GUID(unsigned long d1, unsigned short d2, unsigned short d3, std::initializer_list d4) @@ -22,11 +24,12 @@ typedef struct _GUID { _GUID() = default; - unsigned long Data1; + uint32_t Data1; unsigned short Data2; unsigned short Data3; unsigned char Data4[ 8 ]; } GUID; +#define GUID_FORMAT_DATA1 "X" #endif // GUID_DEFINED #if !defined _SYS_GUID_OPERATOR_EQ_ && !defined _NO_SYS_GUID_OPERATOR_EQ_ From b1246dcc0851abf6047e04ffff18aaec2e68a2ff Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Wed, 25 Aug 2021 12:12:36 -0700 Subject: [PATCH 094/131] CMakeLists.txt frrom templates are not being installed (#3456) Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Templates/CMakeLists.txt | 9 ++++++++- cmake/Install.cmake | 19 +++++++++++-------- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/Templates/CMakeLists.txt b/Templates/CMakeLists.txt index 300e11ac3e..1a3a45b5ec 100644 --- a/Templates/CMakeLists.txt +++ b/Templates/CMakeLists.txt @@ -6,4 +6,11 @@ # # -ly_install_directory(DIRECTORIES .) +ly_install_directory( + DIRECTORIES + AssetGem + DefaultGem + DefaultProject + MinimalProject + VERBATIM +) diff --git a/cmake/Install.cmake b/cmake/Install.cmake index 5781fc7ae5..34f316e31e 100644 --- a/cmake/Install.cmake +++ b/cmake/Install.cmake @@ -16,17 +16,18 @@ endif() # \arg:DIRECTORIES directories to install # \arg:DESTINATION (optional) destination to install the directory to (relative to CMAKE_PREFIX_PATH) # \arg:EXCLUDE_PATTERNS (optional) patterns to exclude +# \arg:VERBATIM (optional) copies the directories as they are, this excludes the default exclude patterns # # \notes: # - refer to cmake's install(DIRECTORY documentation for more information # - If the directory contains programs/scripts, exclude them from this call and add a specific ly_install_files with # PROGRAMS set. This is necessary to set the proper execution permissions. # - This function will automatically filter out __pycache__, *.egg-info, CMakeLists.txt, *.cmake files. If those files -# need to be installed, use ly_install_files. +# need to be installed, use ly_install_files. Use VERBATIM to exclude such filters. # function(ly_install_directory) - set(options) + set(options VERBATIM) set(oneValueArgs DESTINATION) set(multiValueArgs DIRECTORIES EXCLUDE_PATTERNS) @@ -60,13 +61,15 @@ function(ly_install_directory) endforeach() endif() - # Exclude cmake since that has to be generated - list(APPEND exclude_patterns PATTERN CMakeLists.txt EXCLUDE) - list(APPEND exclude_patterns PATTERN *.cmake EXCLUDE) + if(NOT ly_install_directory_VERBATIM) + # Exclude cmake since that has to be generated + list(APPEND exclude_patterns PATTERN CMakeLists.txt EXCLUDE) + list(APPEND exclude_patterns PATTERN *.cmake EXCLUDE) - # Exclude python-related things that dont need to be installed - list(APPEND exclude_patterns PATTERN __pycache__ EXCLUDE) - list(APPEND exclude_patterns PATTERN *.egg-info EXCLUDE) + # Exclude python-related things that dont need to be installed + list(APPEND exclude_patterns PATTERN __pycache__ EXCLUDE) + list(APPEND exclude_patterns PATTERN *.egg-info EXCLUDE) + endif() install(DIRECTORY ${directory} DESTINATION ${ly_install_directory_DESTINATION} From 9f6434fc681e6dec623237b8935aa824aae8a5e0 Mon Sep 17 00:00:00 2001 From: amzn-phist <52085794+amzn-phist@users.noreply.github.com> Date: Wed, 25 Aug 2021 14:16:40 -0500 Subject: [PATCH 095/131] Fix an issue with project-centric ninja builds [Linux] (#3429) * Fix an issue with project-centric ninja builds Normalizes relative paths when adding engine.json as a cmake configure dependency. It should match the dependency added later which uses absolute path. Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com> * Fix typo Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com> --- cmake/Findo3de.cmake | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/cmake/Findo3de.cmake b/cmake/Findo3de.cmake index b0d30f1dcc..26b3719d14 100644 --- a/cmake/Findo3de.cmake +++ b/cmake/Findo3de.cmake @@ -17,23 +17,27 @@ endfunction() o3de_current_file_path(current_path) -# Make sure we are matching LY_ENGINE_NAME_TO_USE with the current engine -file(READ ${current_path}/../engine.json engine_json) -set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${current_path}/../engine.json) +# Make sure the cmake configure dependency added here is a normalized path to engine.json, +# because later it's read again using a path like ${LY_ROOT_FOLDER}/engine.json, which +# is also normalized. They should match to avoid errors on some build systems. +cmake_path(SET engine_json_path NORMALIZE ${current_path}/../engine.json) +file(READ ${engine_json_path} engine_json) +set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${engine_json_path}) string(JSON this_engine_name ERROR_VARIABLE json_error GET ${engine_json} engine_name) if(json_error) - message(FATAL_ERROR "Unable to read key 'engine_name' from '${current_path}/../engine.json', error: ${json_error}") + message(FATAL_ERROR "Unable to read key 'engine_name' from '${engine_json_path}', error: ${json_error}") endif() +# Make sure we are matching LY_ENGINE_NAME_TO_USE with the current engine set(found_matching_engine FALSE) if(this_engine_name STREQUAL LY_ENGINE_NAME_TO_USE) set(found_matching_engine TRUE) endif() find_package_handle_standard_args(o3de - "Could not find an engine with matching ${LY_ENGINE_NAME_TO_USE}" - found_matching_engine + "Could not find an engine with matching ${LY_ENGINE_NAME_TO_USE}" + found_matching_engine ) macro(o3de_initialize) @@ -41,4 +45,4 @@ macro(o3de_initialize) set(LY_PROJECTS ${CMAKE_CURRENT_LIST_DIR}) o3de_current_file_path(current_path) add_subdirectory(${current_path}/.. o3de) -endmacro() \ No newline at end of file +endmacro() From 4a05d6f7ec54d4b666019087f3de81aa781a7662 Mon Sep 17 00:00:00 2001 From: Jeremy Ong Date: Wed, 25 Aug 2021 14:06:47 -0600 Subject: [PATCH 096/131] Add CMakeUserPresets.json file to gitignore Signed-off-by: Jeremy Ong --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index b73c89b1d9..c28f6ab123 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ __pycache__ AssetProcessorTemp/** [Bb]uild/** [Oo]ut/** +CMakeUserPresets.json [Cc]ache/ /install/ Editor/EditorEventLog.xml From d21177125325b1570b628d54d87076107bfe0e76 Mon Sep 17 00:00:00 2001 From: Chris Galvan Date: Wed, 25 Aug 2021 15:28:42 -0500 Subject: [PATCH 097/131] Updating PR to change lower API to return AZStd::string instead of const char* for safety. Signed-off-by: Chris Galvan --- Code/Editor/AnimationContext.cpp | 2 +- Code/Editor/Export/ExportManager.cpp | 14 +++---- Code/Editor/TrackView/TVSequenceProps.cpp | 4 +- Code/Editor/TrackView/TrackViewAnimNode.cpp | 19 ++++----- Code/Editor/TrackView/TrackViewAnimNode.h | 4 +- Code/Editor/TrackView/TrackViewDialog.cpp | 7 ++-- .../TrackView/TrackViewDopeSheetBase.cpp | 2 +- Code/Editor/TrackView/TrackViewNode.cpp | 4 +- Code/Editor/TrackView/TrackViewNode.h | 2 +- Code/Editor/TrackView/TrackViewNodes.cpp | 42 +++++++++---------- Code/Editor/TrackView/TrackViewNodes.h | 2 +- .../Editor/TrackView/TrackViewPythonFuncs.cpp | 4 +- Code/Editor/TrackView/TrackViewSequence.cpp | 6 +-- Code/Editor/TrackView/TrackViewSequence.h | 2 +- .../TrackView/TrackViewSequenceManager.cpp | 6 +-- Code/Editor/TrackView/TrackViewTrack.cpp | 4 +- Code/Editor/TrackView/TrackViewTrack.h | 2 +- Code/Editor/TrackView/TrackViewUndo.cpp | 2 +- Code/Editor/TrackViewNewSequenceDialog.cpp | 2 +- Code/Legacy/CryCommon/IMovieSystem.h | 4 +- .../LyShine/Animation/IUiAnimation.h | 8 ++-- .../Editor/Animation/AnimationContext.cpp | 2 +- .../Editor/Animation/UiAVSequenceProps.cpp | 4 +- .../Editor/Animation/UiAnimViewAnimNode.cpp | 16 ++++--- .../Editor/Animation/UiAnimViewAnimNode.h | 6 +-- .../Editor/Animation/UiAnimViewDialog.cpp | 6 +-- .../Animation/UiAnimViewDopeSheetBase.cpp | 2 +- .../Editor/Animation/UiAnimViewFindDlg.cpp | 4 +- .../Animation/UiAnimViewNewSequenceDialog.cpp | 2 +- .../Code/Editor/Animation/UiAnimViewNode.cpp | 4 +- .../Code/Editor/Animation/UiAnimViewNode.h | 2 +- .../Code/Editor/Animation/UiAnimViewNodes.cpp | 18 ++++---- .../Code/Editor/Animation/UiAnimViewNodes.h | 2 +- .../Editor/Animation/UiAnimViewSequence.cpp | 2 +- .../Editor/Animation/UiAnimViewSequence.h | 2 +- .../Animation/UiAnimViewSequenceManager.cpp | 6 +-- .../Editor/Animation/UiAnimViewSplineCtrl.cpp | 2 +- .../Code/Editor/Animation/UiAnimViewTrack.cpp | 4 +- .../Code/Editor/Animation/UiAnimViewTrack.h | 2 +- .../Code/Source/Animation/AnimNode.cpp | 4 +- Gems/LyShine/Code/Source/Animation/AnimNode.h | 6 +-- .../Code/Source/Animation/AnimSplineTrack.h | 2 +- .../LyShine/Code/Source/Animation/AnimTrack.h | 2 +- .../Code/Source/Animation/AzEntityNode.cpp | 4 +- .../Code/Source/Animation/AzEntityNode.h | 4 +- .../Source/Animation/CompoundSplineTrack.cpp | 4 +- .../Source/Animation/CompoundSplineTrack.h | 2 +- .../Source/Animation/UiAnimationSystem.cpp | 17 +++----- .../Source/Cinematics/AnimComponentNode.h | 4 +- .../Code/Source/Cinematics/AnimNode.cpp | 4 +- .../Maestro/Code/Source/Cinematics/AnimNode.h | 2 +- .../Code/Source/Cinematics/AnimSplineTrack.h | 2 +- .../Code/Source/Cinematics/AnimTrack.h | 2 +- .../Source/Cinematics/CompoundSplineTrack.cpp | 4 +- .../Source/Cinematics/CompoundSplineTrack.h | 2 +- .../Code/Source/Cinematics/MaterialNode.cpp | 2 +- .../Code/Source/Cinematics/MaterialNode.h | 2 +- 57 files changed, 142 insertions(+), 155 deletions(-) diff --git a/Code/Editor/AnimationContext.cpp b/Code/Editor/AnimationContext.cpp index 6e146faacb..fce1150878 100644 --- a/Code/Editor/AnimationContext.cpp +++ b/Code/Editor/AnimationContext.cpp @@ -628,7 +628,7 @@ void CAnimationContext::GoToFrameCmd(IConsoleCmdArgs* pArgs) float targetFrame = (float)atof(pArgs->GetArg(1)); if (pSeq->GetTimeRange().start > targetFrame || targetFrame > pSeq->GetTimeRange().end) { - gEnv->pLog->LogError("GoToFrame: requested time %f is outside the range of sequence %s (%f, %f)", targetFrame, pSeq->GetName(), pSeq->GetTimeRange().start, pSeq->GetTimeRange().end); + gEnv->pLog->LogError("GoToFrame: requested time %f is outside the range of sequence %s (%f, %f)", targetFrame, pSeq->GetName().c_str(), pSeq->GetTimeRange().start, pSeq->GetTimeRange().end); return; } GetIEditor()->GetAnimation()->m_currTime = targetFrame; diff --git a/Code/Editor/Export/ExportManager.cpp b/Code/Editor/Export/ExportManager.cpp index 7601740033..220c341f5c 100644 --- a/Code/Editor/Export/ExportManager.cpp +++ b/Code/Editor/Export/ExportManager.cpp @@ -622,7 +622,7 @@ bool CExportManager::ShowFBXExportDialog() if (pivotObjectNode && !pivotObjectNode->IsGroupNode()) { - m_pivotEntityObject = static_cast(GetIEditor()->GetObjectManager()->FindObject(pivotObjectNode->GetName())); + m_pivotEntityObject = static_cast(GetIEditor()->GetObjectManager()->FindObject(pivotObjectNode->GetName().c_str())); if (m_pivotEntityObject) { @@ -807,7 +807,7 @@ void CExportManager::FillAnimTimeNode(XmlNodeRef writeNode, CTrackViewAnimNode* if (numAllTracks > 0) { - XmlNodeRef objNode = writeNode->createNode(CleanXMLText(pObjectNode->GetName()).toUtf8().data()); + XmlNodeRef objNode = writeNode->createNode(CleanXMLText(pObjectNode->GetName().c_str()).toUtf8().data()); writeNode->setAttr("time", m_animTimeExportPrimarySequenceCurrentTime); for (unsigned int trackID = 0; trackID < numAllTracks; ++trackID) @@ -818,7 +818,7 @@ void CExportManager::FillAnimTimeNode(XmlNodeRef writeNode, CTrackViewAnimNode* if (trackType == AnimParamType::Animation || trackType == AnimParamType::Sound) { - QString childName = CleanXMLText(childTrack->GetName()); + QString childName = CleanXMLText(childTrack->GetName().c_str()); if (childName.isEmpty()) { @@ -976,7 +976,7 @@ bool CExportManager::AddObjectsFromSequence(CTrackViewSequence* pSequence, XmlNo else { // In case of exporting animation/sound times data - const QString sequenceName = pSubSequence->GetName(); + const QString sequenceName = QString::fromUtf8(pSubSequence->GetName().c_str()); XmlNodeRef subSeqNode2 = seqNode->createNode(sequenceName.toUtf8().data()); if (sequenceName == m_animTimeExportPrimarySequenceName) @@ -1253,14 +1253,14 @@ void CExportManager::SaveNodeKeysTimeToXML() m_soundKeyTimeExport = exportDialog.IsSoundExportChecked(); QString filters = "All files (*.xml)"; - QString defaultName = QString(pSequence->GetName()) + ".xml"; + QString defaultName = QString::fromUtf8(pSequence->GetName().c_str()) + ".xml"; QtUtil::QtMFCScopedHWNDCapture cap; CAutoDirectoryRestoreFileDialog dlg(QFileDialog::AcceptSave, QFileDialog::AnyFile, "xml", defaultName, filters, {}, {}, cap); if (dlg.exec()) { - m_animTimeNode = XmlHelpers::CreateXmlNode(pSequence->GetName()); - m_animTimeExportPrimarySequenceName = pSequence->GetName(); + m_animTimeNode = XmlHelpers::CreateXmlNode(pSequence->GetName().c_str()); + m_animTimeExportPrimarySequenceName = QString::fromUtf8(pSequence->GetName().c_str()); m_data.Clear(); m_animTimeExportPrimarySequenceCurrentTime = 0.0; diff --git a/Code/Editor/TrackView/TVSequenceProps.cpp b/Code/Editor/TrackView/TVSequenceProps.cpp index d4e06d0c94..0abab65645 100644 --- a/Code/Editor/TrackView/TVSequenceProps.cpp +++ b/Code/Editor/TrackView/TVSequenceProps.cpp @@ -53,7 +53,7 @@ CTVSequenceProps::~CTVSequenceProps() // CTVSequenceProps message handlers bool CTVSequenceProps::OnInitDialog() { - ui->NAME->setText(m_pSequence->GetName()); + ui->NAME->setText(m_pSequence->GetName().c_str()); int seqFlags = m_pSequence->GetFlags(); ui->ALWAYS_PLAY->setChecked((seqFlags & IAnimSequence::eSeqFlags_PlayOnReset)); @@ -141,7 +141,7 @@ void CTVSequenceProps::UpdateSequenceProps(const QString& name) ac->UpdateTimeRange(); } - QString seqName = m_pSequence->GetName(); + QString seqName = QString::fromUtf8(m_pSequence->GetName().c_str()); if (name != seqName) { // Rename sequence. diff --git a/Code/Editor/TrackView/TrackViewAnimNode.cpp b/Code/Editor/TrackView/TrackViewAnimNode.cpp index 4b599859e9..0377d4cd86 100644 --- a/Code/Editor/TrackView/TrackViewAnimNode.cpp +++ b/Code/Editor/TrackView/TrackViewAnimNode.cpp @@ -423,7 +423,7 @@ CTrackViewAnimNode* CTrackViewAnimNode::CreateSubNode( AZStd::string::format( "Failed to add '%s' to sequence '%s', could not find associated entity. " "Please try adding the entity associated with '%s'.", - originalNameStr.constData(), director->GetName(), originalNameStr.constData())); + originalNameStr.constData(), director->GetName().c_str(), originalNameStr.constData())); return nullptr; } @@ -472,7 +472,7 @@ CTrackViewAnimNode* CTrackViewAnimNode::CreateSubNode( { GetIEditor()->GetMovieSystem()->LogUserNotificationMsg( AZStd::string::format("'%s' already exists in sequence '%s', skipping...", - originalNameStr.constData(), director2->GetName())); + originalNameStr.constData(), director2->GetName().c_str())); return nullptr; } @@ -488,7 +488,7 @@ CTrackViewAnimNode* CTrackViewAnimNode::CreateSubNode( if (!newAnimNode) { GetIEditor()->GetMovieSystem()->LogUserNotificationMsg( - AZStd::string::format("Failed to add '%s' to sequence '%s'.", nameStr.constData(), director->GetName())); + AZStd::string::format("Failed to add '%s' to sequence '%s'.", nameStr.constData(), director->GetName().c_str())); return nullptr; } @@ -1195,7 +1195,7 @@ CTrackViewAnimNodeBundle CTrackViewAnimNode::GetAnimNodesByName(const char* pNam { CTrackViewAnimNodeBundle bundle; - QString nodeName = GetName(); + QString nodeName = QString::fromUtf8(GetName().c_str()); if (GetNodeType() == eTVNT_AnimNode && QString::compare(pName, nodeName, Qt::CaseInsensitive) == 0) { bundle.AppendAnimNode(this); @@ -1215,10 +1215,9 @@ CTrackViewAnimNodeBundle CTrackViewAnimNode::GetAnimNodesByName(const char* pNam } ////////////////////////////////////////////////////////////////////////// -const char* CTrackViewAnimNode::GetParamName(const CAnimParamType& paramType) const +AZStd::string CTrackViewAnimNode::GetParamName(const CAnimParamType& paramType) const { - const char* pName = m_animNode->GetParamName(paramType); - return pName ? pName : ""; + return m_animNode->GetParamName(paramType); } ////////////////////////////////////////////////////////////////////////// @@ -1274,7 +1273,7 @@ CTrackViewAnimNodeBundle CTrackViewAnimNode::AddSelectedEntities(const AZStd::ve if (existingNode->GetDirector() == GetDirector()) { GetIEditor()->GetMovieSystem()->LogUserNotificationMsg(AZStd::string::format( - "'%s' was already added to '%s', skipping...", entity->GetName().c_str(), GetDirector()->GetName())); + "'%s' was already added to '%s', skipping...", entity->GetName().c_str(), GetDirector()->GetName().c_str())); continue; } @@ -1377,7 +1376,7 @@ void CTrackViewAnimNode::UpdateDynamicParams() void CTrackViewAnimNode::CopyKeysToClipboard(XmlNodeRef& xmlNode, const bool bOnlySelectedKeys, const bool bOnlyFromSelectedTracks) { XmlNodeRef childNode = xmlNode->createNode("Node"); - childNode->setAttr("name", GetName()); + childNode->setAttr("name", GetName().c_str()); childNode->setAttr("type", static_cast(GetType())); for (auto iter = m_childNodes.begin(); iter != m_childNodes.end(); ++iter) @@ -1683,7 +1682,7 @@ bool CTrackViewAnimNode::IsValidReparentingTo(CTrackViewAnimNode* pNewParent) } // Check if the new parent already contains a node with this name - CTrackViewAnimNodeBundle foundNodes = pNewParent->GetAnimNodesByName(GetName()); + CTrackViewAnimNodeBundle foundNodes = pNewParent->GetAnimNodesByName(GetName().c_str()); if (foundNodes.GetCount() > 1 || (foundNodes.GetCount() == 1 && foundNodes.GetNode(0) != this)) { return false; diff --git a/Code/Editor/TrackView/TrackViewAnimNode.h b/Code/Editor/TrackView/TrackViewAnimNode.h index 466e60bcf0..aa6474ccdb 100644 --- a/Code/Editor/TrackView/TrackViewAnimNode.h +++ b/Code/Editor/TrackView/TrackViewAnimNode.h @@ -124,7 +124,7 @@ public: virtual void SetAsViewCamera(); // Name setter/getter - virtual const char* GetName() const override { return m_animNode->GetName(); } + AZStd::string GetName() const override { return m_animNode->GetName(); } virtual bool SetName(const char* pName) override; virtual bool CanBeRenamed() const override; @@ -187,7 +187,7 @@ public: // Param unsigned int GetParamCount() const; CAnimParamType GetParamType(unsigned int index) const; - const char* GetParamName(const CAnimParamType& paramType) const; + AZStd::string GetParamName(const CAnimParamType& paramType) const; bool IsParamValid(const CAnimParamType& param) const; IAnimNode::ESupportedParamFlags GetParamFlags(const CAnimParamType& paramType) const; AnimValueType GetParamValueType(const CAnimParamType& paramType) const; diff --git a/Code/Editor/TrackView/TrackViewDialog.cpp b/Code/Editor/TrackView/TrackViewDialog.cpp index 26d844a68b..388366d8c3 100644 --- a/Code/Editor/TrackView/TrackViewDialog.cpp +++ b/Code/Editor/TrackView/TrackViewDialog.cpp @@ -1125,7 +1125,7 @@ void CTrackViewDialog::ReloadSequencesComboBox() { CTrackViewSequence* sequence = pSequenceManager->GetSequenceByIndex(k); QString entityIdString = GetEntityIdAsString(sequence->GetSequenceComponentEntityId()); - m_sequencesComboBox->addItem(sequence->GetName(), entityIdString); + m_sequencesComboBox->addItem(QString::fromUtf8(sequence->GetName().c_str()), entityIdString); } } @@ -2033,8 +2033,7 @@ void CTrackViewDialog::UpdateTracksToolBar() continue; } - AZStd::string paramName = pAnimNode->GetParamName(paramType); - name = paramName.c_str(); + name = QString::fromUtf8(pAnimNode->GetParamName(paramType).c_str()); QString sToolTipText("Add " + name + " Track"); QIcon hIcon = m_wndNodesCtrl->GetIconForTrack(pTrack); @@ -2310,7 +2309,7 @@ void CTrackViewDialog::SaveCurrentSequenceToFBX() return; } - QString selectedSequenceFBXStr = QString(sequence->GetName()) + ".fbx"; + QString selectedSequenceFBXStr = QString::fromUtf8(sequence->GetName().c_str()) + ".fbx"; CExportManager* pExportManager = static_cast(GetIEditor()->GetExportManager()); const char szFilters[] = "FBX Files (*.fbx)"; diff --git a/Code/Editor/TrackView/TrackViewDopeSheetBase.cpp b/Code/Editor/TrackView/TrackViewDopeSheetBase.cpp index d0034b2da4..d77d262727 100644 --- a/Code/Editor/TrackView/TrackViewDopeSheetBase.cpp +++ b/Code/Editor/TrackView/TrackViewDopeSheetBase.cpp @@ -3453,7 +3453,7 @@ void CTrackViewDopeSheetBase::DrawNodeTrack(CTrackViewAnimNode* animNode, QPaint const QRect textRect = trackRect.adjusted(4, 0, -4, 0); - QString sAnimNodeName = animNode->GetName(); + QString sAnimNodeName = QString::fromUtf8(animNode->GetName().c_str()); const bool hasObsoleteTrack = animNode->HasObsoleteTrack(); if (hasObsoleteTrack) diff --git a/Code/Editor/TrackView/TrackViewNode.cpp b/Code/Editor/TrackView/TrackViewNode.cpp index d8507d9b0a..ee786cbc20 100644 --- a/Code/Editor/TrackView/TrackViewNode.cpp +++ b/Code/Editor/TrackView/TrackViewNode.cpp @@ -626,7 +626,7 @@ bool CTrackViewNode::operator<(const CTrackViewNode& otherNode) const if (thisTypeOrder == otherTypeOrder) { // Same node type, sort by name - return azstricmp(thisAnimNode.GetName(), otherAnimNode.GetName()) < 0; + return thisAnimNode.GetName() < otherAnimNode.GetName(); } return thisTypeOrder < otherTypeOrder; @@ -638,7 +638,7 @@ bool CTrackViewNode::operator<(const CTrackViewNode& otherNode) const if (thisTrack.GetParameterType() == otherTrack.GetParameterType()) { // Same parameter type, sort by name - return azstricmp(thisTrack.GetName(), otherTrack.GetName()) < 0; + return thisTrack.GetName() < otherTrack.GetName(); } return thisTrack.GetParameterType() < otherTrack.GetParameterType(); diff --git a/Code/Editor/TrackView/TrackViewNode.h b/Code/Editor/TrackView/TrackViewNode.h index 2c289049e9..d11b0c2e9f 100644 --- a/Code/Editor/TrackView/TrackViewNode.h +++ b/Code/Editor/TrackView/TrackViewNode.h @@ -159,7 +159,7 @@ public: virtual ~CTrackViewNode() {} // Name - virtual const char* GetName() const = 0; + virtual AZStd::string GetName() const = 0; virtual bool SetName([[maybe_unused]] const char* pName) { return false; }; virtual bool CanBeRenamed() const { return false; } diff --git a/Code/Editor/TrackView/TrackViewNodes.cpp b/Code/Editor/TrackView/TrackViewNodes.cpp index 62b134a508..e3b994c488 100644 --- a/Code/Editor/TrackView/TrackViewNodes.cpp +++ b/Code/Editor/TrackView/TrackViewNodes.cpp @@ -616,8 +616,7 @@ CTrackViewNodesCtrl::CRecord* CTrackViewNodesCtrl::AddAnimNodeRecord(CRecord* pP { CRecord* pNewRecord = new CRecord(animNode); - AZStd::string nodeName = animNode->GetName(); - pNewRecord->setText(0, nodeName.c_str()); + pNewRecord->setText(0, QString::fromUtf8(animNode->GetName().c_str())); UpdateAnimNodeRecord(pNewRecord, animNode); pParentRecord->insertChild(GetInsertPosition(pParentRecord, animNode), pNewRecord); FillNodesRec(pNewRecord, animNode); @@ -630,8 +629,7 @@ CTrackViewNodesCtrl::CRecord* CTrackViewNodesCtrl::AddTrackRecord(CRecord* pPare { CRecord* pNewTrackRecord = new CRecord(pTrack); pNewTrackRecord->setSizeHint(0, QSize(30, 18)); - AZStd::string trackName = pTrack->GetName(); - pNewTrackRecord->setText(0, trackName.c_str()); + pNewTrackRecord->setText(0, QString::fromUtf8(pTrack->GetName().c_str())); UpdateTrackRecord(pNewTrackRecord, pTrack); pParentRecord->insertChild(GetInsertPosition(pParentRecord, pTrack), pNewTrackRecord); FillNodesRec(pNewTrackRecord, pTrack); @@ -862,7 +860,7 @@ void CTrackViewNodesCtrl::OnFillItems() m_nodeToRecordMap.clear(); CRecord* pRootGroupRec = new CRecord(sequence); - pRootGroupRec->setText(0, sequence->GetName()); + pRootGroupRec->setText(0, QString::fromUtf8(sequence->GetName().c_str())); QFont f = font(); f.setBold(true); pRootGroupRec->setData(0, Qt::FontRole, f); @@ -1034,8 +1032,8 @@ void CTrackViewNodesCtrl::OnNMRclick(QPoint point) return; } - QString file = QString(sequence2->GetName()) + QString(".fbx"); - QString selectedSequenceFBXStr = QString(sequence2->GetName()) + ".fbx"; + QString file = QString::fromUtf8(sequence2->GetName().c_str()) + QString(".fbx"); + QString selectedSequenceFBXStr = QString::fromUtf8(sequence2->GetName().c_str()) + ".fbx"; if (numSelectedNodes > 1) { @@ -1043,7 +1041,7 @@ void CTrackViewNodesCtrl::OnNMRclick(QPoint point) } else { - file = QString(selectedNodes.GetNode(0)->GetName()) + QString(".fbx"); + file = QString::fromUtf8(selectedNodes.GetNode(0)->GetName().c_str()) + QString(".fbx"); } QString path = QFileDialog::getSaveFileName(this, tr("Export Selected Nodes To FBX File"), QString(), tr("FBX Files (*.fbx)")); @@ -1340,7 +1338,7 @@ void CTrackViewNodesCtrl::OnNMRclick(QPoint point) if (animNode || groupNode) { CTrackViewAnimNode* animNode2 = static_cast(pNode); - QString oldName = animNode2->GetName(); + QString oldName = QString::fromUtf8(animNode2->GetName().c_str()); StringDlg dlg(tr("Rename Node")); dlg.SetString(oldName); @@ -1496,7 +1494,7 @@ void CTrackViewNodesCtrl::OnNMRclick(QPoint point) if (animNode) { QString matName; - GetMatNameAndSubMtlIndexFromName(matName, animNode->GetName()); + GetMatNameAndSubMtlIndexFromName(matName, animNode->GetName().c_str()); QString newMatName; newMatName = tr("%1.[%2]").arg(matName).arg(cmd - eMI_SelectSubmaterialBase + 1); CUndo undo("Rename TrackView node"); @@ -1578,7 +1576,7 @@ CTrackViewTrack* CTrackViewNodesCtrl::GetTrackViewTrack(const Export::EntityAnim for (unsigned int trackID = 0; trackID < trackBundle.GetCount(); ++trackID) { CTrackViewTrack* pTrack = trackBundle.GetTrack(trackID); - const QString bundleTrackName = pTrack->GetAnimNode()->GetName(); + const QString bundleTrackName = QString::fromUtf8(pTrack->GetAnimNode()->GetName().c_str()); if (bundleTrackName.compare(nodeName, Qt::CaseInsensitive) != 0) { @@ -2166,7 +2164,7 @@ int CTrackViewNodesCtrl::ShowPopupMenuSingleSelection(SContextMenu& contextMenu, if (bOnNode && !pNode->IsGroupNode()) { AddMenuSeperatorConditional(contextMenu.main, bAppended); - QString string = QString("%1 Tracks").arg(animNode->GetName()); + QString string = QString("%1 Tracks").arg(animNode->GetName().c_str()); contextMenu.main.addAction(string)->setEnabled(false); bool bAppendedTrackFlag = false; @@ -2184,7 +2182,7 @@ int CTrackViewNodesCtrl::ShowPopupMenuSingleSelection(SContextMenu& contextMenu, continue; } - QAction* a = contextMenu.main.addAction(QString(" %1").arg(pTrack2->GetName())); + QAction* a = contextMenu.main.addAction(QString(" %1").arg(pTrack2->GetName().c_str())); a->setData(eMI_ShowHideBase + childIndex); a->setCheckable(true); a->setChecked(!pTrack2->IsHidden()); @@ -2350,12 +2348,11 @@ bool CTrackViewNodesCtrl::FillAddTrackMenu(STrackMenuTreeNode& menuAddTrack, con continue; } } - AZStd::string paramName = animNode->GetParamName(paramType); - name = paramName.c_str(); - QStringList splittedName = name.split("/", Qt::SkipEmptyParts); + name = QString::fromUtf8(animNode->GetParamName(paramType).c_str()); + QStringList splitName = name.split("/", Qt::SkipEmptyParts); STrackMenuTreeNode* pCurrentNode = &menuAddTrack; - for (const QString& segment : splittedName) + for (const QString& segment : splitName) { auto findIter = pCurrentNode->children.find(segment); if (findIter != pCurrentNode->children.end()) @@ -2372,10 +2369,10 @@ bool CTrackViewNodesCtrl::FillAddTrackMenu(STrackMenuTreeNode& menuAddTrack, con // only add tracks to the that STrackMenuTreeNode tree that haven't already been added CTrackViewTrackBundle matchedTracks = animNode->GetTracksByParam(paramType); - if (matchedTracks.GetCount() == 0 && !splittedName.isEmpty()) + if (matchedTracks.GetCount() == 0 && !splitName.isEmpty()) { STrackMenuTreeNode* pParamNode = new STrackMenuTreeNode; - pCurrentNode->children[splittedName.back()] = std::unique_ptr(pParamNode); + pCurrentNode->children[splitName.back()] = std::unique_ptr(pParamNode); pParamNode->paramType = paramType; bTracksToAdd = true; @@ -2466,7 +2463,7 @@ void CTrackViewNodesCtrl::FillAutoCompletionListForFilter() for (unsigned int i = 0; i < animNodeCount; ++i) { - strings << animNodes.GetNode(i)->GetName(); + strings << QString::fromUtf8(animNodes.GetNode(i)->GetName().c_str()); } } else @@ -2583,8 +2580,7 @@ void CTrackViewNodesCtrl::Update() const CTrackViewAnimNode* track = static_cast(node); if (track) { - AZStd::string trackName = track->GetName(); - record->setText(0, trackName.c_str()); + record->setText(0, QString::fromUtf8(track->GetName().c_str())); } } } @@ -2858,7 +2854,7 @@ void CTrackViewNodesCtrl::OnNodeRenamed(CTrackViewNode* pNode, [[maybe_unused]] if (!m_bIgnoreNotifications) { CRecord* pNodeRecord = GetNodeRecord(pNode); - pNodeRecord->setText(0, pNode->GetName()); + pNodeRecord->setText(0, QString::fromUtf8(pNode->GetName().c_str())); update(); } diff --git a/Code/Editor/TrackView/TrackViewNodes.h b/Code/Editor/TrackView/TrackViewNodes.h index d6ed95b88d..e9cf31b2df 100644 --- a/Code/Editor/TrackView/TrackViewNodes.h +++ b/Code/Editor/TrackView/TrackViewNodes.h @@ -66,7 +66,7 @@ public: CRecord(CTrackViewNode* pNode = nullptr); CTrackViewNode* GetNode() const { return m_pNode; } bool IsGroup() const { return m_pNode->GetChildCount() != 0; } - const QString GetName() const { return m_pNode->GetName(); } + const QString GetName() const { return QString::fromUtf8(m_pNode->GetName().c_str()); } // Workaround: CXTPReportRecord::IsVisible is // unreliable after the last visible element diff --git a/Code/Editor/TrackView/TrackViewPythonFuncs.cpp b/Code/Editor/TrackView/TrackViewPythonFuncs.cpp index d50060269b..72da1e0b18 100644 --- a/Code/Editor/TrackView/TrackViewPythonFuncs.cpp +++ b/Code/Editor/TrackView/TrackViewPythonFuncs.cpp @@ -293,8 +293,8 @@ namespace CTrackViewTrack* pTrack = pNode->GetTrackForParameter(paramType); if (!pTrack || (paramFlags & IAnimNode::eSupportedParamFlags_MultipleTracks)) { - const char* name = pNode->GetParamName(paramType); - if (_stricmp(name, paramName) == 0) + AZStd::string name = pNode->GetParamName(paramType); + if (name == paramName) { CUndo undo("Create track"); if (!pNode->CreateTrack(paramType)) diff --git a/Code/Editor/TrackView/TrackViewSequence.cpp b/Code/Editor/TrackView/TrackViewSequence.cpp index f66e5276cd..af20aadf46 100644 --- a/Code/Editor/TrackView/TrackViewSequence.cpp +++ b/Code/Editor/TrackView/TrackViewSequence.cpp @@ -894,14 +894,14 @@ bool CTrackViewSequence::SetName(const char* name) return false; } - const char* oldName = GetName(); - if (0 != strcmp(name, oldName)) + AZStd::string oldName = GetName(); + if (name != oldName) { m_pAnimSequence->SetName(name); MarkAsModified(); AzToolsFramework::ScopedUndoBatch undoBatch("Rename Sequence"); - GetSequence()->OnNodeRenamed(this, oldName); + GetSequence()->OnNodeRenamed(this, oldName.c_str()); undoBatch.MarkEntityDirty(m_pAnimSequence->GetSequenceEntityId()); } diff --git a/Code/Editor/TrackView/TrackViewSequence.h b/Code/Editor/TrackView/TrackViewSequence.h index 66412360f2..69858adf8f 100644 --- a/Code/Editor/TrackView/TrackViewSequence.h +++ b/Code/Editor/TrackView/TrackViewSequence.h @@ -102,7 +102,7 @@ public: // ITrackViewNode virtual ETrackViewNodeType GetNodeType() const override { return eTVNT_Sequence; } - virtual const char* GetName() const override { return m_pAnimSequence->GetName(); } + virtual AZStd::string GetName() const override { return m_pAnimSequence->GetName(); } virtual bool SetName(const char* pName) override; virtual bool CanBeRenamed() const override { return true; } diff --git a/Code/Editor/TrackView/TrackViewSequenceManager.cpp b/Code/Editor/TrackView/TrackViewSequenceManager.cpp index 780c8f04ce..d7c1e3c709 100644 --- a/Code/Editor/TrackView/TrackViewSequenceManager.cpp +++ b/Code/Editor/TrackView/TrackViewSequenceManager.cpp @@ -75,7 +75,7 @@ CTrackViewSequence* CTrackViewSequenceManager::GetSequenceByName(QString name) c { CTrackViewSequence* sequence = (*iter).get(); - if (sequence->GetName() == name) + if (QString::fromUtf8(sequence->GetName().c_str()) == name) { return sequence; } @@ -371,8 +371,8 @@ void CTrackViewSequenceManager::SortSequences() std::stable_sort(m_sequences.begin(), m_sequences.end(), [](const std::unique_ptr& a, const std::unique_ptr& b) -> bool { - QString aName = a.get()->GetName(); - QString bName = b.get()->GetName(); + QString aName = QString::fromUtf8(a.get()->GetName().c_str()); + QString bName = QString::fromUtf8(b.get()->GetName().c_str()); return aName < bName; }); } diff --git a/Code/Editor/TrackView/TrackViewTrack.cpp b/Code/Editor/TrackView/TrackViewTrack.cpp index 64fd252534..27d6bbee54 100644 --- a/Code/Editor/TrackView/TrackViewTrack.cpp +++ b/Code/Editor/TrackView/TrackViewTrack.cpp @@ -472,7 +472,7 @@ void CTrackViewTrack::RestoreFromMemento(const CTrackViewTrackMemento& memento) } ////////////////////////////////////////////////////////////////////////// -const char* CTrackViewTrack::GetName() const +AZStd::string CTrackViewTrack::GetName() const { CTrackViewNode* pParentNode = GetParentNode(); @@ -810,7 +810,7 @@ void CTrackViewTrack::CopyKeysToClipboard(XmlNodeRef& xmlNode, const bool bOnlyS } XmlNodeRef childNode = xmlNode->newChild("Track"); - childNode->setAttr("name", GetName()); + childNode->setAttr("name", GetName().c_str()); GetParameterType().SaveToXml(childNode); childNode->setAttr("valueType", static_cast(GetValueType())); diff --git a/Code/Editor/TrackView/TrackViewTrack.h b/Code/Editor/TrackView/TrackViewTrack.h index bbe81f6377..1eef9c60e9 100644 --- a/Code/Editor/TrackView/TrackViewTrack.h +++ b/Code/Editor/TrackView/TrackViewTrack.h @@ -80,7 +80,7 @@ public: CTrackViewAnimNode* GetAnimNode() const; // Name getter - virtual const char* GetName() const; + AZStd::string GetName() const override; // CTrackViewNode virtual ETrackViewNodeType GetNodeType() const override { return eTVNT_Track; } diff --git a/Code/Editor/TrackView/TrackViewUndo.cpp b/Code/Editor/TrackView/TrackViewUndo.cpp index c9cdc62bc3..ee31dfe2bf 100644 --- a/Code/Editor/TrackView/TrackViewUndo.cpp +++ b/Code/Editor/TrackView/TrackViewUndo.cpp @@ -75,7 +75,7 @@ CTrackViewTrack* CUndoComponentEntityTrackObject::FindTrack(CTrackViewSequence* CTrackViewTrack* curTrack = allTracks.GetTrack(trackIndex); if (curTrack->GetAnimNode() && curTrack->GetAnimNode()->GetComponentId() == m_trackComponentId) { - if (0 == azstricmp(curTrack->GetName(), m_trackName.c_str())) + if (curTrack->GetName() == m_trackName) { CTrackViewAnimNode* parentAnimNode = static_cast(curTrack->GetAnimNode()->GetParentNode()); if (parentAnimNode && parentAnimNode->GetAzEntityId() == m_entityId) diff --git a/Code/Editor/TrackViewNewSequenceDialog.cpp b/Code/Editor/TrackViewNewSequenceDialog.cpp index 287f69df47..e922f345cc 100644 --- a/Code/Editor/TrackViewNewSequenceDialog.cpp +++ b/Code/Editor/TrackViewNewSequenceDialog.cpp @@ -81,7 +81,7 @@ void CTVNewSequenceDialog::OnOK() for (unsigned int k = 0; k < GetIEditor()->GetSequenceManager()->GetCount(); ++k) { CTrackViewSequence* pSequence = GetIEditor()->GetSequenceManager()->GetSequenceByIndex(k); - QString fullname = pSequence->GetName(); + QString fullname = QString::fromUtf8(pSequence->GetName().c_str()); if (fullname.compare(m_sequenceName, Qt::CaseInsensitive) == 0) { diff --git a/Code/Legacy/CryCommon/IMovieSystem.h b/Code/Legacy/CryCommon/IMovieSystem.h index 2385f3c358..d46d00361c 100644 --- a/Code/Legacy/CryCommon/IMovieSystem.h +++ b/Code/Legacy/CryCommon/IMovieSystem.h @@ -378,7 +378,7 @@ struct IAnimTrack virtual int GetSubTrackCount() const = 0; // Retrieve pointer the specfied sub track. virtual IAnimTrack* GetSubTrack(int nIndex) const = 0; - virtual const char* GetSubTrackName(int nIndex) const = 0; + virtual AZStd::string GetSubTrackName(int nIndex) const = 0; virtual void SetSubTrackName(int nIndex, const char* name) = 0; ////////////////////////////////////////////////////////////////////////// @@ -738,7 +738,7 @@ public: // Returns name of supported parameter of this animation node or NULL if not available // Arguments: // paramType - parameter id - virtual const char* GetParamName(const CAnimParamType& paramType) const = 0; + virtual AZStd::string GetParamName(const CAnimParamType& paramType) const = 0; // Description: // Returns the params value type diff --git a/Code/Legacy/CryCommon/LyShine/Animation/IUiAnimation.h b/Code/Legacy/CryCommon/LyShine/Animation/IUiAnimation.h index e04fb6ada7..8cd47293f0 100644 --- a/Code/Legacy/CryCommon/LyShine/Animation/IUiAnimation.h +++ b/Code/Legacy/CryCommon/LyShine/Animation/IUiAnimation.h @@ -442,7 +442,7 @@ struct IUiAnimTrack virtual int GetSubTrackCount() const = 0; // Retrieve pointer the specfied sub track. virtual IUiAnimTrack* GetSubTrack(int nIndex) const = 0; - virtual const char* GetSubTrackName(int nIndex) const = 0; + virtual AZStd::string GetSubTrackName(int nIndex) const = 0; virtual void SetSubTrackName(int nIndex, const char* name) = 0; ////////////////////////////////////////////////////////////////////////// @@ -634,7 +634,7 @@ public: virtual void SetName(const char* name) = 0; //! Get node name. - virtual const char* GetName() = 0; + virtual AZStd::string GetName() = 0; // Get Type of this node. virtual EUiAnimNodeType GetType() const = 0; @@ -710,13 +710,13 @@ public: // Returns name of supported parameter of this animation node or NULL if not available // Arguments: // paramType - parameter id - virtual const char* GetParamName(const CUiAnimParamType& paramType) const = 0; + virtual AZStd::string GetParamName(const CUiAnimParamType& paramType) const = 0; // Description: // Returns name of supported parameter of this animation node or NULL if not available // Arguments: // paramType - parameter id - virtual const char* GetParamNameForTrack(const CUiAnimParamType& paramType, [[maybe_unused]] const IUiAnimTrack* track) const { return GetParamName(paramType); } + virtual AZStd::string GetParamNameForTrack(const CUiAnimParamType& paramType, [[maybe_unused]] const IUiAnimTrack* track) const { return GetParamName(paramType); } // Description: // Returns the params value type diff --git a/Gems/LyShine/Code/Editor/Animation/AnimationContext.cpp b/Gems/LyShine/Code/Editor/Animation/AnimationContext.cpp index c2c05277a8..8f8864106b 100644 --- a/Gems/LyShine/Code/Editor/Animation/AnimationContext.cpp +++ b/Gems/LyShine/Code/Editor/Animation/AnimationContext.cpp @@ -521,7 +521,7 @@ void CUiAnimationContext::OnEditorNotifyEvent(EEditorNotifyEvent event) case eNotify_OnBeginLayerExport: if (m_pSequence) { - m_sequenceName = m_pSequence->GetName(); + m_sequenceName = QString::fromUtf8(m_pSequence->GetName().c_str()); } else { diff --git a/Gems/LyShine/Code/Editor/Animation/UiAVSequenceProps.cpp b/Gems/LyShine/Code/Editor/Animation/UiAVSequenceProps.cpp index db8a96830b..a2df73cf26 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAVSequenceProps.cpp +++ b/Gems/LyShine/Code/Editor/Animation/UiAVSequenceProps.cpp @@ -45,7 +45,7 @@ CUiAVSequenceProps::~CUiAVSequenceProps() // CUiAVSequenceProps message handlers bool CUiAVSequenceProps::OnInitDialog() { - QString name = m_pSequence->GetName(); + QString name = QString::fromUtf8(m_pSequence->GetName().c_str()); ui->NAME->setText(name); ui->MOVE_SCALE_KEYS->setChecked(false); @@ -135,7 +135,7 @@ void CUiAVSequenceProps::OnOK() ac->UpdateTimeRange(); } - QString seqName = m_pSequence->GetName(); + QString seqName = QString::fromUtf8(m_pSequence->GetName().c_str()); if (name != seqName) { // Rename sequence. diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewAnimNode.cpp b/Gems/LyShine/Code/Editor/Animation/UiAnimViewAnimNode.cpp index 3646e5a413..d0e2e15f67 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewAnimNode.cpp +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewAnimNode.cpp @@ -1246,7 +1246,7 @@ CUiAnimViewAnimNodeBundle CUiAnimViewAnimNode::GetAnimNodesByName(const char* pN { CUiAnimViewAnimNodeBundle bundle; - QString nodeName = GetName(); + QString nodeName = QString::fromUtf8(GetName().c_str()); if (GetNodeType() == eUiAVNT_AnimNode && QString::compare(pName, nodeName, Qt::CaseInsensitive) == 0) { bundle.AppendAnimNode(this); @@ -1266,17 +1266,15 @@ CUiAnimViewAnimNodeBundle CUiAnimViewAnimNode::GetAnimNodesByName(const char* pN } ////////////////////////////////////////////////////////////////////////// -const char* CUiAnimViewAnimNode::GetParamName(const CUiAnimParamType& paramType) const +AZStd::string CUiAnimViewAnimNode::GetParamName(const CUiAnimParamType& paramType) const { - const char* pName = m_pAnimNode->GetParamName(paramType); - return pName ? pName : ""; + return m_pAnimNode->GetParamName(paramType); } ////////////////////////////////////////////////////////////////////////// -const char* CUiAnimViewAnimNode::GetParamNameForTrack(const CUiAnimParamType& paramType, const IUiAnimTrack* track) const +AZStd::string CUiAnimViewAnimNode::GetParamNameForTrack(const CUiAnimParamType& paramType, const IUiAnimTrack* track) const { - const char* pName = m_pAnimNode->GetParamNameForTrack(paramType, track); - return pName ? pName : ""; + return m_pAnimNode->GetParamNameForTrack(paramType, track); } ////////////////////////////////////////////////////////////////////////// @@ -1413,7 +1411,7 @@ void CUiAnimViewAnimNode::UpdateDynamicParams() void CUiAnimViewAnimNode::CopyKeysToClipboard(XmlNodeRef& xmlNode, const bool bOnlySelectedKeys, const bool bOnlyFromSelectedTracks) { XmlNodeRef childNode = xmlNode->createNode("Node"); - childNode->setAttr("name", GetName()); + childNode->setAttr("name", GetName().c_str()); childNode->setAttr("type", GetType()); for (auto iter = m_childNodes.begin(); iter != m_childNodes.end(); ++iter) @@ -1557,7 +1555,7 @@ bool CUiAnimViewAnimNode::IsValidReparentingTo(CUiAnimViewAnimNode* pNewParent) } // Check if the new parent already contains a node with this name - CUiAnimViewAnimNodeBundle foundNodes = pNewParent->GetAnimNodesByName(GetName()); + CUiAnimViewAnimNodeBundle foundNodes = pNewParent->GetAnimNodesByName(GetName().c_str()); if (foundNodes.GetCount() > 1 || (foundNodes.GetCount() == 1 && foundNodes.GetNode(0) != this)) { return false; diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewAnimNode.h b/Gems/LyShine/Code/Editor/Animation/UiAnimViewAnimNode.h index 72dc7344ec..abc4a84c8c 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewAnimNode.h +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewAnimNode.h @@ -118,7 +118,7 @@ public: virtual bool IsActive(); // Name setter/getter - virtual const char* GetName() const override { return m_pAnimNode->GetName(); } + AZStd::string GetName() const override { return m_pAnimNode->GetName(); } virtual bool SetName(const char* pName) override; virtual bool CanBeRenamed() const override; @@ -164,8 +164,8 @@ public: // Param unsigned int GetParamCount() const; CUiAnimParamType GetParamType(unsigned int index) const; - const char* GetParamName(const CUiAnimParamType& paramType) const; - const char* GetParamNameForTrack(const CUiAnimParamType& paramType, const IUiAnimTrack* track) const; + AZStd::string GetParamName(const CUiAnimParamType& paramType) const; + AZStd::string GetParamNameForTrack(const CUiAnimParamType& paramType, const IUiAnimTrack* track) const; bool IsParamValid(const CUiAnimParamType& param) const; IUiAnimNode::ESupportedParamFlags GetParamFlags(const CUiAnimParamType& paramType) const; EUiAnimValue GetParamValueType(const CUiAnimParamType& paramType) const; diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewDialog.cpp b/Gems/LyShine/Code/Editor/Animation/UiAnimViewDialog.cpp index 6a3afe2036..80247f653d 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewDialog.cpp +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewDialog.cpp @@ -992,7 +992,7 @@ void CUiAnimViewDialog::ReloadSequencesComboBox() for (unsigned int k = 0; k < numSequences; ++k) { CUiAnimViewSequence* pSequence = pSequenceManager->GetSequenceByIndex(k); - QString fullname = pSequence->GetName(); + QString fullname = QString::fromUtf8(pSequence->GetName().c_str()); m_sequencesComboBox->addItem(fullname); } } @@ -1132,7 +1132,7 @@ void CUiAnimViewDialog::OnSequenceChanged(CUiAnimViewSequence* pSequence) if (pSequence) { - m_currentSequenceName = pSequence->GetName(); + m_currentSequenceName = QString::fromUtf8(pSequence->GetName().c_str()); pSequence->Reset(true); SaveZoomScrollSettings(); @@ -1733,7 +1733,7 @@ void CUiAnimViewDialog::OnNodeRenamed(CUiAnimViewNode* pNode, const char* pOldNa { if (m_currentSequenceName == QString(pOldName)) { - m_currentSequenceName = pNode->GetName(); + m_currentSequenceName = QString::fromUtf8(pNode->GetName().c_str()); } ReloadSequencesComboBox(); diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewDopeSheetBase.cpp b/Gems/LyShine/Code/Editor/Animation/UiAnimViewDopeSheetBase.cpp index 4e67fb520e..a41fea0157 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewDopeSheetBase.cpp +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewDopeSheetBase.cpp @@ -2980,7 +2980,7 @@ void CUiAnimViewDopeSheetBase::DrawNodeTrack(CUiAnimViewAnimNode* pAnimNode, QPa const QRect textRect = trackRect.adjusted(4, 0, -4, 0); - QString sAnimNodeName = pAnimNode->GetName(); + QString sAnimNodeName = QString::fromUtf8(pAnimNode->GetName().c_str()); const bool hasObsoleteTrack = pAnimNode->HasObsoleteTrack(); if (hasObsoleteTrack) diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewFindDlg.cpp b/Gems/LyShine/Code/Editor/Animation/UiAnimViewFindDlg.cpp index 511866db43..0b4ce7f633 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewFindDlg.cpp +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewFindDlg.cpp @@ -61,8 +61,8 @@ void CUiAnimViewFindDlg::FillData() { IUiAnimNode* pNode = seq->GetNode(i); ObjName obj; - obj.m_objName = pNode->GetName(); - obj.m_directorName = pNode->HasDirectorAsParent() ? pNode->HasDirectorAsParent()->GetName() : ""; + obj.m_objName = QString::fromUtf8(pNode->GetName().c_str()); + obj.m_directorName = pNode->HasDirectorAsParent() ? QString::fromUtf8(pNode->HasDirectorAsParent()->GetName().c_str()) : ""; AZStd::string fullname = seq->GetName(); obj.m_seqName = fullname.c_str(); m_objs.push_back(obj); diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewNewSequenceDialog.cpp b/Gems/LyShine/Code/Editor/Animation/UiAnimViewNewSequenceDialog.cpp index 3dd49574fd..e7ad1b91ea 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewNewSequenceDialog.cpp +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewNewSequenceDialog.cpp @@ -46,7 +46,7 @@ void CUiAVNewSequenceDialog::OnOK() for (unsigned int k = 0; k < CUiAnimViewSequenceManager::GetSequenceManager()->GetCount(); ++k) { CUiAnimViewSequence* pSequence = CUiAnimViewSequenceManager::GetSequenceManager()->GetSequenceByIndex(k); - QString fullname = pSequence->GetName(); + QString fullname = QString::fromUtf8(pSequence->GetName().c_str()); if (fullname.compare(m_sequenceName, Qt::CaseInsensitive) == 0) { diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewNode.cpp b/Gems/LyShine/Code/Editor/Animation/UiAnimViewNode.cpp index 2b14a38015..f252d58b50 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewNode.cpp +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewNode.cpp @@ -598,7 +598,7 @@ bool CUiAnimViewNode::operator<(const CUiAnimViewNode& otherNode) const if (thisTypeOrder == otherTypeOrder) { // Same node type, sort by name - return azstricmp(thisAnimNode.GetName(), otherAnimNode.GetName()) < 0; + return thisAnimNode.GetName() < otherAnimNode.GetName(); } return thisTypeOrder < otherTypeOrder; @@ -610,7 +610,7 @@ bool CUiAnimViewNode::operator<(const CUiAnimViewNode& otherNode) const if (thisTrack.GetParameterType() == otherTrack.GetParameterType()) { // Same parameter type, sort by name - return azstricmp(thisTrack.GetName(), otherTrack.GetName()) < 0; + return thisTrack.GetName() < otherTrack.GetName(); } return thisTrack.GetParameterType() < otherTrack.GetParameterType(); diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewNode.h b/Gems/LyShine/Code/Editor/Animation/UiAnimViewNode.h index 5a82d1be7f..4f090729aa 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewNode.h +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewNode.h @@ -159,7 +159,7 @@ public: virtual ~CUiAnimViewNode() {} // Name - virtual const char* GetName() const = 0; + virtual AZStd::string GetName() const = 0; virtual bool SetName([[maybe_unused]] const char* pName) { return false; }; virtual bool CanBeRenamed() const { return false; } diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewNodes.cpp b/Gems/LyShine/Code/Editor/Animation/UiAnimViewNodes.cpp index 74d2c7d4fb..06725d4672 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewNodes.cpp +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewNodes.cpp @@ -413,7 +413,7 @@ CUiAnimViewNodesCtrl::CRecord* CUiAnimViewNodesCtrl::AddAnimNodeRecord(CRecord* { CRecord* pNewRecord = new CRecord(pAnimNode); - pNewRecord->setText(0, pAnimNode->GetName()); + pNewRecord->setText(0, QString::fromUtf8(pAnimNode->GetName().c_str())); UpdateUiAnimNodeRecord(pNewRecord, pAnimNode); pParentRecord->insertChild(GetInsertPosition(pParentRecord, pAnimNode), pNewRecord); FillNodesRec(pNewRecord, pAnimNode); @@ -426,7 +426,7 @@ CUiAnimViewNodesCtrl::CRecord* CUiAnimViewNodesCtrl::AddTrackRecord(CRecord* pPa { CRecord* pNewTrackRecord = new CRecord(pTrack); pNewTrackRecord->setSizeHint(0, QSize(30, 18)); - pNewTrackRecord->setText(0, pTrack->GetName()); + pNewTrackRecord->setText(0, QString::fromUtf8(pTrack->GetName().c_str())); UpdateTrackRecord(pNewTrackRecord, pTrack); pParentRecord->insertChild(GetInsertPosition(pParentRecord, pTrack), pNewTrackRecord); FillNodesRec(pNewTrackRecord, pTrack); @@ -576,7 +576,7 @@ void CUiAnimViewNodesCtrl::UpdateUiAnimNodeRecord(CRecord* pRecord, CUiAnimViewA int nNodeImage = GetIconIndexForNode(nodeType); assert(m_imageList.contains(nNodeImage)); - QString nodeName = pAnimNode->GetName(); + QString nodeName = QString::fromUtf8(pAnimNode->GetName().c_str()); pRecord->setIcon(0, m_imageList[nNodeImage]); @@ -635,7 +635,7 @@ void CUiAnimViewNodesCtrl::OnFillItems() m_nodeToRecordMap.clear(); CRecord* pRootGroupRec = new CRecord(pSequence); - pRootGroupRec->setText(0, pSequence->GetName()); + pRootGroupRec->setText(0, QString::fromUtf8(pSequence->GetName().c_str())); QFont f = font(); f.setBold(true); pRootGroupRec->setData(0, Qt::FontRole, f); @@ -987,7 +987,7 @@ void CUiAnimViewNodesCtrl::OnNMRclick(QPoint point) if (pAnimNode) { QString matName; - GetMatNameAndSubMtlIndexFromName(matName, pAnimNode->GetName()); + GetMatNameAndSubMtlIndexFromName(matName, pAnimNode->GetName().c_str()); QString newMatName; newMatName = QStringLiteral("%1.[%2]").arg(matName).arg(cmd - eMI_SelectSubmaterialBase + 1); UiAnimUndo undo("Rename Animation node"); @@ -1232,7 +1232,7 @@ int CUiAnimViewNodesCtrl::ShowPopupMenuSingleSelection(UiAnimContextMenu& contex if (bOnNode && !pNode->IsGroupNode()) { AddMenuSeperatorConditional(contextMenu.main, bAppended); - QString string = QString("%1 Tracks").arg(pAnimNode->GetName()); + QString string = QString("%1 Tracks").arg(QString::fromUtf8(pAnimNode->GetName().c_str())); contextMenu.main.addAction(string)->setEnabled(false); bool bAppendedTrackFlag = false; @@ -1250,7 +1250,7 @@ int CUiAnimViewNodesCtrl::ShowPopupMenuSingleSelection(UiAnimContextMenu& contex continue; } - QAction* a = contextMenu.main.addAction(QString(" %1").arg(pTrack2->GetName())); + QAction* a = contextMenu.main.addAction(QString(" %1").arg(QString::fromUtf8(pTrack2->GetName().c_str()))); a->setData(eMI_ShowHideBase + childIndex); a->setCheckable(true); a->setChecked(!pTrack2->IsHidden()); @@ -1386,7 +1386,7 @@ void CUiAnimViewNodesCtrl::FillAutoCompletionListForFilter() for (unsigned int i = 0; i < animNodeCount; ++i) { - strings << QString(animNodes.GetNode(i)->GetName()); + strings << QString::fromUtf8(animNodes.GetNode(i)->GetName().c_str()); } } else @@ -1690,7 +1690,7 @@ void CUiAnimViewNodesCtrl::OnNodeRenamed(CUiAnimViewNode* pNode, [[maybe_unused] if (!m_bIgnoreNotifications) { CRecord* pNodeRecord = GetNodeRecord(pNode); - pNodeRecord->setText(0, pNode->GetName()); + pNodeRecord->setText(0, QString::fromUtf8(pNode->GetName().c_str())); update(); } diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewNodes.h b/Gems/LyShine/Code/Editor/Animation/UiAnimViewNodes.h index a5cce764e3..12d6af9ac6 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewNodes.h +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewNodes.h @@ -56,7 +56,7 @@ public: CRecord(CUiAnimViewNode* pNode = nullptr); CUiAnimViewNode* GetNode() const { return m_pNode; } bool IsGroup() const { return m_pNode->GetChildCount() != 0; } - const QString GetName() const { return m_pNode->GetName(); } + const QString GetName() const { return QString::fromUtf8(m_pNode->GetName().c_str()); } // Workaround: CXTPReportRecord::IsVisible is // unreliable after the last visible element diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewSequence.cpp b/Gems/LyShine/Code/Editor/Animation/UiAnimViewSequence.cpp index d8888124a4..7e720dfaa7 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewSequence.cpp +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewSequence.cpp @@ -334,7 +334,7 @@ void CUiAnimViewSequence::OnNodeRenamed(CUiAnimViewNode* pNode, const char* pOld bool bLightAnimationSetActive = GetFlags() & IUiAnimSequence::eSeqFlags_LightAnimationSet; if (bLightAnimationSetActive) { - UpdateLightAnimationRefs(pOldName, pNode->GetName()); + UpdateLightAnimationRefs(pOldName, pNode->GetName().c_str()); } if (m_bNoNotifications) diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewSequence.h b/Gems/LyShine/Code/Editor/Animation/UiAnimViewSequence.h index 69c933509f..3aa8d74563 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewSequence.h +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewSequence.h @@ -86,7 +86,7 @@ public: // IUiAnimViewNode virtual EUiAnimViewNodeType GetNodeType() const override { return eUiAVNT_Sequence; } - virtual const char* GetName() const override { return m_pAnimSequence->GetName(); } + AZStd::string GetName() const override { return m_pAnimSequence->GetName(); } virtual bool SetName(const char* pName) override; virtual bool CanBeRenamed() const override { return true; } diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewSequenceManager.cpp b/Gems/LyShine/Code/Editor/Animation/UiAnimViewSequenceManager.cpp index 7a0d637a9e..4cfeeaff6a 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewSequenceManager.cpp +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewSequenceManager.cpp @@ -58,7 +58,7 @@ CUiAnimViewSequence* CUiAnimViewSequenceManager::GetSequenceByName(QString name) { CUiAnimViewSequence* pSequence = (*iter).get(); - if (pSequence->GetName() == name) + if (QString::fromUtf8(pSequence->GetName().c_str()) == name) { return pSequence; } @@ -156,8 +156,8 @@ void CUiAnimViewSequenceManager::SortSequences() std::stable_sort(m_sequences.begin(), m_sequences.end(), [](const std::unique_ptr& a, const std::unique_ptr& b) -> bool { - QString aName = a.get()->GetName(); - QString bName = b.get()->GetName(); + QString aName = QString::fromUtf8(a.get()->GetName().c_str()); + QString bName = QString::fromUtf8(b.get()->GetName().c_str()); return aName < bName; }); } diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewSplineCtrl.cpp b/Gems/LyShine/Code/Editor/Animation/UiAnimViewSplineCtrl.cpp index 8edd13f8cc..c99060fc32 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewSplineCtrl.cpp +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewSplineCtrl.cpp @@ -28,7 +28,7 @@ public: CUndoUiAnimViewSplineCtrl(CUiAnimViewSplineCtrl* pCtrl, std::vector& splineContainer) : CUndoAnimKeySelection(CUiAnimViewSequenceManager::GetSequenceManager()->GetAnimationContext()->GetSequence()) { - m_sequenceName = CUiAnimViewSequenceManager::GetSequenceManager()->GetAnimationContext()->GetSequence()->GetName(); + m_sequenceName = QString::fromUtf8(CUiAnimViewSequenceManager::GetSequenceManager()->GetAnimationContext()->GetSequence()->GetName().c_str()); m_pCtrl = pCtrl; diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewTrack.cpp b/Gems/LyShine/Code/Editor/Animation/UiAnimViewTrack.cpp index 2984e152cd..651ca2cebb 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewTrack.cpp +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewTrack.cpp @@ -404,7 +404,7 @@ void CUiAnimViewTrack::RestoreFromMemento(const CUiAnimViewTrackMemento& memento } ////////////////////////////////////////////////////////////////////////// -const char* CUiAnimViewTrack::GetName() const +AZStd::string CUiAnimViewTrack::GetName() const { CUiAnimViewNode* pParentNode = GetParentNode(); @@ -629,7 +629,7 @@ void CUiAnimViewTrack::CopyKeysToClipboard(XmlNodeRef& xmlNode, const bool bOnly EBUS_EVENT_RESULT(animationSystem, UiEditorAnimationBus, GetAnimationSystem); XmlNodeRef childNode = xmlNode->newChild("Track"); - childNode->setAttr("name", GetName()); + childNode->setAttr("name", GetName().c_str()); GetParameterType().Serialize(animationSystem, childNode, false); childNode->setAttr("valueType", GetValueType()); diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewTrack.h b/Gems/LyShine/Code/Editor/Animation/UiAnimViewTrack.h index a2e38edc51..b16dbf6dfa 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewTrack.h +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewTrack.h @@ -73,7 +73,7 @@ public: CUiAnimViewAnimNode* GetAnimNode() const; // Name getter - virtual const char* GetName() const; + AZStd::string GetName() const override; // CUiAnimViewNode virtual EUiAnimViewNodeType GetNodeType() const override { return eUiAVNT_Track; } diff --git a/Gems/LyShine/Code/Source/Animation/AnimNode.cpp b/Gems/LyShine/Code/Source/Animation/AnimNode.cpp index a87dae6fbd..533a1c7b46 100644 --- a/Gems/LyShine/Code/Source/Animation/AnimNode.cpp +++ b/Gems/LyShine/Code/Source/Animation/AnimNode.cpp @@ -65,7 +65,7 @@ int CUiAnimNode::GetTrackCount() const return static_cast(m_tracks.size()); } -const char* CUiAnimNode::GetParamName(const CUiAnimParamType& paramType) const +AZStd::string CUiAnimNode::GetParamName(const CUiAnimParamType& paramType) const { SParamInfo info; if (GetParamInfoFromType(paramType, info)) @@ -636,7 +636,7 @@ void CUiAnimNode::Serialize(XmlNodeRef& xmlNode, bool bLoading, bool bLoadEmptyT EUiAnimNodeType nodeType = GetType(); static_cast(GetUiAnimationSystem())->SerializeNodeType(nodeType, xmlNode, bLoading, IUiAnimSequence::kSequenceVersion, m_flags); - xmlNode->setAttr("Name", GetName()); + xmlNode->setAttr("Name", GetName().c_str()); // Don't store expanded or selected flags int flags = GetFlags() & ~(eUiAnimNodeFlags_Expanded | eUiAnimNodeFlags_EntitySelected); diff --git a/Gems/LyShine/Code/Source/Animation/AnimNode.h b/Gems/LyShine/Code/Source/Animation/AnimNode.h index dc3144dfba..6ac198a5c7 100644 --- a/Gems/LyShine/Code/Source/Animation/AnimNode.h +++ b/Gems/LyShine/Code/Source/Animation/AnimNode.h @@ -39,7 +39,7 @@ public: , valueType(_valueType) , flags(_flags) {}; - const char* name; // parameter name. + AZStd::string name; // parameter name. CUiAnimParamType paramType; // parameter id. EUiAnimValue valueType; // value type, defines type of track to use for animating this parameter. ESupportedParamFlags flags; // combination of flags from ESupportedParamFlags. @@ -58,7 +58,7 @@ public: ////////////////////////////////////////////////////////////////////////// void SetName(const char* name) override { m_name = name; }; - const char* GetName() { return m_name.c_str(); }; + AZStd::string GetName() override { return m_name; }; void SetSequence(IUiAnimSequence* pSequence) override { m_pSequence = pSequence; } // Return Animation Sequence that owns this node. @@ -81,7 +81,7 @@ public: ////////////////////////////////////////////////////////////////////////// bool IsParamValid(const CUiAnimParamType& paramType) const; - virtual const char* GetParamName(const CUiAnimParamType& param) const; + AZStd::string GetParamName(const CUiAnimParamType& param) const override; virtual EUiAnimValue GetParamValueType(const CUiAnimParamType& paramType) const; virtual IUiAnimNode::ESupportedParamFlags GetParamFlags(const CUiAnimParamType& paramType) const; virtual unsigned int GetParamCount() const { return 0; }; diff --git a/Gems/LyShine/Code/Source/Animation/AnimSplineTrack.h b/Gems/LyShine/Code/Source/Animation/AnimSplineTrack.h index cd94277795..0bc625155a 100644 --- a/Gems/LyShine/Code/Source/Animation/AnimSplineTrack.h +++ b/Gems/LyShine/Code/Source/Animation/AnimSplineTrack.h @@ -47,7 +47,7 @@ public: virtual int GetSubTrackCount() const { return 0; }; virtual IUiAnimTrack* GetSubTrack([[maybe_unused]] int nIndex) const { return 0; }; - virtual const char* GetSubTrackName([[maybe_unused]] int nIndex) const { return NULL; }; + AZStd::string GetSubTrackName([[maybe_unused]] int nIndex) const override { return AZStd::string(); }; virtual void SetSubTrackName([[maybe_unused]] int nIndex, [[maybe_unused]] const char* name) { assert(0); } virtual const CUiAnimParamType& GetParameterType() const { return m_nParamType; }; diff --git a/Gems/LyShine/Code/Source/Animation/AnimTrack.h b/Gems/LyShine/Code/Source/Animation/AnimTrack.h index df0ae3a805..9645572e3e 100644 --- a/Gems/LyShine/Code/Source/Animation/AnimTrack.h +++ b/Gems/LyShine/Code/Source/Animation/AnimTrack.h @@ -32,7 +32,7 @@ public: virtual int GetSubTrackCount() const { return 0; }; virtual IUiAnimTrack* GetSubTrack([[maybe_unused]] int nIndex) const { return 0; }; - virtual const char* GetSubTrackName([[maybe_unused]] int nIndex) const { return NULL; }; + AZStd::string GetSubTrackName([[maybe_unused]] int nIndex) const override { return AZStd::string(); }; virtual void SetSubTrackName([[maybe_unused]] int nIndex, [[maybe_unused]] const char* name) { assert(0); } virtual const CUiAnimParamType& GetParameterType() const { return m_nParamType; }; diff --git a/Gems/LyShine/Code/Source/Animation/AzEntityNode.cpp b/Gems/LyShine/Code/Source/Animation/AzEntityNode.cpp index 814d1404b4..4a48fbb05c 100644 --- a/Gems/LyShine/Code/Source/Animation/AzEntityNode.cpp +++ b/Gems/LyShine/Code/Source/Animation/AzEntityNode.cpp @@ -384,7 +384,7 @@ void CUiAnimAzEntityNode::ComputeOffsetsFromElementNames() } ////////////////////////////////////////////////////////////////////////// -const char* CUiAnimAzEntityNode::GetParamName(const CUiAnimParamType& param) const +AZStd::string CUiAnimAzEntityNode::GetParamName(const CUiAnimParamType& param) const { SParamInfo info; if (GetParamInfoFromType(param, info)) @@ -402,7 +402,7 @@ const char* CUiAnimAzEntityNode::GetParamName(const CUiAnimParamType& param) con } ////////////////////////////////////////////////////////////////////////// -const char* CUiAnimAzEntityNode::GetParamNameForTrack(const CUiAnimParamType& param, const IUiAnimTrack* track) const +AZStd::string CUiAnimAzEntityNode::GetParamNameForTrack(const CUiAnimParamType& param, const IUiAnimTrack* track) const { // for Az Component Fields we use the name from the ClassElement if (param == eUiAnimParamType_AzComponentField) diff --git a/Gems/LyShine/Code/Source/Animation/AzEntityNode.h b/Gems/LyShine/Code/Source/Animation/AzEntityNode.h index 56680f1094..9771ac7be3 100644 --- a/Gems/LyShine/Code/Source/Animation/AzEntityNode.h +++ b/Gems/LyShine/Code/Source/Animation/AzEntityNode.h @@ -91,8 +91,8 @@ public: ////////////////////////////////////////////////////////////////////////// virtual unsigned int GetParamCount() const; virtual CUiAnimParamType GetParamType(unsigned int nIndex) const; - virtual const char* GetParamName(const CUiAnimParamType& param) const; - const char* GetParamNameForTrack(const CUiAnimParamType& param, const IUiAnimTrack* track) const override; + AZStd::string GetParamName(const CUiAnimParamType& param) const override; + AZStd::string GetParamNameForTrack(const CUiAnimParamType& param, const IUiAnimTrack* track) const override; static int GetParamCountStatic(); static bool GetParamInfoStatic(int nIndex, SParamInfo& info); diff --git a/Gems/LyShine/Code/Source/Animation/CompoundSplineTrack.cpp b/Gems/LyShine/Code/Source/Animation/CompoundSplineTrack.cpp index dee96ee22a..a9b7dde6cd 100644 --- a/Gems/LyShine/Code/Source/Animation/CompoundSplineTrack.cpp +++ b/Gems/LyShine/Code/Source/Animation/CompoundSplineTrack.cpp @@ -386,10 +386,10 @@ IUiAnimTrack* UiCompoundSplineTrack::GetSubTrack(int nIndex) const } ////////////////////////////////////////////////////////////////////////// -const char* UiCompoundSplineTrack::GetSubTrackName(int nIndex) const +AZStd::string UiCompoundSplineTrack::GetSubTrackName(int nIndex) const { assert(nIndex >= 0 && nIndex < m_nDimensions); - return m_subTrackNames[nIndex].c_str(); + return m_subTrackNames[nIndex]; } diff --git a/Gems/LyShine/Code/Source/Animation/CompoundSplineTrack.h b/Gems/LyShine/Code/Source/Animation/CompoundSplineTrack.h index 3ae230d4e4..127b6593fb 100644 --- a/Gems/LyShine/Code/Source/Animation/CompoundSplineTrack.h +++ b/Gems/LyShine/Code/Source/Animation/CompoundSplineTrack.h @@ -37,7 +37,7 @@ public: virtual int GetSubTrackCount() const { return m_nDimensions; }; virtual IUiAnimTrack* GetSubTrack(int nIndex) const; - virtual const char* GetSubTrackName(int nIndex) const; + AZStd::string GetSubTrackName(int nIndex) const override; virtual void SetSubTrackName(int nIndex, const char* name); virtual EUiAnimCurveType GetCurveType() { return eUiAnimCurveType_BezierFloat; }; diff --git a/Gems/LyShine/Code/Source/Animation/UiAnimationSystem.cpp b/Gems/LyShine/Code/Source/Animation/UiAnimationSystem.cpp index 35fde93e83..96ce31982a 100644 --- a/Gems/LyShine/Code/Source/Animation/UiAnimationSystem.cpp +++ b/Gems/LyShine/Code/Source/Animation/UiAnimationSystem.cpp @@ -735,7 +735,7 @@ void UiAnimationSystem::ShowPlayedSequencesDebug() f32 purple[4] = {1, 0, 1, 1}; f32 white[4] = {1, 1, 1, 1}; float y = 10.0f; - std::vector names; + AZStd::vector names; for (PlayingSequences::iterator it = m_playingSequences.begin(); it != m_playingSequences.end(); ++it) { @@ -755,23 +755,18 @@ void UiAnimationSystem::ShowPlayedSequencesDebug() { // Checks nodes which happen to be in several sequences. // Those can be a bug, since several sequences may try to control the same entity. - const char* name = playingSequence.sequence->GetNode(i)->GetName(); + AZStd::string name = playingSequence.sequence->GetNode(i)->GetName(); bool alreadyThere = false; - for (size_t k = 0; k < names.size(); ++k) + if (AZStd::find(names.begin(), names.end(), name) != names.end()) { - if (strcmp(names[k], name) == 0) - { - alreadyThere = true; - break; - } + alreadyThere = true; } - - if (alreadyThere == false) + else { names.push_back(name); } - gEnv->pRenderer->Draw2dLabel((21.0f + 100.0f * i), ((i % 2) ? (y + 8.0f) : y), 1.0f, alreadyThere ? white : purple, false, "%s", name); + gEnv->pRenderer->Draw2dLabel((21.0f + 100.0f * i), ((i % 2) ? (y + 8.0f) : y), 1.0f, alreadyThere ? white : purple, false, "%s", name.c_str()); } y += 32.0f; diff --git a/Gems/Maestro/Code/Source/Cinematics/AnimComponentNode.h b/Gems/Maestro/Code/Source/Cinematics/AnimComponentNode.h index 867afcb28e..43f49e8b80 100644 --- a/Gems/Maestro/Code/Source/Cinematics/AnimComponentNode.h +++ b/Gems/Maestro/Code/Source/Cinematics/AnimComponentNode.h @@ -150,8 +150,8 @@ private: } BehaviorPropertyInfo(const BehaviorPropertyInfo& other) { - m_displayName = AZStd::move(other.m_displayName); - m_animNodeParamInfo.paramType = m_displayName; + m_displayName = other.m_displayName; + m_animNodeParamInfo.paramType = other.m_displayName; m_animNodeParamInfo.name = m_displayName; } BehaviorPropertyInfo& operator=(const AZStd::string& str) diff --git a/Gems/Maestro/Code/Source/Cinematics/AnimNode.cpp b/Gems/Maestro/Code/Source/Cinematics/AnimNode.cpp index c238d40ca8..c141dc51c8 100644 --- a/Gems/Maestro/Code/Source/Cinematics/AnimNode.cpp +++ b/Gems/Maestro/Code/Source/Cinematics/AnimNode.cpp @@ -77,12 +77,12 @@ int CAnimNode::GetTrackCount() const return static_cast(m_tracks.size()); } -const char* CAnimNode::GetParamName(const CAnimParamType& paramType) const +AZStd::string CAnimNode::GetParamName(const CAnimParamType& paramType) const { SParamInfo info; if (GetParamInfoFromType(paramType, info)) { - return info.name.c_str(); + return info.name; } return "Unknown"; diff --git a/Gems/Maestro/Code/Source/Cinematics/AnimNode.h b/Gems/Maestro/Code/Source/Cinematics/AnimNode.h index 418d667c34..7c56d8f641 100644 --- a/Gems/Maestro/Code/Source/Cinematics/AnimNode.h +++ b/Gems/Maestro/Code/Source/Cinematics/AnimNode.h @@ -86,7 +86,7 @@ public: ////////////////////////////////////////////////////////////////////////// bool IsParamValid(const CAnimParamType& paramType) const; - virtual const char* GetParamName(const CAnimParamType& param) const; + AZStd::string GetParamName(const CAnimParamType& param) const override; virtual AnimValueType GetParamValueType(const CAnimParamType& paramType) const; virtual IAnimNode::ESupportedParamFlags GetParamFlags(const CAnimParamType& paramType) const; virtual unsigned int GetParamCount() const { return 0; }; diff --git a/Gems/Maestro/Code/Source/Cinematics/AnimSplineTrack.h b/Gems/Maestro/Code/Source/Cinematics/AnimSplineTrack.h index 5167a8e7b1..46dcb63daa 100644 --- a/Gems/Maestro/Code/Source/Cinematics/AnimSplineTrack.h +++ b/Gems/Maestro/Code/Source/Cinematics/AnimSplineTrack.h @@ -54,7 +54,7 @@ public: virtual int GetSubTrackCount() const { return 0; }; virtual IAnimTrack* GetSubTrack([[maybe_unused]] int nIndex) const { return 0; }; - virtual const char* GetSubTrackName([[maybe_unused]] int nIndex) const { return NULL; }; + AZStd::string GetSubTrackName([[maybe_unused]] int nIndex) const { return AZStd::string(); }; virtual void SetSubTrackName([[maybe_unused]] int nIndex, [[maybe_unused]] const char* name) { assert(0); } void SetNode(IAnimNode* node) override { m_node = node; } diff --git a/Gems/Maestro/Code/Source/Cinematics/AnimTrack.h b/Gems/Maestro/Code/Source/Cinematics/AnimTrack.h index b65dad1323..e16f64c7c1 100644 --- a/Gems/Maestro/Code/Source/Cinematics/AnimTrack.h +++ b/Gems/Maestro/Code/Source/Cinematics/AnimTrack.h @@ -37,7 +37,7 @@ public: virtual int GetSubTrackCount() const { return 0; }; virtual IAnimTrack* GetSubTrack([[maybe_unused]] int nIndex) const { return 0; }; - virtual const char* GetSubTrackName([[maybe_unused]] int nIndex) const { return NULL; }; + AZStd::string GetSubTrackName([[maybe_unused]] int nIndex) const override { return AZStd::string(); }; virtual void SetSubTrackName([[maybe_unused]] int nIndex, [[maybe_unused]] const char* name) { assert(0); } virtual const CAnimParamType& GetParameterType() const { return m_nParamType; }; diff --git a/Gems/Maestro/Code/Source/Cinematics/CompoundSplineTrack.cpp b/Gems/Maestro/Code/Source/Cinematics/CompoundSplineTrack.cpp index 884a90b200..d134d5f0f7 100644 --- a/Gems/Maestro/Code/Source/Cinematics/CompoundSplineTrack.cpp +++ b/Gems/Maestro/Code/Source/Cinematics/CompoundSplineTrack.cpp @@ -346,10 +346,10 @@ IAnimTrack* CCompoundSplineTrack::GetSubTrack(int nIndex) const } ////////////////////////////////////////////////////////////////////////// -const char* CCompoundSplineTrack::GetSubTrackName(int nIndex) const +AZStd::string CCompoundSplineTrack::GetSubTrackName(int nIndex) const { assert(nIndex >= 0 && nIndex < m_nDimensions); - return m_subTrackNames[nIndex].c_str(); + return m_subTrackNames[nIndex]; } diff --git a/Gems/Maestro/Code/Source/Cinematics/CompoundSplineTrack.h b/Gems/Maestro/Code/Source/Cinematics/CompoundSplineTrack.h index b0a2733316..443bad584b 100644 --- a/Gems/Maestro/Code/Source/Cinematics/CompoundSplineTrack.h +++ b/Gems/Maestro/Code/Source/Cinematics/CompoundSplineTrack.h @@ -38,7 +38,7 @@ public: virtual int GetSubTrackCount() const { return m_nDimensions; }; virtual IAnimTrack* GetSubTrack(int nIndex) const; - virtual const char* GetSubTrackName(int nIndex) const; + AZStd::string GetSubTrackName(int nIndex) const; virtual void SetSubTrackName(int nIndex, const char* name); virtual EAnimCurveType GetCurveType() { return eAnimCurveType_BezierFloat; }; diff --git a/Gems/Maestro/Code/Source/Cinematics/MaterialNode.cpp b/Gems/Maestro/Code/Source/Cinematics/MaterialNode.cpp index 74b0fb1063..9a54b21d7f 100644 --- a/Gems/Maestro/Code/Source/Cinematics/MaterialNode.cpp +++ b/Gems/Maestro/Code/Source/Cinematics/MaterialNode.cpp @@ -217,7 +217,7 @@ bool CAnimMaterialNode::GetParamInfoFromType(const CAnimParamType& paramId, SPar } ////////////////////////////////////////////////////////////////////////// -const char* CAnimMaterialNode::GetParamName(const CAnimParamType& param) const +AZStd::string CAnimMaterialNode::GetParamName(const CAnimParamType& param) const { if (param.GetType() == AnimParamType::ByString) { diff --git a/Gems/Maestro/Code/Source/Cinematics/MaterialNode.h b/Gems/Maestro/Code/Source/Cinematics/MaterialNode.h index 003312c426..63f287f513 100644 --- a/Gems/Maestro/Code/Source/Cinematics/MaterialNode.h +++ b/Gems/Maestro/Code/Source/Cinematics/MaterialNode.h @@ -37,7 +37,7 @@ public: ////////////////////////////////////////////////////////////////////////// virtual unsigned int GetParamCount() const; virtual CAnimParamType GetParamType(unsigned int nIndex) const; - virtual const char* GetParamName(const CAnimParamType& paramType) const; + AZStd::string GetParamName(const CAnimParamType& paramType) const override; virtual void GetKeyValueRange(float& fMin, float& fMax) const { fMin = m_fMinKeyValue; fMax = m_fMaxKeyValue; }; virtual void SetKeyValueRange(float fMin, float fMax){ m_fMinKeyValue = fMin; m_fMaxKeyValue = fMax; }; From 45b2336dce304bff70ebbbe8102816c72c6561c5 Mon Sep 17 00:00:00 2001 From: Artur K <96597+nemerle@users.noreply.github.com> Date: Wed, 25 Aug 2021 23:04:38 +0200 Subject: [PATCH 098/131] Legacy cleanup (#3383) * WIP - small legacy cleanup Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * More cleanups + build fixes Use AZstd instead of std types in a few places. Remove m_nameTable. Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * Legacy code cleanups Remove unused methods using legacy functionality * EditorViewportWidget::AdjustObjectPosition * DisplayContext - remove `renderer` pointer * DisplayContext - log errors when functions using `renderer` are called * CTrackGizmo::DrawAxis - log errors when function uses `renderer`. * Legacy CCamera - remove Project, Unproject and CalcScreenBounds * Remove all unused methods from Cry_GeoDistance.h/Cry_GeoIntersect.h * Remove Lineseg_Triangle from Cry_GeoOverlap.h * IEntityRenderState.h - remove unused types * SMeshColor remove Lerp method and associated constructor. * IMaterial.h - remove unused types and a few methods * IRenderMesh.h - remove a few unused methods and use int8 instead of byte * IRender.h - remove almost all of the contents * IShader.h - remove unused types and a few methods * IStatObj.h - remove unused types and a few methods * SSystemGlobalEnvironment - remove `renderer` pointer * IRenderGraph - remove 2 unused methods * physinterface.h - remove almost all of the contents * CXmlUtils no longer inherits ISystemEventListener * CXmlNode no longer has custom new/delete * Remove IRenderer from some test mocks. Removed files: * CryName.h * Cry_MatrixDiag.h * Cry_XOptimise.h * HeapAllocator.h * IRendererMock.h * PoolAllocator.h Things to consider: * Remove GetMemoryUsage & friends. Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * Apply review suggestions IMovieSystem.h - remove unused includes. Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * Move unreachable code to `#if 0` block This is hopefully temporary measure until the original functionality is re-implemented Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * Fix bad merge I messed up. Fix bad merge I messed up, by re-removing FrameProfiler.h from crycommon_files.cmake (this was removed in an earlier commit this morning: https://github.com/o3de/o3de/pull/3394). Signed-off-by: bosnichd * Update Code/Framework/AzCore/AzCore/std/string/string_view.h Co-authored-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * implement review suggestion Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * following review, using LYSHINE_ATOM_TODO to guard Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * Remove commented out include Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * EditorViewportWidget.cpp: Convert commented out code to guarded one Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> Co-authored-by: bosnichd Co-authored-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> --- Code/Editor/Controls/WndGridHelper.h | 1 + Code/Editor/CryEdit.cpp | 1 - Code/Editor/EditorViewportWidget.cpp | 81 +- Code/Editor/EditorViewportWidget.h | 1 - Code/Editor/IconManager.h | 3 - Code/Editor/Include/IEditorMaterial.h | 4 - Code/Editor/Objects/DisplayContext.h | 1 - Code/Editor/Objects/DisplayContextShared.inl | 25 +- Code/Editor/Objects/TrackGizmo.cpp | 7 +- Code/Editor/Plugin.h | 1 + .../Objects/ComponentEntityObject.cpp | 1 + Code/Editor/SettingsManager.cpp | 2 +- Code/Editor/TrackView/CommentNodeAnimator.cpp | 1 + Code/Editor/Util/ColorUtils.cpp | 2 +- Code/Editor/Util/EditorUtils.cpp | 2 +- Code/Editor/Util/Math.h | 1 + Code/Editor/Util/StringHelpers.cpp | 1 + Code/Framework/AzCore/AzCore/EBus/BusImpl.h | 9 +- .../AzCore/AzCore/std/string/string_view.h | 1 + Code/Legacy/CryCommon/CryName.h | 564 --- Code/Legacy/CryCommon/CryTypeInfo.h | 4 - Code/Legacy/CryCommon/Cry_Camera.h | 188 - Code/Legacy/CryCommon/Cry_Geo.h | 14 - Code/Legacy/CryCommon/Cry_GeoDistance.h | 1568 +------ Code/Legacy/CryCommon/Cry_GeoIntersect.h | 751 +--- Code/Legacy/CryCommon/Cry_GeoOverlap.h | 58 - Code/Legacy/CryCommon/Cry_Math.h | 2 - Code/Legacy/CryCommon/Cry_Matrix33.h | 72 - Code/Legacy/CryCommon/Cry_Matrix34.h | 37 - Code/Legacy/CryCommon/Cry_Matrix44.h | 57 - Code/Legacy/CryCommon/Cry_MatrixDiag.h | 192 - Code/Legacy/CryCommon/Cry_XOptimise.h | 566 --- Code/Legacy/CryCommon/HeapAllocator.h | 457 --- Code/Legacy/CryCommon/IEntityRenderState.h | 208 +- Code/Legacy/CryCommon/IIndexedMesh.h | 21 +- Code/Legacy/CryCommon/IMaterial.h | 142 +- Code/Legacy/CryCommon/IMovieSystem.h | 10 +- Code/Legacy/CryCommon/INavigationSystem.h | 6 +- Code/Legacy/CryCommon/IPhysics.h | 26 +- Code/Legacy/CryCommon/IRenderAuxGeom.h | 11 +- Code/Legacy/CryCommon/IRenderMesh.h | 49 +- Code/Legacy/CryCommon/IRenderer.h | 2462 +---------- Code/Legacy/CryCommon/IShader.h | 2088 +--------- Code/Legacy/CryCommon/ISplines.h | 3 +- Code/Legacy/CryCommon/IStatObj.h | 27 +- Code/Legacy/CryCommon/ISystem.h | 3 - .../LyShine/Animation/IUiAnimation.h | 4 +- Code/Legacy/CryCommon/LyShine/IRenderGraph.h | 12 +- Code/Legacy/CryCommon/Mocks/IRendererMock.h | 854 ---- Code/Legacy/CryCommon/Mocks/ISystemMock.h | 2 - Code/Legacy/CryCommon/PoolAllocator.h | 507 --- Code/Legacy/CryCommon/StaticInstance.h | 19 +- Code/Legacy/CryCommon/crycommon_files.cmake | 5 - .../CryCommon/crycommon_testing_files.cmake | 1 - Code/Legacy/CryCommon/physinterface.h | 3655 ----------------- Code/Legacy/CrySystem/CrySystem_precompiled.h | 1 - .../CrySystem/LevelSystem/LevelSystem.cpp | 1 + .../CrySystem/LocalizedStringManager.cpp | 37 +- .../CrySystem/RemoteConsole/RemoteConsole.h | 5 +- Code/Legacy/CrySystem/System.cpp | 2 +- Code/Legacy/CrySystem/System.h | 41 +- Code/Legacy/CrySystem/SystemInit.cpp | 4 +- Code/Legacy/CrySystem/XConsole.cpp | 4 +- Code/Legacy/CrySystem/XML/XmlUtils.cpp | 24 +- Code/Legacy/CrySystem/XML/XmlUtils.h | 7 - Code/Legacy/CrySystem/XML/xml.h | 39 - Gems/AudioSystem/Code/Source/Engine/ATL.cpp | 3 +- .../Code/Tests/UI/LODSkinnedMeshTests.cpp | 2 - .../Gestures/GestureRecognizerClickOrTap.inl | 2 + .../Gestures/GestureRecognizerDrag.inl | 1 + .../Include/Gestures/GestureRecognizerHold.h | 1 + .../Gestures/GestureRecognizerHold.inl | 1 + .../Gestures/GestureRecognizerPinch.inl | 1 + .../Gestures/GestureRecognizerRotate.inl | 1 + .../Include/Gestures/GestureRecognizerSwipe.h | 2 +- .../Code/Source/Shape/CapsuleShape.cpp | 1 + .../Source/Shape/CompoundShapeComponent.cpp | 3 +- .../Code/Source/Shape/CylinderShape.cpp | 1 - .../Animation/UiAnimViewSequenceManager.h | 1 + .../Code/Editor/Animation/UiAnimViewTrack.cpp | 1 + .../Editor/Animation/Util/UiEditorUtils.cpp | 2 +- .../Code/Source/Animation/TrackEventTrack.h | 1 + .../Source/Animation/UiAnimationSystem.cpp | 8 +- .../Code/Source/Animation/UiAnimationSystem.h | 7 +- .../LyShine/Code/Source/LyShineLoadScreen.cpp | 21 +- Gems/LyShine/Code/Source/RenderGraph.cpp | 53 +- Gems/LyShine/Code/Source/RenderGraph.h | 23 +- .../LyShine/Code/Source/UiCanvasComponent.cpp | 4 + Gems/LyShine/Code/Source/UiCanvasManager.cpp | 1 + .../Code/Source/UiElementComponent.cpp | 2 + Gems/LyShine/Code/Source/UiFaderComponent.h | 2 +- Gems/LyShine/Code/Source/UiImageComponent.h | 2 +- .../Code/Source/UiImageSequenceComponent.h | 2 +- Gems/LyShine/Code/Source/UiMaskComponent.h | 2 +- .../Code/Source/UiParticleEmitterComponent.h | 2 +- Gems/LyShine/Code/Source/UiTextComponent.cpp | 2 +- Gems/LyShine/Code/Source/UiTextComponent.h | 28 +- .../Code/Source/UiTextInputComponent.cpp | 2 + .../Code/Source/UiTransform2dComponent.cpp | 5 +- Gems/LyShine/Code/Tests/LyShineEditorTest.cpp | 3 - Gems/LyShine/Code/Tests/SpriteTest.cpp | 11 - .../Code/Tests/TextInputComponentTest.cpp | 9 - .../Code/Source/UiCustomImageComponent.h | 2 +- .../Code/Source/Cinematics/AnimSequence.h | 2 + Gems/Maestro/Code/Source/Cinematics/Movie.cpp | 1 + Gems/Maestro/Code/Source/Cinematics/Movie.h | 1 + .../Source/Cinematics/ScreenFaderTrack.cpp | 2 +- .../Code/Source/Cinematics/SoundTrack.h | 1 + .../Code/Source/Cinematics/TrackEventTrack.h | 1 + 109 files changed, 349 insertions(+), 14829 deletions(-) delete mode 100644 Code/Legacy/CryCommon/CryName.h delete mode 100644 Code/Legacy/CryCommon/Cry_MatrixDiag.h delete mode 100644 Code/Legacy/CryCommon/Cry_XOptimise.h delete mode 100644 Code/Legacy/CryCommon/HeapAllocator.h delete mode 100644 Code/Legacy/CryCommon/Mocks/IRendererMock.h delete mode 100644 Code/Legacy/CryCommon/PoolAllocator.h diff --git a/Code/Editor/Controls/WndGridHelper.h b/Code/Editor/Controls/WndGridHelper.h index 158ffca508..d693eda3fb 100644 --- a/Code/Editor/Controls/WndGridHelper.h +++ b/Code/Editor/Controls/WndGridHelper.h @@ -14,6 +14,7 @@ #include #include #include "Cry_Vector2.h" +#include ////////////////////////////////////////////////////////////////////////// class CWndGridHelper diff --git a/Code/Editor/CryEdit.cpp b/Code/Editor/CryEdit.cpp index f943265ec5..f0cc5c6264 100644 --- a/Code/Editor/CryEdit.cpp +++ b/Code/Editor/CryEdit.cpp @@ -78,7 +78,6 @@ AZ_POP_DISABLE_WARNING // CryCommon #include -#include #include // Editor diff --git a/Code/Editor/EditorViewportWidget.cpp b/Code/Editor/EditorViewportWidget.cpp index c15fc0363e..c51c37bac0 100644 --- a/Code/Editor/EditorViewportWidget.cpp +++ b/Code/Editor/EditorViewportWidget.cpp @@ -54,6 +54,8 @@ // CryCommon #include +#include +#include // AzFramework #include @@ -739,9 +741,13 @@ void EditorViewportWidget::OnBeginPrepareRender() RenderAll(); // Draw 2D helpers. +#ifdef LYSHINE_ATOM_TODO TransformationMatrices backupSceneMatrices; +#endif m_debugDisplay->DepthTestOff(); - //m_renderer->Set2DMode(m_rcClient.right(), m_rcClient.bottom(), backupSceneMatrices); +#ifdef LYSHINE_ATOM_TODO + m_renderer->Set2DMode(m_rcClient.right(), m_rcClient.bottom(), backupSceneMatrices); +#endif auto prevState = m_debugDisplay->GetState(); m_debugDisplay->SetState(e_Mode3D | e_AlphaBlended | e_FillModeSolid | e_CullModeBack | e_DepthWriteOn | e_DepthTestOn); @@ -1283,7 +1289,7 @@ void EditorViewportWidget::SetViewportId(int id) m_renderViewport->GetControllerList()->Add(AZStd::make_shared()); m_renderViewport->GetControllerList()->Add(CreateModularViewportCameraController(AzFramework::ViewportId(id))); - + m_renderViewport->SetViewportSettings(&g_EditorViewportSettings); UpdateScene(); @@ -1643,7 +1649,7 @@ void EditorViewportWidget::SetViewTM(const Matrix34& camMatrix, bool bMoveOnly) { // Should be impossible anyways AZ_Assert(false, "Internal logic error - view entity Id and view source type out of sync. Please report this as a bug"); - return ShouldUpdateObject::No; + return ShouldUpdateObject::No; } // Check that the current view is the same view as the view entity view @@ -2008,73 +2014,6 @@ Vec3 EditorViewportWidget::ViewToWorldNormal(const QPoint& vp, bool onlyTerrain, return Vec3(0, 0, 1); } -////////////////////////////////////////////////////////////////////////// -bool EditorViewportWidget::AdjustObjectPosition(const ray_hit& hit, Vec3& outNormal, Vec3& outPos) const -{ - Matrix34A objMat, objMatInv; - Matrix33 objRot, objRotInv; - - if (hit.pCollider->GetiForeignData() != PHYS_FOREIGN_ID_STATIC) - { - return false; - } - - IRenderNode* pNode = (IRenderNode*) hit.pCollider->GetForeignData(PHYS_FOREIGN_ID_STATIC); - if (!pNode || !pNode->GetEntityStatObj()) - { - return false; - } - - IStatObj* pEntObject = pNode->GetEntityStatObj(hit.partid, 0, &objMat, false); - if (!pEntObject || !pEntObject->GetRenderMesh()) - { - return false; - } - - objRot = Matrix33(objMat); - objRot.NoScale(); // No scale. - objRotInv = objRot; - objRotInv.Invert(); - - float fWorldScale = objMat.GetColumn(0).GetLength(); // GetScale - float fWorldScaleInv = 1.0f / fWorldScale; - - // transform decal into object space - objMatInv = objMat; - objMatInv.Invert(); - - // put into normal object space hit direction of projection - Vec3 invhitn = -(hit.n); - Vec3 vOS_HitDir = objRotInv.TransformVector(invhitn).GetNormalized(); - - // put into position object space hit position - Vec3 vOS_HitPos = objMatInv.TransformPoint(hit.pt); - vOS_HitPos -= vOS_HitDir * RENDER_MESH_TEST_DISTANCE * fWorldScaleInv; - - IRenderMesh* pRM = pEntObject->GetRenderMesh(); - - AABB aabbRNode; - pRM->GetBBox(aabbRNode.min, aabbRNode.max); - Vec3 vOut(0, 0, 0); - if (!Intersect::Ray_AABB(Ray(vOS_HitPos, vOS_HitDir), aabbRNode, vOut)) - { - return false; - } - - if (!pRM || !pRM->GetVerticesCount()) - { - return false; - } - - if (RayRenderMeshIntersection(pRM, vOS_HitPos, vOS_HitDir, outPos, outNormal)) - { - outNormal = objRot.TransformVector(outNormal).GetNormalized(); - outPos = objMat.TransformPoint(outPos); - return true; - } - return false; -} - ////////////////////////////////////////////////////////////////////////// bool EditorViewportWidget::RayRenderMeshIntersection(IRenderMesh* pRenderMesh, const Vec3& vInPos, const Vec3& vInDir, Vec3& vOutPos, Vec3& vOutNormal) const { @@ -2507,7 +2446,7 @@ void EditorViewportWidget::SetViewFromEntityPerspective(const AZ::EntityId& enti void EditorViewportWidget::SetViewAndMovementLockFromEntityPerspective(const AZ::EntityId& entityId, [[maybe_unused]] bool lockCameraMovement) { // This is an editor event, so is only serviced during edit mode, not play game mode - // + // if (m_playInEditorState != PlayInEditorState::Editor) { AZ_Warning("EditorViewportWidget", false, diff --git a/Code/Editor/EditorViewportWidget.h b/Code/Editor/EditorViewportWidget.h index a75928b353..d4bb14ad3b 100644 --- a/Code/Editor/EditorViewportWidget.h +++ b/Code/Editor/EditorViewportWidget.h @@ -220,7 +220,6 @@ private: // Draw a selected region if it has been selected void RenderSelectedRegion(); - bool AdjustObjectPosition(const ray_hit& hit, Vec3& outNormal, Vec3& outPos) const; bool RayRenderMeshIntersection(IRenderMesh* pRenderMesh, const Vec3& vInPos, const Vec3& vInDir, Vec3& vOutPos, Vec3& vOutNormal) const; bool AddCameraMenuItems(QMenu* menu); diff --git a/Code/Editor/IconManager.h b/Code/Editor/IconManager.h index d6684f4cc3..7183f036ed 100644 --- a/Code/Editor/IconManager.h +++ b/Code/Editor/IconManager.h @@ -15,9 +15,6 @@ #pragma once -struct IStatObj; -struct IMaterial; - #include "Include/IIconManager.h" // for IIconManager #include "IEditor.h" // for IDocListener diff --git a/Code/Editor/Include/IEditorMaterial.h b/Code/Editor/Include/IEditorMaterial.h index a117020d19..487246eb60 100644 --- a/Code/Editor/Include/IEditorMaterial.h +++ b/Code/Editor/Include/IEditorMaterial.h @@ -6,8 +6,6 @@ * */ #pragma once -#ifndef CRYINCLUDE_EDITOR_INCLUDE_IEDITORMATERIAL_H -#define CRYINCLUDE_EDITOR_INCLUDE_IEDITORMATERIAL_H #include "BaseLibraryItem.h" @@ -20,5 +18,3 @@ struct IEditorMaterial virtual _smart_ptr GetMatInfo(bool bUseExistingEngineMaterial = false) = 0; virtual void DisableHighlightForFrame() = 0; }; - -#endif diff --git a/Code/Editor/Objects/DisplayContext.h b/Code/Editor/Objects/DisplayContext.h index 47fd450220..a78e35cdba 100644 --- a/Code/Editor/Objects/DisplayContext.h +++ b/Code/Editor/Objects/DisplayContext.h @@ -63,7 +63,6 @@ struct SANDBOX_API DisplayContext CDisplaySettings* settings; IDisplayViewport* view; - IRenderer* renderer; IRenderAuxGeom* pRenderAuxGeom; IIconManager* pIconManager; CCamera* camera; diff --git a/Code/Editor/Objects/DisplayContextShared.inl b/Code/Editor/Objects/DisplayContextShared.inl index 90c6ba09b0..df0b1f82a1 100644 --- a/Code/Editor/Objects/DisplayContextShared.inl +++ b/Code/Editor/Objects/DisplayContextShared.inl @@ -26,7 +26,6 @@ DisplayContext::DisplayContext() { view = 0; - renderer = 0; flags = 0; settings = 0; pIconManager = 0; @@ -1083,7 +1082,10 @@ void DisplayContext::DrawTerrainLine(Vec3 worldPos1, Vec3 worldPos2) ////////////////////////////////////////////////////////////////////////// void DisplayContext::DrawTextLabel(const Vec3& pos, float size, const char* text, const bool bCenter, [[maybe_unused]] int srcOffsetX, [[maybe_unused]] int scrOffsetY) { - ColorF col(m_color4b.r * (1.0f / 255.0f), m_color4b.g * (1.0f / 255.0f), m_color4b.b * (1.0f / 255.0f), m_color4b.a * (1.0f / 255.0f)); + AZ_ErrorOnce(nullptr, false, "DisplayContext::DrawTextLabel needs to be removed/ported to use Atom"); + +#if 0 + ColorF col(m_color4b.r * (1.0f / 255.0f), m_color4b.g * (1.0f / 255.0f), m_color4b.b * (1.0f / 255.0f), m_color4b.a * (1.0f / 255.0f)); float fCol[4] = { col.r, col.g, col.b, col.a }; if (flags & DISPLAY_2D) @@ -1096,13 +1098,28 @@ void DisplayContext::DrawTextLabel(const Vec3& pos, float size, const char* text { renderer->DrawLabelEx(pos, size, fCol, true, true, text); } +#else + AZ_UNUSED(pos); + AZ_UNUSED(size); + AZ_UNUSED(text); + AZ_UNUSED(bCenter); +#endif } ////////////////////////////////////////////////////////////////////////// void DisplayContext::Draw2dTextLabel(float x, float y, float size, const char* text, bool bCenter) { + AZ_ErrorOnce(nullptr, false, "DisplayContext::Draw2dTextLabel needs to be removed/ported to use Atom"); +#if 0 float col[4] = { m_color4b.r * (1.0f / 255.0f), m_color4b.g * (1.0f / 255.0f), m_color4b.b * (1.0f / 255.0f), m_color4b.a * (1.0f / 255.0f) }; renderer->Draw2dLabel(x, y, size, col, bCenter, "%s", text); +#else + AZ_UNUSED(x); + AZ_UNUSED(y); + AZ_UNUSED(size); + AZ_UNUSED(text); + AZ_UNUSED(bCenter); +#endif } ////////////////////////////////////////////////////////////////////////// @@ -1269,6 +1286,9 @@ void DisplayContext::Flush2D() int rcw, rch; view->GetDimensions(&rcw, &rch); + AZ_ErrorOnce(nullptr, false, "DisplayContext::Flush2D needs to be removed/ported to use Atom"); +#if 0 + TransformationMatrices backupSceneMatrices; renderer->Set2DMode(rcw, rch, backupSceneMatrices, 0.0f, 1.0f); @@ -1310,6 +1330,7 @@ void DisplayContext::Flush2D() } renderer->Unset2DMode(backupSceneMatrices); +#endif m_textureLabels.clear(); } diff --git a/Code/Editor/Objects/TrackGizmo.cpp b/Code/Editor/Objects/TrackGizmo.cpp index 8cbd7df2e5..f234a15d9e 100644 --- a/Code/Editor/Objects/TrackGizmo.cpp +++ b/Code/Editor/Objects/TrackGizmo.cpp @@ -177,11 +177,15 @@ void CTrackGizmo::DrawAxis(DisplayContext& dc, const Vec3& org) float col[4] = { 1, 1, 1, 1 }; float hcol[4] = { 1, 0, 0, 1 }; + Vec3 colX(1, 0, 0), colY(0, 1, 0), colZ(0, 0, 1); + + AZ_ErrorOnce(nullptr, false, "CTrackGizmo::DrawAxis needs to be removed/ported to use Atom"); +#if 0 + dc.renderer->DrawLabelEx(org + x, 1.2f, col, true, true, "X"); dc.renderer->DrawLabelEx(org + y, 1.2f, col, true, true, "Y"); dc.renderer->DrawLabelEx(org + z, 1.2f, col, true, true, "Z"); - Vec3 colX(1, 0, 0), colY(0, 1, 0), colZ(0, 0, 1); if (s_highlightAxis) { float col2[4] = { 1, 0, 0, 1 }; @@ -201,6 +205,7 @@ void CTrackGizmo::DrawAxis(DisplayContext& dc, const Vec3& org) dc.renderer->DrawLabelEx(org + z, 1.2f, col2, true, true, "Z"); } } +#endif x = x * 0.8f; y = y * 0.8f; diff --git a/Code/Editor/Plugin.h b/Code/Editor/Plugin.h index 1ad6a1496f..5fa45ac140 100644 --- a/Code/Editor/Plugin.h +++ b/Code/Editor/Plugin.h @@ -13,6 +13,7 @@ #include "Include/IEditorClassFactory.h" #include "Util/GuidUtil.h" +#include //! Derive from this class to decrease the amount of work for creating a new class description //! Provides standard reference counter implementation for IUnknown diff --git a/Code/Editor/Plugins/ComponentEntityEditorPlugin/Objects/ComponentEntityObject.cpp b/Code/Editor/Plugins/ComponentEntityEditorPlugin/Objects/ComponentEntityObject.cpp index c91bf58074..dce8bfddfc 100644 --- a/Code/Editor/Plugins/ComponentEntityEditorPlugin/Objects/ComponentEntityObject.cpp +++ b/Code/Editor/Plugins/ComponentEntityEditorPlugin/Objects/ComponentEntityObject.cpp @@ -40,6 +40,7 @@ #include #include +#include #include #include #include diff --git a/Code/Editor/SettingsManager.cpp b/Code/Editor/SettingsManager.cpp index d567da4c26..7455d9134f 100644 --- a/Code/Editor/SettingsManager.cpp +++ b/Code/Editor/SettingsManager.cpp @@ -987,7 +987,7 @@ QString CSettingsManager::GenerateContentHash(XmlNodeRef& node, QString sourceNa return sourceName; } - uint32 hash = CCrc32::ComputeLowercase(node->getXML(0)); + uint32 hash = AZ::Crc32(node->getXML(0)); hashStr = QString::number(hash); return hashStr; diff --git a/Code/Editor/TrackView/CommentNodeAnimator.cpp b/Code/Editor/TrackView/CommentNodeAnimator.cpp index 2dd2cfbb22..c49504509c 100644 --- a/Code/Editor/TrackView/CommentNodeAnimator.cpp +++ b/Code/Editor/TrackView/CommentNodeAnimator.cpp @@ -13,6 +13,7 @@ // CryCommon #include +#include // Editor #include "Settings.h" diff --git a/Code/Editor/Util/ColorUtils.cpp b/Code/Editor/Util/ColorUtils.cpp index 4e240bc51b..02e3c9b615 100644 --- a/Code/Editor/Util/ColorUtils.cpp +++ b/Code/Editor/Util/ColorUtils.cpp @@ -24,7 +24,7 @@ QColor ColorLinearToGamma(ColorF col) g = (float)(g <= 0.0031308 ? (12.92 * g) : (1.055 * pow((double)g, 1.0 / 2.4) - 0.055)); b = (float)(b <= 0.0031308 ? (12.92 * b) : (1.055 * pow((double)b, 1.0 / 2.4) - 0.055)); - return QColor(FtoI(r * 255.0f), FtoI(g * 255.0f), FtoI(b * 255.0f), FtoI(a * 255.0f)); + return QColor(int(r * 255.0f), int(g * 255.0f), int(b * 255.0f), int(a * 255.0f)); } ////////////////////////////////////////////////////////////////////////// diff --git a/Code/Editor/Util/EditorUtils.cpp b/Code/Editor/Util/EditorUtils.cpp index de06a95a62..adae34773a 100644 --- a/Code/Editor/Util/EditorUtils.cpp +++ b/Code/Editor/Util/EditorUtils.cpp @@ -205,7 +205,7 @@ QColor ColorLinearToGamma(ColorF col) g = (float)(g <= 0.0031308 ? (12.92 * g) : (1.055 * pow((double)g, 1.0 / 2.4) - 0.055)); b = (float)(b <= 0.0031308 ? (12.92 * b) : (1.055 * pow((double)b, 1.0 / 2.4) - 0.055)); - return QColor(FtoI(r * 255.0f), FtoI(g * 255.0f), FtoI(b * 255.0f), FtoI(a * 255.0f)); + return QColor(int(r * 255.0f), int(g * 255.0f), int(b * 255.0f), int(a * 255.0f)); } ////////////////////////////////////////////////////////////////////////// diff --git a/Code/Editor/Util/Math.h b/Code/Editor/Util/Math.h index 34fb77e434..10402876e6 100644 --- a/Code/Editor/Util/Math.h +++ b/Code/Editor/Util/Math.h @@ -14,6 +14,7 @@ #pragma once #include +#include //! Half PI #define PI_HALF (3.1415926535897932384626433832795f / 2.0f) diff --git a/Code/Editor/Util/StringHelpers.cpp b/Code/Editor/Util/StringHelpers.cpp index d0999d6ae2..9ef3e86e7a 100644 --- a/Code/Editor/Util/StringHelpers.cpp +++ b/Code/Editor/Util/StringHelpers.cpp @@ -9,6 +9,7 @@ #include "StringHelpers.h" #include "Util.h" +#include int StringHelpers::CompareIgnoreCase(const AZStd::string& str0, const AZStd::string& str1) { diff --git a/Code/Framework/AzCore/AzCore/EBus/BusImpl.h b/Code/Framework/AzCore/AzCore/EBus/BusImpl.h index 882deaad01..8e655c0525 100644 --- a/Code/Framework/AzCore/AzCore/EBus/BusImpl.h +++ b/Code/Framework/AzCore/AzCore/EBus/BusImpl.h @@ -655,7 +655,7 @@ namespace AZ static void Validate() {} }; - template > + template struct ArgumentValidatorHelper { constexpr static void Validate() @@ -674,13 +674,6 @@ namespace AZ } }; - // bind has already copied/bound its arguments, we can't validate them further in any reasonable way - template - struct ArgumentValidatorHelper - { - constexpr static void Validate() {} - }; - template struct QueueFunctionArgumentValidator { diff --git a/Code/Framework/AzCore/AzCore/std/string/string_view.h b/Code/Framework/AzCore/AzCore/std/string/string_view.h index 4ded44644f..d37ec9c58c 100644 --- a/Code/Framework/AzCore/AzCore/std/string/string_view.h +++ b/Code/Framework/AzCore/AzCore/std/string/string_view.h @@ -9,6 +9,7 @@ #include #include +#include namespace AZStd diff --git a/Code/Legacy/CryCommon/CryName.h b/Code/Legacy/CryCommon/CryName.h deleted file mode 100644 index b9b3799dd7..0000000000 --- a/Code/Legacy/CryCommon/CryName.h +++ /dev/null @@ -1,564 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - - -#ifndef CRYINCLUDE_CRYCOMMON_CRYNAME_H -#define CRYINCLUDE_CRYCOMMON_CRYNAME_H -#pragma once - -#include -#include -#include -#include -#include - -class CNameTable; - - -struct INameTable -{ - virtual ~INameTable(){} - - // Name entry header, immediately after this header in memory starts actual string data. - struct SNameEntry - { - enum - { - TAG = 0xdeadbeef - }; - - int nTag; // tag to ensure that this is actually a name entry - // Reference count of this string. - int nRefCount; - // Current length of string. - int nLength; - // Size of memory allocated at the end of this class. - int nAllocSize; - // Here in memory starts character buffer of size nAllocSize. - //char data[nAllocSize] - - const char* GetStr() { return (char*)(this + 1); } - void AddRef() { nRefCount++; /*InterlockedIncrement(&_header()->nRefCount);*/}; - int Release() { return --nRefCount; }; - int GetMemoryUsage() { return static_cast(sizeof(SNameEntry) + strlen(GetStr())); } - int GetLength(){return nLength; } - }; - - - // Finds an existing name table entry, or creates a new one if not found. - virtual INameTable::SNameEntry* GetEntry(const char* str) = 0; - // Only finds an existing name table entry, return 0 if not found. - virtual INameTable::SNameEntry* FindEntry(const char* str) = 0; - // Release existing name table entry. - virtual void Release(SNameEntry* pEntry) = 0; - virtual int GetMemoryUsage() = 0; - virtual int GetNumberOfEntries() = 0; - - // Output all names from the table to log. - virtual void LogNames() = 0; - - virtual void GetMemoryUsage(ICrySizer* pSizer) const = 0; -}; - -////////////////////////////////////////////////////////////////////////// -class CNameTable - : public INameTable -{ -private: - typedef AZStd::unordered_map, stl::equality_string_caseless > NameMap; - NameMap m_nameMap; - -public: - CNameTable() - { - // Ensure that SNameEntry is an aligned size - static_assert(sizeof(INameTable::SNameEntry) % sizeof(void*) == 0, "SNameEntry must be an aligned size"); - } - - ~CNameTable() - { - for (NameMap::iterator it = m_nameMap.begin(); it != m_nameMap.end(); ++it) - { - CryModuleFree(it->second); - } - } - - // Only finds an existing name table entry, return 0 if not found. - virtual INameTable::SNameEntry* FindEntry(const char* str) - { - SNameEntry* pEntry = stl::find_in_map(m_nameMap, str, 0); - return pEntry; - } - - // Finds an existing name table entry, or creates a new one if not found. - virtual INameTable::SNameEntry* GetEntry(const char* str) - { - SNameEntry* pEntry = FindEntry(str); - if (!pEntry) - { - // Create a new entry. - size_t nLen = strlen(str); - size_t allocLen = sizeof(SNameEntry) + (nLen + 1) * sizeof(char); - pEntry = (SNameEntry*)CryModuleMalloc(allocLen); - assert(pEntry != NULL); - pEntry->nTag = SNameEntry::TAG; - pEntry->nRefCount = 0; - pEntry->nLength = static_cast(nLen); - pEntry->nAllocSize = static_cast(allocLen); - // Copy string to the end of name entry. - char* pEntryStr = const_cast(pEntry->GetStr()); - memcpy(pEntryStr, str, nLen + 1); - // put in map. - //m_nameMap.insert( NameMap::value_type(pEntry->GetStr(),pEntry) ); - m_nameMap[pEntry->GetStr()] = pEntry; - } - return pEntry; - } - - // Release existing name table entry. - virtual void Release(SNameEntry* pEntry) - { - assert(pEntry); - m_nameMap.erase(pEntry->GetStr()); - CryModuleFree(pEntry); - } - virtual int GetMemoryUsage() - { - int nSize = 0; - NameMap::iterator it; - int n = 0; - for (it = m_nameMap.begin(); it != m_nameMap.end(); it++) - { - nSize += static_cast(strlen(it->first)); - nSize += it->second->GetMemoryUsage(); - n++; - } - nSize += n * 8; - - return nSize; - } - virtual void GetMemoryUsage(ICrySizer* pSizer) const - { - pSizer->AddObject(this, sizeof(*this)); - pSizer->AddContainer(m_nameMap); - } - virtual int GetNumberOfEntries() - { - return static_cast(m_nameMap.size()); - } - - // Log all names inside CryName table. - virtual void LogNames() - { - NameMap::iterator it; - for (it = m_nameMap.begin(); it != m_nameMap.end(); ++it) - { - SNameEntry* pNameEntry = it->second; - CryLog("[%4d] %s", pNameEntry->nLength, pNameEntry->GetStr()); - } - } -}; - -/////////////////////////////////////////////////////////////////////////////// -// Class CCryName. -////////////////////////////////////////////////////////////////////////// -class CCryName -{ -public: - CCryName(); - CCryName(const CCryName& n); - explicit CCryName(const char* s); - CCryName(const char* s, bool bOnlyFind); - ~CCryName(); - - CCryName& operator=(const CCryName& n); - CCryName& operator=(const char* s); - - bool operator==(const CCryName& n) const; - bool operator!=(const CCryName& n) const; - - bool operator==(const char* s) const; - bool operator!=(const char* s) const; - - bool operator<(const CCryName& n) const; - bool operator>(const CCryName& n) const; - - bool empty() const { return !m_str || !m_str[0]; } - void reset() { _release(m_str); m_str = 0; } - void addref() { _addref(m_str); } - - const char* c_str() const - { - return (m_str) ? m_str : ""; - } - int length() const { return _length(); }; - - static bool find(const char* str) { return GetNameTable()->FindEntry(str) != 0; } - void GetMemoryUsage(ICrySizer* pSizer) const - { - //pSizer->AddObject(m_str); - pSizer->AddObject(GetNameTable()); // cause for slowness? - } - static int GetMemoryUsage() - { -#ifdef USE_STATIC_NAME_TABLE - CNameTable* pTable = GetNameTable(); -#else - INameTable* pTable = GetNameTable(); -#endif - return pTable->GetMemoryUsage(); - } - static int GetNumberOfEntries() - { -#ifdef USE_STATIC_NAME_TABLE - CNameTable* pTable = GetNameTable(); -#else - INameTable* pTable = GetNameTable(); -#endif - return pTable->GetNumberOfEntries(); - } - - // Compare functor for sorting CCryNames lexically. - struct CmpLex - { - bool operator () (const CCryName& n1, const CCryName& n2) const - { - return strcmp(n1.c_str(), n2.c_str()) < 0; - } - }; - -private: - typedef INameTable::SNameEntry SNameEntry; - -#ifdef USE_STATIC_NAME_TABLE - static CNameTable* GetNameTable() - { - // Note: can not use a 'static CNameTable sTable' here, because that - // implies a static destruction order depenency - the name table is - // accessed from static destructor calls. - static CNameTable* table = NULL; - - if (table == NULL) - { - table = new CNameTable(); - } - return table; - } -#else - //static INameTable* GetNameTable() { return GetISystem()->GetINameTable(); } - static INameTable* GetNameTable() - { - assert(gEnv && gEnv->pNameTable); - return gEnv->pNameTable; - } -#endif - - SNameEntry* _entry(const char* pBuffer) const - { - CRY_ASSERT(pBuffer); - CRY_ASSERT((((SNameEntry*)pBuffer) - 1)->nTag == SNameEntry::TAG); - return ((SNameEntry*)pBuffer) - 1; - } - void _release(const char* pBuffer) - { - if (pBuffer && _entry(pBuffer)->Release() <= 0 && gEnv) - { - GetNameTable()->Release(_entry(pBuffer)); - } - } - int _length() const { return (m_str) ? _entry(m_str)->nLength : 0; }; - void _addref(const char* pBuffer) - { - if (pBuffer) - { - _entry(pBuffer)->AddRef(); - } - } - - - const char* m_str; -}; - -////////////////////////////////////////////////////////////////////////// - -////////////////////////////////////////////////////////////////////////// -// CryName -////////////////////////////////////////////////////////////////////////// -inline CCryName::CCryName() -{ - m_str = 0; -} - -////////////////////////////////////////////////////////////////////////// -inline CCryName::CCryName(const CCryName& n) -{ - _addref(n.m_str); - m_str = n.m_str; -} - -////////////////////////////////////////////////////////////////////////// -inline CCryName::CCryName(const char* s) -{ - m_str = 0; - *this = s; -} - -////////////////////////////////////////////////////////////////////////// -inline CCryName::CCryName(const char* s, [[maybe_unused]] bool bOnlyFind) -{ - assert(s); - m_str = 0; - if (*s) // if not empty - { - SNameEntry* pNameEntry = GetNameTable()->FindEntry(s); - if (pNameEntry) - { - m_str = pNameEntry->GetStr(); - _addref(m_str); - } - } -} - -inline CCryName::~CCryName() -{ - _release(m_str); -} - -////////////////////////////////////////////////////////////////////////// -inline CCryName& CCryName::operator=(const CCryName& n) -{ - if (m_str != n.m_str) - { - _release(m_str); - m_str = n.m_str; - _addref(m_str); - } - return *this; -} - -////////////////////////////////////////////////////////////////////////// -inline CCryName& CCryName::operator=(const char* s) -{ - assert(s); - const char* pBuf = 0; - if (s && *s) // if not empty - { - pBuf = GetNameTable()->GetEntry(s)->GetStr(); - } - if (m_str != pBuf) - { - _release(m_str); - m_str = pBuf; - _addref(m_str); - } - return *this; -} - - -////////////////////////////////////////////////////////////////////////// -inline bool CCryName::operator==(const CCryName& n) const -{ - return m_str == n.m_str; -} - -inline bool CCryName::operator!=(const CCryName& n) const -{ - return !(*this == n); -} - -inline bool CCryName::operator==(const char* str) const -{ - return m_str && _stricmp(m_str, str) == 0; -} - -inline bool CCryName::operator!=(const char* str) const -{ - if (!m_str) - { - return true; - } - return _stricmp(m_str, str) != 0; -} - -inline bool CCryName::operator<(const CCryName& n) const -{ - return m_str < n.m_str; -} - -inline bool CCryName::operator>(const CCryName& n) const -{ - return m_str > n.m_str; -} - -inline bool operator==(const AZStd::string& s, const CCryName& n) -{ - return s == n.c_str(); -} -inline bool operator!=(const AZStd::string& s, const CCryName& n) -{ - return s != n.c_str(); -} - -inline bool operator==(const char* s, const CCryName& n) -{ - return n == s; -} -inline bool operator!=(const char* s, const CCryName& n) -{ - return n != s; -} - - -/////////////////////////////////////////////////////////////////////////////// -// Class CCryNameCRC. -////////////////////////////////////////////////////////////////////////// -class CCryNameCRC -{ -public: - CCryNameCRC(); - CCryNameCRC(const CCryNameCRC& n); - CCryNameCRC(const char* s); - CCryNameCRC(const char* s, bool bOnlyFind); - explicit CCryNameCRC(uint32 n) { m_nID = n; } // We use "explicit" to prevent comparison of strings with ints due to implicit conversion. - ~CCryNameCRC(); - - CCryNameCRC& operator=(const CCryNameCRC& n); - CCryNameCRC& operator=(const char* s); - - bool operator==(const CCryNameCRC& n) const; - bool operator!=(const CCryNameCRC& n) const; - - bool operator==(const char* s) const; - bool operator!=(const char* s) const; - - bool operator<(const CCryNameCRC& n) const; - bool operator>(const CCryNameCRC& n) const; - - bool empty() const { return m_nID == 0; } - void reset() { m_nID = 0; } - uint32 get() const { return m_nID; } - void add(int nAdd) { m_nID += nAdd; } - - AUTO_STRUCT_INFO - - void GetMemoryUsage([[maybe_unused]] ICrySizer* pSizer) const { /*nothing*/} -private: - - uint32 m_nID; -}; - -////////////////////////////////////////////////////////////////////////// -// CCryNameCRC -////////////////////////////////////////////////////////////////////////// -inline CCryNameCRC::CCryNameCRC() -{ - m_nID = 0; -} - -////////////////////////////////////////////////////////////////////////// -inline CCryNameCRC::CCryNameCRC(const CCryNameCRC& n) -{ - m_nID = n.m_nID; -} - -////////////////////////////////////////////////////////////////////////// -inline CCryNameCRC::CCryNameCRC(const char* s) -{ - m_nID = 0; - *this = s; -} - -inline CCryNameCRC::~CCryNameCRC() -{ - m_nID = 0; -} - -////////////////////////////////////////////////////////////////////////// -inline CCryNameCRC& CCryNameCRC::operator=(const CCryNameCRC& n) -{ - m_nID = n.m_nID; - return *this; -} - -////////////////////////////////////////////////////////////////////////// -inline CCryNameCRC& CCryNameCRC::operator=(const char* s) -{ - assert(s); - if (*s) // if not empty - { - m_nID = CCrc32::ComputeLowercase(s); - } - return *this; -} - - -////////////////////////////////////////////////////////////////////////// -inline bool CCryNameCRC::operator==(const CCryNameCRC& n) const -{ - return m_nID == n.m_nID; -} - -inline bool CCryNameCRC::operator!=(const CCryNameCRC& n) const -{ - return !(*this == n); -} - -inline bool CCryNameCRC::operator==(const char* str) const -{ - assert(str); - if (*str) // if not empty - { - uint32 nID = CCrc32::ComputeLowercase(str); - return m_nID == nID; - } - return m_nID == 0; -} - -inline bool CCryNameCRC::operator!=(const char* str) const -{ - if (!m_nID) - { - return true; - } - if (*str) // if not empty - { - uint32 nID = CCrc32::ComputeLowercase(str); - return m_nID != nID; - } - return false; -} - -inline bool CCryNameCRC::operator<(const CCryNameCRC& n) const -{ - return m_nID < n.m_nID; -} - -inline bool CCryNameCRC::operator>(const CCryNameCRC& n) const -{ - return m_nID > n.m_nID; -} - -inline bool operator==(const AZStd::string& s, const CCryNameCRC& n) -{ - return n == s.c_str(); -} -inline bool operator!=(const AZStd::string& s, const CCryNameCRC& n) -{ - return n != s.c_str(); -} - -inline bool operator==(const char* s, const CCryNameCRC& n) -{ - return n == s; -} -inline bool operator!=(const char* s, const CCryNameCRC& n) -{ - return n != s; -} - -#endif // CRYINCLUDE_CRYCOMMON_CRYNAME_H diff --git a/Code/Legacy/CryCommon/CryTypeInfo.h b/Code/Legacy/CryCommon/CryTypeInfo.h index 0bd734492a..dbc3fdb642 100644 --- a/Code/Legacy/CryCommon/CryTypeInfo.h +++ b/Code/Legacy/CryCommon/CryTypeInfo.h @@ -21,10 +21,6 @@ class ICrySizer; -class CCryName; -AZStd::string ToString(CCryName const& val); -bool FromString(CCryName& val, const char* s); - //--------------------------------------------------------------------------- // Specify options for converting data to/from strings struct FToString diff --git a/Code/Legacy/CryCommon/Cry_Camera.h b/Code/Legacy/CryCommon/Cry_Camera.h index d80a3d120c..4d33260c44 100644 --- a/Code/Legacy/CryCommon/Cry_Camera.h +++ b/Code/Legacy/CryCommon/Cry_Camera.h @@ -18,7 +18,6 @@ #include #include #include -#include //DOC-IGNORE-END ////////////////////////////////////////////////////////////////////// @@ -557,9 +556,6 @@ public: ILINE Vec3 GetPosition() const { return m_Matrix.GetTranslation(); } ILINE void SetPosition(const Vec3& p) { m_Matrix.SetTranslation(p); UpdateFrustum(); } ILINE void SetPositionNoUpdate(const Vec3& p) { m_Matrix.SetTranslation(p); } - ILINE bool Project(const Vec3& p, Vec3& result, Vec2i topLeft = Vec2i(0, 0), Vec2i widthHeight = Vec2i(0, 0)) const; - ILINE bool Unproject(const Vec3& viewportPos, Vec3& result, Vec2i topLeft = Vec2i(0, 0), Vec2i widthHeight = Vec2i(0, 0)) const; - ILINE void CalcScreenBounds(int* vOut, const AABB* pAABB, int nWidth, int nHeight) const; ILINE Vec3 GetUp() const { return m_Matrix.GetColumn2(); } //------------------------------------------------------------ @@ -894,190 +890,6 @@ ILINE Vec3 CCamera::CreateViewdir(const Ang3& ypr) return Vec3(-sz * cx, cz * cx, sx); //calculate the view-direction } -// Description -//
-//p=world space position
-//result=spreen space pos
-//retval=is visible on screen
-// 
-ILINE bool CCamera::Project(const Vec3& p, Vec3& result, Vec2i topLeft, Vec2i widthHeight) const -{ - Matrix44A mProj, mView; - Vec4 in, transformed, projected; - - mathMatrixPerspectiveFov(&mProj, GetFov(), GetProjRatio(), GetNearPlane(), GetFarPlane()); - - mathMatrixLookAt(&mView, GetPosition(), GetPosition() + GetViewdir(), GetUp()); - - int pViewport[4] = {0, 0, GetViewSurfaceX(), GetViewSurfaceZ()}; - - if (!topLeft.IsZero() || !widthHeight.IsZero()) - { - pViewport[0] = topLeft.x; - pViewport[1] = topLeft.y; - pViewport[2] = widthHeight.x; - pViewport[3] = widthHeight.y; - } - - in.x = p.x; - in.y = p.y; - in.z = p.z; - in.w = 1.0f; - mathVec4Transform((f32*)&transformed, (f32*)&mView, (f32*)&in); - - bool visible = transformed.z < 0.0f; - - mathVec4Transform((f32*)&projected, (f32*)&mProj, (f32*)&transformed); - - if (projected.w == 0.0f) - { - result = Vec3(0.f, 0.f, 0.f); - return false; - } - - projected.x /= projected.w; - projected.y /= projected.w; - projected.z /= projected.w; - - visible = visible && (fabs_tpl(projected.x) <= 1.0f) && (fabs_tpl(projected.y) <= 1.0f); - - //output coords - result.x = pViewport[0] + (1 + projected.x) * pViewport[2] / 2; - result.y = pViewport[1] + (1 - projected.y) * pViewport[3] / 2; //flip coords for y axis - result.z = projected.z; - - return visible; -} - -ILINE bool CCamera::Unproject(const Vec3& viewportPos, Vec3& result, Vec2i topLeft, Vec2i widthHeight) const -{ - Matrix44A mProj, mView; - - mathMatrixPerspectiveFov(&mProj, GetFov(), GetProjRatio(), GetNearPlane(), GetFarPlane()); - mathMatrixLookAt(&mView, GetPosition(), GetPosition() + GetViewdir(), Vec3(0, 0, 1)); - - int viewport[4] = {0, 0, GetViewSurfaceX(), GetViewSurfaceZ()}; - - if (!topLeft.IsZero() || !widthHeight.IsZero()) - { - viewport[0] = topLeft.x; - viewport[1] = topLeft.y; - viewport[2] = widthHeight.x; - viewport[3] = widthHeight.y; - } - - Vec4 vIn; - vIn.x = (viewportPos.x - viewport[0]) * 2 / viewport[2] - 1.0f; - vIn.y = (viewportPos.y - viewport[1]) * 2 / viewport[3] - 1.0f; - vIn.z = viewportPos.z; - vIn.w = 1.0; - - Matrix44A m; - const float* proj = mProj.GetData(); - const float* view = mView.GetData(); - float* mdata = m.GetData(); - for (int i = 0; i < 4; i++) - { - float ai0 = proj[i], ai1 = proj[4 + i], ai2 = proj[8 + i], ai3 = proj[12 + i]; - mdata[i] = ai0 * view[0] + ai1 * view[1] + ai2 * view[2] + ai3 * view[3]; - mdata[4 + i] = ai0 * view[4] + ai1 * view[5] + ai2 * view[6] + ai3 * view[7]; - mdata[8 + i] = ai0 * view[8] + ai1 * view[9] + ai2 * view[10] + ai3 * view[11]; - mdata[12 + i] = ai0 * view[12] + ai1 * view[13] + ai2 * view[14] + ai3 * view[15]; - } - - m.Invert(); - if (!m.IsValid()) - { - return false; - } - - Vec4 vOut = vIn * m; - if (vOut.w == 0.0) - { - return false; - } - - result = Vec3(vOut.x / vOut.w, vOut.y / vOut.w, vOut.z / vOut.w); - - return true; -} - -ILINE void CCamera::CalcScreenBounds(int* vOut, const AABB* pAABB, int nWidth, int nHeight) const -{ - Matrix44A mProj, mView, mVP; - mathMatrixPerspectiveFov(&mProj, GetFov(), GetProjRatio(), GetNearPlane(), GetFarPlane()); - mathMatrixLookAt(&mView, GetPosition(), GetPosition() + GetViewdir(), GetMatrix().GetColumn2()); - mVP = mView * mProj; - - Vec3 verts[8]; - - Vec2i topLeft = Vec2i(0, 0); - Vec2i widthHeight = Vec2i(nWidth, nHeight); - float pViewport[4] = {0.0f, 0.0f, (float)widthHeight.x, (float)widthHeight.y}; - - float x0 = 9999.9f, x1 = -9999.9f, y0 = 9999.9f, y1 = -9999.9f; - float fIntersect = 1.0f; - - Vec3 vDir = GetViewdir(); - Vec3 vPos = GetPosition(); - float d = vPos.Dot(vDir); - - verts[0] = Vec3(pAABB->min.x, pAABB->min.y, pAABB->min.z); - verts[1] = Vec3(pAABB->max.x, pAABB->min.y, pAABB->min.z); - verts[2] = Vec3(pAABB->min.x, pAABB->max.y, pAABB->min.z); - verts[3] = Vec3(pAABB->max.x, pAABB->max.y, pAABB->min.z); - verts[4] = Vec3(pAABB->min.x, pAABB->min.y, pAABB->max.z); - verts[5] = Vec3(pAABB->max.x, pAABB->min.y, pAABB->max.z); - verts[6] = Vec3(pAABB->min.x, pAABB->max.y, pAABB->max.z); - verts[7] = Vec3(pAABB->max.x, pAABB->max.y, pAABB->max.z); - - for (int i = 0; i < 8; i++) - { - float fDist = verts[i].Dot(vDir) - d; - fDist = (float)fsel(fDist, 0.0f, -fDist); - - //Project(verts[i],vertsOut[i], topLeft, widthHeight); - - Vec3 result = Vec3(0.0f, 0.0f, 0.0f); - Vec4 transformed, projected, vIn; - - vIn = Vec4(verts[i].x, verts[i].y, verts[i].z, 1.0f); - - mathVec4Transform((f32*)&projected, (f32*)&mVP, (f32*)&vIn); - - fIntersect = (float)fsel(-projected.w, 0.0f, 1.0f); - - if (!fzero(fIntersect) && !fzero(projected.w)) - { - projected.x /= projected.w; - projected.y /= projected.w; - projected.z /= projected.w; - - //output coords - result.x = pViewport[0] + (1.0f + projected.x) * pViewport[2] / 2.0f; - result.y = pViewport[1] + (1.0f - projected.y) * pViewport[3] / 2.0f; //flip coords for y axis - result.z = projected.z; - } - else - { - vOut[0] = topLeft.x; - vOut[1] = topLeft.y; - vOut[2] = widthHeight.x; - vOut[3] = widthHeight.y; - return; - } - - x0 = min(x0, result.x); - x1 = max(x1, result.x); - y0 = min(y0, result.y); - y1 = max(y1, result.y); - } - - vOut[0] = (int)max(0.0f, min(pViewport[2], x0)); - vOut[1] = (int)max(0.0f, min(pViewport[3], y0)); - vOut[2] = (int)max(0.0f, min(pViewport[2], x1)); - vOut[3] = (int)max(0.0f, min(pViewport[3], y1)); -} //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- diff --git a/Code/Legacy/CryCommon/Cry_Geo.h b/Code/Legacy/CryCommon/Cry_Geo.h index 0df130f1e6..f8a356c66f 100644 --- a/Code/Legacy/CryCommon/Cry_Geo.h +++ b/Code/Legacy/CryCommon/Cry_Geo.h @@ -1067,20 +1067,6 @@ public: } }; -////////////////////////////////////////////////////////////////////////// -#include "Cry_GeoDistance.h" -#include "Cry_GeoOverlap.h" -#include "Cry_GeoIntersect.h" - - - - - - - - - - ///////////////////////////////////////////////////////////////////////// //this is some special engine stuff, should be moved to a better location ///////////////////////////////////////////////////////////////////////// diff --git a/Code/Legacy/CryCommon/Cry_GeoDistance.h b/Code/Legacy/CryCommon/Cry_GeoDistance.h index c85845466c..46a863d68c 100644 --- a/Code/Legacy/CryCommon/Cry_GeoDistance.h +++ b/Code/Legacy/CryCommon/Cry_GeoDistance.h @@ -8,605 +8,16 @@ // Description : Common distance-computations - - -#ifndef CRYINCLUDE_CRYCOMMON_CRY_GEODISTANCE_H -#define CRYINCLUDE_CRYCOMMON_CRY_GEODISTANCE_H #pragma once #include -#include #include #ifdef max #undef max #endif -namespace Intersect -{ - bool Lineseg_Triangle(const Lineseg& lineseg, const Vec3& v0, const Vec3& v1, const Vec3& v2, Vec3& output, float* outT); -} - namespace Distance { - template - ILINE F Point_Point(const Vec3_tpl& p1, const Vec3_tpl& p2) - { - return sqrt_tpl(square(p1.x - p2.x) + square(p1.y - p2.y) + square(p1.z - p2.z)); - } - - template - ILINE F Point_PointSq(const Vec3_tpl& p1, const Vec3_tpl& p2) - { - return square(p1.x - p2.x) + square(p1.y - p2.y) + square(p1.z - p2.z); - } - - template - ILINE F Point_Point2DSq(const Vec3_tpl& p1, const Vec3_tpl& p2) - { - return square(p1.x - p2.x) + square(p1.y - p2.y); - } - - template - ILINE F Point_Point2D(const Vec3_tpl& p1, const Vec3_tpl& p2) - { - return sqrt_tpl(square(p1.x - p2.x) + square(p1.y - p2.y)); - } - - // Description: - // Distance: Origin_Triangle2D. - // Calculate the closest distance of a triangle in XY-plane to the coordinate origin. - // it is assumed that the z-values of the triangle are all in the same plane. - // Return Value: - // The 3d-position of the closest point on the triangle. - // Example: - // Vec3 result = Distance::Origin_Triangle2D( triangle ); - template - ILINE Vec3_tpl Origin_Triangle2D(const Triangle_tpl& t) - { - Vec3_tpl a = t.v0; - Vec3_tpl b = t.v1; - Vec3_tpl c = t.v2; - //check if (0,0,0) is inside or in fron of any triangle sides. - uint32 flag = ((a.x * (a.y - b.y) - a.y * (a.x - b.x)) < 0) | (((b.x * (b.y - c.y) - b.y * (b.x - c.x)) < 0) << 1) | (((c.x * (c.y - a.y) - c.y * (c.x - a.x)) < 0) << 2); - switch (flag) - { - case 0: - return Vec3_tpl(0, 0, a.z); //center is inside of triangle - case 1: - if ((a | (b - a)) > 0.0f) - { - flag = 5; - } - else if ((b | (a - b)) > 0.0f) - { - flag = 3; - } - break; - case 2: - if ((b | (c - b)) > 0.0f) - { - flag = 3; - } - else if ((c | (b - c)) > 0.0f) - { - flag = 6; - } - break; - case 3: - return b; //vertex B is closed - case 4: - if ((c | (a - c)) > 0.0f) - { - flag = 6; - } - else if ((a | (c - a)) > 0.0f) - { - flag = 5; - } - break; - case 5: - return a; //vertex A is closed - case 6: - return c; //vertex C is closed - } - //check again using expanded area - switch (flag) - { - case 1: - { - Vec3_tpl n = (b - a).GetNormalized(); - return n * (-a | n) + a; - } - case 2: - { - Vec3_tpl n = (c - b).GetNormalized(); - return n * (-b | n) + b; - } - case 3: - return b; - case 4: - { - Vec3_tpl n = (a - c).GetNormalized(); - return n * (-c | n) + c; - } - case 5: - return a; - case 6: - return c; - } - return Vec3_tpl(0, 0, 0); - } - - ILINE hwvec3 Origin_Triangle2D(const hwvec3& a, const hwvec3& b, const hwvec3& c) - { - const hwvec3 vZero = HWV3Zero(); - const hwvec3 aNeg = HWV3Negate(a); - const hwvec3 bNeg = HWV3Negate(b); - const hwvec3 cNeg = HWV3Negate(c); - - const hwvec3 vASubB = HWVSub(a, b); - const hwvec3 vBSubA = HWVSub(b, a); - const hwvec3 vASubC = HWVSub(a, c); - const hwvec3 vCSubA = HWVSub(c, a); - const hwvec3 vBSubC = HWVSub(b, c); - const hwvec3 vCSubB = HWVSub(c, b); - - HWV4PermuteControl(vSwapXY, HWV_PERMUTE_0Y, HWV_PERMUTE_0X, HWV_PERMUTE_0Z, HWV_PERMUTE_0W); - - const hwvec3 aPerm = HWV3PermuteWord(a, a, vSwapXY); - const hwvec3 vACombined = HWVMultiply(aPerm, vASubB); - - //Yes, this is the right way around, check the non-vectorized version below :) - const simdf vAY = HWV3SplatXToSIMDF(vACombined); - const simdf vAX = HWV3SplatYToSIMDF(vACombined); - - - const hwvec3 bPerm = HWV3PermuteWord(b, b, vSwapXY); - const hwvec3 vBCombined = HWVMultiply(bPerm, vBSubC); - - const simdf vBY = HWV3SplatXToSIMDF(vBCombined); - const simdf vBX = HWV3SplatYToSIMDF(vBCombined); - - - const hwvec3 cPerm = HWV3PermuteWord(c, c, vSwapXY); - const hwvec3 vCCombined = HWVMultiply(cPerm, vCSubA); - - const simdf vCY = HWV3SplatXToSIMDF(vCCombined); - const simdf vCX = HWV3SplatYToSIMDF(vCCombined); - - - //check if (0,0,0) is inside or in front of any triangle sides. - bool subflag0 = SIMDFLessThanB(vAX, vAY); - bool subflag1 = SIMDFLessThanB(vBX, vBY); - bool subflag2 = SIMDFLessThanB(vCX, vCY); - - uint32 flag = ((uint32)subflag0) | ((uint32)(subflag1 << 1)) | ((uint32)(subflag2 << 2)); - - switch (flag) - { - case 0: - { - HWV4PermuteControl(selectz, HWV_PERMUTE_1X, HWV_PERMUTE_1Y, HWV_PERMUTE_0Z, HWV_PERMUTE_1W); - return HWV3PermuteWord(a, vZero, selectz); //center is inside of triangle - } - case 1: - { - if (SIMDFLessThanB(HWV3AsSIMDF(vZero), HWV3Dot(a, vBSubA))) - { - flag = 5; - } - else if (SIMDFLessThanB(HWV3AsSIMDF(vZero), HWV3Dot(b, vASubB))) - { - flag = 3; - } - break; - } - case 2: - { - if (SIMDFLessThanB(HWV3AsSIMDF(vZero), HWV3Dot(b, vCSubB))) - { - flag = 3; - } - else if (SIMDFLessThanB(HWV3AsSIMDF(vZero), HWV3Dot(c, vBSubC))) - { - flag = 6; - } - break; - } - case 3: - return b; //vertex B is closed - case 4: - { - if (SIMDFLessThanB(HWV3AsSIMDF(vZero), HWV3Dot(c, vASubC))) - { - flag = 6; - } - else if (SIMDFLessThanB(HWV3AsSIMDF(vZero), HWV3Dot(a, vCSubA))) - { - flag = 5; - } - break; - } - case 5: - return a; //vertex A is closed - case 6: - return c; //vertex C is closed - } - - switch (flag) - { - case 1: - { - //hwvec3 n = HWV3Normalize(vBSubA); - simdf nLengthSq = HWV3Dot(vBSubA, vBSubA); - simdf invLengthSq = SIMDFReciprocal(nLengthSq); - return HWVMultiplySIMDFAdd(vBSubA, SIMDFMult(HWV3Dot(aNeg, vBSubA), invLengthSq), a); - } - case 2: - { - simdf nLengthSq = HWV3Dot(vCSubB, vCSubB); - simdf invLengthSq = SIMDFReciprocal(nLengthSq); - return HWVMultiplySIMDFAdd(vCSubB, SIMDFMult(HWV3Dot(bNeg, vCSubB), invLengthSq), b); - } - case 3: - return b; - case 4: - { - simdf nLengthSq = HWV3Dot(vASubC, vASubC); - simdf invLengthSq = SIMDFReciprocal(nLengthSq); - return HWVMultiplySIMDFAdd(vASubC, SIMDFMult(HWV3Dot(cNeg, vASubC), invLengthSq), c); - } - case 5: - return a; - case 6: - return c; - } - - // switch (flag) { - // case 1: { Vec3_tpl n=(b-a).GetNormalized(); return n*(-a|n)+a; } - // case 2: { Vec3_tpl n=(c-b).GetNormalized(); return n*(-b|n)+b; } - // case 3: return b; - // case 4: { Vec3_tpl n=(a-c).GetNormalized(); return n*(-c|n)+c; } - // case 5: return a; - // case 6: return c; - // } - - return vZero; - } - - - // Description: - // Distance: Point_Triangle. - // Calculate the closest distance of a point to a triangle in 3d-space. - // Return value: - // The squared distance. - // Example: - // float result = Distance::Point_Triangle( pos, triangle ); - template - ILINE F Point_TriangleSq(const Vec3_tpl& p, const Triangle_tpl& t) - { - //translate triangle into origin - Vec3_tpl a = t.v0 - p; - Vec3_tpl b = t.v1 - p; - Vec3_tpl c = t.v2 - p; - //transform triangle into XY-plane to simplify the test - Matrix33_tpl r33 = Matrix33_tpl::CreateRotationV0V1(((b - a) % (a - c)).GetNormalized(), Vec3(0, 0, 1)); - Vec3_tpl h = Origin_Triangle2D(Triangle_tpl(r33 * a, r33 * b, r33 * c)); - return (h | h); //return squared distance - } - - inline simdf Point_TriangleByPointsSq(const hwvec3& p, const hwvec3& t0, const hwvec3& t1, const hwvec3& t2) - { - //translate triangle into origin - - HWV3Constant(kUp, 0.0f, 0.0f, 1.0f); - - const hwvec3 a = HWVSub(t0, p); - const hwvec3 b = HWVSub(t1, p); - const hwvec3 c = HWVSub(t2, p); - - const hwvec3 baDiff = HWVSub(b, a); - const hwvec3 acDiff = HWVSub(a, c); - - const hwvec3 cross = HWVCross(baDiff, acDiff); - - const hwvec3 crossNormalized = HWV3Normalize(cross); - - hwmtx33 r33 = HWMtx33CreateRotationV0V1(crossNormalized, kUp); - - hwmtx33 r33opt = HWMtx33GetOptimized(r33); - - //transform triangle into XY-plane to simplify the test - const hwvec3 aRot = HWMtx33RotateVecOpt(r33opt, a); - const hwvec3 bRot = HWMtx33RotateVecOpt(r33opt, b); - const hwvec3 cRot = HWMtx33RotateVecOpt(r33opt, c); - - hwvec3 h = Origin_Triangle2D(aRot, bRot, cRot); - - return HWV3Dot(h, h); - } - - template - ILINE F Point_Triangle(const Vec3_tpl& p, const Triangle_tpl& t) - { - return sqrt_tpl(Point_TriangleSq(p, t)); - } - - // Description: - // Distance: Point_Triangle. - // Calculate the closest distance of a point to a triangle in 3d-space. - // The function returns the squared distance and the 3d-position of the - // closest point on the triangle. - // Example: - // float result = Distance::Point_Triangle( pos, triangle, output ); - template - ILINE F Point_TriangleSq(const Vec3_tpl& p, const Triangle_tpl& t, Vec3_tpl& output) - { - //translate triangle into origin - Vec3_tpl a = t.v0 - p; - Vec3_tpl b = t.v1 - p; - Vec3_tpl c = t.v2 - p; - //transform triangle into XY-plane to simplify the test - Matrix33_tpl r33 = Matrix33_tpl::CreateRotationV0V1(((b - a) % (a - c)).GetNormalized(), Vec3_tpl(0, 0, 1)); - Vec3_tpl h = Origin_Triangle2D(Triangle_tpl(r33 * a, r33 * b, r33 * c)); - output = h * r33 + p; - return (h | h); //return squared distance - } - - template - ILINE F Point_Triangle(const Vec3_tpl& p, const Triangle_tpl& t, Vec3_tpl& output) - { - return sqrt_tpl(Point_TriangleSq(p, t, output)); - } - - // Description: - // Squared distance from point to triangle, optionally returning the triangle position in - // parameteric form. - template - ILINE F Point_TriangleSq(const Vec3_tpl& point, const Triangle_tpl& triangle, F* pT0, F* pT1) - { - Vec3 diff = triangle.v0 - point; - const Vec3 edge0 = triangle.v1 - triangle.v0; - const Vec3 edge1 = triangle.v2 - triangle.v0; - F fA00 = edge0.GetLengthSquared(); - F fA01 = edge0.Dot(edge1); - F fA11 = edge1.GetLengthSquared(); - F fB0 = diff.Dot(edge0); - F fB1 = diff.Dot(edge1); - F fC = diff.GetLengthSquared(); - F fDet = abs(fA00 * fA11 - fA01 * fA01); - F fS = fA01 * fB1 - fA11 * fB0; - F fT = fA01 * fB0 - fA00 * fB1; - F fSqrDist; - - if (fS + fT <= fDet) - { - if (fS < (F)0.0) - { - if (fT < (F)0.0) // region 4 - { - if (fB0 < (F)0.0) - { - fT = (F)0.0; - if (-fB0 >= fA00) - { - fS = (F)1.0; - fSqrDist = fA00 + ((F)2.0) * fB0 + fC; - } - else - { - fS = -fB0 / fA00; - fSqrDist = fB0 * fS + fC; - } - } - else - { - fS = (F)0.0; - if (fB1 >= (F)0.0) - { - fT = (F)0.0; - fSqrDist = fC; - } - else if (-fB1 >= fA11) - { - fT = (F)1.0; - fSqrDist = fA11 + ((F)2.0) * fB1 + fC; - } - else - { - fT = -fB1 / fA11; - fSqrDist = fB1 * fT + fC; - } - } - } - else // region 3 - { - fS = (F)0.0; - if (fB1 >= (F)0.0) - { - fT = (F)0.0; - fSqrDist = fC; - } - else if (-fB1 >= fA11) - { - fT = (F)1.0; - fSqrDist = fA11 + ((F)2.0) * fB1 + fC; - } - else - { - fT = -fB1 / fA11; - fSqrDist = fB1 * fT + fC; - } - } - } - else if (fT < (F)0.0) // region 5 - { - fT = (F)0.0; - if (fB0 >= (F)0.0) - { - fS = (F)0.0; - fSqrDist = fC; - } - else if (-fB0 >= fA00) - { - fS = (F)1.0; - fSqrDist = fA00 + ((F)2.0) * fB0 + fC; - } - else - { - fS = -fB0 / fA00; - fSqrDist = fB0 * fS + fC; - } - } - else // region 0 - { - // minimum at interior point - F fInvDet = ((F)1.0) / fDet; - fS *= fInvDet; - fT *= fInvDet; - fSqrDist = fS * (fA00 * fS + fA01 * fT + ((F)2.0) * fB0) + - fT * (fA01 * fS + fA11 * fT + ((F)2.0) * fB1) + fC; - } - } - else - { - F fTmp0, fTmp1, fNumer, fDenom; - - if (fS < (F)0.0) // region 2 - { - fTmp0 = fA01 + fB0; - fTmp1 = fA11 + fB1; - if (fTmp1 > fTmp0) - { - fNumer = fTmp1 - fTmp0; - fDenom = fA00 - 2.0f * fA01 + fA11; - if (fNumer >= fDenom) - { - fS = (F)1.0; - fT = (F)0.0; - fSqrDist = fA00 + ((F)2.0) * fB0 + fC; - } - else - { - fS = fNumer / fDenom; - fT = (F)1.0 - fS; - fSqrDist = fS * (fA00 * fS + fA01 * fT + 2.0f * fB0) + - fT * (fA01 * fS + fA11 * fT + ((F)2.0) * fB1) + fC; - } - } - else - { - fS = (F)0.0; - if (fTmp1 <= (F)0.0) - { - fT = (F)1.0; - fSqrDist = fA11 + ((F)2.0) * fB1 + fC; - } - else if (fB1 >= (F)0.0) - { - fT = (F)0.0; - fSqrDist = fC; - } - else - { - fT = -fB1 / fA11; - fSqrDist = fB1 * fT + fC; - } - } - } - else if (fT < (F)0.0) // region 6 - { - fTmp0 = fA01 + fB1; - fTmp1 = fA00 + fB0; - if (fTmp1 > fTmp0) - { - fNumer = fTmp1 - fTmp0; - fDenom = fA00 - ((F)2.0) * fA01 + fA11; - if (fNumer >= fDenom) - { - fT = (F)1.0; - fS = (F)0.0; - fSqrDist = fA11 + ((F)2.0) * fB1 + fC; - } - else - { - fT = fNumer / fDenom; - fS = (F)1.0 - fT; - fSqrDist = fS * (fA00 * fS + fA01 * fT + ((F)2.0) * fB0) + - fT * (fA01 * fS + fA11 * fT + ((F)2.0) * fB1) + fC; - } - } - else - { - fT = (F)0.0; - if (fTmp1 <= (F)0.0) - { - fS = (F)1.0; - fSqrDist = fA00 + ((F)2.0) * fB0 + fC; - } - else if (fB0 >= (F)0.0) - { - fS = (F)0.0; - fSqrDist = fC; - } - else - { - fS = -fB0 / fA00; - fSqrDist = fB0 * fS + fC; - } - } - } - else // region 1 - { - fNumer = fA11 + fB1 - fA01 - fB0; - if (fNumer <= (F)0.0) - { - fS = (F)0.0; - fT = (F)1.0; - fSqrDist = fA11 + ((F)2.0) * fB1 + fC; - } - else - { - fDenom = fA00 - 2.0f * fA01 + fA11; - if (fNumer >= fDenom) - { - fS = (F)1.0; - fT = (F)0.0; - fSqrDist = fA00 + ((F)2.0) * fB0 + fC; - } - else - { - fS = fNumer / fDenom; - fT = (F)1.0 - fS; - fSqrDist = fS * (fA00 * fS + fA01 * fT + ((F)2.0) * fB0) + - fT * (fA01 * fS + fA11 * fT + ((F)2.0) * fB1) + fC; - } - } - } - } - - if (pT0) - { - *pT0 = fS; - } - - if (pT1) - { - *pT1 = fT; - } - - return abs(fSqrDist); - } - - // Description: - // Distance from point to triangle, optionally returning the triangle position in - // parameteric form. - template - ILINE F Point_Triangle(const Vec3_tpl& point, const Triangle_tpl& triangle, F* pT0, F* pT1) - { - return sqrt_tpl(Point_TriangleSq(point, triangle, pT0, pT1)); - } - //---------------------------------------------------------------------------------- /// Returns squared distance from a point to a line segment and also the "t value" (from 0 to 1) of the /// closest point on the line segment @@ -648,264 +59,6 @@ namespace Distance { return sqrt_tpl(Point_LinesegSq(p, lineseg, fT)); } - - //---------------------------------------------------------------------------------- - /// Returns squared distance from a point to a line segment, ignoring the z coordinates - //---------------------------------------------------------------------------------- - template - ILINE F Point_Lineseg2DSq(const Vec3_tpl& p, const Lineseg& lineseg) - { - F dspx = p.x - lineseg.start.x, dspy = p.y - lineseg.start.y; - F dsex = lineseg.end.x - lineseg.start.x, dsey = lineseg.end.y - lineseg.start.y; - - F denom = (dsex * dsex + dsey * dsey); - F t; - if (denom > 1e-7) - { - t = (F)(dspx * dsex + dspy * dsey) / denom; - t = clamp_tpl(t, 0.0f, 1.0f); - } - else - { - t = 0; - } - - F dx = dsex * t - dspx; - F dy = dsey * t - dspy; - - return dx * dx + dy * dy; - } - - //---------------------------------------------------------------------------------- - /// Returns squared distance from a point to a line segment and also the "t value" (from 0 to 1) of the - /// closest point on the line segment, ignoring the z coordinates - //---------------------------------------------------------------------------------- - template - ILINE F Point_Lineseg2DSq(Vec3_tpl p, Lineseg lineseg, F& fT) - { - p.z = 0.0f; - lineseg.start.z = 0.0f; - lineseg.end.z = 0.0f; - return Point_LinesegSq(p, lineseg, fT); - } - - /// Returns distance from a point to a line segment, ignoring the z coordinates - template - ILINE F Point_Lineseg2D(const Vec3_tpl& p, const Lineseg& lineseg, F& fT) - { - return sqrt_tpl(Point_Lineseg2DSq(p, lineseg, fT)); - } - - /// Returns the squared distance from a point to a line as defined by two points (for accuracy - /// in some situations), and also the closest position on the line - template - ILINE F Point_LineSq(const Vec3_tpl& vPoint, - const Vec3_tpl& vLineStart, const Vec3_tpl& vLineEnd, Vec3_tpl& linePt) - { - Vec3_tpl dir; - Vec3_tpl pointVector; - - if ((vPoint - vLineStart).GetLengthSquared() > (vPoint - vLineEnd).GetLengthSquared()) - { - dir = vLineStart - vLineEnd; - pointVector = vPoint - vLineEnd; - linePt = vLineEnd; - } - else - { - dir = vLineEnd - vLineStart; - pointVector = vPoint - vLineStart; - linePt = vLineStart; - } - - F dirLen2 = dir.GetLengthSquared(); - if (dirLen2 <= 0.0f) - { - return pointVector.GetLengthSquared(); - } - dir /= sqrt_tpl(dirLen2); - - F t0 = pointVector.Dot(dir); - linePt += t0 * dir; - return (vPoint - linePt).GetLengthSquared(); - } - - /// Returns the distance from a point to a line as defined by two points (for accuracy - /// in some situations) - template - ILINE F Point_Line(const Vec3_tpl& vPoint, - const Vec3_tpl& vLineStart, const Vec3_tpl& vLineEnd, Vec3_tpl& linePt) - { - return sqrt_tpl(Point_LineSq(vPoint, vLineStart, vLineEnd, linePt)); - } - - /// In 2D. The returned linePt will have 0 z value - template - ILINE F Point_Line2DSq(Vec3_tpl vPoint, - Vec3_tpl vLineStart, Vec3_tpl vLineEnd, Vec3_tpl& linePt) - { - vPoint.z = 0.0f; - vLineStart.z = 0.0f; - vLineEnd.z = 0.0f; - return Point_LineSq(vPoint, vLineStart, vLineEnd, linePt); - } - - /// In 2D. The returned linePt will have 0 z value - template - ILINE F Point_Line2D(const Vec3_tpl& vPoint, - const Vec3_tpl& vLineStart, const Vec3_tpl& vLineEnd, Vec3_tpl& linePt) - { - return sqrt_tpl(Point_Line2DSq(vPoint, vLineStart, vLineEnd, linePt)); - } - - - /// Returns squared distance from a point to a polygon _edge_, together with the closest point on - /// the edge of the polygon. Can use the same point in/out - template - inline F Point_Polygon2DSq(const Vec3_tpl p, const VecContainer& polygon, Vec3_tpl& polyPos, Vec3_tpl* pNormal = NULL) - { - typename VecContainer::const_iterator li = polygon.begin(); - typename VecContainer::const_iterator liend = polygon.end(); - polyPos.x = polyPos.y = polyPos.z = 0.f; - float bestDist = std::numeric_limits::max(); - for (; li != liend; ++li) - { - typename VecContainer::const_iterator linext = li; - ++linext; - if (linext == liend) - { - linext = polygon.begin(); - } - const Vec3_tpl& l0 = *li; - const Vec3_tpl& l1 = *linext; - - float f; - float thisDist = Distance::Point_Lineseg2DSq(p, Lineseg(l0, l1), f); - if (thisDist < bestDist) - { - bestDist = thisDist; - polyPos = l0 + f * (l1 - l0); - if (pNormal) - { - Vec3_tpl vPolyseg = l1 - l0; - Vec3_tpl vIntSeg = (polyPos - p); - pNormal->x = vPolyseg.y; - pNormal->y = -vPolyseg.x; - pNormal->z = 0; - pNormal->NormalizeSafe(); - // returns the normal towards the start point of the intersecting segment - if ((vIntSeg.Dot(*pNormal)) > 0) - { - pNormal->x = -pNormal->x; - pNormal->y = -pNormal->y; - } - } - } - } - return bestDist; - } - - //---------------------------------------------------------------------------------- - /// Calculate squared distance between two line segments - //---------------------------------------------------------------------------------- - template - ILINE F Lineseg_Lineseg2DSq(const Lineseg& seg0, const Lineseg& seg1) - { - const F Epsilon = (F)0.0000001; - - Vec3_tpl delta = seg1.start - seg0.start; - - Vec3_tpl dir0 = seg0.end - seg0.start; - Vec3_tpl dir1 = seg1.end - seg1.start; - - F det = dir0.x * dir1.y - dir0.y * dir1.x; - F det0 = delta.x * dir1.y - delta.y * dir1.x; - F det1 = delta.x * dir0.y - delta.y * dir0.x; - - F absDet = fabs_tpl(det); - - if (absDet >= Epsilon) - { - F invDet = (F)1.0 / det; - - F a = det0 * invDet; - F b = det1 * invDet; - - if ((a <= (F)1.0) && (a >= (F)0.0) && (b <= (F)1.0) && (b >= (F)0.0)) - { - return (F)0.0; - } - } - - return min(Distance::Point_Lineseg2DSq(seg0.start, seg1), min(Distance::Point_Lineseg2DSq(seg0.end, seg1), - min(Distance::Point_Lineseg2DSq(seg1.start, seg0), Distance::Point_Lineseg2DSq(seg1.end, seg0)))); - } - - /// Returns squared distance from a lineseg to a polygon, together with the closest point on - /// the edge of the polygon. Can use the same point in/out - template - inline float Lineseg_Polygon2DSq(const Lineseg& line, const VecContainer& polygon) - { - typename VecContainer::const_iterator li = polygon.begin(); - typename VecContainer::const_iterator liend = polygon.end(); - - float bestDistSq = std::numeric_limits::max(); - for (; li != liend; ++li) - { - typename VecContainer::const_iterator linext = li; - ++linext; - if (linext == liend) - { - linext = polygon.begin(); - } - - float thisDistSq = Distance::Lineseg_Lineseg2DSq(line, Lineseg(*li, *linext)); - if (thisDistSq < bestDistSq) - { - bestDistSq = thisDistSq; - } - } - - return bestDistSq; - } - - /// Returns distance from a point to a polygon _edge_, together with the closest point on - /// the edge of the polygon - template - inline F Point_Polygon2D(const Vec3_tpl p, const VecContainer& polygon, Vec3_tpl& polyPos, Vec3_tpl* pNormal = NULL) - { - return sqrt_tpl(Point_Polygon2DSq(p, polygon, polyPos, pNormal)); - } - - - //! \brief Get the distance squared from a point to an OBB. - //! \param point Vec3 indicating the point to test - //! \param obb OBB indicating the Obb to test - //! \return float Closest distance squared from the point to the obb. - template - AZ_INLINE F Point_OBBSq(const Vec3_tpl& point, const OBB& obb) - { - F distanceSquared = 0; - const Vec3 v = point - obb.c; // box center to point - for (int i = 0; i < 3; ++i) - { - F d = v.Dot(obb.m33.GetColumn(i)); - F ex = 0; - F halfLength = obb.h[i]; - if (d < -halfLength) - { - ex = d + halfLength; - } - else if (d > halfLength) - { - ex = d - halfLength; - } - distanceSquared += sqr(ex); - } - - return distanceSquared; - } - //! \brief Get the distance squared from a Point to a Cylinder. //! \param point AZ::Vector3 The point to test distance against the cylinder //! \param cylinderAxisEndA AZ::Vector3 One end of the cylinder axis (centered in the circle) @@ -917,7 +70,7 @@ namespace Distance { const AZ::Vector3& cylinderAxisEndA, const AZ::Vector3& cylinderAxisEndB, float radius - ) + ) { // Use the cylinder axis' center point to determine distance by // splitting into Voronoi regions and using symmetry. @@ -972,723 +125,4 @@ namespace Distance { return distanceSquared; } - //---------------------------------------------------------------------------------- - // Distance: Point_AABB - //---------------------------------------------------------------------------------- - // Calculate the closest distance of a point to a AABB in 3d-space. - // The function returns the squared distance. - // optionally the closest point on the hull is calculated - // - // Example: - // float result = Distance::Point_AABBSq( pos, aabb ); - //---------------------------------------------------------------------------------- - template - ILINE F Point_AABBSq(const Vec3_tpl& vPoint, const AABB& aabb) - { - F fDist2 = 0; - - F min0Diff = (F)aabb.min[0] - (F)vPoint[0]; - fDist2 = (F)fsel(min0Diff, fDist2 + sqr(min0Diff), fDist2); - F max0Diff = (F)vPoint[0] - (F)aabb.max[0]; - fDist2 = (F)fsel(max0Diff, fDist2 + sqr(max0Diff), fDist2); - - F min1Diff = (F)aabb.min[1] - (F)vPoint[1]; - fDist2 = (F)fsel(min1Diff, fDist2 + sqr(min1Diff), fDist2); - F max1Diff = (F)vPoint[1] - (F)aabb.max[1]; - fDist2 = (F)fsel(max1Diff, fDist2 + sqr(max1Diff), fDist2); - - F min2Diff = (F)aabb.min[2] - (F)vPoint[2]; - fDist2 = (F)fsel(min2Diff, fDist2 + sqr(min2Diff), fDist2); - F max2Diff = (F)vPoint[2] - (F)aabb.max[2]; - fDist2 = (F)fsel(max2Diff, fDist2 + sqr(max2Diff), fDist2); - - return fDist2; - } - - template - ILINE F Point_AABBSq(const Vec3_tpl& vPoint, const AABB& aabb, Vec3_tpl& vClosest) - { - F fDist2 = Point_AABBSq(vPoint, aabb); - - vClosest = vPoint; - if (!iszero(fDist2)) - { - // vPoint is outside the AABB - vClosest.x = max(vClosest.x, aabb.min.x); - vClosest.x = min(vClosest.x, aabb.max.x); - vClosest.y = max(vClosest.y, aabb.min.y); - vClosest.y = min(vClosest.y, aabb.max.y); - vClosest.z = max(vClosest.z, aabb.min.z); - vClosest.z = min(vClosest.z, aabb.max.z); - } - else - { - // vPoint is inside the AABB - uint16 nSubBox = 0; - F fHalf = 2; - - F fMiddleX = ((aabb.max.x - aabb.min.x) / fHalf) + aabb.min.x; - F fMiddleY = ((aabb.max.y - aabb.min.y) / fHalf) + aabb.min.y; - F fMiddleZ = ((aabb.max.z - aabb.min.z) / fHalf) + aabb.min.z; - - if (vPoint.x < fMiddleX) - { - nSubBox |= 0x001; // Is Left - } - if (vPoint.y < fMiddleY) - { - nSubBox |= 0x010; // Is Rear - } - if (vPoint.z < fMiddleZ) - { - nSubBox |= 0x100; // Is Low - } - F fDistanceToX = 0; - F fDistanceToY = 0; - F fDistanceToZ = 0; - - F fNewX, fNewY, fNewZ; - - switch (nSubBox & 0xFFF) - { - case 0x000: - // Is Right/Front/Top - fDistanceToX = aabb.max.x - vPoint.x; - fDistanceToY = aabb.max.y - vPoint.y; - fDistanceToZ = aabb.max.z - vPoint.z; - - fNewX = aabb.max.x; - fNewY = aabb.max.y; - fNewZ = aabb.max.z; - - break; - case 0x001: - // Is Left/Front/Top - fDistanceToX = vPoint.x - aabb.min.x; - fDistanceToY = aabb.max.y - vPoint.y; - fDistanceToZ = aabb.max.z - vPoint.z; - - fNewX = aabb.min.x; - fNewY = aabb.max.y; - fNewZ = aabb.max.z; - - break; - case 0x010: - // Is Right/Rear/Top - fDistanceToX = aabb.max.x - vPoint.x; - fDistanceToY = vPoint.y - aabb.min.y; - fDistanceToZ = aabb.max.z - vPoint.z; - - fNewX = aabb.max.x; - fNewY = aabb.min.y; - fNewZ = aabb.max.z; - - break; - case 0x011: - // Is Left/Rear/Top - fDistanceToX = vPoint.x - aabb.min.x; - fDistanceToY = vPoint.y - aabb.min.y; - fDistanceToZ = aabb.max.z - vPoint.z; - - fNewX = aabb.min.x; - fNewY = aabb.min.y; - fNewZ = aabb.max.z; - - break; - case 0x100: - // Is Right/Front/Low - fDistanceToX = aabb.max.x - vPoint.x; - fDistanceToY = aabb.max.y - vPoint.y; - fDistanceToZ = vPoint.z - aabb.min.z; - - fNewX = aabb.max.x; - fNewY = aabb.max.y; - fNewZ = aabb.min.z; - - break; - case 0x101: - // Is Left/Front/Low - fDistanceToX = vPoint.x - aabb.min.x; - fDistanceToY = aabb.max.y - vPoint.y; - fDistanceToZ = vPoint.z - aabb.min.z; - - fNewX = aabb.min.x; - fNewY = aabb.max.y; - fNewZ = aabb.min.z; - - break; - case 0x110: - // Is Right/Rear/Low - fDistanceToX = aabb.max.x - vPoint.x; - fDistanceToY = vPoint.y - aabb.min.y; - fDistanceToZ = vPoint.z - aabb.min.z; - - fNewX = aabb.max.x; - fNewY = aabb.min.y; - fNewZ = aabb.min.z; - - break; - case 0x111: - // Is Left/Rear/Low - fDistanceToX = vPoint.x - aabb.min.x; - fDistanceToY = vPoint.y - aabb.min.y; - fDistanceToZ = vPoint.z - aabb.min.z; - - fNewX = aabb.min.x; - fNewY = aabb.min.y; - fNewZ = aabb.min.z; - - break; - default: - fNewX = fNewY = fNewZ = 0; - break; - } - - if (fDistanceToX < fDistanceToY && fDistanceToX < fDistanceToZ) - { - vClosest.x = fNewX; - } - - if (fDistanceToY < fDistanceToX && fDistanceToY < fDistanceToZ) - { - vClosest.y = fNewY; - } - - if (fDistanceToZ < fDistanceToX && fDistanceToZ < fDistanceToY) - { - vClosest.z = fNewZ; - } - - fDist2 = vClosest.GetSquaredDistance(vPoint); - } - return fDist2; - } - - //---------------------------------------------------------------------------------- - // Distance: Sphere_Triangle - //---------------------------------------------------------------------------------- - // Calculate the closest distance of a sphere to a triangle in 3d-space. - // The function returns the squared distance. If sphere and triangle overlaps, - // the returned distance is 0 - // - // Example: - // float result = Distance::Point_TriangleSq( pos, triangle ); - //---------------------------------------------------------------------------------- - template - ILINE F Sphere_TriangleSq(const ::Sphere& s, const Triangle_tpl& t) - { - F sqdistance = Distance::Point_TriangleSq(s.center, t) - (s.radius * s.radius); - if (sqdistance < 0) - { - sqdistance = 0; - } - return sqdistance; - } - - template - ILINE F Sphere_TriangleSq(const ::Sphere& s, const Triangle_tpl& t, Vec3_tpl& output) - { - F sqdistance = Distance::Point_TriangleSq(s.center, t, output) - (s.radius * s.radius); - if (sqdistance < 0) - { - sqdistance = 0; - } - return sqdistance; - } - - //---------------------------------------------------------------------------------- - /// Calculate squared distance between two line segments, along with the optional - /// parameters of the closest points - //---------------------------------------------------------------------------------- - template - ILINE F Lineseg_LinesegSq(const Lineseg& seg0, const Lineseg seg1, F* t0, F* t1) - { - Vec3 diff = seg0.start - seg1.start; - Vec3 delta0 = seg0.end - seg0.start; - Vec3 delta1 = seg1.end - seg1.start; - F fA00 = delta0.GetLengthSquared(); - F fA01 = -delta0.Dot(delta1); - F fA11 = delta1.GetLengthSquared(); - F fB0 = diff.Dot(delta0); - F fC = diff.GetLengthSquared(); - F fDet = abs(fA00 * fA11 - fA01 * fA01); - F fB1, fS, fT, fSqrDist, fTmp; - - if (fDet > (F) 0.0) - { - // line segments are not parallel - fB1 = -diff.Dot(delta1); - fS = fA01 * fB1 - fA11 * fB0; - fT = fA01 * fB0 - fA00 * fB1; - - if (fS >= (F)0.0) - { - if (fS <= fDet) - { - if (fT >= (F)0.0) - { - if (fT <= fDet) // region 0 (interior) - { - // minimum at two interior points of 3D lines - F fInvDet = ((F)1.0) / fDet; - fS *= fInvDet; - fT *= fInvDet; - fSqrDist = fS * (fA00 * fS + fA01 * fT + ((F)2.0) * fB0) + - fT * (fA01 * fS + fA11 * fT + ((F)2.0) * fB1) + fC; - } - else // region 3 (side) - { - fT = (F)1.0; - fTmp = fA01 + fB0; - if (fTmp >= (F)0.0) - { - fS = (F)0.0; - fSqrDist = fA11 + ((F)2.0) * fB1 + fC; - } - else if (-fTmp >= fA00) - { - fS = (F)1.0; - fSqrDist = fA00 + fA11 + fC + ((F)2.0) * (fB1 + fTmp); - } - else - { - fS = -fTmp / fA00; - fSqrDist = fTmp * fS + fA11 + ((F)2.0) * fB1 + fC; - } - } - } - else // region 7 (side) - { - fT = (F)0.0; - if (fB0 >= (F)0.0) - { - fS = (F)0.0; - fSqrDist = fC; - } - else if (-fB0 >= fA00) - { - fS = (F)1.0; - fSqrDist = fA00 + ((F)2.0) * fB0 + fC; - } - else - { - fS = -fB0 / fA00; - fSqrDist = fB0 * fS + fC; - } - } - } - else - { - if (fT >= (F)0.0) - { - if (fT <= fDet) // region 1 (side) - { - fS = (F)1.0; - fTmp = fA01 + fB1; - if (fTmp >= (F)0.0) - { - fT = (F)0.0; - fSqrDist = fA00 + ((F)2.0) * fB0 + fC; - } - else if (-fTmp >= fA11) - { - fT = (F)1.0; - fSqrDist = fA00 + fA11 + fC + ((F)2.0) * (fB0 + fTmp); - } - else - { - fT = -fTmp / fA11; - fSqrDist = fTmp * fT + fA00 + ((F)2.0) * fB0 + fC; - } - } - else // region 2 (corner) - { - fTmp = fA01 + fB0; - if (-fTmp <= fA00) - { - fT = (F)1.0; - if (fTmp >= (F)0.0) - { - fS = (F)0.0; - fSqrDist = fA11 + ((F)2.0) * fB1 + fC; - } - else - { - fS = -fTmp / fA00; - fSqrDist = fTmp * fS + fA11 + ((F)2.0) * fB1 + fC; - } - } - else - { - fS = (F)1.0; - fTmp = fA01 + fB1; - if (fTmp >= (F)0.0) - { - fT = (F)0.0; - fSqrDist = fA00 + ((F)2.0) * fB0 + fC; - } - else if (-fTmp >= fA11) - { - fT = (F)1.0; - fSqrDist = fA00 + fA11 + fC + - ((F)2.0) * (fB0 + fTmp); - } - else - { - fT = -fTmp / fA11; - fSqrDist = fTmp * fT + fA00 + ((F)2.0) * fB0 + fC; - } - } - } - } - else // region 8 (corner) - { - if (-fB0 < fA00) - { - fT = (F)0.0; - if (fB0 >= (F)0.0) - { - fS = (F)0.0; - fSqrDist = fC; - } - else - { - fS = -fB0 / fA00; - fSqrDist = fB0 * fS + fC; - } - } - else - { - fS = (F)1.0; - fTmp = fA01 + fB1; - if (fTmp >= (F)0.0) - { - fT = (F)0.0; - fSqrDist = fA00 + ((F)2.0) * fB0 + fC; - } - else if (-fTmp >= fA11) - { - fT = (F)1.0; - fSqrDist = fA00 + fA11 + fC + ((F)2.0) * (fB0 + fTmp); - } - else - { - fT = -fTmp / fA11; - fSqrDist = fTmp * fT + fA00 + ((F)2.0) * fB0 + fC; - } - } - } - } - } - else - { - if (fT >= (F)0.0) - { - if (fT <= fDet) // region 5 (side) - { - fS = (F)0.0; - if (fB1 >= (F)0.0) - { - fT = (F)0.0; - fSqrDist = fC; - } - else if (-fB1 >= fA11) - { - fT = (F)1.0; - fSqrDist = fA11 + ((F)2.0) * fB1 + fC; - } - else - { - fT = -fB1 / fA11; - fSqrDist = fB1 * fT + fC; - } - } - else // region 4 (corner) - { - fTmp = fA01 + fB0; - if (fTmp < (F)0.0) - { - fT = (F)1.0; - if (-fTmp >= fA00) - { - fS = (F)1.0; - fSqrDist = fA00 + fA11 + fC + ((F)2.0) * (fB1 + fTmp); - } - else - { - fS = -fTmp / fA00; - fSqrDist = fTmp * fS + fA11 + ((F)2.0) * fB1 + fC; - } - } - else - { - fS = (F)0.0; - if (fB1 >= (F)0.0) - { - fT = (F)0.0; - fSqrDist = fC; - } - else if (-fB1 >= fA11) - { - fT = (F)1.0; - fSqrDist = fA11 + ((F)2.0) * fB1 + fC; - } - else - { - fT = -fB1 / fA11; - fSqrDist = fB1 * fT + fC; - } - } - } - } - else // region 6 (corner) - { - if (fB0 < (F)0.0) - { - fT = (F)0.0; - if (-fB0 >= fA00) - { - fS = (F)1.0; - fSqrDist = fA00 + ((F)2.0) * fB0 + fC; - } - else - { - fS = -fB0 / fA00; - fSqrDist = fB0 * fS + fC; - } - } - else - { - fS = (F)0.0; - if (fB1 >= (F)0.0) - { - fT = (F)0.0; - fSqrDist = fC; - } - else if (-fB1 >= fA11) - { - fT = (F)1.0; - fSqrDist = fA11 + ((F)2.0) * fB1 + fC; - } - else - { - fT = -fB1 / fA11; - fSqrDist = fB1 * fT + fC; - } - } - } - } - } - else - { - // line segments are parallel - if (fA01 > (F)0.0) - { - // direction vectors form an obtuse angle - if (fB0 >= (F)0.0) - { - fS = (F)0.0; - fT = (F)0.0; - fSqrDist = fC; - } - else if (-fB0 <= fA00) - { - fS = -fB0 / fA00; - fT = (F)0.0; - fSqrDist = fB0 * fS + fC; - } - else - { - fB1 = -diff.Dot(delta1); - fS = (F)1.0; - fTmp = fA00 + fB0; - if (-fTmp >= fA01) - { - fT = (F)1.0; - fSqrDist = fA00 + fA11 + fC + ((F)2.0) * (fA01 + fB0 + fB1); - } - else - { - fT = -fTmp / fA01; - fSqrDist = fA00 + ((F)2.0) * fB0 + fC + fT * (fA11 * fT + - ((F)2.0) * (fA01 + fB1)); - } - } - } - else - { - // direction vectors form an acute angle - if (-fB0 >= fA00) - { - fS = (F)1.0; - fT = (F)0.0; - fSqrDist = fA00 + ((F)2.0) * fB0 + fC; - } - else if (fB0 <= (F)0.0) - { - fS = -fB0 / fA00; - fT = (F)0.0; - fSqrDist = fB0 * fS + fC; - } - else - { - fB1 = -diff.Dot(delta1); - fS = (F)0.0; - if (fB0 >= -fA01) - { - fT = (F)1.0; - fSqrDist = fA11 + ((F)2.0) * fB1 + fC; - } - else - { - fT = -fB0 / fA01; - fSqrDist = fC + fT * (((F)2.0) * fB1 + fA11 * fT); - } - } - } - } - - if (t0) - { - *t0 = fS; - } - - if (t1) - { - *t1 = fT; - } - - return abs(fSqrDist); - } - - /// Calculate distance between two line segments, along with the optional - /// parameters of the closest points - template - ILINE F Lineseg_Lineseg(const Lineseg& seg0, const Lineseg seg1, F* s, F* t) - { - return sqrt_tpl(Lineseg_LinesegSq(seg0, seg1, s, t)); - } - - //---------------------------------------------------------------------------------- - /// Squared distance from line segment to triangle. Optionally returns the parameters - /// describing the closest points - //---------------------------------------------------------------------------------- - template - ILINE F Lineseg_TriangleSq(const Lineseg_tpl& seg, const Triangle_tpl& triangle, - F* segT, F* triT0, F* triT1) - { - Vec3_tpl intersection; - if (Intersect::Lineseg_Triangle(seg, triangle.v0, triangle.v1, triangle.v2, intersection, segT)) - { - if (triT0 || triT1) - { - const Vec3_tpl v0v1 = triangle.v1 - triangle.v0; - Lineseg_tpl projPtOnV0V2(intersection, intersection - v0v1); - Lineseg_tpl v0v2(triangle.v0, triangle.v2); - Lineseg_LinesegSq(projPtOnV0V2, v0v2, triT0, triT1); - } - return 0.0f; - } - - // compare segment to all three edges of the triangle - F s, t, u; - F distEdgeSq = Distance::Lineseg_LinesegSq(seg, Lineseg(triangle.v0, triangle.v1), &s, &t); - F distSq = distEdgeSq; - if (segT) - { - *segT = s; - } - if (triT0) - { - *triT0 = t; - } - if (triT1) - { - *triT1 = 0.0f; - } - - distEdgeSq = Distance::Lineseg_LinesegSq(seg, Lineseg(triangle.v0, triangle.v2), &s, &t); - if (distEdgeSq < distSq) - { - distSq = distEdgeSq; - if (segT) - { - *segT = s; - } - if (triT0) - { - *triT0 = 0.0f; - } - if (triT1) - { - *triT1 = t; - } - } - distEdgeSq = Distance::Lineseg_LinesegSq(seg, Lineseg(triangle.v1, triangle.v2), &s, &t); - if (distEdgeSq < distSq) - { - distSq = distEdgeSq; - if (segT) - { - *segT = s; - } - if (triT0) - { - *triT0 = 1.0f - t; - } - if (triT1) - { - *triT1 = t; - } - } - - // compare segment end points to triangle interior - F startTriSq = Distance::Point_TriangleSq(seg.start, triangle, &t, &u); - if (startTriSq < distSq) - { - distSq = startTriSq; - if (segT) - { - *segT = 0.0f; - } - if (triT0) - { - *triT0 = t; - } - if (triT1) - { - *triT1 = u; - } - } - F endTriSq = Distance::Point_TriangleSq(seg.end, triangle, &t, &u); - if (endTriSq < distSq) - { - distSq = endTriSq; - if (segT) - { - *segT = 1.0f; - } - if (triT0) - { - *triT0 = t; - } - if (triT1) - { - *triT1 = u; - } - } - return distSq; - } - - /// Distance from line segment to triangle. Optionally returns the parameters - /// describing the closest points - template - ILINE F Lineseg_Triangle(const Lineseg_tpl& seg, const Triangle_tpl& triangle, - F* segT, F* triT0, F* triT1) - { - return sqrt_tpl(Lineseg_TriangleSq(seg, triangle, segT, triT0, triT1)); - } } //namespace Distance - - -#endif // CRYINCLUDE_CRYCOMMON_CRY_GEODISTANCE_H diff --git a/Code/Legacy/CryCommon/Cry_GeoIntersect.h b/Code/Legacy/CryCommon/Cry_GeoIntersect.h index 7e7c42b216..e9e77bd016 100644 --- a/Code/Legacy/CryCommon/Cry_GeoIntersect.h +++ b/Code/Legacy/CryCommon/Cry_GeoIntersect.h @@ -8,19 +8,14 @@ // Description : Common intersection-tests - - -#ifndef CRYINCLUDE_CRYCOMMON_CRY_GEOINTERSECT_H -#define CRYINCLUDE_CRYCOMMON_CRY_GEOINTERSECT_H #pragma once - #include namespace Intersect { inline bool Ray_Plane(const Ray& ray, const Plane_tpl& plane, Vec3& output, bool bSingleSidePlane = true) { - float cosine = plane.n | ray.direction; + float cosine = plane.n | ray.direction; //REJECTION 1: if "line-direction" is perpendicular to "plane-normal", an intersection is not possible! That means ray is parallel // to the plane @@ -33,9 +28,9 @@ namespace Intersect { return false; } - float numer = plane.DistFromPlane(ray.origin); - float fLength = -numer / cosine; - output = ray.origin + (ray.direction * fLength); + float numer = plane.DistFromPlane(ray.origin); + float fLength = -numer / cosine; + output = ray.origin + (ray.direction * fLength); //skip, if cutting-point is "behind" ray.origin if (fLength < 0.0f) { @@ -45,232 +40,6 @@ namespace Intersect { return true; //intersection occurred } - inline bool Line_Plane(const Line& line, const Plane_tpl& plane, Vec3& output, bool bSingleSidePlane = true) - { - float cosine = plane.n | line.direction; - - //REJECTION 1: if "line-direction" is perpendicular to "plane-normal", an intersection is not possible! That means ray is parallel - // to the plane - //REJECTION 2: if bSingleSidePlane == true we deal with single-sided planes. That means - // if "line-direction" is pointing in the same direction as "the plane-normal", - // an intersection is not possible! - if ((cosine == 0.0f) || // normal is orthogonal to vector, cant intersect - (bSingleSidePlane && (cosine > 0.0f))) // we are trying to find an intersection in the same direction as the plane normal - { - return false; - } - - //an intersection is possible: calculate the exact point! - float perpdist = plane | line.pointonline; - float pd_c = -perpdist / cosine; - output = line.pointonline + (line.direction * pd_c); - - return true; //intersection occurred - } - - // Algorithm description: - // http://softsurfer.com/Archive/algorithm_0104/algorithm_0104B.htm#Line-Plane%20Intersection - template - inline bool Segment_Plane(const Lineseg_tpl& segment, const Plane_tpl& plane, Vec3_tpl& vOutput, bool bSingleSidePlane = true) - { - Vec3_tpl vSegment = segment.end - segment.start; - T planeNormalDotSegment = plane.n | vSegment; - - //REJECTION 1: if "line-direction" is perpendicular to "plane-normal", an intersection is not possible! That means ray is parallel - // to the plane - //REJECTION 2: if bSingleSidePlane == true we deal with single-sided planes. That means - // if "line-direction" is pointing in the same direction as "the plane-normal", - // an intersection is not possible! - if ((planeNormalDotSegment == T(0)) || // normal is orthogonal to vector, cant intersect - (bSingleSidePlane && (planeNormalDotSegment > T(0)))) // we are trying to find an intersection in the same direction as the plane normal - { - return false; - } - - // n Dot (segment.start - closest_point_in_plane) = 1 * DistFromPlane(segment.start) * cos(0) = DistFromPlane(segment.start) - T distanceToStart = plane.DistFromPlane(segment.start); - T scale = -distanceToStart / planeNormalDotSegment; - vOutput = segment.start + (vSegment * scale); - - // skip, if segment start and ends in one side of the plane - if ((scale < T(0)) || (scale > T(1))) - { - return false; - } - - return true; //intersection occurred - } - - /// Intersection between two line segments in 2D (ignoring z coordinate). The two parametric - /// values are set to between 0 and 1 if intersection occurs. If intersection does not occur - /// their values will indicate the parametric values for intersection of the lines extended - /// beyond the segment lengths. Parallel lines will result in a negative result, but the parametric - /// values will both be equal to 0.5 - template - inline bool Lineseg_Lineseg2D(const Lineseg_tpl& lineA, const Lineseg_tpl& lineB, F& outA, F& outB) - { - const F Epsilon = (F)0.0000001; - - Vec3_tpl delta = lineB.start - lineA.start; - - Vec3_tpl dirA = lineA.end - lineA.start; - Vec3_tpl dirB = lineB.end - lineB.start; - - F det = dirA.x * dirB.y - dirA.y * dirB.x; - F detA = delta.x * dirB.y - delta.y * dirB.x; - F detB = delta.x * dirA.y - delta.y * dirA.x; - - F absDet = fabs_tpl(det); - - if (absDet >= Epsilon) - { - F invDet = (F)1.0 / det; - - F a = detA * invDet; - F b = detB * invDet; - outA = a; - outB = b; - - if ((a > (F)1.0) || (a < (F)0.0) || (b > (F)1.0) || (b < (F)0.0)) - { - return false; - } - } - else - { - outA = outB = (F)0.5; - - return false; - } - - return true; - } - - /// Calculates the intersection between a line segment and a polygon, in 2D (i.e. - /// ignoring z coordinate). The VecContainer should be a container of Vec3 such - /// that we can traverse it using iterators. intersectionPoint is set to the intersection - /// point or the end of the segment, if no intersection. - template - inline bool Lineseg_Polygon2D(const Lineseg& lineseg, VecIterator polygonBegin, VecIterator polygonEnd, Vec3& intersectionPoint, Vec3* pNormal = NULL, bool bForceNormalOutwards = false) - { - intersectionPoint = lineseg.end; - bool gotIntersection = false; - - float tmin = 1.0f; - - VecIterator iend = polygonEnd; - VecIterator li, linext; - Lineseg intersectSegment; - for (li = polygonBegin; li != iend; ++li) - { - linext = li; - ++linext; - if (linext == iend) - { - linext = polygonBegin; - } - Lineseg segmentPoly(*li, *linext); - float s, t; - if (Intersect::Lineseg_Lineseg2D(lineseg, segmentPoly, s, t)) - { - if (s < 0.00001f || s > 0.99999f || t < 0.00001f || t > 0.99999f) - { - continue; - } - if (s < tmin) - { - tmin = s; - gotIntersection = true; - intersectSegment = segmentPoly; - } - } - } - - intersectionPoint = lineseg.start + tmin * (lineseg.end - lineseg.start); - - if (pNormal && gotIntersection) - { - Vec3 vPolyseg = intersectSegment.end - intersectSegment.start; - Vec3 vIntSeg = (lineseg.end - lineseg.start); - pNormal->x = vPolyseg.y; - pNormal->y = -vPolyseg.x; - pNormal->z = 0; - pNormal->NormalizeSafe(); - // returns the normal towards the start point of the intersecting segment (if it's not forced to be outwards) - if (!bForceNormalOutwards && vIntSeg.Dot(*pNormal) > 0) - { - pNormal->x = -pNormal->x; - pNormal->y = -pNormal->y; - } - } - return gotIntersection; - } - - template - inline bool Lineseg_Polygon2D(const Lineseg& lineseg, const VecContainer& polygon, Vec3& intersectionPoint, Vec3* pNormal = NULL, bool bForceNormalOutwards = false) - { - return Lineseg_Polygon2D(lineseg, polygon.begin(), polygon.end(), intersectionPoint, pNormal, bForceNormalOutwards); - } - - /* - * calculates intersection between a line and a triangle. - * IMPORTANT: this is a single-sided intersection test. That means its not enough - * that the triangle and line overlap, its also important that the triangle - * is "visible" when you are looking along the line-direction. - * - * If you need a double-sided test, you'll have to call this function twice with - * reversed order of triangle vertices. - * - * return values - * if there is an intertection the functions return "true" and stores the - * 3d-intersection point in "output". if the function returns "false" the value in - * "output" is undefined - * - */ - inline bool Line_Triangle(const Line& line, const Vec3& v0, const Vec3& v1, const Vec3& v2, Vec3& output) - { - const float Epsilon = 0.0000001f; - - Vec3 edgeA = v1 - v0; - Vec3 edgeB = v2 - v0; - - Vec3 dir = line.direction; - - Vec3 p = dir.Cross(edgeA); - Vec3 t = line.pointonline - v0; - Vec3 q = t.Cross(edgeB); - - float dot = edgeB.Dot(p); - - float u = t.Dot(p); - float v = dir.Dot(q); - - float DotGreaterThanEpsilon = dot - Epsilon; - float VGreaterEqualThanZero = v; - float UGreaterEqualThanZero = u; - float UVLessThanDot = dot - (u + v); - float ULessThanDot = dot - u; - - float UVGreaterEqualThanZero = (float)fsel(VGreaterEqualThanZero, UGreaterEqualThanZero, VGreaterEqualThanZero); - float UUVLessThanDot = (float)fsel(UVLessThanDot, ULessThanDot, UVLessThanDot); - float BothGood = (float)fsel(UVGreaterEqualThanZero, UUVLessThanDot, UVGreaterEqualThanZero); - float AllGood = (float)fsel(DotGreaterThanEpsilon, BothGood, DotGreaterThanEpsilon); - - if (AllGood < 0.0f) - { - return false; - } - - float dt = edgeA.Dot(q) / dot; - - Vec3 result = (dir * dt) + line.pointonline; - output = result; - - return true; - } - - - /* * calculates intersection between a ray and a triangle. * IMPORTANT: this is a single-sided intersection test. That means its not sufficient @@ -329,80 +98,6 @@ namespace Intersect { return AfterStart >= 0.0f; } - - - /* - * Description: - * Calculates intersection between a line-segment and a triangle. - * Remarks: - * IMPORTANT: this is a single-sided intersection test. That means its not sufficient - * that the triangle and line-segment overlap, its also important that the triangle - * is "visible" when you are looking along the linesegment from "start" to "end". - * Notes: - * If you need a double-sided test, you'll have to call this function twice with - * reversed order of triangle vertices. - * - * Return value: - * If there is an intertection the the functions return "true" and stores the - * 3d-intersection point in "output". if the function returns "false" the value in - * "output" is undefined. If pT is non-zero then if there is an intersection the "t-value" - * (from 0-1) is also returned (unmodified if there is no intersection). - */ - inline bool Lineseg_Triangle(const Lineseg& lineseg, const Vec3& v0, const Vec3& v1, const Vec3& v2, Vec3& output, - float* outT = 0) - { - const float Epsilon = 0.0000001f; - - Vec3 edgeA = v1 - v0; - Vec3 edgeB = v2 - v0; - - Vec3 dir = lineseg.end - lineseg.start; - - Vec3 p = dir.Cross(edgeA); - Vec3 t = lineseg.start - v0; - Vec3 q = t.Cross(edgeB); - - float dot = edgeB.Dot(p); - - float u = t.Dot(p); - float v = dir.Dot(q); - - float DotGreaterThanEpsilon = dot - Epsilon; - float VGreaterEqualThanZero = v; - float UGreaterEqualThanZero = u; - float UVLessThanDot = dot - (u + v); - float ULessThanDot = dot - u; - - float UVGreaterEqualThanZero = (float)fsel(VGreaterEqualThanZero, UGreaterEqualThanZero, VGreaterEqualThanZero); - float UUVLessThanDot = (float)fsel(UVLessThanDot, ULessThanDot, UVLessThanDot); - float BothGood = (float)fsel(UVGreaterEqualThanZero, UUVLessThanDot, UVGreaterEqualThanZero); - float AllGood = (float)fsel(DotGreaterThanEpsilon, BothGood, DotGreaterThanEpsilon); - - if (AllGood < 0.0f) - { - return false; - } - - float dt = edgeA.Dot(q) / dot; - - Vec3 result = (dir * dt) + lineseg.start; - output = result; - - float AfterStart = (result - lineseg.start).Dot(dir); - float BeforeEnd = -(result - lineseg.end).Dot(dir); - float Within = (float)fsel(AfterStart, BeforeEnd, AfterStart); - - if (outT) - { - *outT = dt; - } - - return Within >= 0.0f; - } - - - - //---------------------------------------------------------------------------------- // Ray_AABB // @@ -466,359 +161,6 @@ namespace Intersect { return 0x00;//no intersection } - - - //---------------------------------------------------------------------------------- - // Ray_OBB - // - // just ONE intersection point is calculated, and thats the entry point - - // Lineseg and OBB are assumed to be in the same space - // - //--- 0x00 = no intersection (output undefined) ---- - //--- 0x01 = intersection (intersection point in output) -------------- - //--- 0x02 = start of Lineseg is inside the OBB (ls.start is output) - //---------------------------------------------------------------------------------- - inline uint8 Ray_OBB(const Ray& ray, const Vec3& pos, const OBB& obb, Vec3& output1) - { - AABB aabb(obb.c - obb.h, obb.c + obb.h); - Ray aray((ray.origin - pos) * obb.m33, ray.direction * obb.m33); - - uint8 cflags; - float cosine; - Vec3 cut; - //-------------------------------------------------------------------------------------- - //---- check if "aray.origin" is inside of AABB --------------------------- - //-------------------------------------------------------------------------------------- - cflags = (aray.origin.x > aabb.min.x) << 0; - cflags |= (aray.origin.x < aabb.max.x) << 1; - cflags |= (aray.origin.y > aabb.min.y) << 2; - cflags |= (aray.origin.y < aabb.max.y) << 3; - cflags |= (aray.origin.z > aabb.min.z) << 4; - cflags |= (aray.origin.z < aabb.max.z) << 5; - if (cflags == 0x3f) - { - output1 = aray.origin; - return 0x02; - } - - //-------------------------------------------------------------------------------------- - //---- check intersection with planes ------------------------------ - //-------------------------------------------------------------------------------------- - for (int i = 0; i < 3; i++) - { - if ((aray.direction[i] > 0) && (aray.origin[i] < aabb.min[i])) - { - cosine = (-aray.origin[i] + aabb.min[i]) / aray.direction[i]; - cut[i] = aabb.min[i]; - cut[incm3(i)] = aray.origin[incm3(i)] + (aray.direction[incm3(i)] * cosine); - cut[decm3(i)] = aray.origin[decm3(i)] + (aray.direction[decm3(i)] * cosine); - if ((cut[incm3(i)] > aabb.min[incm3(i)]) && (cut[incm3(i)] < aabb.max[incm3(i)]) && (cut[decm3(i)] > aabb.min[decm3(i)]) && (cut[decm3(i)] < aabb.max[decm3(i)])) - { - output1 = obb.m33 * cut + pos; - return 0x01; - } - } - if ((aray.direction[i] < 0) && (aray.origin[i] > aabb.max[i])) - { - cosine = (+aray.origin[i] - aabb.max[i]) / aray.direction[i]; - cut[i] = aabb.max[i]; - cut[incm3(i)] = aray.origin[incm3(i)] - (aray.direction[incm3(i)] * cosine); - cut[decm3(i)] = aray.origin[decm3(i)] - (aray.direction[decm3(i)] * cosine); - if ((cut[incm3(i)] > aabb.min[incm3(i)]) && (cut[incm3(i)] < aabb.max[incm3(i)]) && (cut[decm3(i)] > aabb.min[decm3(i)]) && (cut[decm3(i)] < aabb.max[decm3(i)])) - { - output1 = obb.m33 * cut + pos; - return 0x01; - } - } - } - return 0x00;//no intersection - } - - //---------------------------------------------------------------------------------- - // Lineseg_AABB - // - // just ONE intersection point is calculated, and thats the entry point - - // Lineseg and AABB are assumed to be in the same space - // - //--- 0x00 = no intersection (output undefined) -------------------------- - //--- 0x01 = intersection (intersection point in output) -------------- - //--- 0x02 = start of Lineseg is inside the AABB (ls.start is output) - //---------------------------------------------------------------------------------- - inline uint8 Lineseg_AABB(const Lineseg& ls, const AABB& aabb, Vec3& output1) - { - uint8 cflags; - float cosine; - Vec3 cut; - Vec3 lnormal = (ls.start - ls.end).GetNormalized(); - //-------------------------------------------------------------------------------------- - //---- check if "ls.start" is inside of AABB --------------------------- - //-------------------------------------------------------------------------------------- - cflags = (ls.start.x > aabb.min.x) << 0; - cflags |= (ls.start.x < aabb.max.x) << 1; - cflags |= (ls.start.y > aabb.min.y) << 2; - cflags |= (ls.start.y < aabb.max.y) << 3; - cflags |= (ls.start.z > aabb.min.z) << 4; - cflags |= (ls.start.z < aabb.max.z) << 5; - if (cflags == 0x3f) - { - //ls.start is inside of aabb - output1 = ls.start; - return 0x02; - } - - //-------------------------------------------------------------------------------------- - //---- check intersection with x-planes ------------------------------ - //-------------------------------------------------------------------------------------- - if (lnormal.x) - { - if ((ls.start.x < aabb.min.x) && (ls.end.x > aabb.min.x)) - { - cosine = (-ls.start.x + (+aabb.min.x)) / lnormal.x; - cut(aabb.min.x, ls.start.y + (lnormal.y * cosine), ls.start.z + (lnormal.z * cosine)); - //check if cut-point is inside YZ-plane border - if ((cut.y > aabb.min.y) && (cut.y < aabb.max.y) && (cut.z > aabb.min.z) && (cut.z < aabb.max.z)) - { - output1 = cut; - return 0x01; - } - } - if ((ls.start.x > aabb.max.x) && (ls.end.x < aabb.max.x)) - { - cosine = (+ls.start.x + (-aabb.max.x)) / lnormal.x; - cut(aabb.max.x, ls.start.y - (lnormal.y * cosine), ls.start.z - (lnormal.z * cosine)); - //check if cut-point is inside YZ-plane border - if ((cut.y > aabb.min.y) && (cut.y < aabb.max.y) && (cut.z > aabb.min.z) && (cut.z < aabb.max.z)) - { - output1 = cut; - return 0x01; - } - } - } - //-------------------------------------------------------------------------------------- - //---- check intersection with z-planes ------------------------------ - //-------------------------------------------------------------------------------------- - if (lnormal.z) - { - if ((ls.start.z < aabb.min.z) && (ls.end.z > aabb.min.z)) - { - cosine = (-ls.start.z + (+aabb.min.z)) / lnormal.z; - cut(ls.start.x + (lnormal.x * cosine), ls.start.y + (lnormal.y * cosine), aabb.min.z); - //check if cut-point is inside XY-plane border - if ((cut.x > aabb.min.x) && (cut.x < aabb.max.x) && (cut.y > aabb.min.y) && (cut.y < aabb.max.y)) - { - output1 = cut; - return 0x01; - } - } - if ((ls.start.z > aabb.max.z) && (ls.end.z < aabb.max.z)) - { - cosine = (+ls.start.z + (-aabb.max.z)) / lnormal.z; - cut(ls.start.x - (lnormal.x * cosine), ls.start.y - (lnormal.y * cosine), aabb.max.z); - //check if cut-point is inside XY-plane border - if ((cut.x > aabb.min.x) && (cut.x < aabb.max.x) && (cut.y > aabb.min.y) && (cut.y < aabb.max.y)) - { - output1 = cut; - return 0x01; - } - } - } - //-------------------------------------------------------------------------------------- - //---- check intersection with y-planes ------------------------------ - //-------------------------------------------------------------------------------------- - if (lnormal.y) - { - if ((ls.start.y < aabb.min.y) && (ls.end.y > aabb.min.y)) - { - cosine = (-ls.start.y + (+aabb.min.y)) / lnormal.y; - cut(ls.start.x + (lnormal.x * cosine), aabb.min.y, ls.start.z + (lnormal.z * cosine)); - //check if cut-point is inside XZ-plane border - if ((cut.x > aabb.min.x) && (cut.x < aabb.max.x) && (cut.z > aabb.min.z) && (cut.z < aabb.max.z)) - { - output1 = cut; - return 0x01; - } - } - if ((ls.start.y > aabb.max.y) && (ls.end.y < aabb.max.y)) - { - cosine = (+ls.start.y + (-aabb.max.y)) / lnormal.y; - cut(ls.start.x - (lnormal.x * cosine), aabb.max.y, ls.start.z - (lnormal.z * cosine)); - //check if cut-point is inside XZ-plane border - if ((cut.x > aabb.min.x) && (cut.x < aabb.max.x) && (cut.z > aabb.min.z) && (cut.z < aabb.max.z)) - { - output1 = cut; - return 0x01; - } - } - } - //no intersection - return 0x00; - } - - - - //---------------------------------------------------------------------------------- - // Lineseg_OBB - // - // just ONE intersection point is calculated, and thats the entry point - - // Lineseg and OBB are assumed to be in the same space - // - //--- 0x00 = no intersection (output undefined) -------------------------- - //--- 0x01 = intersection (intersection point in output) -------------- - //--- 0x02 = start of Lineseg is inside the OBB (ls.start is output) - //---------------------------------------------------------------------------------- - inline uint8 Lineseg_OBB(const Lineseg& lseg, const Vec3& pos, const OBB& obb, Vec3& output1) - { - AABB aabb(obb.c - obb.h, obb.c + obb.h); - Lineseg ls((lseg.start - pos) * obb.m33, (lseg.end - pos) * obb.m33); - - uint8 cflags; - float cosine; - Vec3 cut; - Vec3 lnormal = (ls.start - ls.end).GetNormalized(); - //-------------------------------------------------------------------------------------- - //---- check if "ls.start" is inside of AABB --------------------------- - //-------------------------------------------------------------------------------------- - cflags = (ls.start.x > aabb.min.x) << 0; - cflags |= (ls.start.x < aabb.max.x) << 1; - cflags |= (ls.start.y > aabb.min.y) << 2; - cflags |= (ls.start.y < aabb.max.y) << 3; - cflags |= (ls.start.z > aabb.min.z) << 4; - cflags |= (ls.start.z < aabb.max.z) << 5; - if (cflags == 0x3f) - { - //ls.start is inside of aabb - output1 = obb.m33 * ls.start + pos; - return 0x02; - } - - //-------------------------------------------------------------------------------------- - //---- check intersection with x-planes ------------------------------ - //-------------------------------------------------------------------------------------- - if (lnormal.x) - { - if ((ls.start.x < aabb.min.x) && (ls.end.x > aabb.min.x)) - { - cosine = (-ls.start.x + (+aabb.min.x)) / lnormal.x; - cut(aabb.min.x, ls.start.y + (lnormal.y * cosine), ls.start.z + (lnormal.z * cosine)); - //check if cut-point is inside YZ-plane border - if ((cut.y > aabb.min.y) && (cut.y < aabb.max.y) && (cut.z > aabb.min.z) && (cut.z < aabb.max.z)) - { - output1 = obb.m33 * cut + pos; - return 0x01; - } - } - if ((ls.start.x > aabb.max.x) && (ls.end.x < aabb.max.x)) - { - cosine = (+ls.start.x + (-aabb.max.x)) / lnormal.x; - cut(aabb.max.x, ls.start.y - (lnormal.y * cosine), ls.start.z - (lnormal.z * cosine)); - //check if cut-point is inside YZ-plane border - if ((cut.y > aabb.min.y) && (cut.y < aabb.max.y) && (cut.z > aabb.min.z) && (cut.z < aabb.max.z)) - { - output1 = obb.m33 * cut + pos; - return 0x01; - } - } - } - //-------------------------------------------------------------------------------------- - //---- check intersection with z-planes ------------------------------ - //-------------------------------------------------------------------------------------- - if (lnormal.z) - { - if ((ls.start.z < aabb.min.z) && (ls.end.z > aabb.min.z)) - { - cosine = (-ls.start.z + (+aabb.min.z)) / lnormal.z; - cut(ls.start.x + (lnormal.x * cosine), ls.start.y + (lnormal.y * cosine), aabb.min.z); - //check if cut-point is inside XY-plane border - if ((cut.x > aabb.min.x) && (cut.x < aabb.max.x) && (cut.y > aabb.min.y) && (cut.y < aabb.max.y)) - { - output1 = obb.m33 * cut + pos; - return 0x01; - } - } - if ((ls.start.z > aabb.max.z) && (ls.end.z < aabb.max.z)) - { - cosine = (+ls.start.z + (-aabb.max.z)) / lnormal.z; - cut(ls.start.x - (lnormal.x * cosine), ls.start.y - (lnormal.y * cosine), aabb.max.z); - //check if cut-point is inside XY-plane border - if ((cut.x > aabb.min.x) && (cut.x < aabb.max.x) && (cut.y > aabb.min.y) && (cut.y < aabb.max.y)) - { - output1 = obb.m33 * cut + pos; - return 0x01; - } - } - } - //-------------------------------------------------------------------------------------- - //---- check intersection with y-planes ------------------------------ - //-------------------------------------------------------------------------------------- - if (lnormal.y) - { - if ((ls.start.y < aabb.min.y) && (ls.end.y > aabb.min.y)) - { - cosine = (-ls.start.y + (+aabb.min.y)) / lnormal.y; - cut(ls.start.x + (lnormal.x * cosine), aabb.min.y, ls.start.z + (lnormal.z * cosine)); - //check if cut-point is inside XZ-plane border - if ((cut.x > aabb.min.x) && (cut.x < aabb.max.x) && (cut.z > aabb.min.z) && (cut.z < aabb.max.z)) - { - output1 = obb.m33 * cut + pos; - return 0x01; - } - } - if ((ls.start.y > aabb.max.y) && (ls.end.y < aabb.max.y)) - { - cosine = (+ls.start.y + (-aabb.max.y)) / lnormal.y; - cut(ls.start.x - (lnormal.x * cosine), aabb.max.y, ls.start.z - (lnormal.z * cosine)); - //check if cut-point is inside XZ-plane border - if ((cut.x > aabb.min.x) && (cut.x < aabb.max.x) && (cut.z > aabb.min.z) && (cut.z < aabb.max.z)) - { - output1 = obb.m33 * cut + pos; - return 0x01; - } - } - } - //no intersection - return 0x00; - } - - - - //---------------------------------------------------------------------------------- - //--- 0x00 = no intersection -------------------------- - //--- 0x01 = not possible -- - //--- 0x02 = not possible -- - //--- 0x03 = two intersection, lineseg has ENTRY and EXIT point -- - //---------------------------------------------------------------------------------- - - inline unsigned char Line_Sphere(const Line& line, const ::Sphere& s, Vec3& i0, Vec3& i1) - { - Vec3 end = line.pointonline + line.direction; - - float a = line.direction | line.direction; - float b = (line.direction | (line.pointonline - s.center)) * 2.0f; - float c = ((line.pointonline - s.center) | (line.pointonline - s.center)) - (s.radius * s.radius); - - float desc = (b * b) - (4 * a * c); - - unsigned char intersection = 0; - if (desc >= 0.0f) - { - float lamba0 = (-b - sqrt_tpl(desc)) / (2.0f * a); - //_stprintf(d3dApp.token,"lamba0: %20.12f",lamba0); - //d3dApp.m_pFont->DrawText( 2, d3dApp.PrintY, D3DCOLOR_ARGB(255,255,255,0), d3dApp.token ); d3dApp.PrintY+=20; - i0 = line.pointonline + ((end - line.pointonline) * lamba0); - intersection = 1; - - float lamba1 = (-b + sqrt_tpl(desc)) / (2.0f * a); - //_stprintf(d3dApp.token,"lamba1: %20.12f",lamba1); - //d3dApp.m_pFont->DrawText( 2, d3dApp.PrintY, D3DCOLOR_ARGB(255,255,255,0), d3dApp.token ); d3dApp.PrintY+=20; - i1 = line.pointonline + ((end - line.pointonline) * lamba1); - intersection |= 2; - } - - return intersection; - } - - - //---------------------------------------------------------------------------------- //--- 0x00 = no intersection -------------------------- //--- 0x01 = not possible -- @@ -873,87 +215,4 @@ namespace Intersect { } return false; } - - - - //---------------------------------------------------------------------------------- - //--- 0x00 = no intersection -------------------------- - //--- 0x01 = one intersection, lineseg has just an ENTRY point but no EXIT point (ls.end is inside the sphere) -- - //--- 0x02 = one intersection, lineseg has just an EXIT point but no ENTRY point (ls.start is inside the sphere) -- - //--- 0x03 = two intersection, lineseg has ENTRY and EXIT point -- - //---------------------------------------------------------------------------------- - inline unsigned char Lineseg_Sphere(const Lineseg& ls, const ::Sphere& s, Vec3& i0, Vec3& i1) - { - Vec3 dir = (ls.end - ls.start); - - float a = dir | dir; - if (a == 0.0f) - { - return 0; - } - - float b = (dir | (ls.start - s.center)) * 2.0f; - float c = ((ls.start - s.center) | (ls.start - s.center)) - (s.radius * s.radius); - float desc = (b * b) - (4 * a * c); - - unsigned char intersection = 0; - if (desc >= 0.0f) - { - float lamba0 = (-b - sqrt_tpl(desc)) / (2.0f * a); - if (lamba0 > 0.0f) - { - i0 = ls.start + ((ls.end - ls.start) * lamba0); - //skip, if 1st cutting-point is "in front" of ls.end - if (((i0 - ls.end) | dir) > 0) - { - return 0; - } - intersection = 0x01; - } - - float lamba1 = (-b + sqrt_tpl(desc)) / (2.0f * a); - if (lamba1 > 0.0f) - { - i1 = ls.start + ((ls.end - ls.start) * lamba1); - //skip, if 2nd cutting-point is "in front" of ls.end (=ls.end is inside sphere) - if (((i1 - ls.end) | dir) > 0) - { - return intersection; - } - intersection |= 0x02; - } - } - return intersection; - } - - - inline bool Lineseg_SphereFirst(const Lineseg& lineseg, const ::Sphere& s, Vec3& intPoint) - { - Vec3 p2; - uint8 res = Lineseg_Sphere(lineseg, s, intPoint, p2); - if (res == 2) - { - intPoint = p2; - } - if (res > 1) - { - return true; - } - return false; - } -}; //CIntersect - - - - - - - - - - - - - - -#endif // CRYINCLUDE_CRYCOMMON_CRY_GEOINTERSECT_H +} //Intersect diff --git a/Code/Legacy/CryCommon/Cry_GeoOverlap.h b/Code/Legacy/CryCommon/Cry_GeoOverlap.h index badb4a1edd..039f292f5b 100644 --- a/Code/Legacy/CryCommon/Cry_GeoOverlap.h +++ b/Code/Legacy/CryCommon/Cry_GeoOverlap.h @@ -657,64 +657,6 @@ namespace Overlap { return AfterStart >= 0.0f; } - /*! - * - * overlap-test between line-segment and a triangle. - * IMPORTANT: this is a single-sided test. That means its not sufficient - * that the triangle and line-segment overlap, its also important that the triangle - * is "visible" when you are looking along the linesegment from "start" to "end". - * - * If you need a double-sided test, you'll have to call this function twice with - * reversed order of triangle vertices. - * - * return values - * return "true" if linesegment and triangle overlap. - */ - inline bool Lineseg_Triangle(const Lineseg& lineseg, const Vec3& v0, const Vec3& v1, const Vec3& v2) - { - const float Epsilon = 0.0000001f; - - Vec3 edgeA = v1 - v0; - Vec3 edgeB = v2 - v0; - - Vec3 dir = lineseg.end - lineseg.start; - - Vec3 p = dir.Cross(edgeA); - Vec3 t = lineseg.start - v0; - Vec3 q = t.Cross(edgeB); - - float dot = edgeB.Dot(p); - - float u = t.Dot(p); - float v = dir.Dot(q); - - float DotGreaterThanEpsilon = dot - Epsilon; - float VGreaterEqualThanZero = v; - float UGreaterEqualThanZero = u; - float UVLessThanDot = dot - (u + v); - float ULessThanDot = dot - u; - - float UVGreaterEqualThanZero = (float)fsel(VGreaterEqualThanZero, UGreaterEqualThanZero, VGreaterEqualThanZero); - float UUVLessThanDot = (float)fsel(UVLessThanDot, ULessThanDot, UVLessThanDot); - float BothGood = (float)fsel(UVGreaterEqualThanZero, UUVLessThanDot, UVGreaterEqualThanZero); - float AllGood = (float)fsel(DotGreaterThanEpsilon, BothGood, DotGreaterThanEpsilon); - - if (AllGood < 0.0f) - { - return false; - } - - float dt = edgeA.Dot(q) / dot; - - Vec3 result = (dir * dt) + lineseg.start; - - float AfterStart = (result - lineseg.start).Dot(dir); - float BeforeEnd = -(result - lineseg.end).Dot(dir); - float Within = (float)fsel(AfterStart, BeforeEnd, AfterStart); - - return Within >= 0.0f; - } - /*---------------------------------------------------------------------------------- * Sphere_AABB * Sphere and AABB are assumed to be in the same space diff --git a/Code/Legacy/CryCommon/Cry_Math.h b/Code/Legacy/CryCommon/Cry_Math.h index 91ceebd51a..885361f4e3 100644 --- a/Code/Legacy/CryCommon/Cry_Math.h +++ b/Code/Legacy/CryCommon/Cry_Math.h @@ -592,14 +592,12 @@ enum type_identity #include "Cry_Vector2.h" #include "Cry_Vector3.h" #include "Cry_Vector4.h" -#include "Cry_MatrixDiag.h" #include "Cry_Matrix33.h" #include "Cry_Matrix34.h" #include "Cry_Matrix44.h" #include "Cry_Quat.h" #include "Cry_HWVector3.h" #include "Cry_HWMatrix.h" -#include "Cry_XOptimise.h" ////////////////////////////////////////////////////////////////////////// diff --git a/Code/Legacy/CryCommon/Cry_Matrix33.h b/Code/Legacy/CryCommon/Cry_Matrix33.h index 075f07a896..02d1586931 100644 --- a/Code/Legacy/CryCommon/Cry_Matrix33.h +++ b/Code/Legacy/CryCommon/Cry_Matrix33.h @@ -177,44 +177,6 @@ struct Matrix33_tpl m22 = F(vz.z); } - - - - - //CONSTRUCTOR for identical float-types. It converts a Diag33 into a Matrix33. - //Matrix33(diag33); - ILINE Matrix33_tpl(const Diag33_tpl&d) - { - assert(d.IsValid()); - m00 = d.x; - m01 = 0; - m02 = 0; - m10 = 0; - m11 = d.y; - m12 = 0; - m20 = 0; - m21 = 0; - m22 = d.z; - } - //CONSTRUCTOR for different float-types. It converts a Diag33 into a Matrix33 and also converts between double/float. - //Matrix33(diag33); - template - ILINE Matrix33_tpl(const Diag33_tpl&d) - { - assert(d.IsValid()); - m00 = F(d.x); - m01 = 0; - m02 = 0; - m10 = 0; - m11 = F(d.y); - m12 = 0; - m20 = 0; - m21 = 0; - m22 = F(d.z); - } - - - //CONSTRUCTOR for identical float-types //Matrix33 m=m33; ILINE Matrix33_tpl(const Matrix33_tpl&m) @@ -1252,40 +1214,6 @@ typedef Matrix33_tpl Matrix33r; //variable float precision. depending on t //---------------------------------------------------------------------------------- //---------------------------------------------------------------------------------- -template -ILINE Matrix33_tpl operator*(const Matrix33_tpl& l, const Diag33_tpl& r) -{ - assert(l.IsValid()); - assert(r.IsValid()); - Matrix33_tpl res; - res.m00 = l.m00 * r.x; - res.m01 = l.m01 * r.y; - res.m02 = l.m02 * r.z; - res.m10 = l.m10 * r.x; - res.m11 = l.m11 * r.y; - res.m12 = l.m12 * r.z; - res.m20 = l.m20 * r.x; - res.m21 = l.m21 * r.y; - res.m22 = l.m22 * r.z; - return res; -} -template -ILINE Matrix33_tpl& operator *= (Matrix33_tpl& l, const Diag33_tpl& r) -{ - assert(l.IsValid()); - assert(r.IsValid()); - l.m00 *= r.x; - l.m01 *= r.y; - l.m02 *= r.z; - l.m10 *= r.x; - l.m11 *= r.y; - l.m12 *= r.z; - l.m20 *= r.x; - l.m21 *= r.y; - l.m22 *= r.z; - return l; -} - //Matrix33 operations with another Matrix33 template ILINE Matrix33_tpl operator * (const Matrix33_tpl& l, const Matrix33_tpl& r) diff --git a/Code/Legacy/CryCommon/Cry_Matrix34.h b/Code/Legacy/CryCommon/Cry_Matrix34.h index dfc059c11e..d409cfef8b 100644 --- a/Code/Legacy/CryCommon/Cry_Matrix34.h +++ b/Code/Legacy/CryCommon/Cry_Matrix34.h @@ -1281,43 +1281,6 @@ ILINE Vec3_tpl operator * (const Matrix34_tpl& m, const Vec3_tpl& p) return tp; } - -template -ILINE Matrix34_tpl operator*(const Matrix34_tpl& l, const Diag33_tpl& r) -{ - assert(l.IsValid()); - assert(r.IsValid()); - Matrix34_tpl m; - m.m00 = l.m00 * r.x; - m.m01 = l.m01 * r.y; - m.m02 = l.m02 * r.z; - m.m03 = l.m03; - m.m10 = l.m10 * r.x; - m.m11 = l.m11 * r.y; - m.m12 = l.m12 * r.z; - m.m13 = l.m13; - m.m20 = l.m20 * r.x; - m.m21 = l.m21 * r.y; - m.m22 = l.m22 * r.z; - m.m23 = l.m23; - return m; -} -template -ILINE Matrix34_tpl& operator *= (Matrix34_tpl& l, const Diag33_tpl& r) -{ - assert(l.IsValid()); - assert(r.IsValid()); - l.m00 *= r.x; - l.m01 *= r.y; - l.m02 *= r.z; - l.m10 *= r.x; - l.m11 *= r.y; - l.m12 *= r.z; - l.m20 *= r.x; - l.m21 *= r.y; - l.m22 *= r.z; - return l; -} template ILINE Matrix34_tpl operator + (const Matrix34_tpl& l, const Matrix34_tpl& r) { diff --git a/Code/Legacy/CryCommon/Cry_Matrix44.h b/Code/Legacy/CryCommon/Cry_Matrix44.h index 8304f7761e..e97325141c 100644 --- a/Code/Legacy/CryCommon/Cry_Matrix44.h +++ b/Code/Legacy/CryCommon/Cry_Matrix44.h @@ -680,63 +680,6 @@ typedef Matrix44_tpl Matrix44r; //variable float precision. depending on //---------------------------------------------------------------------------------- //---------------------------------------------------------------------------------- -/*! -* Implements the multiplication operator: Matrix44=Matrix44*Matrix33diag -* -* Matrix44 and Matrix33diag are specified in collumn order. -* AxB = operation B followed by operation A. -* This operation takes 12 mults. -* -* Example: -* Matrix33diag diag(1,2,3); -* Matrix44 m44=CreateRotationZ33(3.14192f); -* Matrix44 result=m44*diag; -*/ -template -ILINE Matrix44_tpl operator * (const Matrix44_tpl& l, const Diag33_tpl& r) -{ - assert(l.IsValid()); - assert(r.IsValid()); - Matrix44_tpl m; - m.m00 = l.m00 * r.x; - m.m01 = l.m01 * r.y; - m.m02 = l.m02 * r.z; - m.m03 = l.m03; - m.m10 = l.m10 * r.x; - m.m11 = l.m11 * r.y; - m.m12 = l.m12 * r.z; - m.m13 = l.m13; - m.m20 = l.m20 * r.x; - m.m21 = l.m21 * r.y; - m.m22 = l.m22 * r.z; - m.m23 = l.m23; - m.m30 = l.m30 * r.x; - m.m31 = l.m31 * r.y; - m.m32 = l.m32 * r.z; - m.m33 = l.m33; - return m; -} -template -ILINE Matrix44_tpl& operator *= (Matrix44_tpl& l, const Diag33_tpl& r) -{ - assert(l.IsValid()); - assert(r.IsValid()); - l.m00 *= r.x; - l.m01 *= r.y; - l.m02 *= r.z; - l.m10 *= r.x; - l.m11 *= r.y; - l.m12 *= r.z; - l.m20 *= r.x; - l.m21 *= r.y; - l.m22 *= r.z; - l.m30 *= r.x; - l.m31 *= r.y; - l.m32 *= r.z; - return l; -} - - /*! * Implements the multiplication operator: Matrix44=Matrix44*Matrix33 * diff --git a/Code/Legacy/CryCommon/Cry_MatrixDiag.h b/Code/Legacy/CryCommon/Cry_MatrixDiag.h deleted file mode 100644 index 897265049e..0000000000 --- a/Code/Legacy/CryCommon/Cry_MatrixDiag.h +++ /dev/null @@ -1,192 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - - -// Description : Common matrix class - - -#ifndef CRYINCLUDE_CRYCOMMON_CRY_MATRIXDIAG_H -#define CRYINCLUDE_CRYCOMMON_CRY_MATRIXDIAG_H -#pragma once - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// struct Diag33_tpl -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -template -struct Diag33_tpl -{ - F x, y, z; - -#ifdef _DEBUG - ILINE Diag33_tpl() - { - if constexpr (sizeof(F) == 4) - { - uint32* p = alias_cast(&x); - p[0] = F32NAN; - p[1] = F32NAN; - p[2] = F32NAN; - } - if constexpr (sizeof(F) == 8) - { - uint64* p = alias_cast(&x); - p[0] = F64NAN; - p[1] = F64NAN; - p[2] = F64NAN; - } - } -#else - ILINE Diag33_tpl() {}; -#endif - - - Diag33_tpl(F dx, F dy, F dz) { x = dx; y = dy; z = dz; } - Diag33_tpl(const Vec3_tpl& v) { x = v.x; y = v.y; z = v.z; } - template - const Diag33_tpl& operator=(const Vec3_tpl& v) { x = v.x; y = v.y; z = v.z; return *this; } - Diag33_tpl& operator=(const Diag33_tpl& diag) { x = diag.x; y = diag.y; z = diag.z; return *this; } - template - Diag33_tpl& operator=(const Diag33_tpl& diag) { x = diag.x; y = diag.y; z = diag.z; return *this; } - - const void SetIdentity() { x = y = z = 1; } - Diag33_tpl(type_identity) { x = y = z = 1; } - - const Diag33_tpl& zero() { x = y = z = 0; return *this; } - - Diag33_tpl& fabs() { x = fabs_tpl(x); y = fabs_tpl(y); z = fabs_tpl(z); return *this; } - - Diag33_tpl& invert() // in-place inversion - { - F det = determinant(); - if (det == 0) - { - return *this; - } - det = (F)1.0 / det; - F oldata[3]; - oldata[0] = x; - oldata[1] = y; - oldata[2] = z; - x = oldata[1] * oldata[2] * det; - y = oldata[0] * oldata[2] * det; - z = oldata[0] * oldata[1] * det; - return *this; - } - - /*! - * Linear-Interpolation between Diag33(lerp) - * - * Example: - * Diag33 r=Diag33::CreateLerp( p, q, 0.345f ); - */ - ILINE void SetLerp(const Diag33_tpl& p, const Diag33_tpl& q, F t) - { - x = p.x * (1.0f - t) + q.x * t; - y = p.y * (1.0f - t) + q.y * t; - z = p.z * (1.0f - t) + q.z * t; - } - ILINE static Diag33_tpl CreateLerp(const Diag33_tpl& p, const Diag33_tpl& q, F t) - { - Diag33_tpl d; - d.x = p.x * (1.0f - t) + q.x * t; - d.y = p.y * (1.0f - t) + q.y * t; - d.z = p.z * (1.0f - t) + q.z * t; - return d; - } - - F determinant() const { return x * y * z; } - - ILINE bool IsValid() const - { - if (!NumberValid(x)) - { - return false; - } - if (!NumberValid(y)) - { - return false; - } - if (!NumberValid(z)) - { - return false; - } - return true; - } -}; - -/////////////////////////////////////////////////////////////////////////////// -// Typedefs // -/////////////////////////////////////////////////////////////////////////////// - -typedef Diag33_tpl Diag33; //always 32 bit -typedef Diag33_tpl Diag33d;//always 64 bit -typedef Diag33_tpl Diag33r;//variable float precision. depending on the target system it can be between 32, 64 or 80 bit - - -template -Diag33_tpl operator*(const Diag33_tpl& l, const Diag33_tpl& r) -{ - return Diag33_tpl(l.x * r.x, l.y * r.y, l.z * r.z); -} - -template -Matrix33_tpl operator*(const Diag33_tpl& l, const Matrix33_tpl& r) -{ - Matrix33_tpl res; - res.m00 = r.m00 * l.x; - res.m01 = r.m01 * l.x; - res.m02 = r.m02 * l.x; - res.m10 = r.m10 * l.y; - res.m11 = r.m11 * l.y; - res.m12 = r.m12 * l.y; - res.m20 = r.m20 * l.z; - res.m21 = r.m21 * l.z; - res.m22 = r.m22 * l.z; - return res; -} -template -Matrix34_tpl operator*(const Diag33_tpl& l, const Matrix34_tpl& r) -{ - Matrix34_tpl m; - m.m00 = l.x * r.m00; - m.m01 = l.x * r.m01; - m.m02 = l.x * r.m02; - m.m03 = l.x * r.m03; - m.m10 = l.y * r.m10; - m.m11 = l.y * r.m11; - m.m12 = l.y * r.m12; - m.m13 = l.y * r.m13; - m.m20 = l.z * r.m20; - m.m21 = l.z * r.m21; - m.m22 = l.z * r.m22; - m.m23 = l.z * r.m23; - return m; -} - -template -Vec3_tpl operator *(const Diag33_tpl& mtx, const Vec3_tpl& vec) -{ - return Vec3_tpl(mtx.x * vec.x, mtx.y * vec.y, mtx.z * vec.z); -} - -template -Vec3_tpl operator *(const Vec3_tpl& vec, const Diag33_tpl& mtx) -{ - return Vec3_tpl(mtx.x * vec.x, mtx.y * vec.y, mtx.z * vec.z); -} - - - -#endif // CRYINCLUDE_CRYCOMMON_CRY_MATRIXDIAG_H - diff --git a/Code/Legacy/CryCommon/Cry_XOptimise.h b/Code/Legacy/CryCommon/Cry_XOptimise.h deleted file mode 100644 index bc05c16fbc..0000000000 --- a/Code/Legacy/CryCommon/Cry_XOptimise.h +++ /dev/null @@ -1,566 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - - -// Description : Misc mathematical functions - - -#ifndef CRYINCLUDE_CRYCOMMON_CRY_XOPTIMISE_H -#define CRYINCLUDE_CRYCOMMON_CRY_XOPTIMISE_H -#pragma once - -#include - - - - -inline float AngleMod(float a) -{ - a = (float)((360.0 / 65536) * ((int)(a * (65536 / 360.0)) & 65535)); - return a; -} - -inline float AngleModRad(float a) -{ - a = (float)((gf_PI2 / 65536) * ((int)(a * (65536 / gf_PI2)) & 65535)); - return a; -} -inline unsigned short Degr2Word(float f) -{ - return (unsigned short)(AngleMod(f) / 360.0f * 65536.0f); -} -inline float Word2Degr(unsigned short s) -{ - return (float)s / 65536.0f * 360.0f; -} - -#if defined(_CPU_X86) -ILINE float __fastcall Ffabs(float f) -{ - *((unsigned*) &f) &= ~0x80000000; - return (f); -} -#else -inline float Ffabs(float x) { return fabsf(x); } -#endif - - - -#define mathMatrixRotationZ(pOut, angle) (*(Matrix44*)pOut) = GetTransposed44(Matrix44(Matrix34::CreateRotationZ(angle))) -#define mathMatrixRotationY(pOut, angle) (*(Matrix44*)pOut) = GetTransposed44(Matrix44(Matrix34::CreateRotationY(angle))) -#define mathMatrixRotationX(pOut, angle) (*(Matrix44*)pOut) = GetTransposed44(Matrix44(Matrix34::CreateRotationX(angle))) -#define mathMatrixTranslation(pOut, x, y, z) (*(Matrix44*)pOut) = GetTransposed44(Matrix44(Matrix34::CreateTranslationMat(Vec3(x, y, z)))) -#define mathMatrixScaling(pOut, sx, sy, sz) (*(Matrix44*)pOut) = GetTransposed44(Matrix44(Matrix34::CreateScale(Vec3(sx, sy, sz)))) - -template -inline void ExchangeVals(T& X, T& Y) -{ - const T Tmp = X; - X = Y; - Y = Tmp; -} - - -inline void mathMatrixPerspectiveFov(Matrix44A* pMatr, f32 fovY, f32 Aspect, f32 zn, f32 zf) -{ - f32 yScale = 1.0f / tan_tpl(fovY / 2.0f); - f32 xScale = yScale / Aspect; - - f32 m22 = f32(f64(zf) / (f64(zn) - f64(zf))); - f32 m32 = f32(f64(zn) * f64(zf) / (f64(zn) - f64(zf))); - - (*pMatr)(0, 0) = xScale; - (*pMatr)(0, 1) = 0; - (*pMatr)(0, 2) = 0; - (*pMatr)(0, 3) = 0; - (*pMatr)(1, 0) = 0; - (*pMatr)(1, 1) = yScale; - (*pMatr)(1, 2) = 0; - (*pMatr)(1, 3) = 0; - (*pMatr)(2, 0) = 0; - (*pMatr)(2, 1) = 0; - (*pMatr)(2, 2) = m22; - (*pMatr)(2, 3) = -1.0f; - (*pMatr)(3, 0) = 0; - (*pMatr)(3, 1) = 0; - (*pMatr)(3, 2) = m32; - (*pMatr)(3, 3) = 0; -} - - - -inline void mathMatrixOrtho(Matrix44A* pMatr, f32 w, f32 h, f32 zn, f32 zf) -{ - f32 m22 = f32(1.0 / (f64(zn) - f64(zf))); - f32 m32 = f32(f64(zn) / (f64(zn) - f64(zf))); - - (*pMatr)(0, 0) = 2.0f / w; - (*pMatr)(0, 1) = 0; - (*pMatr)(0, 2) = 0; - (*pMatr)(0, 3) = 0; - (*pMatr)(1, 0) = 0; - (*pMatr)(1, 1) = 2.0f / h; - (*pMatr)(1, 2) = 0; - (*pMatr)(1, 3) = 0; - (*pMatr)(2, 0) = 0; - (*pMatr)(2, 1) = 0; - (*pMatr)(2, 2) = m22; - (*pMatr)(2, 3) = 0; - (*pMatr)(3, 0) = 0; - (*pMatr)(3, 1) = 0; - (*pMatr)(3, 2) = m32; - (*pMatr)(3, 3) = 1; -} - -inline void mathMatrixOrthoOffCenter(Matrix44A* pMatr, f32 l, f32 r, f32 b, f32 t, f32 zn, f32 zf) -{ - f32 m22 = f32(1.0 / (f64(zn) - f64(zf))); - f32 m32 = f32(f64(zn) / (f64(zn) - f64(zf))); - - (*pMatr)(0, 0) = 2.0f / (r - l); - (*pMatr)(0, 1) = 0; - (*pMatr)(0, 2) = 0; - (*pMatr)(0, 3) = 0; - (*pMatr)(1, 0) = 0; - (*pMatr)(1, 1) = 2.0f / (t - b); - (*pMatr)(1, 2) = 0; - (*pMatr)(1, 3) = 0; - (*pMatr)(2, 0) = 0; - (*pMatr)(2, 1) = 0; - (*pMatr)(2, 2) = m22; - (*pMatr)(2, 3) = 0; - (*pMatr)(3, 0) = (l + r) / (l - r); - (*pMatr)(3, 1) = (t + b) / (b - t); - (*pMatr)(3, 2) = m32; - (*pMatr)(3, 3) = 1.0f; -} - - -inline void mathMatrixOrthoOffCenterLH(Matrix44A* pMatr, f32 l, f32 r, f32 b, f32 t, f32 zn, f32 zf) -{ - f32 m22 = f32(1.0 / (f64(zf) - f64(zn))); - f32 m32 = f32(f64(zn) / (f64(zn) - f64(zf))); - - (*pMatr)(0, 0) = 2.0f / (r - l); - (*pMatr)(0, 1) = 0; - (*pMatr)(0, 2) = 0; - (*pMatr)(0, 3) = 0; - (*pMatr)(1, 0) = 0; - (*pMatr)(1, 1) = 2.0f / (t - b); - (*pMatr)(1, 2) = 0; - (*pMatr)(1, 3) = 0; - (*pMatr)(2, 0) = 0; - (*pMatr)(2, 1) = 0; - (*pMatr)(2, 2) = m22; - (*pMatr)(2, 3) = 0; - (*pMatr)(3, 0) = (l + r) / (l - r); - (*pMatr)(3, 1) = (t + b) / (b - t); - (*pMatr)(3, 2) = m32; - (*pMatr)(3, 3) = 1.0f; -} - - -inline void mathMatrixPerspectiveOffCenter(Matrix44A* pMatr, f32 l, f32 r, f32 b, f32 t, f32 zn, f32 zf) -{ - f32 m22 = f32(f64(zf) / (f64(zn) - f64(zf))); - f32 m32 = f32(f64(zn) * f64(zf) / (f64(zn) - f64(zf))); - - (*pMatr)(0, 0) = 2 * zn / (r - l); - (*pMatr)(0, 1) = 0; - (*pMatr)(0, 2) = 0; - (*pMatr)(0, 3) = 0; - (*pMatr)(1, 0) = 0; - (*pMatr)(1, 1) = 2 * zn / (t - b); - (*pMatr)(1, 2) = 0; - (*pMatr)(1, 3) = 0; - (*pMatr)(2, 0) = (l + r) / (r - l); - (*pMatr)(2, 1) = (t + b) / (t - b); - (*pMatr)(2, 2) = m22; - (*pMatr)(2, 3) = -1; - (*pMatr)(3, 0) = 0; - (*pMatr)(3, 1) = 0; - (*pMatr)(3, 2) = m32; - (*pMatr)(3, 3) = 0; -} - -inline void mathMatrixPerspectiveOffCenterReverseDepth(Matrix44A* pMatr, f32 l, f32 r, f32 b, f32 t, f32 zn, f32 zf) -{ - f32 m22 = f32(-f64(zn) / (f64(zn) - f64(zf))); - f32 m32 = f32(-f64(zn) * f64(zf) / (f64(zn) - f64(zf))); - - (*pMatr)(0, 0) = 2 * zn / (r - l); - (*pMatr)(0, 1) = 0; - (*pMatr)(0, 2) = 0; - (*pMatr)(0, 3) = 0; - (*pMatr)(1, 0) = 0; - (*pMatr)(1, 1) = 2 * zn / (t - b); - (*pMatr)(1, 2) = 0; - (*pMatr)(1, 3) = 0; - (*pMatr)(2, 0) = (l + r) / (r - l); - (*pMatr)(2, 1) = (t + b) / (t - b); - (*pMatr)(2, 2) = m22; - (*pMatr)(2, 3) = -1; - (*pMatr)(3, 0) = 0; - (*pMatr)(3, 1) = 0; - (*pMatr)(3, 2) = m32; - (*pMatr)(3, 3) = 0; -} - -//RH -inline void mathMatrixLookAt(Matrix44A* pMatr, const Vec3& Eye, const Vec3& At, const Vec3& Up) -{ - Vec3 vLightDir = (Eye - At); - Vec3 zaxis = vLightDir.GetNormalized(); - Vec3 xaxis = (Up.Cross(zaxis)).GetNormalized(); - Vec3 yaxis = zaxis.Cross(xaxis); - - (*pMatr)(0, 0) = xaxis.x; - (*pMatr)(0, 1) = yaxis.x; - (*pMatr)(0, 2) = zaxis.x; - (*pMatr)(0, 3) = 0; - (*pMatr)(1, 0) = xaxis.y; - (*pMatr)(1, 1) = yaxis.y; - (*pMatr)(1, 2) = zaxis.y; - (*pMatr)(1, 3) = 0; - (*pMatr)(2, 0) = xaxis.z; - (*pMatr)(2, 1) = yaxis.z; - (*pMatr)(2, 2) = zaxis.z; - (*pMatr)(2, 3) = 0; - (*pMatr)(3, 0) = -xaxis.Dot(Eye); - (*pMatr)(3, 1) = -yaxis.Dot(Eye); - (*pMatr)(3, 2) = -zaxis.Dot(Eye); - (*pMatr)(3, 3) = 1; -} - -inline bool mathMatrixPerspectiveFovInverse(Matrix44_tpl* pResult, const Matrix44A* pProjFov) -{ - if ((*pProjFov)(0, 1) == 0.0f && (*pProjFov)(0, 2) == 0.0f && (*pProjFov)(0, 3) == 0.0f && - (*pProjFov)(1, 0) == 0.0f && (*pProjFov)(1, 2) == 0.0f && (*pProjFov)(1, 3) == 0.0f && - (*pProjFov)(3, 0) == 0.0f && (*pProjFov)(3, 1) == 0.0f && (*pProjFov)(3, 2) != 0.0f) - { - (*pResult)(0, 0) = 1.0 / (*pProjFov).m00; - (*pResult)(0, 1) = 0; - (*pResult)(0, 2) = 0; - (*pResult)(0, 3) = 0; - (*pResult)(1, 0) = 0; - (*pResult)(1, 1) = 1.0 / (*pProjFov).m11; - (*pResult)(1, 2) = 0; - (*pResult)(1, 3) = 0; - (*pResult)(2, 0) = 0; - (*pResult)(2, 1) = 0; - (*pResult)(2, 2) = 0; - (*pResult)(2, 3) = 1.0 / (*pProjFov).m32; - (*pResult)(3, 0) = (*pProjFov).m20 / (*pProjFov).m00; - (*pResult)(3, 1) = (*pProjFov).m21 / (*pProjFov).m11; - (*pResult)(3, 2) = -1; - (*pResult)(3, 3) = (*pProjFov).m22 / (*pProjFov).m32; - - return true; - } - - return false; -} - -template -inline void mathMatrixLookAtInverse(Matrix44_tpl* pResult, const Matrix44_tpl* pLookAt) -{ - (*pResult)(0, 0) = (*pLookAt).m00; - (*pResult)(0, 1) = (*pLookAt).m10; - (*pResult)(0, 2) = (*pLookAt).m20; - (*pResult)(0, 3) = (*pLookAt).m03; - (*pResult)(1, 0) = (*pLookAt).m01; - (*pResult)(1, 1) = (*pLookAt).m11; - (*pResult)(1, 2) = (*pLookAt).m21; - (*pResult)(1, 3) = (*pLookAt).m13; - (*pResult)(2, 0) = (*pLookAt).m02; - (*pResult)(2, 1) = (*pLookAt).m12; - (*pResult)(2, 2) = (*pLookAt).m22; - (*pResult)(2, 3) = (*pLookAt).m23; - - (*pResult)(3, 0) = T_out(-(f64((*pLookAt).m00) * f64((*pLookAt).m30) + f64((*pLookAt).m01) * f64((*pLookAt).m31) + f64((*pLookAt).m02) * f64((*pLookAt).m32))); - (*pResult)(3, 1) = T_out(-(f64((*pLookAt).m10) * f64((*pLookAt).m30) + f64((*pLookAt).m11) * f64((*pLookAt).m31) + f64((*pLookAt).m12) * f64((*pLookAt).m32))); - (*pResult)(3, 2) = T_out(-(f64((*pLookAt).m20) * f64((*pLookAt).m30) + f64((*pLookAt).m21) * f64((*pLookAt).m31) + f64((*pLookAt).m22) * f64((*pLookAt).m32))); - (*pResult)(3, 3) = (*pLookAt).m33; -}; - -inline void mathVec4Transform(f32 out[4], const f32 m[16], const f32 in[4]) -{ -#define M(row, col) m[col * 4 + row] - out[0] = M(0, 0) * in[0] + M(0, 1) * in[1] + M(0, 2) * in[2] + M(0, 3) * in[3]; - out[1] = M(1, 0) * in[0] + M(1, 1) * in[1] + M(1, 2) * in[2] + M(1, 3) * in[3]; - out[2] = M(2, 0) * in[0] + M(2, 1) * in[1] + M(2, 2) * in[2] + M(2, 3) * in[3]; - out[3] = M(3, 0) * in[0] + M(3, 1) * in[1] + M(3, 2) * in[2] + M(3, 3) * in[3]; -#undef M -} - -//fix: replace by 3x4 Matrix transformation and move to crymath -inline void mathVec3Transform(f32 out[4], const f32 m[16], const f32 in[3]) -{ -#define M(row, col) m[col * 4 + row] - out[0] = M(0, 0) * in[0] + M(0, 1) * in[1] + M(0, 2) * in[2] + M(0, 3) * 1.0f; - out[1] = M(1, 0) * in[0] + M(1, 1) * in[1] + M(1, 2) * in[2] + M(1, 3) * 1.0f; - out[2] = M(2, 0) * in[0] + M(2, 1) * in[1] + M(2, 2) * in[2] + M(2, 3) * 1.0f; - out[3] = M(3, 0) * in[0] + M(3, 1) * in[1] + M(3, 2) * in[2] + M(3, 3) * 1.0f; -#undef M -} - -#define mathVec3TransformF(pOut, pV, pM) mathVec3Transform((f32*)pOut, (const f32*)pM, (f32*)pV) -#define mathVec4TransformF(pOut, pV, pM) mathVec4Transform((f32*)pOut, (const f32*)pM, (f32*)pV) -#define mathVec3NormalizeF(pOut, pV) (*(Vec3*)pOut) = (((Vec3*)pV)->GetNormalizedSafe()) -#define mathVec2NormalizeF(pOut, pV) (*(Vec2*)pOut) = (((Vec2*)pV)->GetNormalizedSafe()) - - -//fix replace viewport by int16 array -//fix for d3d viewport -inline f32 mathVec3Project(Vec3* pvWin, const Vec3* pvObj, const int32 pViewport[4], const Matrix44A* pProjection, const Matrix44A* pView, const Matrix44A* pWorld) -{ - Vec4 in, out; - - in.x = pvObj->x; - in.y = pvObj->y; - in.z = pvObj->z; - in.w = 1.0f; - mathVec4Transform((f32*)&out, (f32*)pWorld, (f32*)&in); - mathVec4Transform((f32*)&in, (f32*)pView, (f32*)&out); - mathVec4Transform((f32*)&out, (f32*)pProjection, (f32*)&in); - - if (out.w == 0.0f) - { - return 0.f; - } - - out.x /= out.w; - out.y /= out.w; - out.z /= out.w; - - //output coords - pvWin->x = pViewport[0] + (1 + out.x) * pViewport[2] / 2; - pvWin->y = pViewport[1] + (1 - out.y) * pViewport[3] / 2; //flip coords for y axis - - //FIX: update fViewportMinZ fViewportMaxZ support for Viewport everywhere - float fViewportMinZ = 0, fViewportMaxZ = 1.0f; - - pvWin->z = fViewportMinZ + out.z * (fViewportMaxZ - fViewportMinZ); - - return out.w; -} - -inline Vec3* mathVec3UnProject(Vec3* pvObj, const Vec3* pvWin, const int32 pViewport[4], const Matrix44A* pProjection, const Matrix44A* pView, const Matrix44A* pWorld, [[maybe_unused]] int32 OptFlags) -{ - Matrix44A m, mA; - Vec4 in, out; - - //FIX: update fViewportMinZ fViewportMaxZ support for Viewport everywhere - float fViewportMinZ = 0, fViewportMaxZ = 1.0f; - - in.x = (pvWin->x - pViewport[0]) * 2 / pViewport[2] - 1.0f; - in.y = 1.0f - ((pvWin->y - pViewport[1]) * 2 / pViewport[3]); //flip coords for y axis - in.z = (pvWin->z - fViewportMinZ) / (fViewportMaxZ - fViewportMinZ); - in.w = 1.0f; - - //prepare inverse projection matrix - mA = ((*pWorld) * (*pView)) * (*pProjection); - m = mA.GetInverted(); - - mathVec4Transform((f32*)&out, m.GetData(), (f32*)&in); - if (out.w == 0.0f) - { - return NULL; - } - - pvObj->x = out.x / out.w; - pvObj->y = out.y / out.w; - pvObj->z = out.z / out.w; - - return pvObj; -} - - -inline Vec3* mathVec3ProjectArray(Vec3* pOut, uint32 OutStride, const Vec3* pV, uint32 VStride, const int32 pViewport[4], const Matrix44A* pProjection, const Matrix44A* pView, const Matrix44A* pWorld, uint32 n, int32) -{ - Matrix44A m; - Vec4 in, out; - - int8* pOutT = (int8*)pOut; - int8* pInT = (int8*)pV; - - Vec3* pvWin; - Vec3* pvObj; - - //FIX: update fViewportMinZ fViewportMaxZ support for Viewport everywhere - float fViewportMinZ = 0, fViewportMaxZ = 1.0f; - - m = ((*pWorld) * (*pView)) * (*pProjection); - - for (uint32 i = 0; i < n; i++) - { - pvObj = (Vec3*)pInT; - pvWin = (Vec3*)pOutT; - - in.x = pvObj->x; - in.y = pvObj->y; - in.z = pvObj->z; - in.w = 1.0f; - - mathVec4Transform((f32*)&out, m.GetData(), (f32*)&in); - - if (out.w == 0.0f) - { - return NULL; - } - - float fInvW = 1.0f / out.w; - out.x *= fInvW; - out.y *= fInvW; - out.z *= fInvW; - - //output coords - pvWin->x = pViewport[0] + (1 + out.x) * pViewport[2] / 2; - pvWin->y = pViewport[1] + (1 - out.y) * pViewport[3] / 2; //flip coords for y axis - - pvWin->z = fViewportMinZ + out.z * (fViewportMaxZ - fViewportMinZ); - - pOutT += OutStride; - pInT += VStride; - } - - return pOut; -} - - -inline Vec3* mathVec3UnprojectArray(Vec3* pOut, uint32 OutStride, const Vec3* pV, uint32 VStride, const int32 pViewport[4], const Matrix44* pProjection, const Matrix44* pView, const Matrix44* pWorld, uint32 n, [[maybe_unused]] int32 OptFlags) -{ - Vec4 in, out; - Matrix44 m, mA; - - int8* pOutT = (int8*)pOut; - int8* pInT = (int8*)pV; - - Vec3* pvWin; - Vec3* pvObj; - - //FIX: update fViewportMinZ fViewportMaxZ support for Viewport everywhere - float fViewportMinZ = 0, fViewportMaxZ = 1.0f; - - mA = ((*pWorld) * (*pView)) * (*pProjection); - m = mA.GetInverted(); - - for (uint32 i = 0; i < n; i++) - { - pvWin = (Vec3*)pInT; - pvObj = (Vec3*)pOutT; - - in.x = (pvWin->x - pViewport[0]) * 2 / pViewport[2] - 1.0f; - in.y = 1.0f - ((pvWin->y - pViewport[1]) * 2 / pViewport[3]); //flip coords for y axis - in.z = (pvWin->z - fViewportMinZ) / (fViewportMaxZ - fViewportMinZ); - in.w = 1.0f; - - mathVec4Transform((f32*)&out, m.GetData(), (f32*)&in); - - assert(out.w != 0.0f); - - if (out.w == 0.0f) - { - return NULL; - } - - pvObj->x = out.x / out.w; - pvObj->y = out.y / out.w; - pvObj->z = out.z / out.w; - - pOutT += OutStride; - pInT += VStride; - } - - return pOut; -} - - - - -/***************************************************** -MISC FUNCTIONS -*****************************************************/ - -////////////////////////////////////////////////////////////////////////// -#if defined(_CPU_X86) -inline int fastftol_positive(float f) -{ - int i; - - f -= 0.5f; -#if defined(_MSC_VER) - __asm fld [f] - __asm fistp [i] -#elif defined(__GNUC__) - __asm__ ("fld %[f]\n fistpl %[i]" : [i] "+m" (i) : [f] "m" (f)); -#else -#error -#endif - return i; -} -#else -inline int fastftol_positive (float f) -{ - assert(f >= 0.f); - return (int)floorf(f); -} -#endif - - - -////////////////////////////////////////////////////////////////////////// -#if defined(_CPU_X86) -inline int fastround_positive(float f) -{ - int i; - assert(f >= 0.f); -#if defined(_MSC_VER) - __asm fld [f] - __asm fistp [i] -#elif defined(__GNUC__) - __asm__ ("fld %[f]\n fistpl %[i]" : [i] "+m" (i) : [f] "m" (f)); -#else -#error -#endif - return i; -} -#else -inline int fastround_positive(float f) -{ - assert(f >= 0.f); - return (int) (f + 0.5f); -} -#endif - - - -////////////////////////////////////////////////////////////////////////// -#if defined(_CPU_X86) -ILINE int __fastcall FtoI(float x) -{ - int t; -#if defined(_MSC_VER) - __asm - { - fld x - fistp t - } -#elif defined(__GNUC__) - __asm__ ("fld %[x]\n fistpl %[t]" : [t] "+m" (t) : [x] "m" (x)); -#else -#error -#endif - return t; -} -#else -inline int FtoI(float x) { return (int)x; } -#endif - -#endif // CRYINCLUDE_CRYCOMMON_CRY_XOPTIMISE_H - diff --git a/Code/Legacy/CryCommon/HeapAllocator.h b/Code/Legacy/CryCommon/HeapAllocator.h deleted file mode 100644 index da5d23e06f..0000000000 --- a/Code/Legacy/CryCommon/HeapAllocator.h +++ /dev/null @@ -1,457 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - - -#ifndef CRYINCLUDE_CRYCOMMON_HEAPALLOCATOR_H -#define CRYINCLUDE_CRYCOMMON_HEAPALLOCATOR_H -#pragma once - - -#include "Synchronization.h" -#include "Options.h" - -#include - -//--------------------------------------------------------------------------- -#define bMEM_ACCESS_CHECK 0 -#define bMEM_HEAP_CHECK 0 - -namespace stl -{ - class HeapSysAllocator - { - public: - static void* SysAlloc(size_t nSize) - { return CryModuleMalloc(nSize); } - static void SysDealloc(void* ptr) - { CryModuleFree(ptr); } - }; - - class GlobalHeapSysAllocator - { - public: - static void* SysAlloc(size_t nSize) - { - return CryModuleMalloc(nSize); - } - static void SysDealloc(void* ptr) - { - CryModuleFree(ptr); - } - }; - - // Round up to next multiple of nAlign. Handles any positive integer. - inline size_t RoundUpTo(size_t nSize, size_t nAlign) - { - assert(nAlign > 0); - nSize += nAlign - 1; - return nSize - nSize % nAlign; - } - - /*--------------------------------------------------------------------------- - HeapAllocator - A memory pool that can allocate arbitrary amounts of memory of arbitrary size - and alignment. The heap may be freed all at once. Individual block deallocation - is not provided. - - Usable as a base class to implement more general-purpose allocators that - track, free, and reuse individual memory blocks. - - The class can optionally support multi-threading, using the second - template parameter. By default it is multithread-safe. - See Synchronization.h. - - Allocation details: Maintains a linked list of pages. - All pages after first are in order of most free memory first. - Allocations are from the smallest free page available. - - ---------------------------------------------------------------------------*/ - - struct SMemoryUsage - { - size_t nAlloc, nUsed; - - SMemoryUsage(size_t _nAlloc = 0, size_t _nUsed = 0) - : nAlloc(_nAlloc) - , nUsed(_nUsed) - { - Validate(); - } - - size_t nFree() const - { - return nAlloc - nUsed; - } - void Validate() const - { - assert(nUsed <= nAlloc); - } - void Clear() - { - nAlloc = nUsed = 0; - } - - void operator += (SMemoryUsage const& op) - { - nAlloc += op.nAlloc; - nUsed += op.nUsed; - } - }; - - ////////////////////////////////////////////////////////////////////////// - struct FHeap - { - OPT_STRUCT(FHeap) - OPT_VAR(size_t, PageSize); // Pages allocated at this size, or multiple thereof if needed. - OPT_VAR(bool, SinglePage) // Only 1 page allowed (fixed alloc) - OPT_VAR(bool, FreeWhenEmpty) // Release all memory when no longer used - }; - - template - class HeapAllocator - : public FHeap - , public L - , private SysAl - { - public: - - typedef AutoLock Lock; - - enum - { - DefaultAlignment = sizeof(void*) - }; - enum - { - DefaultPageSize = 0x1000 - }; - - private: - - struct PageNode - { - PageNode* pNext; - char* pEndAlloc; - char* pEndUsed; - - char* StartUsed() const - { - return (char*)(this + 1); - } - - PageNode(size_t nAlloc) - { - pNext = 0; - pEndAlloc = (char*)this + nAlloc; - pEndUsed = StartUsed(); - } - - void* Allocate(size_t nSize, size_t nAlign) - { - // Align current mem. - char* pNew = Align(pEndUsed, nAlign); - if (pNew + nSize > pEndAlloc) - { - return 0; - } - pEndUsed = pNew + nSize; - return pNew; - } - - bool CanAllocate(size_t nSize, size_t nAlign) - { - return Align(pEndUsed, nAlign) + nSize <= pEndAlloc; - } - - void Reset() - { - pEndUsed = StartUsed(); - } - - size_t GetMemoryAlloc() const - { - return pEndAlloc - (char*)this; - } - size_t GetMemoryUsed() const - { - return pEndUsed - StartUsed(); - } - size_t GetMemoryFree() const - { - return pEndAlloc - pEndUsed; - } - - void Validate() const - { - assert(pEndAlloc >= (char*)this); - assert(pEndUsed >= StartUsed() && pEndUsed <= pEndAlloc); - } - - bool CheckPtr(void* ptr) const - { - return (char*)ptr >= StartUsed() && (char*)ptr < pEndUsed; - } - }; - - public: - - HeapAllocator(FHeap opts = 0) - : FHeap(opts) - , _pPageList(0) - { - PageSize = max(Align(PageSize, DefaultPageSize), DefaultPageSize); - } - - ~HeapAllocator() - { - Clear(); - } - - // - // Raw memory allocation. - // - void* Allocate(const Lock& lock, size_t nSize, size_t nAlign = DefaultAlignment) - { - for (;; ) - { - // Try allocating from head page first. - if (_pPageList) - { - if (void* ptr = _pPageList->Allocate(nSize, nAlign)) - { - _TotalMem.nUsed += nSize; - return ptr; - } - - if (_pPageList->pNext && _pPageList->pNext->GetMemoryFree() > _pPageList->GetMemoryFree()) - { - SortPage(lock, _pPageList); - Validate(lock); - - // Try allocating from new head, which has the most free memory. - // If this fails, we know no further pages will succeed. - if (void* ptr = _pPageList->Allocate(nSize, nAlign)) - { - _TotalMem.nUsed += nSize; - return ptr; - } - } - if (SinglePage) - { - return 0; - } - } - - // Allocate the new page of the required size. - size_t nAllocSize = Align(sizeof(PageNode), nAlign) + nSize; - nAllocSize = RoundUpTo(nAllocSize, PageSize); - - void* pAlloc = this->SysAlloc(nAllocSize); - PageNode* pPageNode = new(pAlloc) PageNode(nAllocSize); - - // Insert at head of list. - pPageNode->pNext = _pPageList; - _pPageList = pPageNode; - - _TotalMem.nAlloc += nAllocSize; - - Validate(lock); - } - } - - void Deallocate([[maybe_unused]] const Lock& lock, [[maybe_unused]] void* ptr, size_t nSize) - { - // Just to maintain counts, can't reuse memory. - assert(CheckPtr(lock, ptr)); - assert(_TotalMem.nUsed >= nSize); - _TotalMem.nUsed -= nSize; - } - - // - // Templated type allocation. - // - template - T* New(size_t nAlign = 0) - { - void* pMemory = Allocate(Lock(*this), sizeof(T), nAlign ? nAlign : alignof(T)); - return pMemory ? new(pMemory) T : 0; - } - - template - T* NewArray(size_t nCount, size_t nAlign = 0) - { - void* pMemory = Allocate(Lock(*this), sizeof(T) * nCount, nAlign ? nAlign : alignof(T)); - return pMemory ? new(pMemory) T[nCount] : 0; - } - - // - // Maintenance. - // - SMemoryUsage GetTotalMemory(const Lock&) - { - return _TotalMem; - } - SMemoryUsage GetTotalMemory() - { - Lock lock(*this); - return _TotalMem; - } - - // Facility to defer freeing of dead pages during memory release calls. - struct FreeMemLock - : Lock - { - struct PageNode* _pPageList; - - FreeMemLock(L& lock) - : Lock(lock) - , _pPageList(0) {} - - ~FreeMemLock() - { - while (_pPageList != 0) - { - // Read the "next" pointer before deleting. - PageNode* pNext = _pPageList->pNext; - - // Delete the current page. - SysAl::SysDealloc(_pPageList); - - // Move to the next page in the list. - _pPageList = pNext; - } - } - }; - - void Clear(FreeMemLock& lock) - { - // Remove the pages from the object. - Validate(lock); - lock._pPageList = _pPageList; - _pPageList = 0; - _TotalMem.Clear(); - } - - void Clear() - { - FreeMemLock lock(*this); - Clear(lock); - } - - void Reset(const Lock& lock) - { - // Reset all pages, allowing memory re-use. - Validate(lock); - size_t nPrevSize = ~0; - for (PageNode** ppPage = &_pPageList; *ppPage; ) - { - (*ppPage)->Reset(); - if ((*ppPage)->GetMemoryAlloc() > nPrevSize) - { - // Move page to sorted location near beginning. - SortPage(lock, *ppPage); - - // ppPage is now next page, so continue loop. - continue; - } - nPrevSize = (*ppPage)->GetMemoryAlloc(); - ppPage = &(*ppPage)->pNext; - } - _TotalMem.nUsed = 0; - Validate(lock); - } - - void Reset() - { - Reset(Lock(*this)); - } - - // - // Validation. - // - bool CheckPtr(const Lock&, void* ptr) const - { - if (!ptr) - { - return true; - } - for (PageNode* pNode = _pPageList; pNode; pNode = pNode->pNext) - { - if (pNode->CheckPtr(ptr)) - { - return true; - } - } - return false; - } - - void Validate(const Lock&) const - { - #ifdef _DEBUG - // Check page validity, and memory counts. - SMemoryUsage MemCheck; - - for (PageNode* pPage = _pPageList; pPage; pPage = pPage->pNext) - { - pPage->Validate(); - if (pPage != _pPageList && pPage->pNext) - { - assert(pPage->GetMemoryFree() >= pPage->pNext->GetMemoryFree()); - } - MemCheck.nAlloc += pPage->GetMemoryAlloc(); - MemCheck.nUsed += pPage->GetMemoryUsed(); - } - assert(MemCheck.nAlloc == _TotalMem.nAlloc); - assert(MemCheck.nUsed >= _TotalMem.nUsed); - #endif - - #if bMEM_HEAP_CHECK - static int nCount = 0, nInterval = 0; - if (nCount++ >= nInterval) - { - nInterval++; - nCount = 0; - } - #endif - } - - void GetMemoryUsage(ICrySizer* pSizer) const - { - Lock lock(non_const(*this)); - for (PageNode* pNode = _pPageList; pNode; pNode = pNode->pNext) - { - pSizer->AddObject(pNode, pNode->GetMemoryAlloc()); - } - } - - private: - - void SortPage(const Lock&, PageNode*& rpPage) - { - // Unlink rpPage. - PageNode* pPage = rpPage; - rpPage = pPage->pNext; - - // Insert into list based on free memory. - PageNode** ppBefore = &_pPageList; - while (*ppBefore && (*ppBefore)->GetMemoryFree() > pPage->GetMemoryFree()) - { - ppBefore = &(*ppBefore)->pNext; - } - - // Link before rpList. - pPage->pNext = *ppBefore; - *ppBefore = pPage; - } - - PageNode* _pPageList; // All allocated pages. - SMemoryUsage _TotalMem; // Track memory allocated and used. - }; -} - -#endif // CRYINCLUDE_CRYCOMMON_HEAPALLOCATOR_H diff --git a/Code/Legacy/CryCommon/IEntityRenderState.h b/Code/Legacy/CryCommon/IEntityRenderState.h index e9f041ba17..c4267b28f2 100644 --- a/Code/Legacy/CryCommon/IEntityRenderState.h +++ b/Code/Legacy/CryCommon/IEntityRenderState.h @@ -6,21 +6,22 @@ * */ - -#ifndef CRYINCLUDE_CRYCOMMON_IENTITYRENDERSTATE_H -#define CRYINCLUDE_CRYCOMMON_IENTITYRENDERSTATE_H #pragma once +#include "IStatObj.h" + #include #include #include + namespace AZ { class Vector2; } struct IMaterial; +struct IRenderNode; struct IVisArea; struct SRenderingPassInfo; struct SRendItemSorter; @@ -576,51 +577,6 @@ struct IVoxelObject // }; -// Summary: -// IFogVolumeRenderNode is an interface to the Fog Volume Render Node object. -struct SFogVolumeProperties -{ - // Common parameters. - // Center position & rotation values are taken from the entity matrix. - - int m_volumeType; - Vec3 m_size; - ColorF m_color; - bool m_useGlobalFogColor; - bool m_ignoresVisAreas; - bool m_affectsThisAreaOnly; - float m_globalDensity; - float m_densityOffset; - float m_softEdges; - float m_fHDRDynamic; // 0 to get the same results in LDR, <0 to get darker, >0 to get brighter. - float m_nearCutoff; - - float m_heightFallOffDirLong; // Height based fog specifics. - float m_heightFallOffDirLati; // Height based fog specifics. - float m_heightFallOffShift; // Height based fog specifics. - float m_heightFallOffScale; // Height based fog specifics. - - float m_rampStart; - float m_rampEnd; - float m_rampInfluence; - float m_windInfluence; - float m_densityNoiseScale; - float m_densityNoiseOffset; - float m_densityNoiseTimeFrequency; - Vec3 m_densityNoiseFrequency; -}; - -struct IFogVolumeRenderNode - : public IRenderNode -{ - // - virtual void SetFogVolumeProperties(const SFogVolumeProperties& properties) = 0; - virtual const Matrix34& GetMatrix() const = 0; - - virtual void FadeGlobalDensity(float fadeTime, float newGlobalDensity) = 0; - // -}; - // LY renderer system spec levels. enum class EngineSpec : AZ::u32 { @@ -630,159 +586,3 @@ enum class EngineSpec : AZ::u32 VeryHigh, Never = UINT_MAX, }; - -struct SDecalProperties -{ - SDecalProperties() - { - m_projectionType = ePlanar; - m_sortPrio = 0; - m_deferred = false; - m_pos = Vec3(0.0f, 0.0f, 0.0f); - m_normal = Vec3(0.0f, 0.0f, 1.0f); - m_explicitRightUpFront = Matrix33::CreateIdentity(); - m_radius = 1.0f; - m_depth = 1.0f; - m_opacity = 1.0f; - m_angleAttenuation = 1.0f; - m_maxViewDist = 8000.0f; - m_minSpec = EngineSpec::Low; - } - - enum EProjectionType : int - { - ePlanar, - eProjectOnTerrain, - eProjectOnTerrainAndStaticObjects - }; - - EProjectionType m_projectionType; - uint8 m_sortPrio; - uint8 m_deferred; - Vec3 m_pos; - Vec3 m_normal; - Matrix33 m_explicitRightUpFront; - float m_radius; - float m_depth; - const char* m_pMaterialName; - float m_opacity; - float m_angleAttenuation; - float m_maxViewDist; - EngineSpec m_minSpec; -}; - -// Description: -// IDecalRenderNode is an interface to the Decal Render Node object. -struct IDecalRenderNode - : public IRenderNode -{ - // - virtual void SetDecalProperties(const SDecalProperties& properties) = 0; - virtual const SDecalProperties* GetDecalProperties() const = 0; - virtual const Matrix34& GetMatrix() = 0; - virtual void CleanUpOldDecals() = 0; - // -}; - -// Description: -// IWaterVolumeRenderNode is an interface to the Water Volume Render Node object. -struct IWaterVolumeRenderNode - : public IRenderNode -{ - enum EWaterVolumeType - { - eWVT_Unknown, - eWVT_Ocean, - eWVT_Area, - eWVT_River - }; - - // - // Description: - // Sets if the render node is attached to a parent entity - // This must be called right after the object construction if it is the case - // Only supported for Areas (not rivers or ocean) - virtual void SetAreaAttachedToEntity() = 0; - - virtual void SetFogDensity(float fogDensity) = 0; - virtual float GetFogDensity() const = 0; - virtual void SetFogColor(const Vec3& fogColor) = 0; - virtual void SetFogColorAffectedBySun(bool enable) = 0; - virtual void SetFogShadowing(float fogShadowing) = 0; - - virtual void SetCapFogAtVolumeDepth(bool capFog) = 0; - virtual void SetVolumeDepth(float volumeDepth) = 0; - virtual void SetStreamSpeed(float streamSpeed) = 0; - - virtual void SetCaustics(bool caustics) = 0; - virtual void SetCausticIntensity(float causticIntensity) = 0; - virtual void SetCausticTiling(float causticTiling) = 0; - virtual void SetCausticHeight(float causticHeight) = 0; - virtual void SetAuxPhysParams(pe_params_area*) = 0; - - virtual void CreateOcean(uint64 volumeID, /* TBD */ bool keepSerializationParams = false) = 0; - virtual void CreateArea(uint64 volumeID, const Vec3* pVertices, unsigned int numVertices, const Vec2& surfUVScale, const Plane_tpl& fogPlane, bool keepSerializationParams = false, int nSID = -1) = 0; - virtual void CreateRiver(uint64 volumeID, const Vec3* pVertices, unsigned int numVertices, float uTexCoordBegin, float uTexCoordEnd, const Vec2& surfUVScale, const Plane_tpl& fogPlane, bool keepSerializationParams = false, int nSID = -1) = 0; - virtual void CreateRiver(uint64 volumeID, const AZStd::vector& verticies, const AZ::Transform& transform, float uTexCoordBegin, float uTexCoordEnd, const AZ::Vector2& surfUVScale, const AZ::Plane& fogPlane, bool keepSerializationParams = false, int nSID = -1) = 0; - - virtual void SetAreaPhysicsArea(const Vec3* pVertices, unsigned int numVertices, bool keepSerializationParams = false) = 0; - virtual void SetRiverPhysicsArea(const Vec3* pVertices, unsigned int numVertices, bool keepSerializationParams = false) = 0; - virtual void SetRiverPhysicsArea(const AZStd::vector& verticies, const AZ::Transform& transform, bool keepSerializationParams = false) = 0; - - // - - // This flag is used to account for legacy entities which used to serialize the node without parent objects. - // Now there are runtime components which spawn the rendering node, however we need to support legacy code as well. - // Remove this flag when legacy entities are removed entirely - bool m_hasToBeSerialised = true; -}; - -// Description: -// IDistanceCloudRenderNode is an interface to the Distance Cloud Render Node object. -struct SDistanceCloudProperties -{ - Vec3 m_pos; - float m_sizeX; - float m_sizeY; - float m_rotationZ; - const char* m_pMaterialName; -}; - -struct IDistanceCloudRenderNode - : public IRenderNode -{ - virtual void SetProperties(const SDistanceCloudProperties& properties) = 0; -}; - -struct SVolumeObjectProperties -{ -}; - -struct SVolumeObjectMovementProperties -{ - bool m_autoMove; - Vec3 m_speed; - Vec3 m_spaceLoopBox; - float m_fadeDistance; -}; - -// Description: -// IVolumeObjectRenderNode is an interface to the Volume Object Render Node object. -struct IVolumeObjectRenderNode - : public IRenderNode -{ - // - virtual void LoadVolumeData(const char* filePath) = 0; - virtual void SetProperties(const SVolumeObjectProperties& properties) = 0; - virtual void SetMovementProperties(const SVolumeObjectMovementProperties& properties) = 0; - // -}; - -#if !defined(EXCLUDE_DOCUMENTATION_PURPOSE) -struct IPrismRenderNode - : public IRenderNode -{ -}; -#endif // EXCLUDE_DOCUMENTATION_PURPOSE - -#endif // CRYINCLUDE_CRYCOMMON_IENTITYRENDERSTATE_H diff --git a/Code/Legacy/CryCommon/IIndexedMesh.h b/Code/Legacy/CryCommon/IIndexedMesh.h index 87c3df98bd..2199415503 100644 --- a/Code/Legacy/CryCommon/IIndexedMesh.h +++ b/Code/Legacy/CryCommon/IIndexedMesh.h @@ -15,6 +15,7 @@ #include "Cry_Color.h" #include "StlUtils.h" #include "CryEndian.h" + #include #include // for AABB #include @@ -145,14 +146,6 @@ public: a = othera; } - explicit SMeshColor(const Vec4& otherc) - { - r = aznumeric_caster(FtoI(otherc.x)); - g = aznumeric_caster(FtoI(otherc.y)); - b = aznumeric_caster(FtoI(otherc.z)); - a = aznumeric_caster(FtoI(otherc.w)); - } - void TransferRGBTo(SMeshColor& other) const { other.r = r; @@ -200,18 +193,6 @@ public: otherc = Vec4(r, g, b, a); } - void Lerp(const SMeshColor& other, float pos) - { - Vec4 clrA; - Vec4 clrB; - this->GetRGBA(clrA); - other.GetRGBA(clrB); - - clrA.SetLerp(clrA, clrB, pos); - - *this = SMeshColor(clrA); - } - AUTO_STRUCT_INFO }; diff --git a/Code/Legacy/CryCommon/IMaterial.h b/Code/Legacy/CryCommon/IMaterial.h index 83f9140be7..e1502b0f1a 100644 --- a/Code/Legacy/CryCommon/IMaterial.h +++ b/Code/Legacy/CryCommon/IMaterial.h @@ -8,10 +8,6 @@ // Description : IMaterial interface declaration. - - -#ifndef CRYINCLUDE_CRYCOMMON_IMATERIAL_H -#define CRYINCLUDE_CRYCOMMON_IMATERIAL_H #pragma once struct ISurfaceType; @@ -19,18 +15,13 @@ struct ISurfaceTypeManager; class ICrySizer; enum EEfResTextures : int; // Need to specify a fixed size for the forward declare to work on clang -struct IRenderShaderResources; -struct SEfTexModificator; -struct SInputShaderResources; struct SShaderItem; struct SShaderParam; struct IShader; -struct IShaderPublicParams; struct IMaterial; struct IMaterialManager; struct CMaterialCGF; -struct CRenderChunk; struct IRenderMesh; #include @@ -162,90 +153,6 @@ enum EMaterialCopyFlags MTL_COPY_TEXTURES = BIT(1), }; -struct IMaterialHelpers -{ - virtual ~IMaterialHelpers() {} - - ////////////////////////////////////////////////////////////////////////// - virtual EEfResTextures FindTexSlot(const char* texName) const = 0; - virtual const char* FindTexName(EEfResTextures texSlot) const = 0; - virtual const char* LookupTexName(EEfResTextures texSlot) const = 0; - virtual const char* LookupTexDesc(EEfResTextures texSlot) const = 0; - virtual const char* LookupTexEnum(EEfResTextures texSlot) const = 0; - virtual const char* LookupTexSuffix(EEfResTextures texSlot) const = 0; - virtual bool IsAdjustableTexSlot(EEfResTextures texSlot) const = 0; - - ////////////////////////////////////////////////////////////////////////// - virtual bool SetGetMaterialParamFloat(IRenderShaderResources& pShaderResources, const char* sParamName, float& v, bool bGet) const = 0; - virtual bool SetGetMaterialParamVec3(IRenderShaderResources& pShaderResources, const char* sParamName, Vec3& v, bool bGet) const = 0; - - ////////////////////////////////////////////////////////////////////////// - virtual void SetTexModFromXml(SEfTexModificator& pShaderResources, const XmlNodeRef& node) const = 0; - virtual void SetXmlFromTexMod(const SEfTexModificator& pShaderResources, XmlNodeRef& node) const = 0; - - ////////////////////////////////////////////////////////////////////////// - virtual void SetTexturesFromXml(SInputShaderResources& pShaderResources, const XmlNodeRef& node) const = 0; - virtual void SetXmlFromTextures( SInputShaderResources& pShaderResources, XmlNodeRef& node) const = 0; - - ////////////////////////////////////////////////////////////////////////// - virtual void SetVertexDeformFromXml(SInputShaderResources& pShaderResources, const XmlNodeRef& node) const = 0; - virtual void SetXmlFromVertexDeform(const SInputShaderResources& pShaderResources, XmlNodeRef& node) const = 0; - - ////////////////////////////////////////////////////////////////////////// - virtual void SetLightingFromXml(SInputShaderResources& pShaderResources, const XmlNodeRef& node) const = 0; - virtual void SetXmlFromLighting(const SInputShaderResources& pShaderResources, XmlNodeRef& node) const = 0; - - ////////////////////////////////////////////////////////////////////////// - virtual void SetShaderParamsFromXml(SInputShaderResources& pShaderResources, const XmlNodeRef& node) const = 0; - virtual void SetXmlFromShaderParams(const SInputShaderResources& pShaderResources, XmlNodeRef& node) const = 0; - - ////////////////////////////////////////////////////////////////////////// - virtual void MigrateXmlLegacyData(SInputShaderResources& pShaderResources, const XmlNodeRef& node) const = 0; -}; - -////////////////////////////////////////////////////////////////////////////////////// -// Description: -// IMaterialLayer is group of material layer properties. -// Each layer is composed of shader item, specific layer textures, lod info, etc -struct IMaterialLayer -{ - // - virtual ~IMaterialLayer(){} - // Reference counting - virtual void AddRef() = 0; - virtual void Release() = 0; - - // Description: - // - Enable/disable layer usage - virtual void Enable(bool bEnable = true) = 0; - // Description: - // - Check if layer enabled - virtual bool IsEnabled() const = 0; - // Description: - // - Enable/disable fade out - virtual void FadeOut(bool bFadeOut = true) = 0; - // Description: - // - Check if layer fades out - virtual bool DoesFadeOut() const = 0; - // Description: - // - Set shader item - virtual void SetShaderItem(const _smart_ptr pParentMtl, const SShaderItem& pShaderItem) = 0; - // Description: - // - Return shader item - virtual const SShaderItem& GetShaderItem() const = 0; - virtual SShaderItem& GetShaderItem() = 0; - // Description: - // - Set layer usage flags - virtual void SetFlags(uint8 nFlags) = 0; - // Description: - // - Get layer usage flags - virtual uint8 GetFlags() const = 0; - - // todo: layer specific textures support - // - // -}; - struct IMaterial { // TODO: Remove it! @@ -254,7 +161,7 @@ struct IMaterial float m_fDefautMappingScale; // - virtual ~IMaterial() {}; + virtual ~IMaterial() {} ////////////////////////////////////////////////////////////////////////// // Reference counting. @@ -263,7 +170,6 @@ struct IMaterial virtual void Release() = 0; virtual int GetNumRefs() = 0; - virtual IMaterialHelpers& GetMaterialHelpers() = 0; virtual IMaterialManager* GetMaterialManager() = 0; ////////////////////////////////////////////////////////////////////////// @@ -295,10 +201,6 @@ struct IMaterial virtual ISurfaceType* GetSurfaceType() = 0; // shader item - virtual void ReleaseCurrentShaderItem() = 0; - virtual void SetShaderItem(const SShaderItem& _ShaderItem) = 0; - // [Alexey] EF_LoadShaderItem return value with RefCount = 1, so if you'll use SetShaderItem after EF_LoadShaderItem use Assign function - virtual void AssignShaderItem(const SShaderItem& _ShaderItem) = 0; virtual SShaderItem& GetShaderItem() = 0; virtual const SShaderItem& GetShaderItem() const = 0; @@ -310,41 +212,6 @@ struct IMaterial // Returns true if streamed in virtual bool IsStreamedIn(const int nMinPrecacheRoundIds[MAX_STREAM_PREDICTION_ZONES], IRenderMesh* pRenderMesh) const = 0; - ////////////////////////////////////////////////////////////////////////// - // Sub materials access. - ////////////////////////////////////////////////////////////////////////// - //! Returns number of child sub materials holded by this material. - virtual void SetSubMtlCount(int numSubMtl) = 0; - //! Returns number of child sub materials holded by this material. - virtual int GetSubMtlCount() = 0; - //! Return sub material at specified index. - virtual _smart_ptr GetSubMtl(int nSlot) = 0; - // Assign material to the sub mtl slot. - // Must first allocate slots using SetSubMtlCount. - virtual void SetSubMtl(int nSlot, _smart_ptr pMtl) = 0; - - ////////////////////////////////////////////////////////////////////////// - // Layers access. - ////////////////////////////////////////////////////////////////////////// - //! Returns number of layers in this material. - virtual void SetLayerCount(uint32 nCount) = 0; - //! Returns number of layers in this material. - virtual uint32 GetLayerCount() const = 0; - //! Set layer at slot id (### MUST ALOCATE SLOTS FIRST ### USING SetLayerCount) - virtual void SetLayer(uint32 nSlot, IMaterialLayer* pLayer) = 0; - //! Return active layer - virtual const IMaterialLayer* GetLayer(uint8 nLayersMask, uint8 nLayersUsageMask) const = 0; - //! Return layer at slot id - virtual const IMaterialLayer* GetLayer(uint32 nSlot) const = 0; - //! Create a new layer - virtual IMaterialLayer* CreateLayer() = 0; - - ////////////////////////////////////////////////////////////////////////// - // Always get a valid material. - // If not multi material return this material. - // If Multi material return Default material if wrong id. - virtual _smart_ptr GetSafeSubMtl(int nSlot) = 0; - // Description: // Fill an array of integeres representing surface ids of the sub materials or the material itself. // Arguments: @@ -567,12 +434,5 @@ struct IMaterialManager // Updates material data in the renderer virtual void RefreshMaterialRuntime() = 0; - //// Forcing to create ISurfaceTypeManager - //virtual void CreateSurfaceTypeManager() = 0; - //// Forcing to destroy ISurfaceTypeManager - //virtual void ReleaseSurfaceTypeManager() = 0; - // }; - -#endif // CRYINCLUDE_CRYCOMMON_IMATERIAL_H diff --git a/Code/Legacy/CryCommon/IMovieSystem.h b/Code/Legacy/CryCommon/IMovieSystem.h index 915dc925bf..ed62624871 100644 --- a/Code/Legacy/CryCommon/IMovieSystem.h +++ b/Code/Legacy/CryCommon/IMovieSystem.h @@ -20,10 +20,8 @@ #include #include #include -#include -#include +#include #include -#include // forward declaration. struct IAnimTrack; @@ -116,7 +114,7 @@ public: { *this = name; } - + CAnimParamType(AnimParamType type) { *this = type; @@ -838,7 +836,7 @@ public: // override this method to handle explicit setting of time virtual void TimeChanged([[maybe_unused]] float newTime) {}; - // Compares all of the node's track values at the given time with the associated property value and + // Compares all of the node's track values at the given time with the associated property value and // sets a key at that time if they are different to match the latter // Returns the number of keys set virtual int SetKeysForChangedTrackValues([[maybe_unused]] float time) { return 0; }; @@ -1309,7 +1307,7 @@ struct IMovieSystem // Disable Fixed Step cvars and return to previous settings virtual void DisableFixedStepForCapture() = 0; - + // Signal the capturing start. virtual void StartCapture(const ICaptureKey& key, int frame) = 0; diff --git a/Code/Legacy/CryCommon/INavigationSystem.h b/Code/Legacy/CryCommon/INavigationSystem.h index 6253f815bf..f88fccafff 100644 --- a/Code/Legacy/CryCommon/INavigationSystem.h +++ b/Code/Legacy/CryCommon/INavigationSystem.h @@ -11,10 +11,12 @@ #define CRYINCLUDE_CRYCOMMON_INAVIGATIONSYSTEM_H #pragma once +#include "CryCommon/Cry_Geo.h" + #include #include -#include +#include struct IOffMeshNavigationManager; @@ -47,7 +49,6 @@ typedef TNavigationID NavigationMeshID; typedef TNavigationID NavigationAgentTypeID; typedef TNavigationID NavigationVolumeID; typedef AZStd::function NavigationMeshChangeCallback; -typedef AZStd::function NavigationMeshEntityCallback; struct INavigationSystemUser { @@ -141,7 +142,6 @@ struct INavigationSystem virtual NavigationMeshID CreateMesh(const char* name, NavigationAgentTypeID agentTypeID, const CreateMeshParams& params, NavigationMeshID requestedID) = 0; virtual void DestroyMesh(NavigationMeshID meshID) = 0; - virtual void SetMeshEntityCallback(NavigationAgentTypeID agentTypeID, const NavigationMeshEntityCallback& callback) = 0; virtual void AddMeshChangeCallback(NavigationAgentTypeID agentTypeID, const NavigationMeshChangeCallback& callback) = 0; virtual void RemoveMeshChangeCallback(NavigationAgentTypeID agentTypeID, const NavigationMeshChangeCallback& callback) = 0; diff --git a/Code/Legacy/CryCommon/IPhysics.h b/Code/Legacy/CryCommon/IPhysics.h index f2097ddf36..a1825d3e44 100644 --- a/Code/Legacy/CryCommon/IPhysics.h +++ b/Code/Legacy/CryCommon/IPhysics.h @@ -7,22 +7,11 @@ */ -#ifndef CRYINCLUDE_CRYCOMMON_IPHYSICS_H -#define CRYINCLUDE_CRYCOMMON_IPHYSICS_H #pragma once - - -// -#ifdef PHYSICS_EXPORTS - #define CRYPHYSICS_API DLL_EXPORT -#else - #define CRYPHYSICS_API DLL_IMPORT -#endif - -#define vector_class Vec3_tpl - - #include +#include "Cry_Math.h" +#include "primitives.h" +#include // <> required for Interfuscator ////////////////////////////////////////////////////////////////////////// // IDs that can be used for foreign id. @@ -47,12 +36,3 @@ enum EPhysicsForeignIds PHYS_FOREIGN_ID_USER = 100, // All user defined foreign ids should start from this enum. }; - - -//#include "utils.h" -#include "Cry_Math.h" -#include "primitives.h" -#include // <> required for Interfuscator - - -#endif // CRYINCLUDE_CRYCOMMON_IPHYSICS_H diff --git a/Code/Legacy/CryCommon/IRenderAuxGeom.h b/Code/Legacy/CryCommon/IRenderAuxGeom.h index ab3c1036d5..d487cb483f 100644 --- a/Code/Legacy/CryCommon/IRenderAuxGeom.h +++ b/Code/Legacy/CryCommon/IRenderAuxGeom.h @@ -6,16 +6,12 @@ * */ - -#ifndef CRYINCLUDE_CRYCOMMON_IRENDERAUXGEOM_H -#define CRYINCLUDE_CRYCOMMON_IRENDERAUXGEOM_H #pragma once - -struct SAuxGeomRenderFlags; - +#include "Cry_Color.h" #include "IRenderer.h" +struct SAuxGeomRenderFlags; enum EBoundingBoxDrawStyle { @@ -833,6 +829,3 @@ inline CRenderAuxGeomRenderFlagsRestore::~CRenderAuxGeomRenderFlagsRestore() { m_pRender->SetRenderFlags(m_backuppedRenderFlags); } - - -#endif // CRYINCLUDE_CRYCOMMON_IRENDERAUXGEOM_H diff --git a/Code/Legacy/CryCommon/IRenderMesh.h b/Code/Legacy/CryCommon/IRenderMesh.h index 062c949043..0e225579ad 100644 --- a/Code/Legacy/CryCommon/IRenderMesh.h +++ b/Code/Legacy/CryCommon/IRenderMesh.h @@ -13,18 +13,15 @@ #include "VertexFormats.h" #include -#include #include // PublicRenderPrimitiveType #include #include #include class CMesh; -struct CRenderChunk; class CRenderObject; struct SSkinningData; struct IMaterial; -struct IShader; struct IIndexedMesh; struct SMRendTexVert; struct UCol; @@ -127,7 +124,7 @@ struct IRenderMesh , pNormals(0) , pIndices(0) , nIndexCount(0) - , nPrimetiveType(prtTriangleList) + , nPrimetiveType(PublicRenderPrimitiveType::prtTriangleList) , nRenderChunkCount(0) , nClientTextureBindID(0) , bOnlyVideoBuffer(false) @@ -182,8 +179,6 @@ struct IRenderMesh virtual bool CheckUpdate(uint32 nStreamMask) = 0; virtual int GetStreamStride(int nStream) const = 0; - virtual const uintptr_t GetVBStream(int nStream) const = 0; - virtual const uintptr_t GetIBStream() const = 0; virtual int GetNumVerts() const = 0; virtual int GetNumInds() const = 0; virtual const eRenderPrimitiveType GetPrimitiveType() const = 0; @@ -207,33 +202,24 @@ struct IRenderMesh virtual bool UpdateVertices(const void* pVertBuffer, int nVertCount, int nOffset, int nStream, uint32 copyFlags, bool requiresLock = true) = 0; virtual bool UpdateIndices(const vtx_idx* pNewInds, int nInds, int nOffsInd, uint32 copyFlags, bool requiresLock = true) = 0; virtual void SetCustomTexID(int nCustomTID) = 0; - virtual void SetChunk(int nIndex, CRenderChunk& chunk) = 0; - virtual void SetChunk(_smart_ptr pNewMat, int nFirstVertId, int nVertCount, int nFirstIndexId, int nIndexCount, float texelAreaDensity, const AZ::Vertex::Format& vertexFormat, int nMatID = 0) = 0; - - // Assign array of render chunks. - // Initializes render element for each render chunk. - virtual void SetRenderChunks(CRenderChunk* pChunksArray, int nCount, bool bSubObjectChunks) = 0; virtual void GenerateQTangents() = 0; virtual void CreateChunksSkinned() = 0; virtual void NextDrawSkinned() = 0; virtual IRenderMesh* GetVertexContainer() = 0; virtual void SetVertexContainer(IRenderMesh* pBuf) = 0; - virtual TRenderChunkArray& GetChunks() = 0; - virtual TRenderChunkArray& GetChunksSkinned() = 0; - virtual TRenderChunkArray& GetChunksSubObjects() = 0; virtual void SetBBox(const Vec3& vBoxMin, const Vec3& vBoxMax) = 0; virtual void GetBBox(Vec3& vBoxMin, Vec3& vBoxMax) = 0; virtual void UpdateBBoxFromMesh() = 0; virtual uint32* GetPhysVertexMap() = 0; virtual bool IsEmpty() = 0; - virtual byte* GetPosPtrNoCache(int32& nStride, uint32 nFlags) = 0; - virtual byte* GetPosPtr(int32& nStride, uint32 nFlags) = 0; - virtual byte* GetColorPtr(int32& nStride, uint32 nFlags) = 0; - virtual byte* GetNormPtr(int32& nStride, uint32 nFlags) = 0; + virtual int8* GetPosPtrNoCache(int32& nStride, uint32 nFlags) = 0; + virtual int8* GetPosPtr(int32& nStride, uint32 nFlags) = 0; + virtual int8* GetColorPtr(int32& nStride, uint32 nFlags) = 0; + virtual int8* GetNormPtr(int32& nStride, uint32 nFlags) = 0; //! Returns a pointer to the first uv coordinate in the interleaved vertex stream - virtual byte* GetUVPtrNoCache(int32& nStride, uint32 nFlags, uint32 uvSetIndex = 0) = 0; + virtual int8* GetUVPtrNoCache(int32& nStride, uint32 nFlags, uint32 uvSetIndex = 0) = 0; /*! Get a pointer to the mesh's uv coordinates and the stride from the beginning of one uv coordinate to the next \param[out] nStride The stride in between successive uv coordinates. \param nFlags Stream lock flags (FSL_READ, FSL_WRITE, etc) @@ -242,13 +228,13 @@ struct IRenderMesh Either way, nStride is set such that the caller can use it to iterate over the data in the same way regardless of which pointer was returned Returns nullptr if there is no uv coordinate stream at the given index */ - virtual byte* GetUVPtr(int32& nStride, uint32 nFlags, uint32 uvSetIndex = 0) = 0; + virtual int8* GetUVPtr(int32& nStride, uint32 nFlags, uint32 uvSetIndex = 0) = 0; - virtual byte* GetTangentPtr(int32& nStride, uint32 nFlags) = 0; - virtual byte* GetQTangentPtr(int32& nStride, uint32 nFlags) = 0; + virtual int8* GetTangentPtr(int32& nStride, uint32 nFlags) = 0; + virtual int8* GetQTangentPtr(int32& nStride, uint32 nFlags) = 0; - virtual byte* GetHWSkinPtr(int32& nStride, uint32 nFlags, bool remapped = false) = 0; - virtual byte* GetVelocityPtr(int32& nStride, uint32 nFlags) = 0; + virtual int8* GetHWSkinPtr(int32& nStride, uint32 nFlags, bool remapped = false) = 0; + virtual int8* GetVelocityPtr(int32& nStride, uint32 nFlags) = 0; virtual void UnlockStream(int nStream) = 0; virtual void UnlockIndexStream() = 0; @@ -261,8 +247,6 @@ struct IRenderMesh virtual void Render(const struct SRendParams& rParams, CRenderObject* pObj, _smart_ptr pMaterial, const SRenderingPassInfo& passInfo, bool bSkinned = false) = 0; virtual void Render(CRenderObject* pObj, const SRenderingPassInfo& passInfo, const SRendItemSorter& rendItemSorter) = 0; - virtual void AddRenderElements(_smart_ptr pIMatInfo, CRenderObject* pObj, const SRenderingPassInfo& passInfo, int nSortId = EFSLIST_GENERAL, int nAW = 1) = 0; - virtual void AddRE(_smart_ptr pMaterial, CRenderObject* pObj, IShader* pEf, const SRenderingPassInfo& passInfo, int nList, int nAW, const SRendItemSorter& rendItemSorter) = 0; virtual void SetREUserData(float* pfCustomData, float fFogScale = 0, float fAlpha = 1) = 0; // Debug draw this render mesh. @@ -295,15 +279,4 @@ struct IRenderMesh // }; -struct SBufferStream -{ - void* m_pLocalData; // pointer to buffer data - uintptr_t m_BufferHdl; - SBufferStream() - { - m_pLocalData = NULL; - m_BufferHdl = ~0u; - } -}; - #endif // CRYINCLUDE_CRYCOMMON_IRENDERMESH_H diff --git a/Code/Legacy/CryCommon/IRenderer.h b/Code/Legacy/CryCommon/IRenderer.h index 254f1933de..ab185b3bbc 100644 --- a/Code/Legacy/CryCommon/IRenderer.h +++ b/Code/Legacy/CryCommon/IRenderer.h @@ -9,481 +9,13 @@ #pragma once -#include "Cry_Geo.h" #include "Cry_Camera.h" -#include "ITexture.h" -#include "Cry_Vector2.h" -#include "Cry_Vector3.h" -#include "Cry_Matrix33.h" -#include "Cry_Color.h" -#include "smartptr.h" -#include // <> required for Interfuscator -#include "smartptr.h" +#include "VertexFormats.h" + #include #include -// forward declarations -struct SRenderingPassInfo; -struct SRTStack; -struct SFogVolumeData; -// Callback used for DXTCompress -typedef void (* MIPDXTcallback)(const void* buffer, size_t count, void* userData); - -typedef void (* GpuCallbackFunc)(DWORD context); - -// Callback for shadercache miss -typedef void (* ShaderCacheMissCallback)(const char* acShaderRequest); - -struct ICaptureFrameListener -{ - virtual ~ICaptureFrameListener (){} - virtual bool OnNeedFrameData(unsigned char*& pConvertedTextureBuf) = 0; - virtual void OnFrameCaptured(void) = 0; - virtual int OnGetFrameWidth(void) = 0; - virtual int OnGetFrameHeight(void) = 0; - virtual int OnCaptureFrameBegin(int* pTexHandle) = 0; - - enum ECaptureFrameFlags - { - eCFF_NoCaptureThisFrame = (0 << 1), - eCFF_CaptureThisFrame = (1 << 1), - }; -}; - -// Forward declarations. -////////////////////////////////////////////////////////////////////// -typedef void* WIN_HWND; -typedef void* WIN_HINSTANCE; -typedef void* WIN_HDC; -typedef void* WIN_HGLRC; - -class CREMesh; -class CMesh; -//class CImage; -struct CStatObj; -class CVegetation; -struct ShadowMapFrustum; -struct IStatObj; -class CObjManager; -struct SPrimitiveGroup; -class CRendElementBase; -class CRenderObject; -class CTexMan; -//class ColorF; -class CShadowVolEdge; -class CCamera; -class CDLight; -struct SDeferredLightVolume; -struct ILog; -struct IConsole; -struct ICVar; -struct ITimer; -struct ISystem; -class IGPUParticleEngine; -class ICrySizer; -struct IRenderAuxGeom; -struct SREPointSpriteCreateParams; -struct SPointSpriteVertex; -struct RenderLMData; -struct SShaderParam; -struct SSkyLightRenderParams; -struct SParticleRenderInfo; -struct SParticleAddJobCompare; -struct IColorGradingController; -class IStereoRenderer; -struct IFFont; -struct IFFont_RenderProxy; -struct STextDrawContext; -struct IRenderMesh; -struct ShadowFrustumMGPUCache; -struct IAsyncTextureCompileListener; -struct IClipVolume; -struct SClipVolumeBlendInfo; -class CRenderView; -struct SDynTexture2; -class CTexture; -enum ETexPool : int; - -////////////////////////////////////////////////////////////////////// -typedef unsigned char bvec4[4]; -typedef float vec4_t[4]; -typedef unsigned char byte; -typedef float vec2_t[2]; - -//DOC-IGNORE-BEGIN -#include "Cry_Color.h" -#include "Tarray.h" - -#include -//DOC-IGNORE-END - -#define MAX_NUM_VIEWPORTS 7 - -// Query types for CryInd editor (used in EF_Query() function). -enum ERenderQueryTypes -{ - EFQ_DeleteMemoryArrayPtr = 1, - EFQ_DeleteMemoryPtr, - EFQ_GetShaderCombinations, - EFQ_SetShaderCombinations, - EFQ_CloseShaderCombinations, - - EFQ_MainThreadList, - EFQ_RenderThreadList, - EFQ_RenderMultithreaded, - - EFQ_RecurseLevel, - EFQ_IncrementFrameID, - EFQ_DeviceLost, - EFQ_LightSource, - - EFQ_Alloc_APITextures, - EFQ_Alloc_APIMesh, - - // Memory allocated by meshes in system memory. - EFQ_Alloc_Mesh_SysMem, - EFQ_Mesh_Count, - - EFQ_HDRModeEnabled, - EFQ_ParticlesTessellation, - EFQ_WaterTessellation, - EFQ_MeshTessellation, - EFQ_GetShadowPoolFrustumsNum, - EFQ_GetShadowPoolAllocThisFrameNum, - EFQ_GetShadowMaskChannelsNum, - EFQ_GetTiledShadingSkippedLightsNum, - - // Description: - // Query will return all textures in the renderer, - // pass pointer to an SRendererQueryGetAllTexturesParam instance - EFQ_GetAllTextures, - - // Description: - // Release resources allocated by GetAllTextures query - // pass pointer to an SRendererQueryGetAllTexturesParam instance, populated by EFQ_GetAllTextures - EFQ_GetAllTexturesRelease, - - // Description: - // Query will return all IRenderMesh objects in the renderer, - // Pass an array pointer to be allocated and filled with the IRendermesh pointers. The calling function is responsible for freeing this memory. - // This was originally a two pass process, but proved to be non-thread-safe, leading to buffer overruns and underruns. - EFQ_GetAllMeshes, - - // Summary: - // Multigpu (crossfire/sli) is enabled. - EFQ_MultiGPUEnabled, - EFQ_SetDrawNearFov, - EFQ_GetDrawNearFov, - EFQ_TextureStreamingEnabled, - EFQ_MSAAEnabled, - EFQ_AAMode, - - EFQ_Fullscreen, - EFQ_GetTexStreamingInfo, - EFQ_GetMeshPoolInfo, - - // Description: - // True when shading is done in linear space, de-gamma on texture lookup, gamma on frame buffer writing (sRGB), false otherwise. - EFQ_sLinearSpaceShadingEnabled, - - // The percentages of overscan borders for left/right and top/bottom to adjust the title safe area. - EFQ_OverscanBorders, - - // Get num active post effects - EFQ_NumActivePostEffects, - - // Get size of textures memory pool - EFQ_TexturesPoolSize, - EFQ_RenderTargetPoolSize, - - EFQ_GetShaderCacheInfo, - - EFQ_GetFogCullDistance, - EFQ_GetMaxRenderObjectsNum, - - EFQ_IsRenderLoadingThreadActive, - - EFQ_GetSkinningDataPoolSize, - - EFQ_GetViewportDownscaleFactor, - EFQ_ReverseDepthEnabled, - - EFQ_GetLastD3DDebugMessage -}; - -struct ID3DDebugMessage -{ -public: - virtual void Release() = 0; - virtual const char* GetMessage() const = 0; - -protected: - ID3DDebugMessage() {} - virtual ~ID3DDebugMessage() {} -}; - -enum EScreenAspectRatio -{ - eAspect_Unknown, - eAspect_4_3, - eAspect_16_9, - eAspect_16_10, -}; - -class SBoundingVolume -{ -public: - SBoundingVolume() - : m_vCenter(0, 0, 0) - , m_fRadius(0) {} - ~SBoundingVolume() {} - - void SetCenter(const Vec3& center) { m_vCenter = center; } - void SetRadius(float radius) { m_fRadius = radius; } - const Vec3& GetCenter() const { return m_vCenter; } - float GetRadius() const { return m_fRadius; } - -protected: - Vec3 m_vCenter; - float m_fRadius; -}; - -class SMinMaxBox - : public SBoundingVolume -{ -public: - SMinMaxBox() - { - Clear(); - } - SMinMaxBox(const Vec3& min, const Vec3& max) : - m_min(min), - m_max(max) - { - UpdateSphere(); - } - - // Summary: - // Destructor - virtual ~SMinMaxBox() {} - - void AddPoint(const Vec3& pt) - { - if (pt.x > m_max.x) - { - m_max.x = pt.x; - } - if (pt.x < m_min.x) - { - m_min.x = pt.x; - } - - if (pt.y > m_max.y) - { - m_max.y = pt.y; - } - if (pt.y < m_min.y) - { - m_min.y = pt.y; - } - - if (pt.z > m_max.z) - { - m_max.z = pt.z; - } - if (pt.z < m_min.z) - { - m_min.z = pt.z; - } - - // Summary: - // Updates the center and radius. - UpdateSphere(); - } - void AddPoint(float x, float y, float z) - { - AddPoint(Vec3(x, y, z)); - } - - void Union(const SMinMaxBox& box) { AddPoint(box.GetMin()); AddPoint(box.GetMax()); } - - const Vec3& GetMin() const { return m_min; } - const Vec3& GetMax() const { return m_max; } - - void SetMin(const Vec3& min) { m_min = min; UpdateSphere(); } - void SetMax(const Vec3& max) { m_max = max; UpdateSphere(); } - - float GetWidthInX() const { return m_max.x - m_min.x; } - float GetWidthInY() const { return m_max.y - m_min.y; } - float GetWidthInZ() const { return m_max.z - m_min.z; } - - bool PointInBBox(const Vec3& pt) const; - - bool ViewFrustumCull(const CameraViewParameters& viewParameters, const Matrix44& mat); - - void Transform(const Matrix34& mat) - { - Vec3 verts[8]; - CalcVerts(verts); - Clear(); - for (int i = 0; i < 8; i++) - { - AddPoint(mat.TransformPoint(verts[i])); - } - } - - // Summary: - // Resets the bounding box. - void Clear() - { - m_min = Vec3(999999.0f, 999999.0f, 999999.0f); - m_max = Vec3(-999999.0f, -999999.0f, -999999.0f); - } - -protected: - void UpdateSphere() - { - m_vCenter = m_min; - m_vCenter += m_max; - m_vCenter *= 0.5f; - - Vec3 rad = m_max; - rad -= m_vCenter; - m_fRadius = rad.len(); - } - void CalcVerts(Vec3 pVerts[8]) const - { - pVerts[0].Set(m_max.x, m_max.y, m_max.z); - pVerts[4].Set(m_max.x, m_max.y, m_min.z); - pVerts[1].Set(m_min.x, m_max.y, m_max.z); - pVerts[5].Set(m_min.x, m_max.y, m_min.z); - pVerts[2].Set(m_min.x, m_min.y, m_max.z); - pVerts[6].Set(m_min.x, m_min.y, m_min.z); - pVerts[3].Set(m_max.x, m_min.y, m_max.z); - pVerts[7].Set(m_max.x, m_min.y, m_min.z); - } - -private: - Vec3 m_min; // Original object space BV. - Vec3 m_max; -}; - - - -////////////////////////////////////////////////////////////////////// -// All possible primitive types - -enum PublicRenderPrimitiveType -{ - prtTriangleList, - prtTriangleStrip, - prtLineList, - prtLineStrip -}; - -////////////////////////////////////////////////////////////////////// -#define R_CULL_DISABLE 0 -#define R_CULL_NONE 0 -#define R_CULL_FRONT 1 -#define R_CULL_BACK 2 - -////////////////////////////////////////////////////////////////////// -#define R_DEFAULT_LODBIAS 0 - -////////////////////////////////////////////////////////////////////// -#define R_SOLID_MODE 0 -#define R_WIREFRAME_MODE 1 - -#define R_DX9_RENDERER 2 -#define R_DX11_RENDERER 3 -#define R_NULL_RENDERER 4 -#define R_CUBAGL_RENDERER 5 -#define R_GL_RENDERER 6 -#define R_METAL_RENDERER 7 -#define R_DX12_RENDERER 8 - -////////////////////////////////////////////////////////////////////// -// Render features - -#define RFT_FREE_0x1 0x1 -#define RFT_ALLOW_RECTTEX 0x2 -#define RFT_OCCLUSIONQUERY 0x4 -#define RFT_FREE_0x8 0x8 -#define RFT_HWGAMMA 0x10 -#define RFT_FREE_0x20 0x20 -#define RFT_COMPRESSTEXTURE 0x40 -#define RFT_FREE_0x80 0x80 -#define RFT_ALLOWANISOTROPIC 0x100 // Allows anisotropic texture filtering. -#define RFT_SUPPORTZBIAS 0x200 -#define RFT_FREE_0x400 0x400 -#define RFT_FREE_0x800 0x800 -#define RFT_FREE_0x1000 0x1000 -#define RFT_FREE_0x2000 0x2000 -#define RFT_OCCLUSIONTEST 0x8000 // Support hardware occlusion test. - -#define RFT_HW_ARM_MALI 0x04000 // Unclassified ARM (MALI) hardware. -#define RFT_HW_INTEL 0x10000 // Unclassified intel hardware. -#define RFT_HW_QUALCOMM 0x10000 // Unclassified Qualcomm hardware -#define RFT_HW_ATI 0x20000 // Unclassified ATI hardware. -#define RFT_HW_NVIDIA 0x40000 // Unclassified NVidia hardware. -#define RFT_HW_MASK 0x74000 // Graphics chip mask. - -#define RFT_HW_HDR 0x80000 // Hardware supports high dynamic range rendering. - -#define RFT_HW_SM20 0x100000 // Shader model 2.0 -#define RFT_HW_SM2X 0x200000 // Shader model 2.X -#define RFT_HW_SM30 0x400000 // Shader model 3.0 -#define RFT_HW_SM40 0x800000 // Shader model 4.0 -#define RFT_HW_SM50 0x1000000 // Shader model 5.0 - -#define RFT_FREE_0x2000000 0x2000000 -#define RFT_FREE_0x4000000 0x4000000 -#define RFT_FREE_0x8000000 0x8000000 - -#define RFT_HW_VERTEX_STRUCTUREDBUF 0x10000000 // Supports Structured Buffers in the Vertex Shader. -#define RFT_RGBA 0x20000000 // RGBA order (otherwise BGRA). -#define RFT_COMPUTE_SHADERS 0x40000000 // Compute Shaders support -#define RFT_HW_VERTEXTEXTURES 0x80000000 // Vertex texture fetching supported. - -//==================================================================== -// PrecacheResources flags - -#define FPR_NEEDLIGHT 1 -#define FPR_2D 2 -#define FPR_HIGHPRIORITY 4 -#define FPR_SYNCRONOUS 8 -#define FPR_STARTLOADING 16 -#define FPR_SINGLE_FRAME_PRIORITY_UPDATE 32 - -//===================================================================== -// SetRenderTarget flags -#define SRF_SCREENTARGET 1 -#define SRF_USE_ORIG_DEPTHBUF 2 -#define SRF_USE_ORIG_DEPTHBUF_MSAA 4 - -//==================================================================== -// Draw shaders flags (EF_EndEf3d) - -#define SHDF_ALLOWHDR BIT(0) -#define SHDF_CUBEMAPGEN BIT(1) -#define SHDF_ZPASS BIT(2) -#define SHDF_ZPASS_ONLY BIT(3) -#define SHDF_DO_NOT_CLEAR_Z_BUFFER BIT(4) -#define SHDF_ALLOWPOSTPROCESS BIT(5) -#define SHDF_ALLOW_AO BIT(8) -#define SHDF_ALLOW_WATER BIT(9) -#define SHDF_NOASYNC BIT(10) -#define SHDF_NO_DRAWNEAR BIT(11) -#define SHDF_STREAM_SYNC BIT(13) -#define SHDF_NO_SHADOWGEN BIT(15) - -////////////////////////////////////////////////////////////////////// -// Virtual screen size -const float VIRTUAL_SCREEN_WIDTH = 800.0f; -const float VIRTUAL_SCREEN_HEIGHT = 600.0f; - -////////////////////////////////////////////////////////////////////// -// Object states + // Object states #define OS_ALPHA_BLEND 0x1 #define OS_ADD_BLEND 0x2 #define OS_MULTIPLY_BLEND 0x4 @@ -520,7 +52,6 @@ const float VIRTUAL_SCREEN_HEIGHT = 600.0f; #define GS_BLDST_ONE_A_ZERO 0x90 // separate alpha blend state #define GS_BLDST_ONEMINUSSRC1ALPHA 0xa0 // dual source blending - #define GS_DEPTHWRITE 0x00000100 #define GS_COLMASK_RT1 0x00000200 @@ -555,8 +86,8 @@ const float VIRTUAL_SCREEN_HEIGHT = 600.0f; #define GS_STENCIL 0x00800000 #define GS_BLEND_OP_MASK 0x03000000 -#define GS_BLOP_MAX 0x01000000 -#define GS_BLOP_MIN 0x02000000 +#define GS_BLOP_MAX 0x01000000 +#define GS_BLOP_MIN 0x02000000 // Separate alpha blend mode #define GS_BLALPHA_MASK 0x0c000000 @@ -568,181 +99,28 @@ const float VIRTUAL_SCREEN_HEIGHT = 600.0f; #define GS_ALPHATEST_LESS 0x20000000 #define GS_ALPHATEST_GEQUAL 0x40000000 #define GS_ALPHATEST_LEQUAL 0x80000000 +////////////////////////////////////////////////////////////////////// +#define R_SOLID_MODE 0 +#define R_WIREFRAME_MODE 1 -#define FORMAT_8_BIT 8 -#define FORMAT_24_BIT 24 -#define FORMAT_32_BIT 32 +#define MAX_NUM_VIEWPORTS 7 -//================================================================== -// StencilStates -//Note: If these are altered, g_StencilFuncLookup and g_StencilOpLookup arrays -// need to be updated in turn - -#define FSS_STENCFUNC_ALWAYS 0x0 -#define FSS_STENCFUNC_NEVER 0x1 -#define FSS_STENCFUNC_LESS 0x2 -#define FSS_STENCFUNC_LEQUAL 0x3 -#define FSS_STENCFUNC_GREATER 0x4 -#define FSS_STENCFUNC_GEQUAL 0x5 -#define FSS_STENCFUNC_EQUAL 0x6 -#define FSS_STENCFUNC_NOTEQUAL 0x7 -#define FSS_STENCFUNC_MASK 0x7 - -#define FSS_STENCIL_TWOSIDED 0x8 - -#define FSS_CCW_SHIFT 16 - -#define FSS_STENCOP_KEEP 0x0 -#define FSS_STENCOP_REPLACE 0x1 -#define FSS_STENCOP_INCR 0x2 -#define FSS_STENCOP_DECR 0x3 -#define FSS_STENCOP_ZERO 0x4 -#define FSS_STENCOP_INCR_WRAP 0x5 -#define FSS_STENCOP_DECR_WRAP 0x6 -#define FSS_STENCOP_INVERT 0x7 - -#define FSS_STENCFAIL_SHIFT 4 -#define FSS_STENCFAIL_MASK (0x7 << FSS_STENCFAIL_SHIFT) - -#define FSS_STENCZFAIL_SHIFT 8 -#define FSS_STENCZFAIL_MASK (0x7 << FSS_STENCZFAIL_SHIFT) - -#define FSS_STENCPASS_SHIFT 12 -#define FSS_STENCPASS_MASK (0x7 << FSS_STENCPASS_SHIFT) - -#define STENC_FUNC(op) (op) -#define STENC_CCW_FUNC(op) (op << FSS_CCW_SHIFT) -#define STENCOP_FAIL(op) (op << FSS_STENCFAIL_SHIFT) -#define STENCOP_ZFAIL(op) (op << FSS_STENCZFAIL_SHIFT) -#define STENCOP_PASS(op) (op << FSS_STENCPASS_SHIFT) -#define STENCOP_CCW_FAIL(op) (op << (FSS_STENCFAIL_SHIFT + FSS_CCW_SHIFT)) -#define STENCOP_CCW_ZFAIL(op) (op << (FSS_STENCZFAIL_SHIFT + FSS_CCW_SHIFT)) -#define STENCOP_CCW_PASS(op) (op << (FSS_STENCPASS_SHIFT + FSS_CCW_SHIFT)) - -//Stencil masks -#define BIT_STENCIL_RESERVED 0x80 -#define BIT_STENCIL_INSIDE_CLIPVOLUME 0x40 -#define STENC_VALID_BITS_NUM 7 -#define STENC_MAX_REF ((1 << STENC_VALID_BITS_NUM) - 1) - -// Read FrameBuffer type -enum ERB_Type -{ - eRB_BackBuffer, - eRB_FrontBuffer, - eRB_ShadowBuffer -}; - -enum EVertexCostTypes -{ - EVCT_STATIC = 0, - EVCT_VEGETATION, - EVCT_SKINNED, - EVCT_NUM -}; +constexpr float UIDRAW_TEXTSIZEFACTOR = 12.0f; +constexpr float MIN_RESOLUTION_SCALE = 0.25f; +constexpr float MAX_RESOLUTION_SCALE = 4.0f; ////////////////////////////////////////////////////////////////////// +// All possible primitive types -struct SDispFormat +enum class PublicRenderPrimitiveType { - int m_Width; - int m_Height; - int m_BPP; + prtTriangleList, + prtTriangleStrip, + prtLineList, + prtLineStrip }; -struct SAAFormat -{ - char szDescr[64]; - int nSamples; - int nQuality; -}; - -// Summary: -// Info about Terrain sector texturing. -struct SSectorTextureSet -{ - SSectorTextureSet(unsigned short nT0) - { - nTex0 = nT0; - fTexOffsetX = fTexOffsetY = 0; - fTexScale = 1.f; - } - - unsigned short nTex0; - float fTexOffsetX, fTexOffsetY, fTexScale; -}; - -struct IRenderNode; -struct SShaderItem; - -#ifdef SUPPORT_HW_MOUSE_CURSOR -class IHWMouseCursor -{ -public: - virtual ~IHWMouseCursor() {} - virtual void SetPosition(int x, int y) = 0; - virtual void Show() = 0; - virtual void Hide() = 0; -}; -#endif - -////////////////////////////////////////////////////////////////////// -//DOC-IGNORE-BEGIN -#include // <> required for Interfuscator -//DOC-IGNORE-END -#include - -// Flags passed in function FreeResources. -#define FRR_SHADERS 1 -#define FRR_SHADERTEXTURES 2 -#define FRR_TEXTURES 4 -#define FRR_SYSTEM 8 -#define FRR_RESTORE 0x10 -#define FRR_REINITHW 0x20 -#define FRR_DELETED_MESHES 0x40 -#define FRR_FLUSH_TEXTURESTREAMING 0x80 -#define FRR_OBJECTS 0x100 -#define FRR_RENDERELEMENTS 0x200 -#define FRR_RP_BUFFERS 0x400 -#define FRR_SYSTEM_RESOURCES 0x800 -#define FRR_POST_EFFECTS 0x1000 -#define FRR_ALL -1 - -// Refresh render resources flags. -// Flags passed in function RefreshResources. -#define FRO_SHADERS 1 -#define FRO_SHADERTEXTURES 2 -#define FRO_TEXTURES 4 -#define FRO_GEOMETRY 8 -#define FRO_FORCERELOAD 0x10 - -//============================================================================= -// Shaders render target stuff. - -#define FRT_CLEAR_DEPTH 0x1 -#define FRT_CLEAR_STENCIL 0x2 -#define FRT_CLEAR_COLOR 0x4 -#define FRT_CLEAR (FRT_CLEAR_COLOR | FRT_CLEAR_DEPTH | FRT_CLEAR_STENCIL) -#define FRT_CLEAR_FOGCOLOR 0x8 -#define FRT_CLEAR_IMMEDIATE 0x10 -#define FRT_CLEAR_COLORMASK 0x20 -#define FRT_CLEAR_RESET_VIEWPORT 0x40 - -#define FRT_CAMERA_REFLECTED_WATERPLANE 0x40 -#define FRT_CAMERA_REFLECTED_PLANE 0x80 -#define FRT_CAMERA_CURRENT 0x100 - -#define FRT_USE_FRONTCLIPPLANE 0x200 -#define FRT_USE_BACKCLIPPLANE 0x400 - -#define FRT_GENERATE_MIPS 0x800 - -#define FRT_RENDTYPE_CUROBJECT 0x1000 -#define FRT_RENDTYPE_CURSCENE 0x2000 -#define FRT_RENDTYPE_RECURSIVECURSCENE 0x4000 -#define FRT_RENDTYPE_COPYSCENE 0x8000 - // Summary: // Flags used in DrawText function. // See also: @@ -751,48 +129,26 @@ public: // Text must be fixed pixel size. enum EDrawTextFlags { - eDrawText_Left = 0, // default left alignment if neither Center or Right are specified - eDrawText_Center = BIT(0), // centered alignment, otherwise right or left - eDrawText_Right = BIT(1), // right alignment, otherwise center or left - eDrawText_CenterV = BIT(2), // center vertically, otherwise top - eDrawText_Bottom = BIT(3), // bottom alignment + eDrawText_Left = 0, // default left alignment if neither Center or Right are specified + eDrawText_Center = BIT(0), // centered alignment, otherwise right or left + eDrawText_Right = BIT(1), // right alignment, otherwise center or left + eDrawText_CenterV = BIT(2), // center vertically, otherwise top + eDrawText_Bottom = BIT(3), // bottom alignment - eDrawText_2D = BIT(4), // 3 component vector is used for xy screen position, otherwise it's 3d world space position + eDrawText_2D = BIT(4), // 3 component vector is used for xy screen position, otherwise it's 3d world space position - eDrawText_FixedSize = BIT(5), // font size is defined in the actual pixel resolution, otherwise it's in the virtual 800x600 - eDrawText_800x600 = BIT(6), // position are specified in the virtual 800x600 resolution, otherwise coordinates are in pixels + eDrawText_FixedSize = BIT(5), // font size is defined in the actual pixel resolution, otherwise it's in the virtual 800x600 + eDrawText_800x600 = BIT(6), // position are specified in the virtual 800x600 resolution, otherwise coordinates are in pixels - eDrawText_Monospace = BIT(7), // non proportional font rendering (Font width is same for all characters) + eDrawText_Monospace = BIT(7), // non proportional font rendering (Font width is same for all characters) - eDrawText_Framed = BIT(8), // draw a transparent, rectangular frame behind the text to ease readability independent from the background + eDrawText_Framed = BIT(8), // draw a transparent, rectangular frame behind the text to ease readability independent from the background - eDrawText_DepthTest = BIT(9), // text should be occluded by world geometry using the depth buffer + eDrawText_DepthTest = BIT(9), // text should be occluded by world geometry using the depth buffer eDrawText_IgnoreOverscan = BIT(10), // ignore the overscan borders, text should be drawn at the location specified - eDrawText_UseTransform = BIT(11), // use a transform for the text + eDrawText_UseTransform = BIT(11), // use a transform for the text }; -// Debug stats/views for Partial resolves -// if REFRACTION_PARTIAL_RESOLVE_DEBUG_VIEWS is enabled, make sure REFRACTION_PARTIAL_RESOLVE_STATS is too -#if defined(PERFORMANCE_BUILD) - #define REFRACTION_PARTIAL_RESOLVE_STATS 1 - #define REFRACTION_PARTIAL_RESOLVE_DEBUG_VIEWS 0 -#elif defined(_RELEASE) // note: _RELEASE is defined in PERFORMANCE_BUILD, so this check must come second - #define REFRACTION_PARTIAL_RESOLVE_STATS 0 - #define REFRACTION_PARTIAL_RESOLVE_DEBUG_VIEWS 0 -#else - #define REFRACTION_PARTIAL_RESOLVE_STATS 1 - #define REFRACTION_PARTIAL_RESOLVE_DEBUG_VIEWS 1 -#endif - -#if REFRACTION_PARTIAL_RESOLVE_DEBUG_VIEWS -enum ERefractionPartialResolvesDebugViews -{ - eRPR_DEBUG_VIEW_2D_AREA = 1, - eRPR_DEBUG_VIEW_3D_BOUNDS, - eRPR_DEBUG_VIEW_2D_AREA_OVERLAY -}; -#endif - ////////////////////////////////////////////////////////////////////////// // Description: // This structure used in DrawText method of renderer. @@ -821,25 +177,6 @@ struct SDrawTextInfo } }; -#define UIDRAW_TEXTSIZEFACTOR (12.0f) -#define MIN_RESOLUTION_SCALE (0.25f) -#define MAX_RESOLUTION_SCALE (4.0f) - -#if defined(AZ_RESTRICTED_PLATFORM) - #include AZ_RESTRICTED_FILE(IRenderer_h) -#else -//SLI/CROSSFIRE GPU maximum count - #define MAX_GPU_NUM 4 -#endif - -#define MAX_FRAME_ID_STEP_PER_FRAME 20 -const int MAX_GSM_LODS_NUM = 16; - -const f32 DRAW_NEAREST_MIN = 0.03f; -const f32 DRAW_NEAREST_MAX = 40.0f; - -//=================================================================== - ////////////////////////////////////////////////////////////////////// struct IRenderDebugListener { @@ -848,1609 +185,23 @@ struct IRenderDebugListener virtual void OnDebugDraw() = 0; }; -////////////////////////////////////////////////////////////////////// -struct ILoadtimeCallback +struct DynUiPrimitive : public AZStd::intrusive_slist_node { - virtual void LoadtimeUpdate(float fDeltaTime) = 0; - virtual void LoadtimeRender() = 0; - virtual ~ILoadtimeCallback(){} -}; - -////////////////////////////////////////////////////////////////////// -struct ISyncMainWithRenderListener -{ - virtual void SyncMainWithRender() = 0; - virtual ~ISyncMainWithRenderListener(){} -}; - -////////////////////////////////////////////////////////////////////// -enum ERenderType -{ - eRT_Undefined, - eRT_Null, - eRT_DX11, - eRT_DX12, - eRT_Provo, - eRT_OpenGL, - eRT_Metal, - eRT_Jasper, -}; - -////////////////////////////////////////////////////////////////////// -// Enum for types of deferred lights -enum eDeferredLightType -{ - eDLT_DeferredLight = 0, - - eDLT_NumShadowCastingLights = eDLT_DeferredLight + 1, - // these lights cannot cast shadows - eDLT_DeferredCubemap = eDLT_NumShadowCastingLights, - eDLT_DeferredAmbientLight, - eDLT_NumLightTypes, -}; - -const float RENDERER_LIGHT_UNIT_SCALE = 10000.0f; // Scale factor between photometric and internal light units - -////////////////////////////////////////////////////////////////////// -struct SCustomRenderInitArgs -{ - bool appStartedFromMediaCenter; -}; - -#if defined(ANDROID) -enum -{ - CULL_SIZEX = 128 -}; -enum -{ - CULL_SIZEY = 64 -}; -#else -enum -{ - CULL_SIZEX = 256 -}; -enum -{ - CULL_SIZEY = 128 -}; -#endif - -////////////////////////////////////////////////////////////////////// -// Description: -// Z-buffer as occlusion buffer definitions: used, shared and initialized in engine and renderer. -struct SHWOccZBuffer -{ - uint32* pHardwareZBuffer; - uint32* pZBufferVMem; - uint32 ZBufferSizeX; - uint32 ZBufferSizeY; - uint32 HardwareZBufferRSXOff; - uint32 ZBufferVMemRSXOff; - uint32 pad[2]; // Keep 32 byte aligned - SHWOccZBuffer() - : pHardwareZBuffer(NULL) - , pZBufferVMem(NULL) - , ZBufferSizeX(CULL_SIZEX) - , ZBufferSizeY(CULL_SIZEY) - , ZBufferVMemRSXOff(0) - , HardwareZBufferRSXOff(0){} -}; - -class ITextureStreamListener -{ -public: - virtual void OnCreatedStreamedTexture(void* pHandle, const char* name, int nMips, int nMinMipAvailable) = 0; - virtual void OnDestroyedStreamedTexture(void* pHandle) = 0; - virtual void OnTextureWantsMip(void* pHandle, int nMinMip) = 0; - virtual void OnTextureHasMip(void* pHandle, int nMinMip) = 0; - virtual void OnBegunUsingTextures(void** pHandles, size_t numHandles) = 0; - virtual void OnEndedUsingTextures(void** pHandle, size_t numHandles) = 0; - -protected: - virtual ~ITextureStreamListener() {} -}; - -enum eDolbyVisionMode -{ - eDVM_Disabled, - eDVM_RGBPQ, - eDVM_Vision, -}; - -enum ERenderPipelineProfilerStats -{ - eRPPSTATS_OverallFrame = 0, - eRPPSTATS_Recursion, - - // Scene - eRPPSTATS_SceneOverall, - eRPPSTATS_SceneDecals, - eRPPSTATS_SceneForward, - eRPPSTATS_SceneWater, - - // Shadows - eRPPSTATS_ShadowsOverall, - eRPPSTATS_ShadowsSun, - eRPPSTATS_ShadowsSunCustom, - eRPPSTATS_ShadowsLocal, - - // Lighting - eRPPSTATS_LightingOverall, - eRPPSTATS_LightingGI, - - // VFX - eRPPSTATS_VfxOverall, - eRPPSTATS_VfxTransparent, - eRPPSTATS_VfxFog, - eRPPSTATS_VfxFlares, - - // Individual Total Illumination stats - eRPPSTATS_TI_INJECT_CLEAR, - eRPPSTATS_TI_VOXELIZE, - eRPPSTATS_TI_INJECT_AIR, - eRPPSTATS_TI_INJECT_LIGHT, - eRPPSTATS_TI_INJECT_REFL0, - eRPPSTATS_TI_INJECT_REFL1, - eRPPSTATS_TI_INJECT_DYNL, - eRPPSTATS_TI_NID_DIFF, - eRPPSTATS_TI_GEN_DIFF, - eRPPSTATS_TI_GEN_SPEC, - eRPPSTATS_TI_GEN_AIR, - eRPPSTATS_TI_DEMOSAIC_DIFF, - eRPPSTATS_TI_DEMOSAIC_SPEC, - eRPPSTATS_TI_UPSCALE_DIFF, - eRPPSTATS_TI_UPSCALE_SPEC, - - RPPSTATS_NUM -}; - -struct RPProfilerStats -{ - float gpuTime; - float gpuTimeSmoothed; - float gpuTimeMax; - float cpuTime; - uint32 numDIPs; - uint32 numPolys; - - // Internal - float _gpuTimeMaxNew; -}; - -struct TransformationMatrices -{ - Matrix44A m_viewMatrix; - Matrix44A m_projectMatrix; -}; - -struct ISvoRenderer -{ - virtual bool IsShaderItemUsedForVoxelization([[maybe_unused]] SShaderItem& rShaderItem, [[maybe_unused]] IRenderNode* pRN){ return false; } - virtual void Release(){} -}; - -////////////////////////////////////////////////////////////////////// -struct SRenderPipeline; -struct SRenderThread; -struct SShaderTechnique; -struct SShaderPass; -struct SDepthTexture; -struct SRenderTileInfo; - -class CShaderMan; -class CDeviceBufferManager; -class CShaderResources; -class PerInstanceConstantBufferPool; - -namespace AZ { - class Plane; - namespace Vertex { - class Format; - } -} -enum eRenderPrimitiveType : int8; -enum RenderIndexType : int; - -struct IRenderAPI -{ -}; - -struct IRenderer - : public IRenderAPI -{ - virtual ~IRenderer(){} - - virtual void AddRenderDebugListener(IRenderDebugListener* pRenderDebugListener) = 0; - virtual void RemoveRenderDebugListener(IRenderDebugListener* pRenderDebugListener) = 0; - - virtual ERenderType GetRenderType() const = 0; - - virtual const char* GetRenderDescription() const - { - return "CryRenderer"; - } - - // Summary: - // Initializes the renderer, params are self-explanatory. - virtual WIN_HWND Init(int x, int y, int width, int height, unsigned int cbpp, int zbpp, int sbits, bool fullscreen, bool isEditor, WIN_HINSTANCE hinst, WIN_HWND Glhwnd = 0, bool bReInit = false, const SCustomRenderInitArgs* pCustomArgs = 0, bool bShaderCacheGen = false) = 0; - virtual void PostInit() = 0; - - virtual bool IsPost3DRendererEnabled() const { return false; } - - virtual int GetFeatures() = 0; - virtual const void SetApiVersion(const AZStd::string& apiVersion) = 0; - virtual const void SetAdapterDescription(const AZStd::string& adapterDescription) = 0; - virtual const AZStd::string& GetApiVersion() const = 0; - virtual const AZStd::string& GetAdapterDescription() const = 0; - virtual void GetVideoMemoryUsageStats(size_t& vidMemUsedThisFrame, size_t& vidMemUsedRecently, bool bGetPoolsSizes = false) = 0; - virtual int GetNumGeomInstances() const = 0; - virtual int GetNumGeomInstanceDrawCalls() const = 0; - virtual int GetCurrentNumberOfDrawCalls() const = 0; - virtual void GetCurrentNumberOfDrawCalls(int& nGeneral, int& nShadowGen) const = 0; - //Sums DIP counts for the EFSLIST_* passes that match the submitted mask. - //Compose the mask with bitwise arithmetic, use (1 << EFSLIST_*) per list. - //e.g. to sum general and transparent, pass in ( (1 << EFSLIST_GENERAL) | (1 << EFSLIST_TRANSP) ) - virtual int GetCurrentNumberOfDrawCalls(uint32 EFSListMask) const = 0; - virtual float GetCurrentDrawCallRTTimes(uint32 EFSListMask) const = 0; - - virtual void SetDebugRenderNode(IRenderNode* pRenderNode) = 0; - virtual bool IsDebugRenderNode(IRenderNode* pRenderNode) const = 0; - - ///////////////////////////////////////////////////////////////////////////////// - // Render-context management - ///////////////////////////////////////////////////////////////////////////////// - virtual bool DeleteContext(WIN_HWND hWnd) = 0; - virtual bool CreateContext(WIN_HWND hWnd, bool bAllowMSAA = false, int SSX = 1, int SSY = 1) = 0; - virtual bool SetCurrentContext(WIN_HWND hWnd) = 0; - virtual void MakeMainContextActive() = 0; - virtual WIN_HWND GetCurrentContextHWND() = 0; - virtual bool IsCurrentContextMainVP() = 0; - - // Summary: - // Gets height of the current viewport. - virtual int GetCurrentContextViewportHeight() const = 0; - - // Summary: - // Gets width of the current viewport. - virtual int GetCurrentContextViewportWidth() const = 0; - ///////////////////////////////////////////////////////////////////////////////// - - // Summary: - // Shuts down the renderer. - virtual void ShutDown(bool bReInit = false) = 0; - virtual void ShutDownFast() = 0; - - // Description: - // Creates array of all supported video formats (except low resolution formats). - // Return value: - // Number of formats in memory. - virtual int EnumDisplayFormats(SDispFormat* Formats) = 0; - - // Summary: - // Returns all supported by video card video AA formats. - virtual int EnumAAFormats(SAAFormat* Formats) = 0; - - // Summary: - // Changes resolution of the window/device (doesn't require to reload the level. - virtual bool ChangeResolution(int nNewWidth, int nNewHeight, int nNewColDepth, int nNewRefreshHZ, bool bFullScreen, bool bForceReset) = 0; - - // Note: - // Should be called at the beginning of every frame. - virtual void BeginFrame() = 0; - - // Summary: - // Creates default system shaders and textures. - virtual void InitSystemResources(int nFlags) = 0; - virtual void InitTexturesSemantics() = 0; - - // Summary: - // Frees the allocated resources. - virtual void FreeResources(int nFlags) = 0; - - // Summary: - // Shuts down the renderer. - virtual void Release() = 0; - - // See also: - // r_ShowDynTextures - virtual void RenderDebug(bool bRenderStats = true) = 0; - - // Note: - // Should be called at the end of every frame. - virtual void EndFrame() = 0; - - // Force a swap on the backbuffer - virtual void ForceSwapBuffers() = 0; - - // Summary: - // Try to flush the render thread commands to keep the render thread active during - // level loading, but simpy return if the render thread is still busy - virtual void TryFlush() = 0; - - virtual void GetViewport(int* x, int* y, int* width, int* height) const = 0; - virtual void SetViewport(int x, int y, int width, int height, int id = 0) = 0; - virtual void SetRenderTile(f32 nTilesPosX = 0.f, f32 nTilesPosY = 0.f, f32 nTilesGridSizeX = 1.f, f32 nTilesGridSizeY = 1.f) = 0; - virtual void SetScissor(int x = 0, int y = 0, int width = 0, int height = 0) = 0; - virtual Matrix44A& GetViewProjectionMatrix() = 0; - virtual void SetTranspOrigCameraProjMatrix(Matrix44A& matrix) = 0; - - virtual EScreenAspectRatio GetScreenAspect(int nWidth, int nHeight) = 0; - - virtual Vec2 SetViewportDownscale(float xscale, float yscale) = 0; - virtual void SetViewParameters(const CameraViewParameters& viewParameters) = 0; // Direct setter - virtual void ApplyViewParameters(const CameraViewParameters& viewParameters) = 0; // Uses CameraViewParameters to create matrices. - - // Summary: - // Draws user primitives. - virtual void DrawDynVB(SVF_P3F_C4B_T2F* pBuf, uint16* pInds, int nVerts, int nInds, PublicRenderPrimitiveType nPrimType) = 0; - - struct DynUiPrimitive : public AZStd::intrusive_slist_node - { - SVF_P2F_C4B_T2F_F4B* m_vertices = nullptr; - uint16* m_indices = nullptr; - int m_numVertices = 0; - int m_numIndices = 0; - }; - - using DynUiPrimitiveList = AZStd::intrusive_slist>; - - // Summary: - // Draws a list of UI primitives as one draw call (if using separate render thread) - virtual void DrawDynUiPrimitiveList(DynUiPrimitiveList& primitives, int totalNumVertices, int totalNumIndices) = 0; - - // Summary: - // Sets the renderer camera. - virtual void SetCamera(const CCamera& cam) = 0; - - // Summary: - // Gets the renderer camera. - virtual const CCamera& GetCamera() = 0; - - virtual CRenderView* GetRenderViewForThread(int nThreadID) = 0; - // Summary: - // Gets the renderer previous camera. - //virtual const CCamera& GetCameraPrev() = 0; - - // Summary: - // Sets delta gamma. - virtual bool SetGammaDelta(float fGamma) = 0; - - // Summary: - // Restores gamma - // Note: - // Reset gamma setting if not in fullscreen mode. - virtual void RestoreGamma(void) = 0; - - // Summary: - // Changes display size. - virtual bool ChangeDisplay(unsigned int width, unsigned int height, unsigned int cbpp) = 0; - - // Summary: - // Changes viewport size. - virtual void ChangeViewport(unsigned int x, unsigned int y, unsigned int width, unsigned int height, bool bMainViewport = false, float scaleWidth = 1.0f, float scaleHeight = 1.0f) = 0; - - // Summary: - // Saves source data to a Tga file. - // Note: - // Should not be here. - virtual bool SaveTga(unsigned char* sourcedata, int sourceformat, int w, int h, const char* filename, bool flip) const = 0; - - // Summary: - // Sets the current binded texture. - virtual void SetTexture(int tnum) = 0; - - // Summary: - // Sets the current bound texture for the given texture unit - virtual void SetTexture(int tnum, int nUnit) = 0; - - // Summary: - // Sets the white texture. - virtual void SetWhiteTexture() = 0; - - // Summary: - // Gets the white texture Id. - virtual int GetWhiteTextureId() const = 0; - - // Summary: - // Gets the white texture Id. - virtual int GetBlackTextureId() const = 0; - - // Summary: - // Draws a 2d image on the screen. - // Example: - // Hud etc. - virtual void Draw2dImage(float xpos, float ypos, float w, float h, int texture_id, float s0 = 0, float t0 = 0, float s1 = 1, float t1 = 1, float angle = 0, float r = 1, float g = 1, float b = 1, float a = 1, float z = 1) = 0; - - virtual void Draw2dImageStretchMode(bool stretch) = 0; - - // Summary: - // Adds a 2d image that should be drawn on the screen to an internal render list. The list can be drawn with Draw2dImageList. - // If several images will be drawn, using this function is more efficient than calling Draw2dImage as it allows better batching. - // The function supports placing images in stereo 3d space. - // Arguments: - // stereoDepth - Places image in stereo 3d space. The depth is specified in camera space, the stereo params are the same that - // are used for the scene. A value of 0 is handled as a special case and always places the image on the screen plane. - virtual void Push2dImage(float xpos, float ypos, float w, float h, int texture_id, float s0 = 0, float t0 = 0, float s1 = 1, float t1 = 1, float angle = 0, float r = 1, float g = 1, float b = 1, float a = 1, float z = 1, float stereoDepth = 0) = 0; - - // Summary: - // Draws all images to the screen that were collected with Push2dImage. - virtual void Draw2dImageList() = 0; - - // Summary: - // Draws a image using the current matrix. - virtual void DrawImage(float xpos, float ypos, float w, float h, int texture_id, float s0, float t0, float s1, float t1, float r, float g, float b, float a, bool filtered = true) = 0; - - // Description: - // Draws a image using the current matrix, more flexible than DrawImage - // order for s and t: 0=left_top, 1=right_top, 2=right_bottom, 3=left_bottom. - virtual void DrawImageWithUV(float xpos, float ypos, float z, float width, float height, int texture_id, float* s, float* t, float r = 1, float g = 1, float b = 1, float a = 1, bool filtered = true) = 0; - - // Summary: - // Sets the polygon mode with Push, Pop restores the last used one - // Example: - // Wireframe, solid. - virtual void PushWireframeMode(int mode) = 0; - virtual void PopWireframeMode() = 0; - - // Summary: - // Gets height of the main rendering resolution. - virtual int GetHeight() const = 0; - - // Summary: - // Gets width of the main rendering resolution. - virtual int GetWidth() const = 0; - - // Summary: - // Gets Pixel Aspect Ratio. - virtual float GetPixelAspectRatio() const = 0; - - // Summary: - // Gets the height of the overlay viewport where UI and debug output are rendered. - virtual int GetOverlayHeight() const = 0; - - // Summary: - // Gets the width of the overlay viewport where UI and debug output are rendered. - virtual int GetOverlayWidth() const = 0; - - // Summary: - // Gets the maximum dimension for a square custom render resolution. - virtual int GetMaxSquareRasterDimension() const = 0; - - // Summary: - // Switches subsequent rendering from the internal backbuffer to the native resolution backbuffer if available. - virtual void SwitchToNativeResolutionBackbuffer() = 0; - - // Summary: - // Gets memory status information - virtual void GetMemoryUsage(ICrySizer* Sizer) = 0; - - // Summary: - // Gets textures streaming bandwidth information - virtual void GetBandwidthStats(float* fBandwidthRequested) = 0; - - // Summary: - // Sets an event listener for texture streaming updates - virtual void SetTextureStreamListener(ITextureStreamListener* pListener) = 0; - - // Summary: - // Populates a CPU-side occlusion buffer with the contents from the previous frame's downsampled depth buffer. - // This will be called from a job thread within the occlusion system. - virtual int GetOcclusionBuffer(uint16* pOutOcclBuffer, Matrix44* pmCamBuffer) = 0; - - // Summary: - // Gets a screenshot and save to a file - // Returns: - // true=success - virtual bool ScreenShot(const char* filename = NULL, int width = 0) = 0; - - // Summary: - // Gets current bpp. - virtual int GetColorBpp() = 0; - - // Summary: - // Gets current z-buffer depth. - virtual int GetDepthBpp() = 0; - - // Summary: - // Gets current stencil bits. - virtual int GetStencilBpp() = 0; - - // Summary: - // Returns true if stereo rendering is enabled. - virtual bool IsStereoEnabled() const = 0; - - // Summary: - // Returns values of nearest rendering z-range max - virtual float GetNearestRangeMax() const = 0; - - // Summary: - // Returns the PerInstanceConstantBufferPool - virtual PerInstanceConstantBufferPool* GetPerInstanceConstantBufferPoolPointer() = 0; - - // Summary: - // Projects to screen. - // Returns true if successful. - virtual bool ProjectToScreen( - float ptx, float pty, float ptz, - float* sx, float* sy, float* sz) = 0; - - // Summary: - // Unprojects to screen. - virtual int UnProject( - float sx, float sy, float sz, - float* px, float* py, float* pz, - const float modelMatrix[16], - const float projMatrix[16], - const int viewport[4]) = 0; - - // Summary: - // Unprojects from screen. - virtual int UnProjectFromScreen( - float sx, float sy, float sz, - float* px, float* py, float* pz) = 0; - - // Remarks: - // For editor. - virtual void GetModelViewMatrix(float* mat) = 0; - - // Remarks: - // For editor. - virtual void GetProjectionMatrix(float* mat) = 0; - - virtual bool WriteDDS(const byte* dat, int wdt, int hgt, int Size, const char* name, ETEX_Format eF, int NumMips) = 0; - virtual bool WriteTGA(const byte* dat, int wdt, int hgt, const char* name, int src_bits_per_pixel, int dest_bits_per_pixel) = 0; - virtual bool WriteJPG(const byte* dat, int wdt, int hgt, char* name, int src_bits_per_pixel, int nQuality = 100) = 0; - - ///////////////////////////////////////////////////////////////////////////////// - //Replacement functions for Font - - static const bool FontCreateTextureGenMipsDefaultValue = false; - virtual int FontCreateTexture(int Width, int Height, byte* pData, ETEX_Format eTF = eTF_R8G8B8A8, bool genMips = FontCreateTextureGenMipsDefaultValue, const char* textureName = nullptr) = 0; - virtual bool FontUpdateTexture(int nTexId, int X, int Y, int USize, int VSize, byte* pData) = 0; - virtual void FontSetTexture(int nTexId, int nFilterMode) = 0; - virtual void FontSetRenderingState(bool overrideViewProjMatrices, TransformationMatrices& backupMatrices) = 0; - virtual void FontSetBlending(int src, int dst, int baseState) = 0; - virtual void FontRestoreRenderingState(bool overrideViewProjMatrices, const TransformationMatrices& restoringMatrices) = 0; - - virtual bool FlushRTCommands(bool bWait, bool bImmediatelly, bool bForce) = 0; - virtual void DrawStringU(IFFont_RenderProxy* pFont, float x, float y, float z, const char* pStr, bool asciiMultiLine, const STextDrawContext& ctx) const = 0; - - virtual int RT_CurThreadList() = 0; - - ///////////////////////////////////////////////////////////////////////////////// - // External interface for shaders - ///////////////////////////////////////////////////////////////////////////////// - virtual bool EF_PrecacheResource(SShaderItem* pSI, float fMipFactor, float fTimeToReady, int Flags, int nUpdateId, int nCounter = 1) = 0; - virtual bool EF_PrecacheResource(IShader* pSH, float fMipFactor, float fTimeToReady, int Flags) = 0; - virtual bool EF_PrecacheResource(ITexture* pTP, float fMipFactor, float fTimeToReady, int Flags, int nUpdateId, int nCounter = 1) = 0; - virtual bool EF_PrecacheResource(IRenderMesh* pPB, _smart_ptr pMaterial, float fMipFactor, float fTimeToReady, int Flags, int nUpdateId) = 0; - virtual bool EF_PrecacheResource(CDLight* pLS, float fMipFactor, float fTimeToReady, int Flags, int nUpdateId) = 0; - - virtual ITexture* EF_CreateCompositeTexture(int type, const char* szName, int nWidth, int nHeight, int nDepth, int nMips, int nFlags, ETEX_Format eTF, const STexComposition* pCompositions, size_t nCompositions, int8 nPriority = -1) = 0; - - virtual void PostLevelLoading() = 0; - virtual void PostLevelUnload() = 0; - - virtual CRenderObject* EF_AddPolygonToScene(SShaderItem& si, int numPts, const SVF_P3F_C4B_T2F* verts, const SPipTangents* tangs, CRenderObject* obj, const SRenderingPassInfo& passInfo, uint16* inds, int ninds, int nAW, const SRendItemSorter& rendItemSorter) = 0; - virtual CRenderObject* EF_AddPolygonToScene(SShaderItem& si, CRenderObject* obj, const SRenderingPassInfo& passInfo, int numPts, int ninds, SVF_P3F_C4B_T2F*& verts, SPipTangents*& tangs, uint16*& inds, int nAW, const SRendItemSorter& rendItemSorter) = 0; - - // This is a workaround for when an editor viewport needs to do immediate rendering - // in the editor. Specifically, global constants are updated in a deferred fashion, so - // if a viewport (like the lens flare view) starts doing main-thread rendering, those - // parameters are not bound. - virtual void ForceUpdateGlobalShaderParameters() {} - - ///////////////////////////////////////////////////////////////////////////////// - // Shaders/Shaders management ///////////////////////////////////////////////////////////////////////////////// - - virtual const char* EF_GetShaderMissLogPath() = 0; - - ///////////////////////////////////////////////////////////////////////////////// - virtual AZStd::string* EF_GetShaderNames(int& nNumShaders) = 0; - // Summary: - // Reloads file - virtual bool EF_ReloadFile (const char* szFileName) = 0; - // Summary: - // Reloads file at any time the renderer feels to do so (no guarantees, but likely on next frame update) - // Is threadsafe - virtual bool EF_ReloadFile_Request (const char* szFileName) = 0; - - // Summary: - // Remaps shader gen mask to common global mask. - virtual uint64 EF_GetRemapedShaderMaskGen(const char* name, uint64 nMaskGen = 0, bool bFixup = 0) = 0; - - virtual uint64 EF_GetShaderGlobalMaskGenFromString(const char* szShaderName, const char* szShaderGen, uint64 nMaskGen = 0) = 0; - virtual AZStd::string EF_GetStringFromShaderGlobalMaskGen(const char* szShaderName, uint64 nMaskGen = 0) = 0; - - virtual const SShaderProfile& GetShaderProfile(EShaderType eST) const = 0; - virtual void EF_SetShaderQuality(EShaderType eST, EShaderQuality eSQ) = 0; - - // Summary: - // Gets renderer quality. - virtual ERenderQuality EF_GetRenderQuality() const = 0; - // Summary: - // Gets shader type quality. - virtual EShaderQuality EF_GetShaderQuality(EShaderType eST) = 0; - // Summary: - // Loads shader item for name (name). - virtual SShaderItem EF_LoadShaderItem (const char* szName, bool bShare, int flags = 0, SInputShaderResources* Res = NULL, uint64 nMaskGen = 0) = 0; - // Summary: - // Loads shader for name (name). - virtual IShader* EF_LoadShader (const char* name, int flags = 0, uint64 nMaskGen = 0) = 0; - // Summary: - // Reinitializes all shader files (build hash tables). - virtual void EF_ReloadShaderFiles (int nCategory) = 0; - // Summary: - // Reloads all texture files. - virtual void EF_ReloadTextures () = 0; - // Summary: - // Gets texture object by ID. - virtual ITexture* EF_GetTextureByID(int Id) = 0; - // Summary: - // Gets texture object by Name. - virtual ITexture* EF_GetTextureByName(const char* name, uint32 flags = 0) = 0; - // Summary: - // Loads the texture for name(nameTex). - virtual ITexture* EF_LoadTexture(const char* nameTex, uint32 flags = 0) = 0; - virtual ITexture* EF_LoadCubemapTexture(const char* nameTex, uint32 flags = 0) = 0; - // Summary: - // Loads default texture whose life cycle is managed by Texture Manager, do not try to release them by yourself! - virtual ITexture* EF_LoadDefaultTexture(const char* nameTex) = 0; - - // Summary: - // Loads lightmap for name. - virtual int EF_LoadLightmap (const char* name) = 0; - - // Summary: - // Starts using of the shaders (return first index for allow recursions). - virtual void EF_StartEf (const SRenderingPassInfo& passInfo) = 0; - - virtual SRenderObjData* EF_GetObjData(CRenderObject* pObj, bool bCreate, int nThreadID) = 0; - - // Summary: - // Gets CRenderObject for RE transformation. - //Get temporary RenderObject - virtual CRenderObject* EF_GetObject_Temp (int nThreadID) = 0; - - //Get permanent RenderObject - virtual CRenderObject* EF_DuplicateRO(CRenderObject* pObj, const SRenderingPassInfo& passInfo) = 0; - - // Summary: - // Adds shader to the list. - virtual void EF_AddEf (IRenderElement* pRE, SShaderItem& pSH, CRenderObject* pObj, const SRenderingPassInfo& passInfo, int nList, int nAW, const SRendItemSorter& rendItemSorter) = 0; - - //! Draw all shaded REs in the list - virtual void EF_EndEf3D (int nFlags, int nPrecacheUpdateId, int nNearPrecacheUpdateId, const SRenderingPassInfo& passInfo) = 0; - - virtual void EF_InvokeShadowMapRenderJobs(int nFlags) = 0; - - // Dynamic lights - void EF_ClearLightsList() {}; // For FC Compatibility. - virtual bool EF_IsFakeDLight (const CDLight* Source) = 0; - virtual void EF_ADDDlight(CDLight* Source, const SRenderingPassInfo& passInfo) = 0; - virtual bool EF_UpdateDLight(SRenderLight* pDL) = 0; - virtual bool EF_AddDeferredDecal([[maybe_unused]] const SDeferredDecal& rDecal){return true; } - - // Deferred lights/vis areas - - virtual int EF_AddDeferredLight(const CDLight& pLight, float fMult, const SRenderingPassInfo& passInfo, const SRendItemSorter& rendItemSorter) = 0; - virtual uint32 EF_GetDeferredLightsNum(eDeferredLightType eLightType = eDLT_DeferredLight) = 0; - virtual void EF_ClearDeferredLightsList() = 0; - - virtual uint8 EF_AddDeferredClipVolume(const IClipVolume* pClipVolume) = 0; - virtual bool EF_SetDeferredClipVolumeBlendData(const IClipVolume* pClipVolume, const SClipVolumeBlendInfo& blendInfo) = 0; - virtual void EF_ClearDeferredClipVolumesList() = 0; - - // called in between levels to free up memory - virtual void EF_ReleaseDeferredData() = 0; - - // called in between levels to free up memory - virtual void EF_ReleaseInputShaderResource(SInputShaderResources* pRes) = 0; - - ////////////////////////////////////////////////////////////////////////// - // Post processing effects interfaces - - virtual void EF_SetPostEffectParam(const char* pParam, float fValue, bool bForceValue = false) = 0; - virtual void EF_SetPostEffectParamVec4(const char* pParam, const Vec4& pValue, bool bForceValue = false) = 0; - virtual void EF_SetPostEffectParamString(const char* pParam, const char* pszArg) = 0; - - virtual void EF_GetPostEffectParam(const char* pParam, float& fValue) = 0; - virtual void EF_GetPostEffectParamVec4(const char* pParam, Vec4& pValue) = 0; - virtual void EF_GetPostEffectParamString(const char* pParam, const char*& pszArg) = 0; - - virtual int32 EF_GetPostEffectID(const char* pPostEffectName) = 0; - - virtual void EF_ResetPostEffects(bool bOnSpecChange = false) = 0; - - virtual void SyncPostEffects() = 0; - - virtual void EF_DisableTemporalEffects() = 0; - - ////////////////////////////////////////////////////////////////////////// - - virtual void EF_AddWaterSimHit(const Vec3& vPos, float scale, float strength) = 0; - virtual void EF_DrawWaterSimHits() = 0; - - ///////////////////////////////////////////////////////////////////////////////// - // 2d interface for the shaders - ///////////////////////////////////////////////////////////////////////////////// - virtual void EF_EndEf2D(bool bSort) = 0; - - // Summary: - // Returns various Renderer Settings, see ERenderQueryTypes. - // Arguments: - // Query - e.g. EFQ_GetShaderCombinations. - // rInOut - Input/Output Parameter, depends on the query if written to/read from, or both - void EF_Query(ERenderQueryTypes eQuery) - { - EF_QueryImpl(eQuery, NULL, 0, NULL, 0); - } - template - void EF_Query(ERenderQueryTypes eQuery, T& rInOut) - { - EF_QueryImpl(eQuery, static_cast(&rInOut), sizeof(T), NULL, 0); - } - template - void EF_Query(ERenderQueryTypes eQuery, T0& rInOut0, T1& rInOut1) - { - EF_QueryImpl(eQuery, static_cast(&rInOut0), sizeof(T0), static_cast(&rInOut1), sizeof(T1)); - } - - // Summary: - // Toggles render mesh garbage collection - // Arguments: - // Param - - virtual void ForceGC() = 0; - - // Remarks: - // For stats. - virtual int GetPolyCount() const = 0; - virtual void GetPolyCount(int& nPolygons, int& nShadowVolPolys) const = 0; - - // Note: - // 3d engine set this color to fog color. - virtual void SetClearColor(const Vec3& vColor) = 0; - - virtual void SetClearBackground(bool bClearBackground) = 0; - - // Summary: - // Creates/deletes RenderMesh object. - virtual _smart_ptr CreateRenderMesh( - const char* szType - , const char* szSourceName - , IRenderMesh::SInitParamerers* pInitParams = NULL - , ERenderMeshType eBufType = eRMT_Static - ) = 0; - - virtual _smart_ptr CreateRenderMeshInitialized( - const void* pVertBuffer, int nVertCount, const AZ::Vertex::Format& vertexFormat, - const vtx_idx* pIndices, int nIndices, - const PublicRenderPrimitiveType nPrimetiveType, const char* szType, const char* szSourceName, ERenderMeshType eBufType = eRMT_Static, - int nMatInfoCount = 1, int nClientTextureBindID = 0, - bool (* PrepareBufferCallback)(IRenderMesh*, bool) = NULL, - void* CustomData = NULL, - bool bOnlyVideoBuffer = false, - bool bPrecache = true, - const SPipTangents* pTangents = NULL, bool bLockForThreadAcc = false, Vec3* pNormals = NULL) = 0; - - //Pass false to get a frameID that increments by one each frame. For this case the increment happens in the game thread at the beginning of the frame. - virtual int GetFrameID(bool bIncludeRecursiveCalls = true) = 0; - - virtual void MakeMatrix(const Vec3& pos, const Vec3& angles, const Vec3& scale, Matrix34* mat) = 0; - - // Description: - // Draws text queued. - // Note: - // Position can be in 3d or in 2d depending on the flags. - virtual void DrawTextQueued(Vec3 pos, SDrawTextInfo& ti, const char* format, va_list args) = 0; - - // Description: - // Draws text queued. - // Note: - // Position can be in 3d or in 2d depending on the flags. - virtual void DrawTextQueued(Vec3 pos, SDrawTextInfo& ti, const char* text) = 0; - - ////////////////////////////////////////////////////////////////////// - - virtual float ScaleCoordX(float value) const = 0; - virtual float ScaleCoordY(float value) const = 0; - virtual void ScaleCoord(float& x, float& y) const = 0; - - virtual void SetState(int State, int AlphaRef = -1) = 0; - virtual void SetCullMode (int mode = R_CULL_BACK) = 0; - virtual void SetStencilState(int st, uint32 nStencRef, uint32 nStencMask, uint32 nStencWriteMask, bool bForceFullReadMask = false) = 0; - - virtual void PushProfileMarker(const char* label) = 0; - virtual void PopProfileMarker(const char* label) = 0; - - virtual bool EnableFog(bool enable) = 0; - virtual void SetFogColor(const ColorF& color) = 0; - - virtual void SetColorOp(byte eCo, byte eAo, byte eCa, byte eAa) = 0; - virtual void SetSrgbWrite(bool srgbWrite) = 0; - - // for one frame allows to disable limit of texture streaming requests - virtual void RequestFlushAllPendingTextureStreamingJobs([[maybe_unused]] int nFrames) { } - - // allows to dynamically adjust texture streaming load depending on game conditions - virtual void SetTexturesStreamingGlobalMipFactor([[maybe_unused]] float fFactor) { } - - ////////////////////////////////////////////////////////////////////// - // Summary: - // Interface for auxiliary geometry (for debugging, editor purposes, etc.) - virtual IRenderAuxGeom* GetIRenderAuxGeom(void* jobID = 0) = 0; - ////////////////////////////////////////////////////////////////////// - - // Interface for renderer side SVO - virtual ISvoRenderer* GetISvoRenderer() { return 0; } - - virtual IColorGradingController* GetIColorGradingController() = 0; - virtual IStereoRenderer* GetIStereoRenderer() = 0; - - virtual ITexture* Create2DTexture(const char* name, int width, int height, int numMips, int flags, unsigned char* data, ETEX_Format format) = 0; - virtual void TextToScreen(float x, float y, const char* format, ...) PRINTF_PARAMS(4, 5) = 0; - virtual void TextToScreenColor(int x, int y, float r, float g, float b, float a, const char* format, ...) PRINTF_PARAMS(8, 9) = 0; - virtual void ResetToDefault() = 0; - virtual void SetMaterialColor(float r, float g, float b, float a) = 0; - - // Sets default Blend, DepthStencil and Raster states. - virtual void SetDefaultRenderStates() = 0; - - virtual void Graph(byte* g, int x, int y, int wdt, int hgt, int nC, int type, const char* text, ColorF& color, float fScale) = 0; - virtual void EF_RenderTextMessages() = 0; - - virtual void ClearTargetsImmediately(uint32 nFlags) = 0; - virtual void ClearTargetsImmediately(uint32 nFlags, const ColorF& Colors, float fDepth) = 0; - virtual void ClearTargetsImmediately(uint32 nFlags, const ColorF& Colors) = 0; - virtual void ClearTargetsImmediately(uint32 nFlags, float fDepth) = 0; - - virtual void ClearTargetsLater(uint32 nFlags) = 0; - virtual void ClearTargetsLater(uint32 nFlags, const ColorF& Colors, float fDepth) = 0; - virtual void ClearTargetsLater(uint32 nFlags, const ColorF& Colors) = 0; - virtual void ClearTargetsLater(uint32 nFlags, float fDepth) = 0; - - virtual void ReadFrameBuffer(unsigned char* pRGB, int nImageX, int nSizeX, int nSizeY, ERB_Type eRBType, bool bRGBA, int nScaledX = -1, int nScaledY = -1) = 0; - virtual void ReadFrameBufferFast(uint32* pDstARGBA8, int dstWidth, int dstHeight, bool BGRA = true) = 0; - - // Note: - // The following functions will be removed. - virtual void EnableVSync(bool enable) = 0; - - virtual void CreateResourceAsync(SResourceAsync* Resource) = 0; - virtual void ReleaseResourceAsync(SResourceAsync* Resource) = 0; - virtual void ReleaseResourceAsync(AZStd::unique_ptr pResource) = 0; - virtual unsigned int DownLoadToVideoMemory(const byte* data, int w, int h, ETEX_Format eTFSrc, ETEX_Format eTFDst, int nummipmap, bool repeat = true, int filter = FILTER_BILINEAR, int Id = 0, const char* szCacheName = NULL, int flags = 0, EEndian eEndian = eLittleEndian, RectI* pRegion = NULL, bool bAsynDevTexCreation = false) = 0; - virtual unsigned int DownLoadToVideoMemory3D(const byte* data, int w, int h, int d, ETEX_Format eTFSrc, ETEX_Format eTFDst, int nummipmap, bool repeat = true, int filter = FILTER_BILINEAR, int Id = 0, const char* szCacheName = NULL, int flags = 0, EEndian eEndian = eLittleEndian, RectI* pRegion = NULL, bool bAsynDevTexCreation = false) = 0; - virtual unsigned int DownLoadToVideoMemoryCube(const byte* data, int w, int h, ETEX_Format eTFSrc, ETEX_Format eTFDst, int nummipmap, bool repeat = true, int filter = FILTER_BILINEAR, int Id = 0, const char* szCacheName = NULL, int flags = 0, EEndian eEndian = eLittleEndian, RectI* pRegion = NULL, bool bAsynDevTexCreation = false) = 0; - virtual void UpdateTextureInVideoMemory(uint32 tnum, const byte* newdata, int posx, int posy, int w, int h, ETEX_Format eTFSrc = eTF_B8G8R8, int posz = 0, int sizez = 1) = 0; - - virtual bool DXTCompress(const byte* raw_data, int nWidth, int nHeight, ETEX_Format eTF, bool bUseHW, bool bGenMips, int nSrcBytesPerPix, MIPDXTcallback callback) = 0; - virtual bool DXTDecompress(const byte* srcData, size_t srcFileSize, byte* dstData, int nWidth, int nHeight, int nMips, ETEX_Format eSrcTF, bool bUseHW, int nDstBytesPerPix) = 0; - virtual void RemoveTexture(unsigned int TextureId) = 0; - virtual void DeleteFont(IFFont* font) = 0; - - ///////////////////////////////////////////////////////////////////////////////////////////////////// - // This routines uses 2 destination surfaces. It triggers a backbuffer copy to one of its surfaces, - // and then copies the other surface to system memory. This hopefully will remove any - // CPU stalls due to the rect lock call since the buffer will already be in system - // memory when it is called - // Inputs : - // pDstARGBA8 : Pointer to a buffer that will hold the captured frame (should be at least 4*dstWidth*dstHieght for RGBA surface) - // destinationWidth : Width of the frame to copy - // destinationHeight : Height of the frame to copy - // - // Note : If dstWidth or dstHeight is larger than the current surface dimensions, the dimensions - // of the surface are used for the copy - // - virtual bool CaptureFrameBufferFast(unsigned char* pDstRGBA8, int destinationWidth, int destinationHeight) = 0; - - - ///////////////////////////////////////////////////////////////////////////////////////////////////// - // Copy a captured surface to a buffer - // - // Inputs : - // pDstARGBA8 : Pointer to a buffer that will hold the captured frame (should be at least 4*dstWidth*dstHieght for RGBA surface) - // destinationWidth : Width of the frame to copy - // destinationHeight : Height of the frame to copy - // - // Note : If dstWidth or dstHeight is larger than the current surface dimensions, the dimensions - // of the surface are used for the copy - // - virtual bool CopyFrameBufferFast(unsigned char* pDstRGBA8, int destinationWidth, int destinationHeight) = 0; - - - - ///////////////////////////////////////////////////////////////////////////////////////////////////// - // This routine registers a callback address that is called when a new frame is available - // Inputs : - // pCapture : Address of the ICaptureFrameListener object - // - // Outputs : returns true if successful, otherwise false - // - virtual bool RegisterCaptureFrame(ICaptureFrameListener* pCapture) = 0; - - ///////////////////////////////////////////////////////////////////////////////////////////////////// - // This routine unregisters a callback address that was previously registered - // Inputs : - // pCapture : Address of the ICaptureFrameListener object to unregister - // - // Outputs : returns true if successful, otherwise false - // - virtual bool UnRegisterCaptureFrame(ICaptureFrameListener* pCapture) = 0; - - - ///////////////////////////////////////////////////////////////////////////////////////////////////// - // This routine initializes 2 destination surfaces for use by the CaptureFrameBufferFast routine - // It also, captures the current backbuffer into one of the created surfaces - // - // Inputs : - // bufferWidth : Width of capture buffer, on consoles the scaling is done on the GPU. Pass in 0 (the default) to use backbuffer dimensions - // bufferHeight : Height of capture buffer. - // - // Outputs : returns true if surfaces were created otherwise returns false - // - virtual bool InitCaptureFrameBufferFast(uint32 bufferWidth = 0, uint32 bufferHeight = 0) = 0; - - ///////////////////////////////////////////////////////////////////////////////////////////////////// - // This routine releases the 2 surfaces used for frame capture by the CaptureFrameBufferFast routine - // - // Inputs : None - // - // Returns : None - // - virtual void CloseCaptureFrameBufferFast(void) = 0; - - - ///////////////////////////////////////////////////////////////////////////////////////////////////// - // This routine checks for any frame buffer callbacks that are needed and calls them - // - // Inputs : None - // - // Outputs : None - // - virtual void CaptureFrameBufferCallBack(void) = 0; - - virtual void RegisterSyncWithMainListener(ISyncMainWithRenderListener* pListener) = 0; - virtual void RemoveSyncWithMainListener(const ISyncMainWithRenderListener* pListener) = 0; - - virtual void Set2DMode(uint32 orthoX, uint32 orthoY, TransformationMatrices& backupMatrices, float znear = -1e10f, float zfar = 1e10f) = 0; - virtual void Unset2DMode(const TransformationMatrices& restoringMatrices) = 0; - virtual void Set2DModeNonZeroTopLeft(float orthoLeft, float orthoTop, float orthoWidth, float orthoHeight, TransformationMatrices& backupMatrices, float znear = -1e10f, float zfar = 1e10f) = 0; - - virtual int ScreenToTexture(int nTexID) = 0; - virtual void EnableSwapBuffers(bool bEnable) = 0; - virtual WIN_HWND GetHWND() = 0; - - // Set the window icon to be displayed on the output window. - // The parameter is the path to a DDS texture file to be used as the icon. - // For best results, pass a square power-of-two sized texture, with a mip-chain. - virtual bool SetWindowIcon(const char* path) = 0; - - virtual void OnEntityDeleted(struct IRenderNode* pRenderNode) = 0; - - virtual int CreateRenderTarget(const char* name, int nWidth, int nHeight, const ColorF& clearColor, ETEX_Format eTF) = 0; - virtual bool DestroyRenderTarget (int nHandle) = 0; - virtual bool ResizeRenderTarget(int nHandle, int nWidth, int nHeight) = 0; - virtual bool SetRenderTarget(int nHandle, SDepthTexture* pDepthSurf = nullptr) = 0; - virtual SDepthTexture* CreateDepthSurface(int nWidth, int nHeight, bool shaderResourceView = false) = 0; - virtual void DestroyDepthSurface(SDepthTexture* pDepthSurf) = 0; - - // Note: - // Used for pausing timer related stuff. - // Example: - // For texture animations, and shader 'time' parameter. - virtual void PauseTimer(bool bPause) = 0; - - // Description: - // Creates an Interface to the public params container. - // Return: - // Created IShaderPublicParams interface. - virtual IShaderPublicParams* CreateShaderPublicParams() = 0; - - virtual void GetThreadIDs(threadID& mainThreadID, threadID& renderThreadID) const = 0; - - struct SArtProfileData - { - enum EArtProfileUnit - { - eArtProfileUnit_GPU = 0, - eArtProfileUnit_CPU, - eArtProfile_NumUnits - }; - - enum EArtProfileSections - { - eArtProfile_Shadows = 0, - eArtProfile_ZPass, - eArtProfile_Decals, - eArtProfile_Lighting, - eArtProfile_Opaque, - eArtProfile_Transparent, - eArtProfile_Max, - }; - - float times[eArtProfile_Max]; - float budgets[eArtProfile_Max]; - float total, budgetTotal; - - // detailed values for anything that is grouped together and can be timed - enum EBreakdownDetailValues - { - // Lighting - eArtProfileDetail_LightsAmbient, - eArtProfileDetail_LightsCubemaps, - eArtProfileDetail_LightsDeferred, - eArtProfileDetail_LightsShadowMaps, // just the cost of the shadow maps - - // Transparent - eArtProfileDetail_Reflections, - eArtProfileDetail_Caustics, - eArtProfileDetail_RefractionOverhead, // partial resolves - eArtProfileDetail_Rain, - eArtProfileDetail_LensOptics, - - eArtProfileDetail_Max, - }; - - float breakdowns[eArtProfileDetail_Max]; - - int batches, drawcalls, processedLights; - -#if defined(ENABLE_ART_RT_TIME_ESTIMATE) - int numStandardBatches; - int numStandardDrawCalls; - int numLightDrawCalls; - float actualRenderTimeMinusPost; - float actualRenderTimePost; - float actualMiscRTTime; - float actualTotalRTTime; -#endif - }; - - virtual void EnableGPUTimers2(bool bEnabled) = 0; - virtual void AllowGPUTimers2(bool bAllow) = 0; - virtual const RPProfilerStats* GetRPPStats(ERenderPipelineProfilerStats eStat, bool bCalledFromMainThread = true) const = 0; - virtual const RPProfilerStats* GetRPPStatsArray(bool bCalledFromMainThread = true) const = 0; - - virtual int GetPolygonCountByType(uint32 EFSList, EVertexCostTypes vct, uint32 z, bool bCalledFromMainThread = true) = 0; - - virtual void SetCloudShadowsParams(int nTexID, const Vec3& speed, float tiling, bool invert, float brightness) = 0; - virtual uint16 PushFogVolumeContribution(const SFogVolumeData& fogVolData, const SRenderingPassInfo& passInfo) = 0; - virtual void PushFogVolume(class CREFogVolume* pFogVolume, const SRenderingPassInfo& passInfo) = 0; - - virtual int GetMaxTextureSize() = 0; - - virtual const char* GetTextureFormatName(ETEX_Format eTF) = 0; - virtual int GetTextureFormatDataSize(int nWidth, int nHeight, int nDepth, int nMips, ETEX_Format eTF) = 0; - - virtual void SetDefaultMaterials(_smart_ptr pDefMat, _smart_ptr pTerrainDefMat) = 0; - - virtual IGPUParticleEngine* GetGPUParticleEngine() const { return 0; } - - virtual uint32 GetActiveGPUCount() const = 0; - virtual ShadowFrustumMGPUCache* GetShadowFrustumMGPUCache() = 0; - virtual const StaticArray& GetCachedShadowsResolution() const = 0; - virtual void SetCachedShadowsResolution(const StaticArray& arrResolutions) = 0; - virtual void UpdateCachedShadowsLodCount(int nGsmLods) const = 0; - - virtual void SetTexturePrecaching(bool stat) = 0; - - //platform specific - virtual void RT_InsertGpuCallback(uint32 context, GpuCallbackFunc callback) = 0; - virtual void EnablePipelineProfiler(bool bEnable) = 0; - - struct SRenderTimes - { - float fWaitForMain; - float fWaitForRender; - float fWaitForGPU; - float fTimeProcessedRT; - float fTimeProcessedRTScene; //The part of the render thread between the "SCENE" profiler labels - float fTimeProcessedGPU; - float fTimeGPUIdlePercent; - }; - virtual void GetRenderTimes(SRenderTimes& outTimes) = 0; - virtual float GetGPUFrameTime() = 0; - - // Enable the batch mode if the meshpools are used to enable quick and dirty flushes. - virtual void EnableBatchMode(bool enable) = 0; - // Flag level unloading in progress to disable f.i. rendermesh creation requests - virtual void EnableLevelUnloading(bool enable) = 0; - // Function to handle cleanup required if a level load fails - virtual void OnLevelLoadFailed() = 0; - - struct SDrawCallCountInfo - { - static const uint32 MESH_NAME_LENGTH = 32; - static const uint32 TYPE_NAME_LENGTH = 16; - - SDrawCallCountInfo() - : pPos(0, 0, 0) - , nZpass(0) - , nShadows(0) - , nGeneral(0) - , nTransparent(0) - , nMisc(0) - { - meshName[0] = '\0'; - typeName[0] = '\0'; - } - - void Update(CRenderObject* pObj, IRenderMesh* pRM); - - Vec3 pPos; - uint8 nZpass, nShadows, nGeneral, nTransparent, nMisc; - char meshName[MESH_NAME_LENGTH]; - char typeName[TYPE_NAME_LENGTH]; - }; - - //Debug draw call info (per node) - typedef AZStd::unordered_map< IRenderNode*, IRenderer::SDrawCallCountInfo, AZStd::hash, AZStd::equal_to, AZ::StdLegacyAllocator > RNDrawcallsMapNode; - typedef RNDrawcallsMapNode::iterator RNDrawcallsMapNodeItor; - - //Debug draw call info (per mesh) - typedef AZStd::unordered_map< IRenderMesh*, IRenderer::SDrawCallCountInfo, AZStd::hash, AZStd::equal_to, AZ::StdLegacyAllocator > RNDrawcallsMapMesh; - typedef RNDrawcallsMapMesh::iterator RNDrawcallsMapMeshItor; - -#if !defined(_RELEASE) - //Get draw call info for frame - virtual RNDrawcallsMapMesh& GetDrawCallsInfoPerMesh(bool mainThread = true) = 0; - virtual RNDrawcallsMapMesh& GetDrawCallsInfoPerMeshPreviousFrame(bool mainThread = true) = 0; - virtual RNDrawcallsMapNode& GetDrawCallsInfoPerNodePreviousFrame(bool mainThread = true) = 0; - virtual int GetDrawCallsPerNode(IRenderNode* pRenderNode) = 0; - virtual void ForceRemoveNodeFromDrawCallsMap(IRenderNode* pNode) = 0; -#endif - - virtual void CollectDrawCallsInfo(bool status) = 0; - virtual void CollectDrawCallsInfoPerNode(bool status) = 0; - - ////////////////////////////////////////////////////////////////////////// - // Summary: - // Helper functions to draw text. - ////////////////////////////////////////////////////////////////////////// - void DrawLabel(Vec3 pos, float font_size, const char* label_text, ...) PRINTF_PARAMS(4, 5) - { - va_list args; - va_start(args, label_text); - SDrawTextInfo ti; - ti.xscale = ti.yscale = font_size; - ti.flags = eDrawText_FixedSize | eDrawText_800x600; - DrawTextQueued(pos, ti, label_text, args); - va_end(args); - } - - void DrawLabelEx(Vec3 pos, float font_size, const float* pfColor, bool bFixedSize, bool bCenter, const char* label_text, ...) PRINTF_PARAMS(7, 8) - { - va_list args; - va_start(args, label_text); - SDrawTextInfo ti; - ti.xscale = ti.yscale = font_size; - ti.flags = ((bFixedSize) ? eDrawText_FixedSize : 0) | ((bCenter) ? eDrawText_Center : 0) | eDrawText_800x600; - if (pfColor) - { - ti.color[0] = pfColor[0]; - ti.color[1] = pfColor[1]; - ti.color[2] = pfColor[2]; - ti.color[3] = pfColor[3]; - } - DrawTextQueued(pos, ti, label_text, args); - va_end(args); - } - - void Draw2dLabelEx(float x, float y, float font_size, const ColorF& fColor, EDrawTextFlags flags, const char* label_text, ...) PRINTF_PARAMS(7, 8) - { - va_list args; - va_start(args, label_text); - SDrawTextInfo ti; - ti.xscale = ti.yscale = font_size; - ti.flags = flags; - { - ti.color[0] = fColor[0]; - ti.color[1] = fColor[1]; - ti.color[2] = fColor[2]; - ti.color[3] = fColor[3]; - } - DrawTextQueued(Vec3(x, y, 0.5f), ti, label_text, args); - va_end(args); - } - - void Draw2dLabel(float x, float y, float font_size, const float* pfColor, bool bCenter, const char* label_text, ...) PRINTF_PARAMS(7, 8) - { - va_list args; - va_start(args, label_text); - SDrawTextInfo ti; - ti.xscale = ti.yscale = font_size; - ti.flags = eDrawText_2D | eDrawText_800x600 | eDrawText_FixedSize | ((bCenter) ? eDrawText_Center : 0); - if (pfColor) - { - ti.color[0] = pfColor[0]; - ti.color[1] = pfColor[1]; - ti.color[2] = pfColor[2]; - ti.color[3] = pfColor[3]; - } - DrawTextQueued(Vec3(x, y, 0.5f), ti, label_text, args); - va_end(args); - } - - void Draw2dLabel(float x, float y, float font_size, const ColorF& fColor, bool bCenter, const char* label_text, ...) PRINTF_PARAMS(7, 8) - { - va_list args; - va_start(args, label_text); - SDrawTextInfo ti; - ti.xscale = ti.yscale = font_size; - ti.flags = eDrawText_2D | eDrawText_800x600 | eDrawText_FixedSize | ((bCenter) ? eDrawText_Center : 0); - { - ti.color[0] = fColor[0]; - ti.color[1] = fColor[1]; - ti.color[2] = fColor[2]; - ti.color[3] = fColor[3]; - } - DrawTextQueued(Vec3(x, y, 0.5f), ti, label_text, args); - va_end(args); - } - - // BLM - Added override that takes flags manually, so we can draw monospaced, etc. - void Draw2dLabelWithFlags(float x, float y, float font_size, const ColorF& fColor, uint32 flags, const char* label_text, ...) PRINTF_PARAMS(7, 8) - { - va_list args; - va_start(args, label_text); - SDrawTextInfo ti; - ti.xscale = ti.yscale = font_size; - ti.flags = flags; - { - ti.color[0] = fColor[0]; - ti.color[1] = fColor[1]; - ti.color[2] = fColor[2]; - ti.color[3] = fColor[3]; - } - DrawTextQueued(Vec3(x, y, 0.5f), ti, label_text, args); - va_end(args); - } - - /** - * Used to determine if the renderer has loaded default system - * textures yet. - * - * Some textures like s_ptexWhite aren't available until this is true. - * - * @return True if the renderer has loaded default resources - */ - virtual bool HasLoadedDefaultResources() { return false; } - - // Summary: - virtual SSkinningData* EF_CreateSkinningData(uint32 nNumBones, bool bNeedJobSyncVar, bool bUseMatrixSkinning = false) = 0; - virtual SSkinningData* EF_CreateRemappedSkinningData(uint32 nNumBones, SSkinningData* pSourceSkinningData, uint32 nCustomDataSize, uint32 pairGuid) = 0; - virtual void EF_ClearSkinningDataPool() = 0; - virtual int EF_GetSkinningPoolID() = 0; - - virtual void ClearShaderItem(SShaderItem* pShaderItem) = 0; - virtual void UpdateShaderItem(SShaderItem* pShaderItem, _smart_ptr pMaterial) = 0; - virtual void ForceUpdateShaderItem(SShaderItem* pShaderItem, _smart_ptr pMaterial) = 0; - virtual void RefreshShaderResourceConstants(SShaderItem* pShaderItem, IMaterial* pMaterial) = 0; - - // Summary: - // Determine if a switch to stereo mode will occur at the start of the next frame - virtual bool IsStereoModeChangePending() = 0; - - // Summary: - // Lock/Unlock the video memory buffer used by particles when using the jobsystem - virtual void LockParticleVideoMemory(uint32 nId) = 0; - virtual void UnLockParticleVideoMemory(uint32 nId) = 0; - - // Summary: - // tell the renderer that we will begin/stop spawning jobs which generate SRendItems - virtual void BeginSpawningGeneratingRendItemJobs(int nThreadID) = 0; - virtual void BeginSpawningShadowGeneratingRendItemJobs(int nThreadID) = 0; - virtual void EndSpawningGeneratingRendItemJobs() = 0; - - virtual void StartLoadtimePlayback(ILoadtimeCallback* pCallback) = 0; - virtual void StopLoadtimePlayback() = 0; - - // Summary: - // get the shared job state for SRendItem Generating jobs - virtual AZ::LegacyJobExecutor* GetGenerateRendItemJobExecutor() = 0; - virtual AZ::LegacyJobExecutor* GetGenerateShadowRendItemJobExecutor() = 0; - virtual AZ::LegacyJobExecutor* GetGenerateRendItemJobExecutorPreProcess() = 0; - virtual AZ::LegacyJobExecutor* GetFinalizeRendItemJobExecutor(int nThreadID) = 0; - virtual AZ::LegacyJobExecutor* GetFinalizeShadowRendItemJobExecutor(int nThreadID) = 0; - - virtual void FlushPendingTextureTasks() = 0; - - virtual void SetShadowJittering(float fShadowJittering) = 0; - virtual float GetShadowJittering() const = 0; - - virtual bool LoadShaderStartupCache() = 0; - virtual void UnloadShaderStartupCache() = 0; - - virtual bool LoadShaderLevelCache() = 0; - virtual void UnloadShaderLevelCache() = 0; - - virtual void StartScreenShot([[maybe_unused]] int e_ScreenShot) {}; - virtual void EndScreenShot([[maybe_unused]] int e_ScreenShot) {}; - - // Sets a renderer tracked cvar - virtual void SetRendererCVar(ICVar* pCVar, const char* pArgText, bool bSilentMode = false) = 0; - - // Get the render piepline - virtual SRenderPipeline* GetRenderPipeline() = 0; - - // Get the sahder manager - virtual CShaderMan* GetShaderManager() = 0; - - // Get render thread - virtual SRenderThread* GetRenderThread() = 0; - - // Get premade white texture - virtual ITexture* GetWhiteTexture() = 0; - - // Get the texture for the name and format given - virtual ITexture* GetTextureForName(const char* name, uint32 nFlags, ETEX_Format eFormat) = 0; - - // Get the camera view parameters - virtual const CameraViewParameters& GetViewParameters() = 0; - - // Get frame reset number - virtual uint32 GetFrameReset() = 0; - - // Get original depth buffer - virtual SDepthTexture* GetDepthBufferOrig() = 0; - - // Get width of backbuffer - virtual uint32 GetBackBufferWidth() = 0; - - // Get height of backbuffer - virtual uint32 GetBackBufferHeight() = 0; - - // Get the device buffer manager - virtual CDeviceBufferManager* GetDeviceBufferManager() = 0; - - // Get render tile info - virtual const SRenderTileInfo* GetRenderTileInfo() const = 0; - - // Returns precomputed identity matrix - virtual Matrix44A GetIdentityMatrix() = 0; - - // Get current GPU group Id. Used for tracking which GPU is being used - virtual int32 RT_GetCurrGpuID() const = 0; - - // Generate the next texture id - virtual int GenerateTextureId() = 0; - - // Set culling mode - virtual void SetCull(ECull eCull, bool bSkipMirrorCull = false) = 0; - - // Draw a 2D quad - virtual void DrawQuad(float x0, float y0, float x1, float y1, const ColorF& color, float z = 1.0f, float s0 = 0.0f, float t0 = 0.0f, float s1 = 1.0f, float t1 = 1.0f) = 0; - - // Draw a quad - virtual void DrawQuad3D(const Vec3& v0, const Vec3& v1, const Vec3& v2, const Vec3& v3, const ColorF& color, float ftx0, float fty0, float ftx1, float fty1) = 0; - - // Resets render pipeline state - virtual void FX_ResetPipe() = 0; - - // Gets an (existing) depth surface of the dimensions given - virtual SDepthTexture* FX_GetDepthSurface(int nWidth, int nHeight, bool bAA, bool shaderResourceView = false) = 0; - - // Check to see if buffers are full and if so flush - virtual void FX_CheckOverflow(int nVerts, int nInds, IRenderElement* re, int* nNewVerts = nullptr, int* nNewInds = nullptr) = 0; - - // Perform pre render work - virtual void FX_PreRender(int Stage) = 0; - - // Perform post render work - virtual void FX_PostRender() = 0; - - // Set render states - virtual void FX_SetState(int st, int AlphaRef = -1, int RestoreState = 0) = 0; - - // Commit render states - virtual void FX_CommitStates(const SShaderTechnique* pTech, const SShaderPass* pPass, bool bUseMaterialState) = 0; - - // Commit changes made thus dar - virtual void FX_Commit(bool bAllowDIP = false) = 0; - - // Sets vertex declaration - virtual long FX_SetVertexDeclaration(int StreamMask, const AZ::Vertex::Format& vertexFormat) = 0; - - // Draw indexed prim - virtual void FX_DrawIndexedPrimitive(eRenderPrimitiveType eType, int nVBOffset, int nMinVertexIndex, int nVerticesCount, int nStartIndex, int nNumIndices, bool bInstanced = false) = 0; - - // Set Index stream - virtual long FX_SetIStream(const void* pB, uint32 nOffs, RenderIndexType idxType) = 0; - - // Set vertex stream - virtual long FX_SetVStream(int nID, const void* pB, uint32 nOffs, uint32 nStride, uint32 nFreq = 1) = 0; - - // Draw primitives - virtual void FX_DrawPrimitive(eRenderPrimitiveType eType, int nStartVertex, int nVerticesCount, int nInstanceVertices = 0) = 0; - - // Clear texture - virtual void FX_ClearTarget(ITexture* pTex) = 0; - - // Clear depth - virtual void FX_ClearTarget(SDepthTexture* pTex) = 0; - - // Set render target - virtual bool FX_SetRenderTarget(int nTarget, void* pTargetSurf, SDepthTexture* pDepthTarget, uint32 nTileCount = 1) = 0; - - // Pushes render target - virtual bool FX_PushRenderTarget(int nTarget, void* pTargetSurf, SDepthTexture* pDepthTarget, uint32 nTileCount = 1) = 0; - - // Sets up the render target - virtual bool FX_SetRenderTarget(int nTarget, CTexture* pTarget, SDepthTexture* pDepthTarget, bool bPush = false, int nCMSide = -1, bool bScreenVP = false, uint32 nTileCount = 1) = 0; - - // Push render target - virtual bool FX_PushRenderTarget(int nTarget, CTexture* pTarget, SDepthTexture* pDepthTarget, int nCMSide = -1, bool bScreenVP = false, uint32 nTileCount = 1) = 0; - - // Restore render target - virtual bool FX_RestoreRenderTarget(int nTarget) = 0; - - // Pop render target - virtual bool FX_PopRenderTarget(int nTarget) = 0; - - // Set active render targets - virtual void FX_SetActiveRenderTargets(bool bAllowDIP = false) = 0; - - // Start an effect / shader / etc.. - virtual void FX_Start(CShader* ef, int nTech, CShaderResources* Res, IRenderElement* re) = 0; - - // Pop render target on render thread - virtual void RT_PopRenderTarget(int nTarget) = 0; - - // Sets viewport dimensions on render thread - virtual void RT_SetViewport(int x, int y, int width, int height, int id = -1) = 0; - - // Push render target on render thread - virtual void RT_PushRenderTarget(int nTarget, CTexture* pTex, SDepthTexture* pDS, int nS) = 0; - - // Setup scissors rect - virtual void EF_Scissor(bool bEnable, int sX, int sY, int sWdt, int sHgt) = 0; - -#ifdef SUPPORT_HW_MOUSE_CURSOR - virtual IHWMouseCursor* GetIHWMouseCursor() = 0; -#endif - - virtual int GetRecursionLevel() = 0; - - virtual int GetIntegerConfigurationValue(const char* varName, int defaultValue) = 0; - virtual float GetFloatConfigurationValue(const char* varName, float defaultValue) = 0; - virtual bool GetBooleanConfigurationValue(const char* varName, bool defaultValue) = 0; - - // Methods exposed to external libraries - virtual void ApplyDepthTextureState(int unit, int nFilter, bool clamp) = 0; - virtual ITexture* GetZTargetTexture() = 0; - virtual int GetTextureState(const STexState& TS) = 0; - virtual uint32 TextureDataSize(uint32 nWidth, uint32 nHeight, uint32 nDepth, uint32 nMips, uint32 nSlices, ETEX_Format eTF, ETEX_TileMode eTM = eTM_None) = 0; - virtual void ApplyForID(int nID, int nTUnit, int nTState, int nTexMaterialSlot, int nSUnit, bool useWhiteDefault) = 0; - virtual ITexture* Create3DTexture(const char* szName, int nWidth, int nHeight, int nDepth, int nMips, int nFlags, const byte* pData, ETEX_Format eTFSrc, ETEX_Format eTFDst) = 0; - virtual bool IsTextureExist(const ITexture* pTex) = 0; - virtual const char* NameForTextureFormat(ETEX_Format eTF) = 0; - virtual const char* NameForTextureType(ETEX_Type eTT) = 0; - virtual bool IsVideoThreadModeEnabled() = 0; - virtual IDynTexture* CreateDynTexture2(uint32 nWidth, uint32 nHeight, uint32 nTexFlags, const char* szSource, ETexPool eTexPool) = 0; - virtual uint32 GetCurrentTextureAtlasSize() = 0; - - virtual void BeginProfilerSection(const char* name, uint32 eProfileLabelFlags = 0) = 0; - virtual void EndProfilerSection(const char* name) = 0; - virtual void AddProfilerLabel(const char* name) = 0; - -private: - // use private for EF_Query to prevent client code to submit arbitrary combinations of output data/size - virtual void EF_QueryImpl(ERenderQueryTypes eQuery, void* pInOut0, uint32 nInOutSize0, void* pInOut1, uint32 nInOutSize1) = 0; -}; - -struct SShaderCacheStatistics -{ - size_t m_nTotalLevelShaderCacheMisses; - size_t m_nGlobalShaderCacheMisses; - size_t m_nNumShaderAsyncCompiles; - bool m_bShaderCompileActive; - - SShaderCacheStatistics() - : m_nTotalLevelShaderCacheMisses(0) - , m_nGlobalShaderCacheMisses(0) - , m_nNumShaderAsyncCompiles(0) - , m_bShaderCompileActive(false) - {} -}; - -// The statistics about the pool for render mesh data -// Note: -struct SMeshPoolStatistics -{ - // The size of the mesh data size in bytes - size_t nPoolSize; - - // The amount of memory currently in use in the pool - size_t nPoolInUse; - - // The highest amount of memory allocated within the mesh data pool - size_t nPoolInUsePeak; - - // The size of the mesh data size in bytes - size_t nInstancePoolSize; - - // The amount of memory currently in use in the pool - size_t nInstancePoolInUse; - - // The highest amount of memory allocated within the mesh data pool - size_t nInstancePoolInUsePeak; - - size_t nFallbacks; - size_t nInstanceFallbacks; - size_t nFlushes; - - SMeshPoolStatistics() - : nPoolSize() - , nPoolInUse() - , nInstancePoolSize() - , nInstancePoolInUse() - , nInstancePoolInUsePeak() - , nFallbacks() - , nInstanceFallbacks() - , nFlushes() - {} -}; - -struct SRendererQueryGetAllTexturesParam -{ - SRendererQueryGetAllTexturesParam() - : pTextures(NULL) - , numTextures(0) - { - } - - _smart_ptr* pTextures; - uint32 numTextures; -}; - - -////////////////////////////////////////////////////////////////////// - -#define STRIPTYPE_NONE 0 -#define STRIPTYPE_ONLYLISTS 1 -#define STRIPTYPE_SINGLESTRIP 2 -#define STRIPTYPE_MULTIPLESTRIPS 3 -#define STRIPTYPE_DEFAULT 4 - -///////////////////////////////////////////////////////////////////// - -struct IRenderMesh; - -//DOC-IGNORE-BEGIN -#include "VertexFormats.h" -//DOC-IGNORE-END - -struct SRestLightingInfo -{ - SRestLightingInfo() - { - averDir.zero(); - averCol = Col_Black; - refPoint.zero(); - } - Vec3 averDir; - ColorF averCol; - Vec3 refPoint; + SVF_P2F_C4B_T2F_F4B* m_vertices = nullptr; + uint16* m_indices = nullptr; + int m_numVertices = 0; + int m_numIndices = 0; }; +using DynUiPrimitiveList = AZStd::intrusive_slist>; class CLodValue { public: - CLodValue() - { - m_nLodA = -1; - m_nLodB = -1; - m_nDissolveRef = 0; - } + CLodValue() = default; CLodValue(int nLodA) { m_nLodA = aznumeric_caster(nLodA); - m_nLodB = -1; - m_nDissolveRef = 0; } CLodValue(int nLodA, uint8 nDissolveRef, int nLodB) @@ -2467,140 +218,7 @@ public: uint8 DissolveRefB() const { return 255 - m_nDissolveRef; } private: - int16 m_nLodA; - int16 m_nLodB; - uint8 m_nDissolveRef; -}; - -// Description: -// Structure used to pass render parameters to Render() functions of IStatObj and ICharInstance. -struct SRendParams -{ - SRendParams() - { - memset(this, 0, sizeof(SRendParams)); - fAlpha = 1.f; - fRenderQuality = 1.f; - nRenderList = EFSLIST_GENERAL; - nAfterWater = 1; - mRenderFirstContainer = false; - NoDecalReceiver = false; - } - - // Summary: - // object transformations. - Matrix34* pMatrix; - struct SInstancingInfo* pInstInfo; - // Summary: - // object previous transformations - motion blur specific. - Matrix34* pPrevMatrix; - // Summary: - // VisArea that contains this object, used for RAM-ambient cube query - IVisArea* m_pVisArea; - // Summary: - // Override material. - _smart_ptr pMaterial; - // Summary: - // Weights stream for deform morphs. - IRenderMesh* pWeights; - // Summary: - // Object Id for objects identification in renderer. - struct IRenderNode* pRenderNode; - // Summary: - // Unique object Id for objects identification in renderer. - void* pInstance; - // Summary: - // TerrainTexInfo for grass. - struct SSectorTextureSet* pTerrainTexInfo; - // Summary: - // storage for LOD transition states. - struct CRNTmpData** ppRNTmpData; - // Summary: - // dynamic render data object which can be set by the game - AZStd::vector* pShaderParams; - // Summary: - // Ambient color for the object. - ColorF AmbientColor; - // Summary: - // Custom sorting offset. - float fCustomSortOffset; - // Summary: - // Object alpha. - float fAlpha; - // Summary: - // Distance from camera. - float fDistance; - // Summary: - // Quality of shaders rendering. - float fRenderQuality; - // Summary: - // Light mask to specify which light to use on the object. - uint32 nDLightMask; - // Summary: - // Approximate information about the lights not included into nDLightMask. - // SRestLightingInfo restLightInfo; - // Summary: - // CRenderObject flags. - int32 dwFObjFlags; - // Summary: - // Material layers blending amount - uint32 nMaterialLayersBlend; - // Summary: - // Vision modes params - uint32 nVisionParams; - // Summary: - // Vision modes params - uint32 nHUDSilhouettesParams; - // Summary: - // Defines what pieces of pre-broken geometry has to be rendered - uint64 nSubObjHideMask; - - // Defines per object float custom data - float fCustomData[4]; - - // Custom TextureID - int16 nTextureID; - - // Defines per object custom flags - uint16 nCustomFlags; - - // The LOD value compute for rendering - CLodValue lodValue; - - // Defines per object custom data - uint8 nCustomData; - - // Summary: - // Defines per object DissolveRef value if used by shader. - uint8 nDissolveRef; - // Summary: - // per-instance vis area stencil ref id - uint8 nClipVolumeStencilRef; - // Summary: - // Custom offset for sorting by distance. - uint8 nAfterWater; - - // Summary: - // Material layers bitmask -> which material layers are active. - uint8 nMaterialLayers; - - // Summary: - // Force a sort value for render elements. - uint8 nRenderList; - // Summary: - // Special sorter to ensure correct ordering even if parts of the 3DEngine are run in parallel - uint32 rendItemSorter; - // Summary: - // Render the first particle container only, instead of all the containers - bool mRenderFirstContainer; - - // Summary: - // Check if the preview would Show Wireframe - Vera,Confetti - bool bIsShowWireframe; - - //Summary: - // Force drawing static instead of deformable meshes - bool bForceDrawStatic; - - bool NoDecalReceiver; + int16 m_nLodA = -1; + int16 m_nLodB = -1; + uint8 m_nDissolveRef = 0; }; diff --git a/Code/Legacy/CryCommon/IShader.h b/Code/Legacy/CryCommon/IShader.h index 5f00eb56d3..93f8534dfc 100644 --- a/Code/Legacy/CryCommon/IShader.h +++ b/Code/Legacy/CryCommon/IShader.h @@ -9,9 +9,6 @@ // Description : Shaders common interface. - -#ifndef CRYINCLUDE_CRYCOMMON_ISHADER_H -#define CRYINCLUDE_CRYCOMMON_ISHADER_H #pragma once @@ -20,19 +17,17 @@ #endif #include "smartptr.h" -#include "Cry_Vector2.h" + #include "Cry_Vector3.h" -#include "Cry_Matrix33.h" + #include "Cry_Color.h" #include "smartptr.h" -#include // <> required for Interfuscator -#include "smartptr.h" + #include "VertexFormats.h" #include -#include -#include -#include "Cry_XOptimise.h" + + #include #include @@ -43,9 +38,12 @@ class CREMesh; struct IRenderMesh; struct IShader; struct IVisArea; -class CShader; + class CRendElement; class CRendElementBase; +class CTexture; +class CTexAnim; +class CShader; class ITexAnim; struct SShaderPass; struct SShaderItem; @@ -192,7 +190,7 @@ enum ESamplerType union UParamVal { - byte m_Byte; + int8 m_Byte; bool m_Bool; short m_Short; int m_Int; @@ -215,7 +213,7 @@ struct SShaderParam uint8 m_eSemantic; uint8 m_Pad[3] = { 0 }; - inline void Construct() + void Construct() { memset(&m_Value, 0, sizeof(m_Value)); m_Type = eType_UNKNOWN; @@ -223,7 +221,8 @@ struct SShaderParam m_Name.clear(); m_Script.clear(); } - inline SShaderParam() + + SShaderParam() { Construct(); } @@ -246,18 +245,20 @@ struct SShaderParam } } - inline void Destroy() + void Destroy() { if (m_Type == eType_STRING) { delete [] m_Value.m_String; } } - inline ~SShaderParam() + + ~SShaderParam() { Destroy(); } - inline SShaderParam (const SShaderParam& src) + + SShaderParam (const SShaderParam& src) { m_Name = src.m_Name; m_Script = src.m_Script; @@ -274,7 +275,8 @@ struct SShaderParam m_Value = src.m_Value; } } - inline SShaderParam& operator = (const SShaderParam& src) + + SShaderParam& operator = (const SShaderParam& src) { this->~SShaderParam(); new(this)SShaderParam(src); @@ -348,7 +350,7 @@ struct SShaderParam static bool GetValue(uint8 eSemantic, AZStd::vector* Params, float* v, int nID); - inline void CopyValue(const SShaderParam& src) + void CopyValue(const SShaderParam& src) { if (m_Type == eType_STRING && this != &src) { @@ -366,131 +368,20 @@ struct SShaderParam m_Value = src.m_Value; } - inline void CopyValueNoString(const SShaderParam& src) + void CopyValueNoString(const SShaderParam& src) { assert(m_Type != eType_STRING && src.m_Type != eType_STRING); m_Value = src.m_Value; } - inline void CopyType(const SShaderParam& src) + void CopyType(const SShaderParam& src) { m_Type = src.m_Type; } }; -// Description: -// IShaderPublicParams can be used to hold a collection of the shader public params. -// Manipulate this collection, and use them during rendering by submit to the SRendParams. -struct IShaderPublicParams -{ - // - virtual ~IShaderPublicParams(){} - virtual void AddRef() = 0; - virtual void Release() = 0; - - // Description: - // Changes number of parameters in collection. - virtual void SetParamCount(int nParam) = 0; - - // Description: - // Retrieves number of parameters in collection. - virtual int GetParamCount() const = 0; - - // Description: - // Retrieves shader public parameter at specified index of the collection. - virtual SShaderParam& GetParam(int nIndex) = 0; - virtual const SShaderParam& GetParam(int nIndex) const = 0; - - // Description: - // Retrieves shader public parameter at specified index of the collection. - virtual SShaderParam* GetParamByName(const char* pszName) = 0; - virtual const SShaderParam* GetParamByName(const char* pszName) const = 0; - - virtual SShaderParam* GetParamBySemantic(uint8 eParamSemantic) = 0; - virtual const SShaderParam* GetParamBySemantic(uint8 eParamSemantic) const = 0; - - // Description: - // Sets a shader parameter (and if doesn't exists, add it to the parameters list). - virtual void SetParam(const char* pszName, UParamVal& pParam, EParamType nType = eType_FLOAT, uint8 eSemantic = 0) = 0; - - // Description: - // Assigns shader public parameter at specified index of the collection. - virtual void SetParam(int nIndex, const SShaderParam& param) = 0; - - // Description: - // Assigns existing shader parameters list. - virtual void SetShaderParams(const AZStd::vector& pParams) = 0; - - // Description: - // Adds a new shader public parameter at the end of the collection. - virtual void AddParam(const SShaderParam& param) = 0; - - // Description: - // Removes a shader public parameter - virtual void RemoveParamByName(const char* pszName) = 0; - virtual void RemoveParamBySemantic(uint8 eParamSemantic) = 0; - - // Description: - // Assigns collection of shader public parameters to the specified render params structure. - virtual void AssignToRenderParams(struct SRendParams& rParams) = 0; - - virtual uint8 GetSemanticByName(const char* pszName) = 0; - - // Description: - // Gets shader parameters. - virtual AZStd::vector* GetShaderParams() = 0; - virtual const AZStd::vector* GetShaderParams() const = 0; - // -}; - -//================================================================================= - -class CInputLightMaterial -{ -public: - CInputLightMaterial() - : m_Diffuse(0, 0, 0, 0) - , m_Specular(0, 0, 0, 0) - , m_Emittance(1, 1, 1, 0) - , m_Opacity(0) - , m_Smoothness(0) - { - // memset() - for (int i = 0; i < EFTT_MAX; i++) - { - m_Channels[i][0] = 0.0f, - m_Channels[i][1] = 1.0f; - } - } - - // scale & bias - ColorF m_Channels[EFTT_MAX][2]; - - // TODO: these will go away - ColorF m_Diffuse; - ColorF m_Specular; - ColorF m_Emittance; // RGB: Color, Alpha: Intensity (kcd/m2 or kilonits) - float m_Opacity; - float m_Smoothness; - - inline friend bool operator == (const CInputLightMaterial& m1, const CInputLightMaterial& m2) - { - return !memcmp(&m1, &m2, CInputLightMaterial::Size()); - } - - inline static int Size() - { - int nSize = sizeof(CInputLightMaterial); - return nSize; - } -}; - -class CTexture; -class CTexAnim; -#include - // Summary: // Vertex modificators definitions (must be 16 bit flag). @@ -505,170 +396,6 @@ class CTexAnim; // Note this is different than the technique flag FHF_POSITION_INVARIANT as that does custom behavior for terrain #define MDV_POSITION_INVARIANT 0x4000 -// Summary: -// Deformations/Morphing types. -enum EDeformType -{ - eDT_Unknown = 0, - eDT_SinWave = 1, - eDT_SinWaveUsingVtxColor = 2, - eDT_Bulge = 3, - eDT_Squeeze = 4, - eDT_Perlin2D = 5, - eDT_Perlin3D = 6, - eDT_FromCenter = 7, - eDT_Bending = 8, - eDT_ProcFlare = 9, - eDT_AutoSprite = 10, - eDT_Beam = 11, - eDT_FixedOffset = 12, -}; - -// Summary: -// Wave form evaluator flags. -enum EWaveForm -{ - eWF_None, - eWF_Sin, - eWF_HalfSin, - eWF_InvHalfSin, - eWF_Square, - eWF_Triangle, - eWF_SawTooth, - eWF_InvSawTooth, - eWF_Hill, - eWF_InvHill, -}; - -#define WFF_CLAMP 1 -#define WFF_LERP 2 - -// Summary: -// Wave form definition. -struct SWaveForm -{ - EWaveForm m_eWFType; - byte m_Flags; - - float m_Level; - float m_Level1; - float m_Amp; - float m_Amp1; - float m_Phase; - float m_Phase1; - float m_Freq; - float m_Freq1; - - SWaveForm(EWaveForm eWFType, float fLevel, float fAmp, float fPhase, float fFreq) - { - m_eWFType = eWFType; - m_Level = m_Level1 = fLevel; - m_Amp = m_Amp1 = fAmp; - m_Phase = m_Phase1 = fPhase; - m_Freq = m_Freq1 = fFreq; - } - - int Size() - { - int nSize = sizeof(SWaveForm); - return nSize; - } - SWaveForm() - { - memset(this, 0, sizeof(SWaveForm)); - } - bool operator == (const SWaveForm& wf) const - { - if (m_eWFType == wf.m_eWFType && m_Level == wf.m_Level && m_Amp == wf.m_Amp && m_Phase == wf.m_Phase && m_Freq == wf.m_Freq && m_Level1 == wf.m_Level1 && m_Amp1 == wf.m_Amp1 && m_Phase1 == wf.m_Phase1 && m_Freq1 == wf.m_Freq1 && m_Flags == wf.m_Flags) - { - return true; - } - return false; - } - - SWaveForm& operator += (const SWaveForm& wf) - { - m_Level += wf.m_Level; - m_Level1 += wf.m_Level1; - m_Amp += wf.m_Amp; - m_Amp1 += wf.m_Amp1; - m_Phase += wf.m_Phase; - m_Phase1 += wf.m_Phase1; - m_Freq += wf.m_Freq; - m_Freq1 += wf.m_Freq1; - return *this; - } -}; - -struct SWaveForm2 -{ - EWaveForm m_eWFType; - - float m_Level; - float m_Amp; - float m_Phase; - float m_Freq; - - SWaveForm2() - { - memset(this, 0, sizeof(SWaveForm2)); - } - bool operator == (const SWaveForm2& wf) const - { - if (m_eWFType == wf.m_eWFType && m_Level == wf.m_Level && m_Amp == wf.m_Amp && m_Phase == wf.m_Phase && m_Freq == wf.m_Freq) - { - return true; - } - return false; - } - - SWaveForm2& operator += (const SWaveForm2& wf) - { - m_Level += wf.m_Level; - m_Amp += wf.m_Amp; - m_Phase += wf.m_Phase; - m_Freq += wf.m_Freq; - return *this; - } -}; - -struct SDeformInfo -{ - EDeformType m_eType; - SWaveForm2 m_WaveX; - float m_fDividerX; - Vec3 m_vNoiseScale; - - SDeformInfo() - { - m_eType = eDT_Unknown; - m_fDividerX = 0.01f; - m_vNoiseScale = Vec3(1, 1, 1); - } - - inline bool operator == (const SDeformInfo& m) - { - if (m_eType == m.m_eType && - m_WaveX == m.m_WaveX && - m_vNoiseScale == m.m_vNoiseScale && - m_fDividerX == m.m_fDividerX) - { - return true; - } - - return false; - } - - int Size() - { - return sizeof(SDeformInfo); - } - - void GetMemoryUsage(ICrySizer* pSizer) const - { - pSizer->Add(*this); - } -}; //============================================================================== // CRenderObject @@ -734,21 +461,6 @@ struct SSkyInfo } }; -struct SBending -{ - Vec2 m_vBending; - float m_fMainBendingScale; - SWaveForm2 m_Waves[2]; - - SBending() - { - m_vBending.zero(); - m_fMainBendingScale = 1.f; - } - - Vec4 GetShaderConstants(float realTime) const; - void GetShaderConstantsStatic(float realTime, Vec4* vBendInfo) const; -}; // Description: // Interface for the skinnable objects (renderer calls its functions to get the skinning data). @@ -786,12 +498,6 @@ struct alignas(16) SRenderObjData uint64 m_nSubObjHideMask; - union - { - SBending* m_pBending; - }; - - SBending* m_BendingPrev; uint16 m_FogVolumeContribIdx[2]; @@ -819,8 +525,7 @@ struct alignas(16) SRenderObjData m_nCustomData = 0; m_nCustomFlags = 0; m_nHUDSilhouetteParams = 0; - m_pBending = nullptr; - m_BendingPrev = nullptr; + m_pShaderParams = nullptr; m_FogVolumeContribIdx[0] = m_FogVolumeContribIdx[1] = static_cast(-1); @@ -882,7 +587,7 @@ public: , m_IndirectId{0xFF} {} - inline bool IsValid() const + bool IsValid() const { return m_Id != 0xFFFF; } @@ -924,9 +629,9 @@ public: uint32 m_nMaterialLayers; //!< Which mtl layers active and how much to blend them - IRenderNode* m_pRenderNode; //!< Will define instance id. + _smart_ptr m_pCurrMaterial; //!< Parent material used for render object. - IRenderElement* m_pRE; //!< RenderElement used by this CRenderObject + PerInstanceConstantBufferKey m_PerInstanceConstantBufferKey; @@ -949,15 +654,15 @@ public: { Init(); } - ~CRenderObject() {}; + ~CRenderObject() {} //========================================================================================================= - inline Vec3 GetTranslation() const { return m_II.m_Matrix.GetTranslation(); } - inline float GetScaleX() const { return sqrt_tpl(m_II.m_Matrix(0, 0) * m_II.m_Matrix(0, 0) + m_II.m_Matrix(0, 1) * m_II.m_Matrix(0, 1) + m_II.m_Matrix(0, 2) * m_II.m_Matrix(0, 2)); } - inline float GetScaleZ() const { return sqrt_tpl(m_II.m_Matrix(2, 0) * m_II.m_Matrix(2, 0) + m_II.m_Matrix(2, 1) * m_II.m_Matrix(2, 1) + m_II.m_Matrix(2, 2) * m_II.m_Matrix(2, 2)); } + Vec3 GetTranslation() const { return m_II.m_Matrix.GetTranslation(); } + float GetScaleX() const { return sqrt_tpl(m_II.m_Matrix(0, 0) * m_II.m_Matrix(0, 0) + m_II.m_Matrix(0, 1) * m_II.m_Matrix(0, 1) + m_II.m_Matrix(0, 2) * m_II.m_Matrix(0, 2)); } + float GetScaleZ() const { return sqrt_tpl(m_II.m_Matrix(2, 0) * m_II.m_Matrix(2, 0) + m_II.m_Matrix(2, 1) * m_II.m_Matrix(2, 1) + m_II.m_Matrix(2, 2) * m_II.m_Matrix(2, 2)); } - inline void Init() + void Init() { m_ObjFlags = 0; m_nRenderQuality = 65535; @@ -976,11 +681,11 @@ public: m_fAlpha = 1.0f; m_nTextureID = -1; m_pCurrMaterial = nullptr; - m_pRE = nullptr; + m_PerInstanceConstantBufferKey = {}; m_nRTMask = 0; - m_pRenderNode = NULL; + m_NoDecalReceiver = false; m_data.Init(); @@ -989,13 +694,6 @@ public: ILINE Matrix34A& GetMatrix() { return m_II.m_Matrix; } - ILINE SRenderObjData* GetObjData() - { - return &m_data; - } - - IRenderElement* GetRE() { return m_pRE; } - void SetRE(IRenderElement* re) { m_pRE = re; } protected: @@ -1023,7 +721,7 @@ struct SResourceAsync { AZ_CLASS_ALLOCATOR(SResourceAsync, AZ::SystemAllocator, 0); int nReady; // 0: Not ready; 1: Ready; -1: Error - byte* pData; + int8* pData; EResClassName eClassName; // Resource class name char* Name; // Resource name union @@ -1131,164 +829,8 @@ enum ETexGenType ETG_Max }; -#define CASE_TEXMOD(var_name) \ - if (!_stricmp(#var_name, szParamName)) \ - { \ - var_name = fValue; \ - return true; \ - } \ -#define CASE_TEXMODANGLE(var_name) \ - if (!_stricmp(#var_name, szParamName)) \ - { \ - var_name = Degr2Word(fValue); \ - return true; \ - } \ -#define CASE_TEXMODBYTE(var_name) \ - if (!_stricmp(#var_name, szParamName)) \ - { \ - var_name = (byte)fValue; \ - return true; \ - } \ - -#define CASE_TEXMODBOOL(var_name) \ - if (!_stricmp(#var_name, szParamName)) \ - { \ - var_name = (fValue == 1.f); \ - return true; \ - } \ - -struct SEfTexModificator -{ - AZ_CLASS_ALLOCATOR(SEfTexModificator, AZ::SystemAllocator, 0); - bool SetMember(const char* szParamName, float fValue) - { - CASE_TEXMODBYTE(m_eTGType); - CASE_TEXMODBYTE(m_eRotType); - CASE_TEXMODBYTE(m_eMoveType[0]); - CASE_TEXMODBYTE(m_eMoveType[1]); - CASE_TEXMODBOOL(m_bTexGenProjected); - - CASE_TEXMOD(m_Tiling[0]); - CASE_TEXMOD(m_Tiling[1]); - CASE_TEXMOD(m_Tiling[2]); - CASE_TEXMOD(m_Offs[0]); - CASE_TEXMOD(m_Offs[1]); - CASE_TEXMOD(m_Offs[2]); - - CASE_TEXMODANGLE(m_Rot[0]); - CASE_TEXMODANGLE(m_Rot[1]); - CASE_TEXMODANGLE(m_Rot[2]); - CASE_TEXMODANGLE(m_RotOscRate[0]); - CASE_TEXMODANGLE(m_RotOscRate[1]); - CASE_TEXMODANGLE(m_RotOscRate[2]); - CASE_TEXMODANGLE(m_RotOscAmplitude[0]); - CASE_TEXMODANGLE(m_RotOscAmplitude[1]); - CASE_TEXMODANGLE(m_RotOscAmplitude[2]); - CASE_TEXMODANGLE(m_RotOscPhase[0]); - CASE_TEXMODANGLE(m_RotOscPhase[1]); - CASE_TEXMODANGLE(m_RotOscPhase[2]); - CASE_TEXMOD(m_RotOscCenter[0]); - CASE_TEXMOD(m_RotOscCenter[1]); - CASE_TEXMOD(m_RotOscCenter[2]); - - CASE_TEXMOD(m_OscRate[0]); - CASE_TEXMOD(m_OscRate[1]); - CASE_TEXMOD(m_OscAmplitude[0]); - CASE_TEXMOD(m_OscAmplitude[1]); - CASE_TEXMOD(m_OscPhase[0]); - CASE_TEXMOD(m_OscPhase[1]); - - return false; - } - - alignas(16) Matrix44 m_TexGenMatrix; - alignas(16) Matrix44 m_TexMatrix; - - float m_Tiling[3]; - float m_Offs[3]; - - float m_RotOscCenter[3]; - - float m_OscRate[2]; - float m_OscAmplitude[2]; - float m_OscPhase[2]; - - // This members are used only during updating of the matrices - float m_LastTime[2]; - float m_CurrentJitter[2]; - - uint16 m_RotOscPhase[3]; - uint16 m_Rot[3]; - uint16 m_RotOscRate[3]; - uint16 m_RotOscAmplitude[3]; - - uint8 m_eTGType; - uint8 m_eRotType; - uint8 m_eMoveType[2]; - bool m_bTexGenProjected; - - void Reset() - { - memset(this, 0, sizeof(*this)); - m_Tiling[0] = m_Tiling[1] = 1.0f; - } - inline SEfTexModificator() - { - Reset(); - } - inline SEfTexModificator(const SEfTexModificator& m) - { - if (&m != this) - { - memcpy(this, &m, sizeof(*this)); - } - } - SEfTexModificator& operator = (const SEfTexModificator& src) - { - if (&src != this) - { - this->~SEfTexModificator(); - new(this)SEfTexModificator(src); - } - return *this; - } - int Size() - { - return sizeof(*this); - } - - inline bool operator != (const SEfTexModificator& m) - { - return memcmp(this, &m, sizeof(*this)) != 0; - } - - inline bool isModified() - { - return ( m_eMoveType[0] != ETMM_NoChange || - m_eMoveType[1] != ETMM_NoChange || - m_eRotType != ETMR_NoChange || - m_Offs[0] != 0.0f || - m_Offs[1] != 0.0f || - m_Tiling[0] != 1.0f || - m_Tiling[1] != 1.0f || - m_Rot[0] != 0.0f || - m_Rot[1] != 0.0f || - m_Rot[2] != 0.0f ); - } -}; - -inline bool IsTextureModifierSupportedForTextureMap(EEfResTextures texture) -{ - // Custom uv modifiers are currently only supported for diffuse, detail, decal, 2nd diffuse, and emittance texture maps - if (texture == EFTT_DIFFUSE || texture == EFTT_DETAIL_OVERLAY || texture == EFTT_DECAL_OVERLAY || texture == EFTT_CUSTOM || texture == EFTT_EMITTANCE) - { - return true; - } - - return false; -} ////////////////////////////////////////////////////////////////////// #define FILTER_NONE -1 @@ -1307,81 +849,6 @@ inline bool IsTextureModifierSupportedForTextureMap(EEfResTextures texture) #define TADDR_MIRROR 2 #define TADDR_BORDER 3 -//============================================================================== -//------------------------------------------------------------------------------ -struct STexState -{ - struct - { - signed char m_nMinFilter : 8; - signed char m_nMagFilter : 8; - signed char m_nMipFilter : 8; - signed char m_nAddressU : 8; - signed char m_nAddressV : 8; - signed char m_nAddressW : 8; - signed char m_nAnisotropy : 8; - signed char padding : 8; - }; - DWORD m_dwBorderColor; - float m_MipBias; - void* m_pDeviceState; - bool m_bActive; - bool m_bComparison; - bool m_bSRGBLookup; - byte m_bPAD; - // NOTE: There are 4 more pad bytes that exist here because m_pDeviceState is a 64-bit pointer. - uint32 m_PadBytes; - - STexState () - { - // Make sure we clear everything, including "invisible" pad bytes. - memset(this, 0, sizeof(*this)); - } - STexState(int nFilter, bool bClamp) - { - memset(this, 0, sizeof(*this)); - int nAddress = bClamp ? TADDR_CLAMP : TADDR_WRAP; - SetFilterMode(nFilter); - SetClampMode(nAddress, nAddress, nAddress); - SetBorderColor(0); - } - STexState(int nFilter, int nAddressU, int nAddressV, int nAddressW, unsigned int borderColor) - { - memset(this, 0, sizeof(*this)); - SetFilterMode(nFilter); - SetClampMode(nAddressU, nAddressV, nAddressW); - SetBorderColor(borderColor); - } - - void Destroy(); - void Init(const STexState& src); - - ~STexState() { Destroy(); } - STexState(const STexState& src) { Init(src); } - STexState& operator = (const STexState& src) - { - this->~STexState(); - new(this)STexState(src); - return *this; - } - _inline friend bool operator == (const STexState& m1, const STexState& m2) - { - return (*(uint64*)&m1 == *(uint64*)&m2 && m1.m_dwBorderColor == m2.m_dwBorderColor && - m1.m_bActive == m2.m_bActive && m1.m_bComparison == m2.m_bComparison && m1.m_bSRGBLookup == m2.m_bSRGBLookup && - m1.m_MipBias == m2.m_MipBias); - } - void Release() - { - delete this; - } - - bool SetFilterMode(int nFilter); - bool SetClampMode(int nAddressU, int nAddressV, int nAddressW); - void SetBorderColor(DWORD dwColor); - void SetComparisonFilter(bool bEnable); - void PostCreate(); -}; - struct IRenderTarget { @@ -1390,569 +857,6 @@ struct IRenderTarget virtual void AddRef() = 0; }; -//============================================================================== -// FX shader texture sampler (description) -//------------------------------------------------------------------------------ -struct STexSamplerFX -{ -#if SHADER_REFLECT_TEXTURE_SLOTS - AZStd::string m_szUIName; - AZStd::string m_szUIDescription; -#endif - - AZStd::string m_szName; - AZStd::string m_szTexture; - - union - { - struct SHRenderTarget* m_pTarget; - IRenderTarget* m_pITarget; - }; - - int16 m_nTexState; - byte m_eTexType; // ETEX_Type e.g. eTT_2D or eTT_Cube - byte m_nSlotId; // EFTT_ index if it references one of the material texture slots, EFTT_MAX otherwise - uint32 m_nTexFlags; - - STexSamplerFX() - { - m_nTexState = -1; - m_eTexType = eTT_2D; - m_nSlotId = EFTT_MAX; - m_nTexFlags = 0; - m_pTarget = NULL; - } - - ~STexSamplerFX() - { - SAFE_RELEASE(m_pITarget); - } - - size_t Size() - { - size_t nSize = sizeof(*this); - nSize += m_szName.capacity(); - nSize += m_szTexture.capacity(); -#if SHADER_REFLECT_TEXTURE_SLOTS - nSize += m_szUIName.capacity(); - nSize += m_szUIDescription.capacity(); -#endif - return nSize; - } - - void GetMemoryUsage([[maybe_unused]] ICrySizer* pSizer) const - { - } - - uint32 GetTexFlags() { return m_nTexFlags; } - void Update(); - void PostLoad(); - NO_INLINE STexSamplerFX (const STexSamplerFX& src) - { - m_pITarget = src.m_pITarget; - if (m_pITarget) - { - m_pITarget->AddRef(); - } - m_szName = src.m_szName; - m_szTexture = src.m_szTexture; - m_nSlotId = src.m_nSlotId; - m_eTexType = src.m_eTexType; - m_nTexFlags = src.m_nTexFlags; - m_nTexState = src.m_nTexState; - -#if SHADER_REFLECT_TEXTURE_SLOTS - m_szUIName = src.m_szUIName; - m_szUIDescription = src.m_szUIDescription; -#endif - } - NO_INLINE STexSamplerFX& operator = (const STexSamplerFX& src) - { - this->~STexSamplerFX(); - new(this)STexSamplerFX(src); - return *this; - } - _inline friend bool operator != (const STexSamplerFX& m1, const STexSamplerFX& m2) - { - if (m1.m_szTexture != m2.m_szTexture || m1.m_eTexType != m2.m_eTexType || m1.m_nTexFlags != m2.m_nTexFlags) - { - return true; - } - return false; - } - _inline bool operator == (const STexSamplerFX& m1) - { - return !(*this != m1); - } - - bool Export(SShaderSerializeContext& SC); - bool Import(SShaderSerializeContext& SC, SSTexSamplerFX* pTS); -}; - - -//============================================================================== -// Resource texture sampler (runtime) -//------------------------------------------------------------------------------ -struct STexSamplerRT -{ - union - { - CTexture* m_pTex; - ITexture* m_pITex; - }; - - union - { - struct SHRenderTarget* m_pTarget; - IRenderTarget* m_pITarget; - }; - - union - { - CTexAnim* m_pAnimInfo; - ITexAnim* m_pIAnimInfo; - }; - - uint32 m_nTexFlags; - int16 m_nTexState; - - uint8 m_eTexType; // ETEX_Type e.g. eTT_2D or eTT_Cube - int8 m_nSamplerSlot; - int8 m_nTextureSlot; - - bool m_bGlobal; - - STexSamplerRT() - { - m_nTexState = -1; - m_pTex = NULL; - m_eTexType = eTT_2D; - m_nTexFlags = 0; - m_pTarget = NULL; - m_pAnimInfo = NULL; - m_nSamplerSlot = -1; - m_nTextureSlot = -1; - m_bGlobal = false; - } - ~STexSamplerRT() - { - Cleanup(); - } - - void Cleanup() - { - SAFE_RELEASE(m_pITex); - // TODO: ref counted deleting of m_pAnimInfo & m_pTarget! - CW - SAFE_RELEASE(m_pITarget); - SAFE_RELEASE(m_pIAnimInfo); - } - int Size() const - { - int nSize = sizeof(*this); - return nSize; - } - - void GetMemoryUsage([[maybe_unused]] ICrySizer* pSizer) const - { - } - - uint32 GetTexFlags() const { return m_nTexFlags; } - void Update(); - void PostLoad(); - - NO_INLINE STexSamplerRT (const STexSamplerRT& src) - { - m_pITex = src.m_pITex; - if (m_pITex) - { - m_pITex->AddRef(); - } - m_pITarget = src.m_pITarget; - if (m_pITarget) - { - m_pITarget->AddRef(); - } - m_pIAnimInfo = src.m_pIAnimInfo; - if (m_pIAnimInfo) - { - m_pIAnimInfo->AddRef(); - } - m_eTexType = src.m_eTexType; - m_nTexFlags = src.m_nTexFlags; - m_nTexState = src.m_nTexState; - m_nSamplerSlot = src.m_nSamplerSlot; - m_nTextureSlot = src.m_nTextureSlot; - m_bGlobal = src.m_bGlobal; - } - NO_INLINE STexSamplerRT& operator = (const STexSamplerRT& src) - { - this->~STexSamplerRT(); - new(this)STexSamplerRT(src); - return *this; - } - STexSamplerRT (const STexSamplerFX& src) - { - m_pITex = NULL; - m_pAnimInfo = NULL; - m_pITarget = src.m_pITarget; - if (m_pITarget) - { - m_pITarget->AddRef(); - } - m_eTexType = src.m_eTexType; - m_nTexFlags = src.m_nTexFlags; - m_nTexState = src.m_nTexState; - m_nSamplerSlot = -1; - m_nTextureSlot = -1; - m_bGlobal = (src.m_nTexFlags & FT_FROMIMAGE) != 0; - } - inline bool operator != (const STexSamplerRT& m) const - { - if (m_pTex != m.m_pTex || m_eTexType != m.m_eTexType || m_nTexFlags != m.m_nTexFlags || m_nTexState != m.m_nTexState) - { - return true; - } - return false; - } -}; - -//============================================================================== -//------------------------------------------------------------------------------ -struct SEfResTextureExt -{ - int32 m_nFrameUpdated; - int32 m_nUpdateFlags; - int32 m_nLastRecursionLevel; - SEfTexModificator* m_pTexModifier; - - SEfResTextureExt () - { - m_nFrameUpdated = -1; - m_nUpdateFlags = 0; - m_nLastRecursionLevel = 0; - m_pTexModifier = nullptr; - } - ~SEfResTextureExt () - { - Cleanup(); - } - void Cleanup() - { - SAFE_DELETE(m_pTexModifier); - } - inline bool operator != (const SEfResTextureExt& m) const - { - if (m_pTexModifier && m.m_pTexModifier) - { - return *m_pTexModifier != *m.m_pTexModifier; - } - if (!m_pTexModifier && !m.m_pTexModifier) - { - return false; - } - return true; - } - SEfResTextureExt(const SEfResTextureExt& src) - { - if (&src != this) - { - Cleanup(); - if (src.m_pTexModifier) - { - m_pTexModifier = new SEfTexModificator; - * m_pTexModifier = *src.m_pTexModifier; - } - m_nFrameUpdated = -1; - m_nUpdateFlags = src.m_nUpdateFlags; - m_nLastRecursionLevel = -1; - } - } - SEfResTextureExt& operator = (const SEfResTextureExt& src) - { - if (&src != this) - { - Cleanup(); - new(this)SEfResTextureExt(src); - } - return *this; - } - - void CopyTo(SEfResTextureExt* pTo) const - { - if (pTo && pTo != this) - { - pTo->Cleanup(); - pTo->m_nFrameUpdated = -1; - pTo->m_nUpdateFlags = m_nUpdateFlags; - pTo->m_nLastRecursionLevel = -1; - pTo->m_pTexModifier = nullptr; - if (m_pTexModifier) - { - pTo->m_pTexModifier = new SEfTexModificator; - *(pTo->m_pTexModifier) = *m_pTexModifier; - } - } - } - inline int Size() const - { - int nSize = sizeof(SEfResTextureExt); - if (m_pTexModifier) - { - nSize += m_pTexModifier->Size(); - } - return nSize; - } -}; - -//============================================================================== -// SEfResTexture - holds the actual data representing a texture and its associated -// sampler and modulator properties. -//------------------------------------------------------------------------------ -struct SEfResTexture -{ - AZStd::string m_Name; - bool m_bUTile; - bool m_bVTile; - signed char m_Filter; - - STexSamplerRT m_Sampler; - SEfResTextureExt m_Ext; - - void UpdateForCreate(int nTSlot); - void Update(int nTSlot); - void UpdateWithModifier(int nTSlot); - - inline bool operator != (const SEfResTexture& m) const - { - if (_stricmp(m_Name.c_str(), m.m_Name.c_str()) != 0 || - m_bUTile != m.m_bUTile || - m_bVTile != m.m_bVTile || - m_Filter != m.m_Filter || - m_Ext != m.m_Ext || - m_Sampler != m.m_Sampler) - { - return true; - } - return false; - } - - inline bool IsHasModificators() const - { - return (m_Ext.m_pTexModifier != NULL); - } - - //! Find out if the texture has modulator and if it requires per frame computation change - bool IsNeedTexTransform() const - { - if (!m_Ext.m_pTexModifier) - { - return false; - } - if (m_Ext.m_pTexModifier->m_eRotType != ETMR_NoChange || m_Ext.m_pTexModifier->m_eMoveType[0] != ETMM_NoChange || m_Ext.m_pTexModifier->m_eMoveType[1] != ETMM_NoChange) - { - return true; - } - return false; - } - - bool IsNeedTexGen() const - { - if (!m_Ext.m_pTexModifier) - { - return false; - } - if (m_Ext.m_pTexModifier->m_eTGType != ETG_Stream) - { - return true; - } - return false; - } - - inline float GetTiling(int n) const - { - if (!m_Ext.m_pTexModifier) - { - return 1.0f; - } - return m_Ext.m_pTexModifier->m_Tiling[n]; - } - - inline float GetOffset(int n) const - { - if (!m_Ext.m_pTexModifier) - { - return 0; - } - return m_Ext.m_pTexModifier->m_Offs[n]; - } - - inline SEfTexModificator* AddModificator() - { - if (!m_Ext.m_pTexModifier) - { - m_Ext.m_pTexModifier = new SEfTexModificator; - } - return m_Ext.m_pTexModifier; - } - - inline SEfTexModificator* GetModificator() const - { - if (!m_Ext.m_pTexModifier) - { - static SEfTexModificator dummy; - dummy.Reset(); - return &dummy; - } - - return m_Ext.m_pTexModifier; - } - - size_t Size() const - { - size_t nSize = sizeof(SEfResTexture) - sizeof(STexSamplerRT) - sizeof(SEfResTextureExt); - nSize += m_Name.size(); - nSize += m_Sampler.Size(); - nSize += m_Ext.Size(); - - return nSize; - } - - void GetMemoryUsage(ICrySizer* pSizer) const - { - pSizer->Add(*this); - pSizer->AddObject(m_Name); - pSizer->AddObject(m_Sampler); - } - - void Cleanup() - { - m_Sampler.Cleanup(); - m_Ext.Cleanup(); - } - - ~SEfResTexture() - { - Cleanup(); - } - - void Reset() - { - m_bUTile = true; - m_bVTile = true; - m_Filter = FILTER_NONE; - SAFE_DELETE(m_Ext.m_pTexModifier); - m_Ext.m_nFrameUpdated = -1; - } - - SEfResTexture (const SEfResTexture& src) - { - if (&src != this) - { - Cleanup(); - m_Sampler = src.m_Sampler; - m_Ext = src.m_Ext; - m_Name = src.m_Name; - m_bUTile = src.m_bUTile; - m_bVTile = src.m_bVTile; - m_Filter = src.m_Filter; - } - } - - SEfResTexture& operator = (const SEfResTexture& src) - { - if (&src != this) - { - Cleanup(); - new(this)SEfResTexture(src); - } - return *this; - } - void CopyTo(SEfResTexture* pTo) const - { - if (pTo && (pTo != this)) - { - pTo->Cleanup(); - pTo->m_Sampler = m_Sampler; - m_Ext.CopyTo(&pTo->m_Ext); - pTo->m_Name = m_Name; - pTo->m_bUTile = m_bUTile; - pTo->m_bVTile = m_bVTile; - pTo->m_Filter = m_Filter; - } - } - - SEfResTexture() - { - Reset(); - } -}; - -//============================================================================== -//------------------------------------------------------------------------------ -struct SBaseShaderResources -{ - AZStd::vector m_ShaderParams; - AZStd::string m_TexturePath; - const char* m_szMaterialName; - - float m_AlphaRef; - uint32 m_ResFlags; - - uint16 m_SortPrio; - - uint8 m_VoxelCoverage; - - size_t Size() const - { - size_t nSize = sizeof(SBaseShaderResources) + m_ShaderParams.size() * sizeof(SShaderParam); - return nSize; - } - - void GetMemoryUsage(ICrySizer* pSizer) const - { - pSizer->AddObject(m_ShaderParams); - } - - SBaseShaderResources& operator=(const SBaseShaderResources& src) - { - if (&src != this) - { - ReleaseParams(); - m_szMaterialName = src.m_szMaterialName; - m_ResFlags = src.m_ResFlags; - m_AlphaRef = src.m_AlphaRef; - m_VoxelCoverage = src.m_VoxelCoverage; - m_SortPrio = src.m_SortPrio; - m_ShaderParams = src.m_ShaderParams; - } - return *this; - } - - SBaseShaderResources() - { - m_ResFlags = 0; - m_AlphaRef = 0; - m_VoxelCoverage = 255; - m_SortPrio = 0; - m_szMaterialName = NULL; - } - - void ReleaseParams() - { - m_ShaderParams.clear(); - } - - virtual ~SBaseShaderResources() - { - ReleaseParams(); - } -}; - -//------------------------------------------------------------------------------ -typedef uint16 ResourceSlotIndex; -typedef AZStd::unordered_map TexturesResourcesMap; -typedef AZStd::unordered_map TexturesSlotsUsageMap; -//------------------------------------------------------------------------------ struct IRenderShaderResources { @@ -1963,8 +867,6 @@ struct IRenderShaderResources virtual bool HasLMConstants() const = 0; // properties - virtual void ToInputLM(CInputLightMaterial& lm) = 0; - virtual void SetInputLM(const CInputLightMaterial& lm) = 0; virtual ColorF GetColorValue(EEfResTextures slot) const = 0; virtual void SetColorValue(EEfResTextures slot, const ColorF& color) = 0; @@ -1982,9 +884,7 @@ struct IRenderShaderResources virtual SSkyInfo* GetSkyInfo() = 0; virtual void SetMaterialName(const char* szName) = 0; - virtual bool TextureSlotExists(ResourceSlotIndex slotId) const = 0; - virtual SEfResTexture* GetTextureResource(ResourceSlotIndex slotId) = 0; - virtual TexturesResourcesMap* GetTexturesResourceMap() = 0; + virtual AZStd::vector& GetParameters() = 0; virtual ColorF GetFinalEmittance() = 0; @@ -2001,23 +901,26 @@ struct IRenderShaderResources virtual void GetMemoryUsage(ICrySizer* pSizer) const = 0; // - inline bool IsEmissive() const + bool IsEmissive() const { // worst: *reinterpret_cast(&) > 0x00000000 // causes value to pass from FPU to CPU registers return GetStrengthValue(EFTT_EMITTANCE) > 0.0f; } - inline bool IsTransparent() const + + bool IsTransparent() const { // worst: *reinterpret_cast(&) < 0x3f800000 // causes value to pass from FPU to CPU registers return GetStrengthValue(EFTT_OPACITY) < 1.0f; } - inline bool IsAlphaTested() const + + bool IsAlphaTested() const { return GetAlphaRef() > 0.0f; } - inline bool IsInvisible() const + + bool IsInvisible() const { const float o = GetStrengthValue(EFTT_OPACITY); const float a = GetAlphaRef(); @@ -2027,75 +930,6 @@ struct IRenderShaderResources }; -struct SInputShaderResources - : public SBaseShaderResources -{ - CInputLightMaterial m_LMaterial; - TexturesResourcesMap m_TexturesResourcesMap; // a map of all textures resources used by the shader by name - SDeformInfo m_DeformInfo; - - size_t Size() const - { - size_t nSize = SBaseShaderResources::Size();// -sizeof(SEfResTexture) * m_TexturesResourcesMap.size(); - nSize += m_TexturePath.size(); - nSize += sizeof(SDeformInfo); - - for (auto& iter : m_TexturesResourcesMap) - { - nSize += iter.second.Size(); - } - return nSize; - } - - SInputShaderResources& operator=(const SInputShaderResources& src) - { - if (&src != this) - { - Cleanup(); // this will also remove all texture slots - SBaseShaderResources::operator = (src); - m_TexturePath = src.m_TexturePath; - m_DeformInfo = src.m_DeformInfo; - m_TexturesResourcesMap = src.m_TexturesResourcesMap; - m_LMaterial = src.m_LMaterial; - } - return *this; - } - - SInputShaderResources() {} - SInputShaderResources(struct IRenderShaderResources* pSrc) - { - pSrc->ConvertToInputResource(this); - m_ShaderParams = pSrc->GetParameters(); - } - - void Cleanup() - { - m_TexturesResourcesMap.clear(); - } - - virtual ~SInputShaderResources() - { - Cleanup(); - } - - bool IsEmpty(ResourceSlotIndex nTSlot) const - { - auto iter = m_TexturesResourcesMap.find(nTSlot); - return (iter != m_TexturesResourcesMap.end()) ? iter->second.m_Name.empty() : true; - } - - SEfResTexture* GetTextureResource(ResourceSlotIndex slotId) - { - auto iter = m_TexturesResourcesMap.find(slotId); - return (iter != m_TexturesResourcesMap.end()) ? &iter->second : nullptr; - } - - inline TexturesResourcesMap* GetTexturesResourceMap() - { - return &m_TexturesResourcesMap; - } -}; - //=================================================================================== // Shader gen structure (used for automatic shader script generating). @@ -2138,106 +972,6 @@ struct SInputShaderResources SHGD_TEX_OCC | SHGD_TEX_SPECULAR_2 | SHGD_TEX_EMITTANCE) -//------------------------------------------------------------------------------ -// Texture slot descriptor for shader -//------------------------------------------------------------------------------ -struct SShaderTextureSlot -{ - SShaderTextureSlot() - { - m_TexType = eTT_MaxTexType; - } - - AZStd::string m_Name; - AZStd::string m_Description; - byte m_TexType; // 2D, 3D, Cube etc.. - - void GetMemoryUsage(ICrySizer* pSizer) const - { - pSizer->AddObject(m_Name); - pSizer->AddObject(m_Description); - pSizer->AddObject(m_TexType); - } -}; - -//------------------------------------------------------------------------------ -// Shader's used texture slots -//------------------------------------------------------------------------------ -/* [Shader System] - To Do: bring that back to life after testing -struct SShaderTexSlots -{ - uint32 m_nRefCount; - TexturesSlotsUsageMap m_UsedTextureSlots; - - SShaderTexSlots() - { - m_nRefCount = 1; - } - - ~SShaderTexSlots() - { - for (auto& iter : m_UsedTextureSlots ) - { - SAFE_DELETE( iter.second ); - } - m_UsedTextureSlots.clear(); - } - void Release() - { - m_nRefCount--; - if (!m_nRefCount) - { - delete this; - } - } - - void GetMemoryUsage(ICrySizer* pSizer) const - { - pSizer->AddObject(m_UsedTextureSlots); - } - - SShaderTextureSlot* GetUsedTextureSlot(uint16 slotId) - { - auto iter = m_UsedTextureSlots.find(slotId); - return (iter != m_UsedTextureSlots.end()) ? iter->second : nullptr; - } -}; -*/ - -// [Shader System] - To Do: replace this with the code above after testing -struct SShaderTexSlots -{ - uint32 m_nRefCount; - SShaderTextureSlot* m_UsedTextureSlots[EFTT_MAX]; - SShaderTexSlots() - { - m_nRefCount = 1; - memset(m_UsedTextureSlots, 0, sizeof(m_UsedTextureSlots)); - } - ~SShaderTexSlots() - { - uint32 i; - for (i = 0; i < EFTT_MAX; i++) - { - SShaderTextureSlot* pSlot = m_UsedTextureSlots[i]; - SAFE_DELETE(pSlot); - } - } - void Release() - { - m_nRefCount--; - if (!m_nRefCount) - { - delete this; - } - } - - void GetMemoryUsage(ICrySizer* pSizer) const - { - pSizer->AddObject(m_UsedTextureSlots); - } -}; - //=================================================================================== enum EShaderType @@ -2291,33 +1025,6 @@ enum ERenderQuality eRQ_Max = 4 }; -// Summary: -// Shader profile flags . -#define SPF_LOADNORMALALPHA 0x1 - -struct SShaderProfile -{ - SShaderProfile() - : m_iShaderProfileQuality(eSQ_High) - , m_nShaderProfileFlags(SPF_LOADNORMALALPHA) - { - } - - EShaderQuality GetShaderQuality() const - { - return (EShaderQuality)CLAMP(m_iShaderProfileQuality, 0, eSQ_VeryHigh); - } - - void SetShaderQuality(const EShaderQuality& rValue) - { - m_iShaderProfileQuality = (int)rValue; - } - - // ---------------------------------------------------------------- - - int m_iShaderProfileQuality; // EShaderQuality e.g. eSQ_Medium, use Get/Set functions if possible - uint32 m_nShaderProfileFlags; // SPF_... -}; //==================================================================================== // Phys. material flags @@ -2350,39 +1057,6 @@ enum EShaderTechniqueID TTYPE_MAX }; -//==================================================================================== - -// EFSLIST_ lists -// Note - declaration order/index value has no explicit meaning. - -enum ERenderListID -{ - EFSLIST_INVALID = 0, // Don't use, internally used. - EFSLIST_PREPROCESS, // Pre-process items. - EFSLIST_GENERAL, // Opaque ambient_light+shadow passes. - EFSLIST_SHADOW_GEN, // Shadow map generation. - EFSLIST_DECAL, // Opaque or transparent decals. - EFSLIST_WATER_VOLUMES, // After decals. - EFSLIST_TRANSP, // Sorted by distance under-water render items. - EFSLIST_WATER, // Water-ocean render items. - EFSLIST_HDRPOSTPROCESS, // Hdr post-processing screen effects. - EFSLIST_AFTER_HDRPOSTPROCESS, // After hdr post-processing screen effects. - EFSLIST_POSTPROCESS, // Post-processing screen effects. - EFSLIST_AFTER_POSTPROCESS, // After post-processing screen effects. - EFSLIST_SHADOW_PASS, // Shadow mask generation (usually from from shadow maps). - EFSLIST_DEFERRED_PREPROCESS, // Pre-process before deferred passes. - EFSLIST_SKIN, // Skin rendering pre-process - EFSLIST_HALFRES_PARTICLES, // Half resolution particles - EFSLIST_PARTICLES_THICKNESS, // Particles thickness passes - EFSLIST_LENSOPTICS, // Lens-optics processing - EFSLIST_VOXELIZE, // Mesh voxelization - EFSLIST_EYE_OVERLAY, // Eye overlay layer requires special processing - EFSLIST_FOG_VOLUME, // Fog density injection passes. - EFSLIST_GPU_PARTICLE_CUBEMAP_COLLISION, // Cubemaps for GPU particle cubemap depth collision - EFSLIST_REFRACTIVE_SURFACE, // After decals, used for instance for the water surface that comes with water volumes. - - EFSLIST_NUM -}; //================================================================ // Different preprocess flags for shaders that require preprocessing (like recursive render to texture, screen effects, visibility check, ...) @@ -2502,35 +1176,15 @@ public: virtual void SetFlags2(int Flags) = 0; virtual void ClearFlags2(int Flags) = 0; virtual bool Reload(int nFlags, const char* szShaderName) = 0; - virtual AZStd::vector& GetPublicParams() = 0; + virtual int GetTexId () = 0; - virtual ITexture* GetBaseTexture(int* nPass, int* nTU) = 0; - virtual unsigned int GetUsedTextureTypes(void) = 0; - virtual SShaderTexSlots* GetUsedTextureSlots(int nTechnique) = 0; + virtual ECull GetCull(void) = 0; virtual int Size(int Flags) = 0; - virtual uint64 GetGenerationMask() = 0; - virtual size_t GetNumberOfUVSets() = 0; + virtual int GetTechniqueID(int nTechnique, int nRegisteredTechnique) = 0; virtual AZ::Vertex::Format GetVertexFormat(void) = 0; - // D3D Effects interface - virtual bool FXSetTechnique(const CCryNameTSCRC& Name) = 0; - virtual bool FXSetPSFloat(const CCryNameR& NameParam, const Vec4 fParams[], int nParams) = 0; - virtual bool FXSetCSFloat(const CCryNameR& NameParam, const Vec4 fParams[], int nParams) = 0; - virtual bool FXSetVSFloat(const CCryNameR& NameParam, const Vec4 fParams[], int nParams) = 0; - virtual bool FXSetGSFloat(const CCryNameR& NameParam, const Vec4 fParams[], int nParams) = 0; - - virtual bool FXSetPSFloat(const char* NameParam, const Vec4 fParams[], int nParams) = 0; - virtual bool FXSetCSFloat(const char* NameParam, const Vec4 fParams[], int nParams) = 0; - virtual bool FXSetVSFloat(const char* NameParam, const Vec4 fParams[], int nParams) = 0; - virtual bool FXSetGSFloat(const char* NameParam, const Vec4 fParams[], int nParams) = 0; - - virtual bool FXBegin(uint32* uiPassCount, uint32 nFlags) = 0; - virtual bool FXBeginPass(uint32 uiPass) = 0; - virtual bool FXCommit(const uint32 nFlags) = 0; - virtual bool FXEndPass() = 0; - virtual bool FXEnd() = 0; virtual EShaderType GetShaderType() = 0; virtual EShaderDrawType GetShaderDrawType() const = 0; @@ -2585,7 +1239,7 @@ struct SShaderItem // If you change this function please check bTransparent variable in CRenderMesh::Render(). // See also: // CRenderMesh::Render() - inline bool IsZWrite() const + bool IsZWrite() const { IShader* pSH = m_pShader; if (pSH->GetFlags() & (EF_NODRAW | EF_DECAL)) @@ -2613,103 +1267,6 @@ struct SShaderItem }; -////////////////////////////////////////////////////////////////////// -// define before including - -struct CRenderChunk -{ - bool m_bUsesBones; - CREMesh* pRE; // Pointer to the mesh. - - float m_texelAreaDensity; - - uint32 nFirstIndexId; - uint32 nNumIndices; - - uint32 nFirstVertId; - uint32 nNumVerts; - - uint16 m_nMatFlags; // Material flags from originally assigned material @see EMaterialFlags. - uint16 m_nMatID; // Material Sub-object id. - - // Index of sub-object that this chunk originates from, used by sub-object hide mask. - // @see IStatObj::GetSubObject - uint32 nSubObjectIndex; - - AZ::Vertex::Format m_vertexFormat; - - ////////////////////////////////////////////////////////////////////////// - CRenderChunk() - : m_bUsesBones(false) - , pRE(0) - , m_texelAreaDensity(1.0f) - , nFirstIndexId(0) - , nNumIndices(0) - , nFirstVertId(0) - , nNumVerts(0) - , m_nMatFlags(0) - , m_nMatID(0) - , nSubObjectIndex(0) - , m_vertexFormat(eVF_P3F_C4B_T2F) - { - } - - int Size() const; - - void GetMemoryUsage([[maybe_unused]] ICrySizer* pSizer) const - { - } -}; - -typedef DynArray TRenderChunkArray; - -////////////////////////////////////////////////////////////////////// -// DLights - -enum eDynamicLightFlags -{ - DLF_AREA_SPEC_TEX = BIT(0), - DLF_DIRECTIONAL = BIT(1), - DLF_BOX_PROJECTED_CM = BIT(2), - // BIT(3) DEPRECATED, Available for use - DLF_POST_3D_RENDERER = BIT(4), - DLF_CASTSHADOW_MAPS = BIT(5), - DLF_POINT = BIT(6), - DLF_PROJECT = BIT(7), - DLF_LIGHT_BEAM = BIT(8), - DLF_IGNORES_VISAREAS = BIT(10), - DLF_DEFERRED_CUBEMAPS = BIT(11), - DLF_HAS_CLIP_VOLUME = BIT(12), - DLF_DISABLED = BIT(13), - DLF_AREA_LIGHT = BIT(14), - DLF_USE_FOR_SVOGI = BIT(15), - // UNUSED = BIT(16), - DLF_FAKE = BIT(17), // No lighting, used for Flares, beams and such. - DLF_SUN = BIT(18), - DLF_LM = BIT(19), - DLF_THIS_AREA_ONLY = BIT(20), // Affects only current area/sector. - DLF_AMBIENT = BIT(21), // Ambient light (has name indicates, used for replacing ambient) - DLF_INDOOR_ONLY = BIT(22), // Do not affect height map. - DLF_VOLUMETRIC_FOG = BIT(23), // Affects volumetric fog. - DLF_ATTACH_TO_SUN = BIT(24), // Add only to Light Propagation Volume if it's possible. - DLF_TRACKVIEW_TIMESCRUBBING = BIT(25), // Add only to Light Propagation Volume if it's possible. - DLF_VOLUMETRIC_FOG_ONLY = BIT(26), // Affects only volumetric fog. - DLF_DEFERRED_LIGHT = BIT(27), // DEPRECATED. Remove once deferred shading by default - DLF_SPECULAROCCLUSION = BIT(28), // DEPRECATED. Remove all dependencies editor side, etc - DLF_DIFFUSEOCCLUSION = BIT(29), - DLF_CAST_TERRAIN_SHADOWS = BIT(30), // Include terrain in shadow casters - - DLF_LIGHTTYPE_MASK = (DLF_DIRECTIONAL | DLF_POINT | DLF_PROJECT | DLF_AREA_LIGHT) -}; - - -//Area light types -#define DLAT_SPHERE 0x1 -#define DLAT_RECTANGLE 0x2 -#define DLAT_POINT 0x4 - -#define DL_SHADOW_UPDATE_SHIFT 8 - #include // <> required for Interfuscator struct IAnimNode; @@ -2732,445 +1289,13 @@ protected: IAnimNode* m_pNode; }; -struct SOpticsInstanceParameters -{ - SOpticsInstanceParameters(float brightness = 0.0f, float size = 0.0f, const ColorF& color = ColorF(), bool valid = false) : - m_brightness(brightness), - m_size(size), m_color(color), - m_isValid(valid) {} - - float m_brightness; - float m_size; - ColorF m_color; - bool m_isValid; -}; #define MAX_RECURSION_LEVELS 2 -struct SRenderLight -{ - SRenderLight() - { - memset(this, 0, sizeof(SRenderLight)); - m_fLightFrustumAngle = 45.0f; - m_fRadius = 4.0f; - m_fBaseRadius = 4.0f; - m_SpecMult = m_BaseSpecMult = 1.0f; - m_ProjMatrix.SetIdentity(); - m_ObjMatrix.SetIdentity(); - m_BaseObjMatrix.SetIdentity(); - m_sName = ""; - m_pLightAnim = NULL; - m_fAreaWidth = 1; - m_fAreaHeight = 1; - m_fBoxWidth = 1.0f; - m_fBoxHeight = 1.0f; - m_fBoxLength = 1.0f; - m_fTimeScrubbed = 0.0f; - - m_fShadowBias = 1.0f; - m_fShadowSlopeBias = 1.0f; - m_fShadowResolutionScale = 1.0f; - m_nShadowMinResolution = 0; - m_fShadowUpdateMinRadius = m_fRadius; - m_nShadowUpdateRatio = 1 << DL_SHADOW_UPDATE_SHIFT; - m_nEntityId = (uint32) - 1; - m_LensOpticsFrustumAngle = 255; - m_nAttenFalloffMax = 255; - m_fAttenuationBulbSize = 0.1f; - m_fProbeAttenuation = 1.0f; - m_lightId = -1; - } - - const Vec3& GetPosition() const - { - return m_Origin; - } - void SetPosition(const Vec3& vPos) - { - m_BaseOrigin = vPos; - m_Origin = vPos; - } - - // Summary: - // Use this instead of m_Color. - void SetLightColor(const ColorF& cColor) - { - m_Color = cColor; - m_BaseColor = cColor; - } - - ITexture* GetDiffuseCubemap() const - { - return m_pDiffuseCubemap; - } - - ITexture* GetSpecularCubemap() const - { - return m_pSpecularCubemap; - } - - ITexture* GetLightTexture() const - { - return m_pLightImage ? m_pLightImage : NULL; - } - - void SetOpticsParams(const SOpticsInstanceParameters& params) - { - m_opticsParams = params; - } - - const SOpticsInstanceParameters& GetOpticsParams() const - { - return m_opticsParams; - } - - void GetMemoryUsage([[maybe_unused]] ICrySizer* pSizer) const { /*LATER*/} - - void AcquireResources() - { - if (m_Shader.m_pShader) - { - m_Shader.m_pShader->AddRef(); - } - if (m_pLightImage) - { - m_pLightImage->AddRef(); - } - if (m_pDiffuseCubemap) - { - m_pDiffuseCubemap->AddRef(); - } - if (m_pSpecularCubemap) - { - m_pSpecularCubemap->AddRef(); - } - if (m_pLightAnim) - { - m_pLightAnim->AddRef(); - } - if (m_pLightAttenMap) - { - m_pLightAttenMap->AddRef(); - } - } - - void DropResources() - { - SAFE_RELEASE(m_Shader.m_pShader); - SAFE_RELEASE(m_pLightImage); - SAFE_RELEASE(m_pDiffuseCubemap); - SAFE_RELEASE(m_pSpecularCubemap); - SAFE_RELEASE(m_pLightAnim); - SAFE_RELEASE(m_pLightAttenMap); - } - - void SetAnimSpeed(float fAnimSpeed) - { - m_nAnimSpeed = aznumeric_caster(int_round(min(fAnimSpeed * 255.0f / 4.0f, 255.0f))); // Assuming speed multiplier in range [0, 4] - } - - float GetAnimSpeed() const - { - return ((float) m_nAnimSpeed) * (4.0f / 255.0f); - } - - void SetFalloffMax(float fMax) - { - m_nAttenFalloffMax = aznumeric_caster(int_round(fMax * 255.0f)); - } - - float GetFalloffMax() const - { - return ((float) m_nAttenFalloffMax) / 255.0f; - } - - // Calculate the scissor rectangle in screenspace that encompasses this light. These values are used to set - // the hardware scissor rect in order to clip the min/max 2d extents for the light. - // These values must be calculated and read on the render thread due to the VR tracking updates performed on the render thread. - void CalculateScissorRect(); - - //========================================================================================================================= - - // Commonly used on most code paths (64 bytes) - int16 m_Id; // Shader id - uint8 m_nStencilRef[2]; - uint32 m_n3DEngineUpdateFrameID; - uint32 m_nEntityId; // Unique entity id - uint32 m_Flags; // light flags (DLF_etc). - Vec3 m_Origin; // World space position - float m_fRadius; // xyz= Origin, w=Radius. (Do not change order) - ColorF m_Color; // w component unused - todo pack spec mul into alpha (post c3 - touches quite some code) - float m_SpecMult; // Specular multiplier - float m_fHDRDynamic; // 0 to get the same results in HDR, <0 to get darker, >0 to get brighter. - int16 m_sX; // Scissor parameters (2d extent). - int16 m_sY; - int16 m_sWidth; - int16 m_sHeight; - int m_lightId; - - // Env. probes - ITexture* m_pDiffuseCubemap; // Very small cubemap texture to make a lookup for diffuse. - ITexture* m_pSpecularCubemap; // Cubemap texture to make a lookup for local specular. - Vec3 m_ProbeExtents; - float m_fBoxWidth; - float m_fBoxHeight; - float m_fBoxLength; - float m_fProbeAttenuation; // Can be used fade out distant probes, or to manually blend between multiple co-located probes - uint8 m_nAttenFalloffMax; - uint8 m_nSortPriority; - - // Shadow map fields - struct ILightSource* m_pOwner; - ShadowMapFrustum** m_pShadowMapFrustums; - float m_fShadowBias; - float m_fShadowSlopeBias; - float m_fShadowResolutionScale; - float m_fShadowUpdateMinRadius; - uint16 m_nShadowMinResolution; - uint16 m_nShadowUpdateRatio; - uint8 m_ShadowChanMask : 4; - uint8 m_ShadowMaskIndex : 4; - - // Projector - ITexture* m_pLightAttenMap; // User can specify custom light attenuation gradient - ITexture* m_pLightImage; - Matrix44 m_ProjMatrix; - Matrix34 m_ObjMatrix; - float m_fLightFrustumAngle; - float m_fProjectorNearPlane; - - // Misc fields. todo: put in cold data struct (post c3 - touches quite some code) - const char* m_sName; // Optional name of the light source. - SShaderItem m_Shader; // Shader item - CRenderObject* m_pObject[MAX_RECURSION_LEVELS]; // Object for light coronas and light flares. - ILightAnimWrapper* m_pLightAnim; - - Matrix34 m_BaseObjMatrix; - float m_fTimeScrubbed; - Vec3 m_BaseOrigin; // World space position. - float m_fBaseRadius; // Base radius - ColorF m_BaseColor; // w component unused.. - float m_BaseSpecMult; - - float m_fAttenuationBulbSize; - - float m_fAreaWidth; - float m_fAreaHeight; - - float m_fFogRadialLobe; // The blend ratio of two radial lobe for volumetric fog. - - AZ::u8 m_nAnimSpeed; - AZ::u8 m_nLightStyle; - AZ::u8 m_nLightPhase; - AZ::u8 m_LensOpticsFrustumAngle; // from 0 to 255, The range will be adjusted from 0 to 360 when used. - - IClipVolume* m_pClipVolumes[2]; - - SOpticsInstanceParameters m_opticsParams; // Per instance optics parameters -}; - -////////////////////////////////////////////////////////////////////// -class CDLight - : public SRenderLight -{ -public: - CDLight() - : SRenderLight() - { - } - - ~CDLight() - { - DropResources(); - } - - // Summary: - // Good for debugging. - bool IsOk() const - { - for (int i = 0; i < 3; ++i) - { - if (m_Color[i] < 0 || m_Color[i] > 100.0f || _isnan(m_Color[i])) - { - return false; - } - if (m_BaseColor[i] < 0 || m_BaseColor[i] > 100.0f || _isnan(m_BaseColor[i])) - { - return false; - } - } - return true; - } - - CDLight(const CDLight& other) - { - operator=(other); - } - - CDLight& operator=(const CDLight& dl) - { - if (this == &dl) - { - return *this; - } - - DropResources(); - - m_pOwner = dl.m_pOwner; - memcpy(m_pObject, dl.m_pObject, sizeof(m_pObject)); - m_Shader = dl.m_Shader; - m_pShadowMapFrustums = dl.m_pShadowMapFrustums; - m_pDiffuseCubemap = dl.m_pDiffuseCubemap; - m_pSpecularCubemap = dl.m_pSpecularCubemap; - m_pLightImage = dl.m_pLightImage; - m_pLightAttenMap = dl.m_pLightAttenMap; - m_sName = dl.m_sName; - m_ProjMatrix = dl.m_ProjMatrix; - m_ObjMatrix = dl.m_ObjMatrix; - m_BaseObjMatrix = dl.m_BaseObjMatrix; - m_Color = dl.m_Color; - m_BaseColor = dl.m_BaseColor; - m_Origin = dl.m_Origin; - m_BaseOrigin = dl.m_BaseOrigin; - m_fRadius = dl.m_fRadius; - m_fBaseRadius = dl.m_fBaseRadius; - m_ProbeExtents = dl.m_ProbeExtents; - m_SpecMult = dl.m_SpecMult; - m_BaseSpecMult = dl.m_BaseSpecMult; - m_fShadowBias = dl.m_fShadowBias; - m_fShadowSlopeBias = dl.m_fShadowSlopeBias; - m_fShadowResolutionScale = dl.m_fShadowResolutionScale; - m_fHDRDynamic = dl.m_fHDRDynamic; - m_LensOpticsFrustumAngle = dl.m_LensOpticsFrustumAngle; - m_fLightFrustumAngle = dl.m_fLightFrustumAngle; - m_fProjectorNearPlane = dl.m_fProjectorNearPlane; - m_Flags = dl.m_Flags; - m_Id = dl.m_Id; - m_n3DEngineUpdateFrameID = dl.m_n3DEngineUpdateFrameID; - m_sX = dl.m_sX; - m_sY = dl.m_sY; - m_sWidth = dl.m_sWidth; - m_sHeight = dl.m_sHeight; - m_nLightStyle = dl.m_nLightStyle; - m_nLightPhase = dl.m_nLightPhase; - m_ShadowChanMask = dl.m_ShadowChanMask; - m_pLightAnim = dl.m_pLightAnim; - m_fAreaWidth = dl.m_fAreaWidth; - m_fAreaHeight = dl.m_fAreaHeight; - m_fBoxWidth = dl.m_fBoxWidth; - m_fBoxHeight = dl.m_fBoxHeight; - m_fBoxLength = dl.m_fBoxLength; - m_fTimeScrubbed = dl.m_fTimeScrubbed; - m_nShadowMinResolution = dl.m_nShadowMinResolution; - m_fShadowUpdateMinRadius = dl.m_fShadowUpdateMinRadius; - m_nShadowUpdateRatio = dl.m_nShadowUpdateRatio; - m_nAnimSpeed = dl.m_nAnimSpeed; - m_nSortPriority = dl.m_nSortPriority; - m_nAttenFalloffMax = dl.m_nAttenFalloffMax; - m_fProbeAttenuation = dl.m_fProbeAttenuation; - m_fAttenuationBulbSize = dl.m_fAttenuationBulbSize; - m_fFogRadialLobe = dl.m_fFogRadialLobe; - m_nEntityId = dl.m_nEntityId; - memcpy(m_nStencilRef, dl.m_nStencilRef, sizeof(m_nStencilRef)); - memcpy(m_pClipVolumes, dl.m_pClipVolumes, sizeof(m_pClipVolumes)); - m_opticsParams = dl.m_opticsParams; - AcquireResources(); - - return *this; - } - - // Summary: - // Use this instead of m_Color. - const ColorF& GetFinalColor([[maybe_unused]] const ColorF& cColor) const - { - return m_Color; - } - - // Summary: - // Use this instead of m_Color. - void SetSpecularMult(float fSpecMult) - { - m_SpecMult = fSpecMult; - m_BaseSpecMult = fSpecMult; - } - - void SetShadowBiasParams(float fShadowBias, float fShadowSlopeBias) - { - m_fShadowBias = fShadowBias; - m_fShadowSlopeBias = fShadowSlopeBias; - } - - // Summary: - // Use this instead of m_Color. - const float& GetSpecularMult() const - { - return m_SpecMult; - } - void SetMatrix(const Matrix34& Matrix, bool reset = true) - { - // Scale the cubemap to adjust the default 45 degree 1/2 angle fustrum to - // the desired angle (0 to 90 degrees). - float scaleFactor = tan_tpl((90.0f - m_fLightFrustumAngle) * gf_PI / 180.0f); - m_ProjMatrix = Matrix33(Matrix) * Matrix33::CreateScale(Vec3(1, scaleFactor, scaleFactor)); - Matrix44 transMat; - transMat.SetIdentity(); - transMat(3, 0) = -Matrix(0, 3); - transMat(3, 1) = -Matrix(1, 3); - transMat(3, 2) = -Matrix(2, 3); - m_ProjMatrix = transMat * m_ProjMatrix; - m_ObjMatrix = Matrix; - - // Remove any scale - m_ObjMatrix.GetColumn0().NormalizeSafe(Vec3_OneX); - m_ObjMatrix.GetColumn1().NormalizeSafe(Vec3_OneY); - m_ObjMatrix.GetColumn2().NormalizeSafe(Vec3_OneZ); - - if (reset) - { - m_BaseObjMatrix = m_ObjMatrix; - } - } - - void SetSpecularCubemap(ITexture* texture) - { - m_pSpecularCubemap = texture; - } - - void SetDiffuseCubemap(ITexture* texture) - { - m_pDiffuseCubemap = texture; - } - - void ReleaseCubemaps() - { - SAFE_RELEASE(m_pSpecularCubemap); - SAFE_RELEASE(m_pDiffuseCubemap); - } -}; - #define DECAL_HAS_NORMAL_MAP (1 << 0) #define DECAL_STATIC (1 << 1) #define DECAL_HAS_SPECULAR_MAP (1 << 2) -struct SDeferredDecal -{ - SDeferredDecal() - { - ZeroStruct(*this); - rectTexture.w = rectTexture.h = 1.f; - angleAttenuation = 1.0f; - } - - Matrix34 projMatrix; // defines where projection should be applied in the world - _smart_ptr pMaterial; // decal material - float fAlpha; // transparency of decal, used mostly for distance fading - float fGrowAlphaRef; - float angleAttenuation; - RectF rectTexture; // subset of texture to render - uint32 nFlags; - uint8 nSortOrder; // user defined sort order -}; // Summary: // Runtime shader flags for HW skinning. @@ -3189,124 +1314,5 @@ enum EBoneTypes eBoneType_Count, }; -// Summary: -// Shader graph support. -enum EGrBlockType -{ - eGrBlock_Unknown, - eGrBlock_VertexInput, - eGrBlock_VertexOutput, - eGrBlock_PixelInput, - eGrBlock_PixelOutput, - eGrBlock_Texture, - eGrBlock_Sampler, - eGrBlock_Function, - eGrBlock_Constant, -}; - -enum EGrBlockSamplerType -{ - eGrBlockSampler_Unknown, - eGrBlockSampler_2D, - eGrBlockSampler_3D, - eGrBlockSampler_Cube, - eGrBlockSampler_Bias2D, - eGrBlockSampler_BiasCube, -}; - -enum EGrNodeType -{ - eGrNode_Unknown, - eGrNode_Input, - eGrNode_Output, -}; - -enum EGrNodeFormat -{ - eGrNodeFormat_Unknown, - eGrNodeFormat_Float, - eGrNodeFormat_Vector, - eGrNodeFormat_Matrix, - eGrNodeFormat_Int, - eGrNodeFormat_Bool, - eGrNodeFormat_Texture2D, - eGrNodeFormat_Texture3D, - eGrNodeFormat_TextureCUBE, -}; - -enum EGrNodeIOSemantic -{ - eGrNodeIOSemantic_Unknown, - eGrNodeIOSemantic_Custom, - eGrNodeIOSemantic_VPos, - eGrNodeIOSemantic_Color0, - eGrNodeIOSemantic_Color1, - eGrNodeIOSemantic_Color2, - eGrNodeIOSemantic_Color3, - eGrNodeIOSemantic_Normal, - eGrNodeIOSemantic_TexCoord0, - eGrNodeIOSemantic_TexCoord1, - eGrNodeIOSemantic_TexCoord2, - eGrNodeIOSemantic_TexCoord3, - eGrNodeIOSemantic_TexCoord4, - eGrNodeIOSemantic_TexCoord5, - eGrNodeIOSemantic_TexCoord6, - eGrNodeIOSemantic_TexCoord7, - eGrNodeIOSemantic_Tangent, - eGrNodeIOSemantic_Binormal, -}; - -struct SShaderGraphFunction -{ - AZStd::string m_Data; - AZStd::string m_Name; - std::vector inParams; - std::vector outParams; - std::vector szInTypes; - std::vector szOutTypes; -}; - -struct SShaderGraphNode -{ - EGrNodeType m_eType; - EGrNodeFormat m_eFormat; - EGrNodeIOSemantic m_eSemantic; - AZStd::string m_CustomSemantics; - AZStd::string m_Name; - bool m_bEditable; - bool m_bWasAdded; - SShaderGraphFunction* m_pFunction; - AZStd::vector m_Properties; - - SShaderGraphNode() - { - m_eType = eGrNode_Unknown; - m_eFormat = eGrNodeFormat_Unknown; - m_eSemantic = eGrNodeIOSemantic_Unknown; - m_bEditable = false; - m_bWasAdded = false; - m_pFunction = NULL; - } - ~SShaderGraphNode(); -}; - - -typedef std::vector FXShaderGraphNodes; -typedef FXShaderGraphNodes::iterator FXShaderGraphNodeItor; - -struct SShaderGraphBlock -{ - EGrBlockType m_eType; - EGrBlockSamplerType m_eSamplerType; - AZStd::string m_ClassName; - FXShaderGraphNodes m_Nodes; - - ~SShaderGraphBlock(); -}; - -typedef std::vector FXShaderGraphBlocks; -typedef FXShaderGraphBlocks::iterator FXShaderGraphBlocksItor; #include - -#endif // CRYINCLUDE_CRYCOMMON_ISHADER_H diff --git a/Code/Legacy/CryCommon/ISplines.h b/Code/Legacy/CryCommon/ISplines.h index 2353489163..ff67ae0d56 100644 --- a/Code/Legacy/CryCommon/ISplines.h +++ b/Code/Legacy/CryCommon/ISplines.h @@ -11,7 +11,6 @@ #define CRYINCLUDE_CRYCOMMON_ISPLINES_H #pragma once -#include #include ////////////////////////////////////////////////////////////////////////// @@ -638,7 +637,7 @@ namespace spline ////////////////////////////////////////////////////////////////////////// static void Reflect(AZ::SerializeContext* serializeContext) {} - + inline void add_ref() { ++m_refCount; diff --git a/Code/Legacy/CryCommon/IStatObj.h b/Code/Legacy/CryCommon/IStatObj.h index 4921ab3a25..a268f40406 100644 --- a/Code/Legacy/CryCommon/IStatObj.h +++ b/Code/Legacy/CryCommon/IStatObj.h @@ -11,20 +11,20 @@ #include "smartptr.h" // TYPEDEF_AUTOPTR #include "IMaterial.h" +#include "ISerialize.h" // forward declarations ////////////////////////////////////////////////////////////////////// struct ShadowMapFrustum; struct SRenderingPassInfo; struct SRendItemSorter; -struct IShader; +struct ITetrLattice; struct SPhysGeomArray; struct CStatObj; class CRenderObject; class CDLight; class IReadStream; -class CRenderObject; class CLodValue; @@ -39,9 +39,11 @@ class CRenderObject; struct SMeshLodInfo; #include "CryHeaders.h" +#include "Cry_Color.h" #include "Cry_Math.h" #include "Cry_Geo.h" -#include "IPhysics.h" +#include "CrySizer.h" +#include "stridedptr.h" #define MAX_STATOBJ_LODS_NUM 6 @@ -399,10 +401,6 @@ struct IStatObj // Set the physic representation virtual void SetPhysGeom(phys_geometry* pPhysGeom, int nType = 0) = 0; - // Description: - // Returns a tetrahedral lattice, if any (used for breakable objects) - virtual ITetrLattice* GetTetrLattice() = 0; - virtual float GetAIVegetationRadius() const = 0; virtual void SetAIVegetationRadius(float radius) = 0; @@ -635,15 +633,6 @@ struct IStatObj // adds a new sub object virtual IStatObj::SSubObject& AddSubObject(IStatObj* pStatObj) = 0; - // Summary: - // Adds subobjects to pent, meshes as parts, joint helpers as breakable joints - virtual int PhysicalizeSubobjects(IPhysicalEntity* pent, const Matrix34* pMtx, float mass, float density = 0.0f, int id0 = 0, strided_pointer pJointsIdMap = 0, const char* szPropsOverride = 0) = 0; - // Summary: - // Adds all phys geometries to pent, assigns ids starting from id; takes mass and density from the StatObj properties if not set in pgp - // for compound objects calls PhysicalizeSubobjects - // returns the physical id of the last physicalized part - virtual int Physicalize(IPhysicalEntity* pent, pe_geomparams* pgp, int id = 0, const char* szPropsOverride = 0) = 0; - virtual bool IsDeformable() = 0; ////////////////////////////////////////////////////////////////////////// @@ -768,12 +757,6 @@ struct IStatObj virtual bool UpdateStreamableComponents(float fImportance, const Matrix34A& objMatrix, bool bFullUpdate, int nNewLod) = 0; - virtual void RenderInternal(CRenderObject* pRenderObject, uint64 nSubObjectHideMask, const CLodValue& lodValue, const SRenderingPassInfo& passInfo, const SRendItemSorter& rendItemSorter, bool forceStaticDraw) = 0; - virtual void RenderObjectInternal(CRenderObject* pRenderObject, int nLod, uint8 uLodDissolveRef, bool dissolveOut, const SRenderingPassInfo& passInfo, const SRendItemSorter& rendItemSorter, bool forceStaticDraw) = 0; - virtual void RenderSubObject(CRenderObject* pRenderObject, int nLod, int nSubObjId, const Matrix34A& renderTM, const SRenderingPassInfo& passInfo, const SRendItemSorter& rendItemSorter, bool forceStaticDraw) = 0; - virtual void RenderSubObjectInternal(CRenderObject* pRenderObject, int nLod, const SRenderingPassInfo& passInfo, const SRendItemSorter& rendItemSorter, bool forceStaticDraw) = 0; - virtual void RenderRenderMesh(CRenderObject* pObj, struct SInstancingInfo* pInstInfo, const SRenderingPassInfo& passInfo, const SRendItemSorter& rendItemSorter) = 0; - virtual SPhysGeomArray& GetArrPhysGeomInfo() = 0; virtual bool IsLodsAreLoadedFromSeparateFile() = 0; diff --git a/Code/Legacy/CryCommon/ISystem.h b/Code/Legacy/CryCommon/ISystem.h index 3c13ac04d8..b213978d16 100644 --- a/Code/Legacy/CryCommon/ISystem.h +++ b/Code/Legacy/CryCommon/ISystem.h @@ -624,8 +624,6 @@ struct SSystemGlobalEnvironment ISystem* pSystem = nullptr; ILog* pLog; IMovieSystem* pMovieSystem; - INameTable* pNameTable; - IRenderer* pRenderer; ILyShine* pLyShine; SharedEnvironmentInstance* pSharedEnvironment; @@ -852,7 +850,6 @@ struct ISystem // virtual IViewSystem* GetIViewSystem() = 0; virtual ILevelSystem* GetILevelSystem() = 0; - virtual INameTable* GetINameTable() = 0; virtual ICmdLine* GetICmdLine() = 0; virtual ILog* GetILog() = 0; virtual AZ::IO::IArchive* GetIPak() = 0; diff --git a/Code/Legacy/CryCommon/LyShine/Animation/IUiAnimation.h b/Code/Legacy/CryCommon/LyShine/Animation/IUiAnimation.h index e04fb6ada7..e2ea9a39c2 100644 --- a/Code/Legacy/CryCommon/LyShine/Animation/IUiAnimation.h +++ b/Code/Legacy/CryCommon/LyShine/Animation/IUiAnimation.h @@ -10,9 +10,7 @@ #include #include #include -#include #include -#include #include #include #include @@ -191,7 +189,7 @@ public: private: EUiAnimParamType m_type; - CCryName m_name; + AZStd::string m_name; }; // The data required to identify a specific parameter/property on an AZ component on an AZ entity diff --git a/Code/Legacy/CryCommon/LyShine/IRenderGraph.h b/Code/Legacy/CryCommon/LyShine/IRenderGraph.h index 561e07243b..716e0f7417 100644 --- a/Code/Legacy/CryCommon/LyShine/IRenderGraph.h +++ b/Code/Legacy/CryCommon/LyShine/IRenderGraph.h @@ -8,6 +8,7 @@ #pragma once #include +#include #include namespace AZ @@ -48,20 +49,11 @@ namespace LyShine //! End rendering to a texture virtual void EndRenderToTexture() = 0; - //! Add an indexed triangle list primitive to the render graph with given render state - virtual void AddPrimitive(IRenderer::DynUiPrimitive* primitive, ITexture* texture, - bool isClampTextureMode, bool isTextureSRGB, bool isTexturePremultipliedAlpha, BlendMode blendMode) = 0; - - //! Add an indexed triangle list primitive to the render graph which will use maskTexture as an alpha (gradient) mask - virtual void AddAlphaMaskPrimitive(IRenderer::DynUiPrimitive* primitive, - ITexture* texture, ITexture* maskTexture, - bool isClampTextureMode, bool isTextureSRGB, bool isTexturePremultipliedAlpha, BlendMode blendMode) = 0; - //! Get a dynamic quad primitive that can be added as an image primitive to the render graph //! The graph handles the allocation of this DynUiPrimitive and deletes it when the graph is reset //! This can be used if the UI component doesn't want to own the storage of the primitive. Used infrequently, //! e.g. for the selection rect on a text component. - virtual IRenderer::DynUiPrimitive* GetDynamicQuadPrimitive(const AZ::Vector2* positions, uint32 packedColor) = 0; + virtual DynUiPrimitive* GetDynamicQuadPrimitive(const AZ::Vector2* positions, uint32 packedColor) = 0; //---- Functions for supporting masking (used during creation of the graph, not rendering ) ---- diff --git a/Code/Legacy/CryCommon/Mocks/IRendererMock.h b/Code/Legacy/CryCommon/Mocks/IRendererMock.h deleted file mode 100644 index be9c1eec8b..0000000000 --- a/Code/Legacy/CryCommon/Mocks/IRendererMock.h +++ /dev/null @@ -1,854 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ -#pragma once - -#include -#include - -struct SRendItemSorter {}; -struct SRenderingPassInfo {}; -struct SClipVolumeBlendInfo {}; -struct SFogVolumeData {}; - -// the following was generated using google's python script to autogenerate mocks. -// however, it needed some hand-editing to make it work, so if you add functions to IRenderer, -// it will probably be better to just manually add them here than try to run the script again -// hand-edits are marked with 'hand-edit'. Everything else was autogenerated. - -class IRendererMock - : public IRenderer -{ -public: - MOCK_METHOD1(AddRenderDebugListener, - void(IRenderDebugListener * pRenderDebugListener)); - MOCK_METHOD1(RemoveRenderDebugListener, - void(IRenderDebugListener * pRenderDebugListener)); - MOCK_CONST_METHOD0(GetRenderType, - ERenderType()); - - // Hand-edit: Googlemock cannot handle 14 param functions. - WIN_HWND Init(int, int, int, int, unsigned int, int, int, bool, bool, WIN_HINSTANCE, WIN_HWND = 0, - bool = false, const SCustomRenderInitArgs* = 0, bool = false) override { return nullptr; } - - MOCK_METHOD0(PostInit, - void()); - MOCK_CONST_METHOD0(IsPost3DRendererEnabled, - bool()); - MOCK_METHOD0(GetFeatures, - int()); - - // Hand-edit: Googlemock doesn't like 'const void' as a return type: - const void SetApiVersion(const AZStd::string&) override {} - const void SetAdapterDescription(const AZStd::string&) override {} - - MOCK_CONST_METHOD0(GetApiVersion, - const AZStd::string& ()); - MOCK_CONST_METHOD0(GetAdapterDescription, - const AZStd::string& ()); - MOCK_METHOD3(GetVideoMemoryUsageStats, - void(size_t&, size_t&, bool)); - MOCK_CONST_METHOD0(GetNumGeomInstances, - int()); - MOCK_CONST_METHOD0(GetNumGeomInstanceDrawCalls, - int()); - MOCK_CONST_METHOD0(GetCurrentNumberOfDrawCalls, - int()); - MOCK_CONST_METHOD2(GetCurrentNumberOfDrawCalls, - void(int& nGeneral, int& nShadowGen)); - MOCK_CONST_METHOD1(GetCurrentNumberOfDrawCalls, - int(uint32 EFSListMask)); - MOCK_CONST_METHOD1(GetCurrentDrawCallRTTimes, - float(uint32 EFSListMask)); - MOCK_METHOD1(SetDebugRenderNode, - void(IRenderNode * pRenderNode)); - MOCK_CONST_METHOD1(IsDebugRenderNode, - bool(IRenderNode * pRenderNode)); - MOCK_METHOD1(DeleteContext, - bool(WIN_HWND hWnd)); - MOCK_METHOD4(CreateContext, - bool(WIN_HWND, bool, int, int)); - MOCK_METHOD1(SetCurrentContext, - bool(WIN_HWND hWnd)); - MOCK_METHOD0(MakeMainContextActive, - void()); - MOCK_METHOD0(GetCurrentContextHWND, - WIN_HWND()); - MOCK_METHOD0(IsCurrentContextMainVP, - bool()); - MOCK_CONST_METHOD0(GetCurrentContextViewportHeight, - int()); - MOCK_CONST_METHOD0(GetCurrentContextViewportWidth, - int()); - MOCK_METHOD1(ShutDown, - void(bool)); - MOCK_METHOD0(ShutDownFast, - void()); - MOCK_METHOD1(EnumDisplayFormats, - int(SDispFormat * Formats)); - MOCK_METHOD1(EnumAAFormats, - int(SAAFormat * Formats)); - MOCK_METHOD6(ChangeResolution, - bool(int nNewWidth, int nNewHeight, int nNewColDepth, int nNewRefreshHZ, bool bFullScreen, bool bForceReset)); - MOCK_METHOD0(BeginFrame, - void()); - MOCK_METHOD1(InitSystemResources, - void(int nFlags)); - MOCK_METHOD0(InitTexturesSemantics, - void()); - MOCK_METHOD1(FreeResources, - void(int nFlags)); - MOCK_METHOD0(Release, - void()); - MOCK_METHOD1(RenderDebug, - void(bool)); - MOCK_METHOD0(EndFrame, - void()); - MOCK_METHOD0(ForceSwapBuffers, - void()); - MOCK_METHOD0(TryFlush, - void()); - MOCK_CONST_METHOD4(GetViewport, - void(int* x, int* y, int* width, int* height)); - MOCK_METHOD5(SetViewport, - void(int, int, int, int, int)); - MOCK_METHOD4(SetRenderTile, - void(f32, f32, f32, f32)); - MOCK_METHOD4(SetScissor, - void(int, int, int, int)); - MOCK_METHOD0(GetViewProjectionMatrix, - Matrix44A & ()); - MOCK_METHOD1(SetTranspOrigCameraProjMatrix, - void(Matrix44A & matrix)); - MOCK_METHOD2(GetScreenAspect, - EScreenAspectRatio(int nWidth, int nHeight)); - MOCK_METHOD2(SetViewportDownscale, - Vec2(float xscale, float yscale)); - MOCK_METHOD1(SetViewParameters, - void(const CameraViewParameters& viewParameters)); - MOCK_METHOD1(ApplyViewParameters, - void(const CameraViewParameters& viewParameters)); - MOCK_METHOD5(DrawDynVB, - void(SVF_P3F_C4B_T2F * pBuf, uint16 * pInds, int nVerts, int nInds, PublicRenderPrimitiveType nPrimType)); - - // Hand-edit: google mock has issues with DynUiPrimitiveList - void DrawDynUiPrimitiveList([[maybe_unused]] DynUiPrimitiveList& primitives, [[maybe_unused]] int totalNumVertices, [[maybe_unused]] int totalNumIndices) override { return; } - - MOCK_METHOD1(SetCamera, - void(const CCamera& cam)); - MOCK_METHOD0(GetCamera, - const CCamera& ()); - MOCK_METHOD1(GetRenderViewForThread, - CRenderView * (int nThreadID)); - MOCK_METHOD1(SetGammaDelta, - bool(float fGamma)); - MOCK_METHOD0(RestoreGamma, - void(void)); - MOCK_METHOD3(ChangeDisplay, - bool(unsigned int width, unsigned int height, unsigned int cbpp)); - MOCK_METHOD7(ChangeViewport, - void(unsigned int, unsigned int, unsigned int, unsigned int, bool, float, float)); - MOCK_CONST_METHOD6(SaveTga, - bool(unsigned char* sourcedata, int sourceformat, int w, int h, const char* filename, bool flip)); - MOCK_METHOD1(SetTexture, - void(int tnum)); - MOCK_METHOD2(SetTexture, - void(int tnum, int nUnit)); - MOCK_METHOD0(SetWhiteTexture, - void()); - MOCK_CONST_METHOD0(GetWhiteTextureId, - int()); - MOCK_CONST_METHOD0(GetBlackTextureId, - int()); - - // Hand-edit: google mock can only do up to 10 parameters - void Draw2dImage(float, float, float, float, int, float, float, float, float, float, float, float, float, float, float) override {}; - MOCK_METHOD1(Draw2dImageStretchMode, - void(bool stretch)); - - // Hand-edit: google mock can only do up to 10 parameters - void Push2dImage(float, float, float, float, int, float, float, float, float, float, float, float, float, float, float, float) override {}; - - MOCK_METHOD0(Draw2dImageList, - void()); - - // Hand-edit: Hand-edit: google mock can only do up to 10 parameters - void DrawImage(float, float, float, float, int, float, float, float, float, float, float, float, float, bool) override {} - - // Hand-edit: google mock can only do up to 10 parameters - void DrawImageWithUV(float, float, float, float, float, int, float*, float*, float, float, float, float, bool) override {} - - MOCK_METHOD1(PushWireframeMode, - void(int mode)); - MOCK_METHOD0(PopWireframeMode, - void()); - MOCK_CONST_METHOD0(GetHeight, - int()); - MOCK_CONST_METHOD0(GetWidth, - int()); - MOCK_CONST_METHOD0(GetPixelAspectRatio, - float()); - MOCK_CONST_METHOD0(GetOverlayHeight, - int()); - MOCK_CONST_METHOD0(GetOverlayWidth, - int()); - MOCK_CONST_METHOD0(GetMaxSquareRasterDimension, - int()); - MOCK_METHOD0(SwitchToNativeResolutionBackbuffer, - void()); - MOCK_METHOD1(GetMemoryUsage, - void(ICrySizer * Sizer)); - MOCK_METHOD1(GetBandwidthStats, - void(float* fBandwidthRequested)); - MOCK_METHOD1(SetTextureStreamListener, - void(ITextureStreamListener * pListener)); - MOCK_METHOD2(GetOcclusionBuffer, - int(uint16 * pOutOcclBuffer, Matrix44 * pmCamBuffer)); - MOCK_METHOD2(ScreenShot, - bool(const char*, int)); - MOCK_METHOD0(GetColorBpp, - int()); - MOCK_METHOD0(GetDepthBpp, - int()); - MOCK_METHOD0(GetStencilBpp, - int()); - MOCK_CONST_METHOD0(IsStereoEnabled, - bool()); - MOCK_CONST_METHOD0(GetNearestRangeMax, - float()); - MOCK_METHOD0(GetPerInstanceConstantBufferPoolPointer, - PerInstanceConstantBufferPool * ()); - MOCK_METHOD6(ProjectToScreen, - bool(float ptx, float pty, float ptz, float* sx, float* sy, float* sz)); - MOCK_METHOD9(UnProject, - int(float sx, float sy, float sz, float* px, float* py, float* pz, const float modelMatrix[16], const float projMatrix[16], const int viewport[4])); - MOCK_METHOD6(UnProjectFromScreen, - int(float sx, float sy, float sz, float* px, float* py, float* pz)); - MOCK_METHOD1(GetModelViewMatrix, - void(float* mat)); - MOCK_METHOD1(GetProjectionMatrix, - void(float* mat)); - MOCK_METHOD7(WriteDDS, - bool(const byte * dat, int wdt, int hgt, int Size, const char* name, ETEX_Format eF, int NumMips)); - MOCK_METHOD6(WriteTGA, - bool(const byte * dat, int wdt, int hgt, const char* name, int src_bits_per_pixel, int dest_bits_per_pixel)); - MOCK_METHOD6(WriteJPG, - bool(const byte*, int, int, char*, int, int)); - MOCK_METHOD6(FontCreateTexture, - int(int, int, byte*, ETEX_Format, bool, const char*)); - MOCK_METHOD6(FontUpdateTexture, - bool(int nTexId, int X, int Y, int USize, int VSize, byte * pData)); - MOCK_METHOD2(FontSetTexture, - void(int nTexId, int nFilterMode)); - MOCK_METHOD2(FontSetRenderingState, - void(bool overrideViewProjMatrices, TransformationMatrices & backupMatrices)); - MOCK_METHOD3(FontSetBlending, - void(int src, int dst, int baseState)); - MOCK_METHOD2(FontRestoreRenderingState, - void(bool overrideViewProjMatrices, const TransformationMatrices& restoringMatrices)); - MOCK_METHOD3(FlushRTCommands, - bool(bool bWait, bool bImmediatelly, bool bForce)); - MOCK_CONST_METHOD7(DrawStringU, - void(IFFont_RenderProxy * pFont, float x, float y, float z, const char* pStr, bool asciiMultiLine, const STextDrawContext& ctx)); - MOCK_METHOD0(RT_CurThreadList, - int()); - MOCK_METHOD6(EF_PrecacheResource, - bool(SShaderItem*, float, float, int, int, int)); - MOCK_METHOD4(EF_PrecacheResource, - bool(IShader * pSH, float fMipFactor, float fTimeToReady, int Flags)); - MOCK_METHOD6(EF_PrecacheResource, - bool(ITexture*, float, float, int, int, int)); - MOCK_METHOD6(EF_PrecacheResource, - bool(IRenderMesh * pPB, _smart_ptr pMaterial, float fMipFactor, float fTimeToReady, int Flags, int nUpdateId)); - MOCK_METHOD5(EF_PrecacheResource, - bool(CDLight * pLS, float fMipFactor, float fTimeToReady, int Flags, int nUpdateId)); - - // Hand-edit: google mock can only do up to 10 parameters - ITexture* EF_CreateCompositeTexture([[maybe_unused]] int type, [[maybe_unused]] const char* szName, [[maybe_unused]] int nWidth, [[maybe_unused]] int nHeight, [[maybe_unused]] int nDepth, [[maybe_unused]] int nMips, [[maybe_unused]] int nFlags, [[maybe_unused]] ETEX_Format eTF, [[maybe_unused]] const STexComposition* pCompositions, [[maybe_unused]] size_t nCompositions, [[maybe_unused]] int8 nPriority = -1) override { return nullptr; } - - MOCK_METHOD0(PostLevelLoading, - void()); - MOCK_METHOD0(PostLevelUnload, - void()); - MOCK_METHOD10(EF_AddPolygonToScene, - CRenderObject * (SShaderItem & si, int numPts, const SVF_P3F_C4B_T2F * verts, const SPipTangents * tangs, CRenderObject * obj, const SRenderingPassInfo& passInfo, uint16 * inds, int ninds, int nAW, const SRendItemSorter& rendItemSorter)); - MOCK_METHOD10(EF_AddPolygonToScene, - CRenderObject * (SShaderItem & si, CRenderObject * obj, const SRenderingPassInfo& passInfo, int numPts, int ninds, SVF_P3F_C4B_T2F * &verts, SPipTangents * &tangs, uint16 * &inds, int nAW, const SRendItemSorter& rendItemSorter)); - MOCK_METHOD0(ForceUpdateGlobalShaderParameters, - void()); - MOCK_METHOD0(EF_GetShaderMissLogPath, - const char*()); - MOCK_METHOD1(EF_GetShaderNames, - AZStd::string * (int& nNumShaders)); - MOCK_METHOD1(EF_ReloadFile, - bool(const char* szFileName)); - MOCK_METHOD1(EF_ReloadFile_Request, - bool(const char* szFileName)); - MOCK_METHOD3(EF_GetRemapedShaderMaskGen, - uint64(const char*, uint64, bool)); - MOCK_METHOD3(EF_GetShaderGlobalMaskGenFromString, - uint64(const char*, const char*, uint64)); - MOCK_METHOD2(EF_GetStringFromShaderGlobalMaskGen, - AZStd::string(const char*, uint64)); - MOCK_CONST_METHOD1(GetShaderProfile, - const SShaderProfile& (EShaderType eST)); - MOCK_METHOD2(EF_SetShaderQuality, - void(EShaderType eST, EShaderQuality eSQ)); - MOCK_CONST_METHOD0(EF_GetRenderQuality, - ERenderQuality()); - MOCK_METHOD1(EF_GetShaderQuality, - EShaderQuality(EShaderType eST)); - MOCK_METHOD5(EF_LoadShaderItem, - SShaderItem(const char*, bool, int, SInputShaderResources*, uint64)); - MOCK_METHOD3(EF_LoadShader, - IShader * (const char*, int, uint64)); - MOCK_METHOD1(EF_ReloadShaderFiles, - void(int nCategory)); - MOCK_METHOD0(EF_ReloadTextures, - void()); - MOCK_METHOD1(EF_GetTextureByID, - ITexture * (int Id)); - MOCK_METHOD2(EF_GetTextureByName, - ITexture * (const char*, uint32)); - MOCK_METHOD2(EF_LoadTexture, - ITexture * (const char*, uint32)); - MOCK_METHOD2(EF_LoadCubemapTexture, - ITexture * (const char*, uint32)); - MOCK_METHOD1(EF_LoadDefaultTexture, - ITexture * (const char* nameTex)); - MOCK_METHOD1(EF_LoadLightmap, - int(const char* name)); - MOCK_METHOD1(EF_StartEf, - void(const SRenderingPassInfo& passInfo)); - MOCK_METHOD3(EF_GetObjData, - SRenderObjData * (CRenderObject * pObj, bool bCreate, int nThreadID)); - MOCK_METHOD1(EF_GetObject_Temp, - CRenderObject * (int nThreadID)); - MOCK_METHOD2(EF_DuplicateRO, - CRenderObject * (CRenderObject * pObj, const SRenderingPassInfo& passInfo)); - MOCK_METHOD7(EF_AddEf, - void(IRenderElement * pRE, SShaderItem & pSH, CRenderObject * pObj, const SRenderingPassInfo& passInfo, int nList, int nAW, const SRendItemSorter& rendItemSorter)); - MOCK_METHOD4(EF_EndEf3D, - void(int nFlags, int nPrecacheUpdateId, int nNearPrecacheUpdateId, const SRenderingPassInfo& passInfo)); - MOCK_METHOD1(EF_InvokeShadowMapRenderJobs, - void(int nFlags)); - MOCK_METHOD1(EF_IsFakeDLight, - bool(const CDLight * Source)); - MOCK_METHOD2(EF_ADDDlight, - void(CDLight * Source, const SRenderingPassInfo& passInfo)); - MOCK_METHOD1(EF_UpdateDLight, - bool(SRenderLight * pDL)); - MOCK_METHOD1(EF_AddDeferredDecal, - bool(const SDeferredDecal& rDecal)); - MOCK_METHOD4(EF_AddDeferredLight, - int(const CDLight& pLight, float fMult, const SRenderingPassInfo& passInfo, const SRendItemSorter& rendItemSorter)); - MOCK_METHOD1(EF_GetDeferredLightsNum, - uint32(eDeferredLightType)); - MOCK_METHOD0(EF_ClearDeferredLightsList, - void()); - MOCK_METHOD1(EF_AddDeferredClipVolume, - uint8(const IClipVolume * pClipVolume)); - MOCK_METHOD2(EF_SetDeferredClipVolumeBlendData, - bool(const IClipVolume * pClipVolume, const SClipVolumeBlendInfo& blendInfo)); - MOCK_METHOD0(EF_ClearDeferredClipVolumesList, - void()); - MOCK_METHOD0(EF_ReleaseDeferredData, - void()); - MOCK_METHOD1(EF_ReleaseInputShaderResource, - void(SInputShaderResources * pRes)); - MOCK_METHOD3(EF_SetPostEffectParam, - void(const char*, float, bool)); - MOCK_METHOD3(EF_SetPostEffectParamVec4, - void(const char*, const Vec4&, bool)); - MOCK_METHOD2(EF_SetPostEffectParamString, - void(const char* pParam, const char* pszArg)); - MOCK_METHOD2(EF_GetPostEffectParam, - void(const char* pParam, float& fValue)); - MOCK_METHOD2(EF_GetPostEffectParamVec4, - void(const char* pParam, Vec4 & pValue)); - MOCK_METHOD2(EF_GetPostEffectParamString, - void(const char* pParam, const char* & pszArg)); - MOCK_METHOD1(EF_GetPostEffectID, - int32(const char* pPostEffectName)); - MOCK_METHOD1(EF_ResetPostEffects, - void(bool)); - MOCK_METHOD0(SyncPostEffects, - void()); - MOCK_METHOD0(EF_DisableTemporalEffects, - void()); - MOCK_METHOD3(EF_AddWaterSimHit, - void(const Vec3& vPos, float scale, float strength)); - MOCK_METHOD0(EF_DrawWaterSimHits, - void()); - MOCK_METHOD1(EF_EndEf2D, - void(bool bSort)); - MOCK_METHOD0(ForceGC, - void()); - MOCK_CONST_METHOD0(GetPolyCount, - int()); - MOCK_CONST_METHOD2(GetPolyCount, - void(int& nPolygons, int& nShadowVolPolys)); - MOCK_METHOD1(SetClearColor, - void(const Vec3& vColor)); - MOCK_METHOD1(SetClearBackground, - void(bool bClearBackground)); - MOCK_METHOD4(CreateRenderMesh, - _smart_ptr(const char*, const char*, IRenderMesh::SInitParamerers*, ERenderMeshType)); - - // Hand-edit: google mock can only do up to 10 parameters - virtual _smart_ptr CreateRenderMeshInitialized( - const void*, int, const AZ::Vertex::Format&, const vtx_idx*, int, const PublicRenderPrimitiveType, - const char*, const char*, ERenderMeshType = eRMT_Static, int = 1, int = 0, - [[maybe_unused]] bool (*PrepareBufferCallback)(IRenderMesh*, bool) = nullptr, void* = nullptr, bool = false, bool = true, - const SPipTangents* = nullptr, bool = false, Vec3* = nullptr) - { - return _smart_ptr(); - } - - MOCK_METHOD1(GetFrameID, - int(bool)); - MOCK_CONST_METHOD0(GetCameraFrameID, - int()); - MOCK_CONST_METHOD0(IsRenderToTextureActive, - bool()); - MOCK_METHOD4(MakeMatrix, - void(const Vec3& pos, const Vec3& angles, const Vec3& scale, Matrix34 * mat)); - MOCK_METHOD4(DrawTextQueued, - void(Vec3 pos, SDrawTextInfo & ti, const char* format, va_list args)); - MOCK_METHOD3(DrawTextQueued, - void(Vec3 pos, SDrawTextInfo & ti, const char* text)); - MOCK_CONST_METHOD1(ScaleCoordX, - float(float value)); - MOCK_CONST_METHOD1(ScaleCoordY, - float(float value)); - MOCK_CONST_METHOD2(ScaleCoord, - void(float& x, float& y)); - MOCK_METHOD2(SetState, - void(int, int)); - MOCK_METHOD1(SetCullMode, - void(int)); - MOCK_METHOD5(SetStencilState, - void(int, uint32, uint32, uint32, bool)); - MOCK_METHOD1(PushProfileMarker, - void(const char* label)); - MOCK_METHOD1(PopProfileMarker, - void(const char* label)); - MOCK_METHOD1(EnableFog, - bool(bool enable)); - MOCK_METHOD1(SetFogColor, - void(const ColorF& color)); - MOCK_METHOD4(SetColorOp, - void(byte eCo, byte eAo, byte eCa, byte eAa)); - MOCK_METHOD1(SetSrgbWrite, - void(bool srgbWrite)); - MOCK_METHOD1(RequestFlushAllPendingTextureStreamingJobs, - void(int nFrames)); - MOCK_METHOD1(SetTexturesStreamingGlobalMipFactor, - void(float fFactor)); - MOCK_METHOD1(GetIRenderAuxGeom, - IRenderAuxGeom * (void*)); - MOCK_METHOD0(GetISvoRenderer, - ISvoRenderer * ()); - MOCK_METHOD0(GetIColorGradingController, - IColorGradingController * ()); - MOCK_METHOD0(GetIStereoRenderer, - IStereoRenderer * ()); - MOCK_METHOD7(Create2DTexture, - ITexture * (const char* name, int width, int height, int numMips, int flags, unsigned char* data, ETEX_Format format)); - - void TextToScreen([[maybe_unused]] float x, [[maybe_unused]] float y, [[maybe_unused]] const char* format, ...) override {} - void TextToScreenColor([[maybe_unused]] int x, [[maybe_unused]] int y, [[maybe_unused]] float r, [[maybe_unused]] float g, [[maybe_unused]] float b, [[maybe_unused]] float a, [[maybe_unused]] const char* format, ...) override {} - - MOCK_METHOD0(ResetToDefault, - void()); - MOCK_METHOD4(SetMaterialColor, - void(float r, float g, float b, float a)); - MOCK_METHOD0(SetDefaultRenderStates, - void()); - MOCK_METHOD10(Graph, - void(byte * g, int x, int y, int wdt, int hgt, int nC, int type, const char* text, ColorF & color, float fScale)); - MOCK_METHOD0(EF_RenderTextMessages, - void()); - MOCK_METHOD1(ClearTargetsImmediately, - void(uint32 nFlags)); - MOCK_METHOD3(ClearTargetsImmediately, - void(uint32 nFlags, const ColorF& Colors, float fDepth)); - MOCK_METHOD2(ClearTargetsImmediately, - void(uint32 nFlags, const ColorF& Colors)); - MOCK_METHOD2(ClearTargetsImmediately, - void(uint32 nFlags, float fDepth)); - MOCK_METHOD1(ClearTargetsLater, - void(uint32 nFlags)); - MOCK_METHOD3(ClearTargetsLater, - void(uint32 nFlags, const ColorF& Colors, float fDepth)); - MOCK_METHOD2(ClearTargetsLater, - void(uint32 nFlags, const ColorF& Colors)); - MOCK_METHOD2(ClearTargetsLater, - void(uint32 nFlags, float fDepth)); - MOCK_METHOD8(ReadFrameBuffer, - void(unsigned char*, int, int, int, ERB_Type, bool, int, int)); - MOCK_METHOD4(ReadFrameBufferFast, - void(uint32*, int, int, bool)); - MOCK_METHOD1(EnableVSync, - void(bool enable)); - MOCK_METHOD1(CreateResourceAsync, - void(SResourceAsync * Resource)); - MOCK_METHOD1(ReleaseResourceAsync, - void(SResourceAsync * Resource)); - MOCK_METHOD1(ReleaseResourceAsync, - void(AZStd::unique_ptr Resource)); - - // Hand-edit: google mock can only do up to 10 parameters - unsigned int DownLoadToVideoMemory(const byte*, int, int, ETEX_Format, ETEX_Format, int, bool = true, - int = FILTER_BILINEAR, int = 0, const char* = nullptr, int = 0, EEndian = eLittleEndian, - RectI* = nullptr, bool = false) override { return 0; } - - unsigned int DownLoadToVideoMemory3D(const byte*, int, int, [[maybe_unused]] int d, ETEX_Format, ETEX_Format, int, bool = true, - int = FILTER_BILINEAR, int = 0, const char* = nullptr, int = 0, EEndian = eLittleEndian, - RectI* = nullptr, bool = false) override { return 0; } - - unsigned int DownLoadToVideoMemoryCube(const byte*, int, int, ETEX_Format, ETEX_Format, int, bool = true, - int = FILTER_BILINEAR, int = 0, const char* = nullptr, int = 0, EEndian = eLittleEndian, - RectI* = nullptr, bool = false) override { return 0; } - - MOCK_METHOD9(UpdateTextureInVideoMemory, - void(uint32, const byte*, int, int, int, int, ETEX_Format, int, int)); - MOCK_METHOD8(DXTCompress, - bool(const byte * raw_data, int nWidth, int nHeight, ETEX_Format eTF, bool bUseHW, bool bGenMips, int nSrcBytesPerPix, MIPDXTcallback callback)); - MOCK_METHOD9(DXTDecompress, - bool(const byte * srcData, size_t srcFileSize, byte * dstData, int nWidth, int nHeight, int nMips, ETEX_Format eSrcTF, bool bUseHW, int nDstBytesPerPix)); - MOCK_METHOD1(RemoveTexture, - void(unsigned int TextureId)); - MOCK_METHOD1(DeleteFont, - void(IFFont * font)); - MOCK_METHOD3(CaptureFrameBufferFast, - bool(unsigned char* pDstRGBA8, int destinationWidth, int destinationHeight)); - MOCK_METHOD3(CopyFrameBufferFast, - bool(unsigned char* pDstRGBA8, int destinationWidth, int destinationHeight)); - MOCK_METHOD1(RegisterCaptureFrame, - bool(ICaptureFrameListener * pCapture)); - MOCK_METHOD1(UnRegisterCaptureFrame, - bool(ICaptureFrameListener * pCapture)); - MOCK_METHOD2(InitCaptureFrameBufferFast, - bool(uint32, uint32)); - MOCK_METHOD0(CloseCaptureFrameBufferFast, - void(void)); - MOCK_METHOD0(CaptureFrameBufferCallBack, - void(void)); - MOCK_METHOD1(RegisterSyncWithMainListener, - void(ISyncMainWithRenderListener * pListener)); - MOCK_METHOD1(RemoveSyncWithMainListener, - void(const ISyncMainWithRenderListener * pListener)); - MOCK_METHOD5(Set2DMode, - void(uint32, uint32, TransformationMatrices&, float, float)); - MOCK_METHOD1(Unset2DMode, - void(const TransformationMatrices& restoringMatrices)); - MOCK_METHOD7(Set2DModeNonZeroTopLeft, - void(float, float, float, float, TransformationMatrices&, float, float)); - MOCK_METHOD1(ScreenToTexture, - int(int nTexID)); - MOCK_METHOD1(EnableSwapBuffers, - void(bool bEnable)); - MOCK_METHOD0(GetHWND, - WIN_HWND()); - MOCK_METHOD1(SetWindowIcon, - bool(const char* path)); - MOCK_METHOD1(OnEntityDeleted, - void(struct IRenderNode* pRenderNode)); - MOCK_METHOD5(CreateRenderTarget, - int(const char* name, int nWidth, int nHeight, const ColorF& clearColor, ETEX_Format eTF)); - MOCK_METHOD1(DestroyRenderTarget, - bool(int nHandle)); - MOCK_METHOD3(ResizeRenderTarget, - bool(int nHandle, int nWidth, int nHeight)); - MOCK_METHOD2(SetRenderTarget, - bool(int, SDepthTexture*)); - MOCK_METHOD3(CreateDepthSurface, - SDepthTexture * (int, int, bool)); - MOCK_METHOD1(DestroyDepthSurface, - void(SDepthTexture * pDepthSurf)); - MOCK_METHOD1(PauseTimer, - void(bool bPause)); - MOCK_METHOD0(CreateShaderPublicParams, - IShaderPublicParams * ()); - MOCK_CONST_METHOD2(GetThreadIDs, - void(threadID & mainThreadID, threadID & renderThreadID)); - MOCK_METHOD1(EnableGPUTimers2, - void(bool bEnabled)); - MOCK_METHOD1(AllowGPUTimers2, - void(bool bAllow)); - MOCK_CONST_METHOD2(GetRPPStats, - const RPProfilerStats * (ERenderPipelineProfilerStats, bool)); - MOCK_CONST_METHOD1(GetRPPStatsArray, - const RPProfilerStats * (bool)); - MOCK_METHOD4(GetPolygonCountByType, - int(uint32, EVertexCostTypes, uint32, bool)); - MOCK_METHOD5(SetCloudShadowsParams, - void(int nTexID, const Vec3& speed, float tiling, bool invert, float brightness)); - MOCK_METHOD2(PushFogVolumeContribution, - uint16(const SFogVolumeData& fogVolData, const SRenderingPassInfo& passInfo)); - MOCK_METHOD2(PushFogVolume, - void(class CREFogVolume * pFogVolume, const SRenderingPassInfo& passInfo)); - MOCK_METHOD0(GetMaxTextureSize, - int()); - MOCK_METHOD1(GetTextureFormatName, - const char*(ETEX_Format eTF)); - MOCK_METHOD5(GetTextureFormatDataSize, - int(int nWidth, int nHeight, int nDepth, int nMips, ETEX_Format eTF)); - MOCK_METHOD2(SetDefaultMaterials, - void(_smart_ptr pDefMat, _smart_ptr pTerrainDefMat)); - MOCK_CONST_METHOD0(GetGPUParticleEngine, - IGPUParticleEngine * ()); - MOCK_CONST_METHOD0(GetActiveGPUCount, - uint32()); - MOCK_METHOD0(GetShadowFrustumMGPUCache, - ShadowFrustumMGPUCache * ()); - - MOCK_CONST_METHOD0(GetCachedShadowsResolution, - const StaticArray&()); - - MOCK_METHOD1(SetCachedShadowsResolution, - void(const StaticArray&arrResolutions)); - MOCK_CONST_METHOD1(UpdateCachedShadowsLodCount, - void(int nGsmLods)); - MOCK_METHOD1(SetTexturePrecaching, - void(bool stat)); - MOCK_METHOD2(RT_InsertGpuCallback, - void(uint32 context, GpuCallbackFunc callback)); - MOCK_METHOD1(EnablePipelineProfiler, - void(bool bEnable)); - MOCK_METHOD1(GetRenderTimes, - void(SRenderTimes & outTimes)); - MOCK_METHOD0(GetGPUFrameTime, - float()); - MOCK_METHOD1(EnableBatchMode, - void(bool enable)); - MOCK_METHOD1(EnableLevelUnloading, - void(bool enable)); - MOCK_METHOD0(OnLevelLoadFailed, - void()); -#if !defined(_RELEASE) - MOCK_METHOD1(GetDrawCallsInfoPerMesh, - RNDrawcallsMapMesh & (bool)); - MOCK_METHOD1(GetDrawCallsInfoPerMeshPreviousFrame, - RNDrawcallsMapMesh & (bool)); - MOCK_METHOD1(GetDrawCallsInfoPerNodePreviousFrame, - RNDrawcallsMapNode & (bool)); - MOCK_METHOD1(GetDrawCallsPerNode, - int(IRenderNode * pRenderNode)); - MOCK_METHOD1(ForceRemoveNodeFromDrawCallsMap, - void(IRenderNode * pNode)); -#endif - MOCK_METHOD1(CollectDrawCallsInfo, - void(bool status)); - MOCK_METHOD1(CollectDrawCallsInfoPerNode, - void(bool status)); - MOCK_METHOD0(HasLoadedDefaultResources, - bool()); - MOCK_METHOD3(EF_CreateSkinningData, - SSkinningData * (uint32, bool, bool)); - MOCK_METHOD4(EF_CreateRemappedSkinningData, - SSkinningData * (uint32 nNumBones, SSkinningData * pSourceSkinningData, uint32 nCustomDataSize, uint32 pairGuid)); - MOCK_METHOD0(EF_ClearSkinningDataPool, - void()); - MOCK_METHOD0(EF_GetSkinningPoolID, - int()); - MOCK_METHOD1(ClearShaderItem, - void(SShaderItem * pShaderItem)); - MOCK_METHOD2(UpdateShaderItem, - void(SShaderItem * pShaderItem, _smart_ptr pMaterial)); - MOCK_METHOD2(ForceUpdateShaderItem, - void(SShaderItem * pShaderItem, _smart_ptr pMaterial)); - MOCK_METHOD2(RefreshShaderResourceConstants, - void(SShaderItem * pShaderItem, IMaterial * pMaterial)); - MOCK_METHOD0(IsStereoModeChangePending, - bool()); - MOCK_METHOD1(LockParticleVideoMemory, - void(uint32 nId)); - MOCK_METHOD1(UnLockParticleVideoMemory, - void(uint32 nId)); - MOCK_METHOD1(BeginSpawningGeneratingRendItemJobs, - void(int nThreadID)); - MOCK_METHOD1(BeginSpawningShadowGeneratingRendItemJobs, - void(int nThreadID)); - MOCK_METHOD0(EndSpawningGeneratingRendItemJobs, - void()); - MOCK_METHOD1(StartLoadtimePlayback, - void(ILoadtimeCallback* pCallback)); - MOCK_METHOD0(StopLoadtimePlayback, - void()); - - MOCK_METHOD0(GetGenerateRendItemJobExecutor, - AZ::LegacyJobExecutor*()); - MOCK_METHOD0(GetGenerateShadowRendItemJobExecutor, - AZ::LegacyJobExecutor*()); - MOCK_METHOD0(GetGenerateRendItemJobExecutorPreProcess, - AZ::LegacyJobExecutor*()); - MOCK_METHOD1(GetFinalizeRendItemJobExecutor, - AZ::LegacyJobExecutor*(int nThreadID)); - MOCK_METHOD1(GetFinalizeShadowRendItemJobExecutor, - AZ::LegacyJobExecutor*(int nThreadID)); - MOCK_METHOD0(FlushPendingTextureTasks, - void()); - MOCK_METHOD1(SetShadowJittering, - void(float fShadowJittering)); - MOCK_CONST_METHOD0(GetShadowJittering, - float()); - MOCK_METHOD0(LoadShaderStartupCache, - bool()); - MOCK_METHOD0(UnloadShaderStartupCache, - void()); - MOCK_METHOD0(LoadShaderLevelCache, - bool()); - MOCK_METHOD0(UnloadShaderLevelCache, - void()); - MOCK_METHOD1(StartScreenShot, - void(int e_ScreenShot)); - MOCK_METHOD1(EndScreenShot, - void(int e_ScreenShot)); - MOCK_METHOD3(SetRendererCVar, - void(ICVar*, const char*, bool)); - MOCK_METHOD0(GetRenderPipeline, - SRenderPipeline * ()); - MOCK_METHOD0(GetShaderManager, - CShaderMan * ()); - MOCK_METHOD0(GetRenderThread, - SRenderThread * ()); - MOCK_METHOD0(GetWhiteTexture, - ITexture * ()); - MOCK_METHOD3(GetTextureForName, - ITexture * (const char* name, uint32 nFlags, ETEX_Format eFormat)); - MOCK_METHOD0(GetViewParameters, - const CameraViewParameters& ()); - MOCK_METHOD0(GetFrameReset, - uint32()); - MOCK_METHOD0(GetDepthBufferOrig, - SDepthTexture * ()); - MOCK_METHOD0(GetBackBufferWidth, - uint32()); - MOCK_METHOD0(GetBackBufferHeight, - uint32()); - MOCK_METHOD0(GetDeviceBufferManager, - CDeviceBufferManager * ()); - MOCK_CONST_METHOD0(GetRenderTileInfo, - const SRenderTileInfo * ()); - MOCK_METHOD0(GetIdentityMatrix, - Matrix44A()); - MOCK_CONST_METHOD0(RT_GetCurrGpuID, - int32()); - MOCK_METHOD0(GenerateTextureId, - int()); - MOCK_METHOD2(SetCull, - void(ECull, bool)); - MOCK_METHOD10(DrawQuad, - void(float x0, float y0, float x1, float y1, const ColorF& color, float z, float s0, float t0, float s1, float t1)); - MOCK_METHOD9(DrawQuad3D, - void(const Vec3& v0, const Vec3& v1, const Vec3& v2, const Vec3& v3, const ColorF& color, float ftx0, float fty0, float ftx1, float fty1)); - MOCK_METHOD0(FX_ResetPipe, - void()); - MOCK_METHOD4(FX_GetDepthSurface, - SDepthTexture * (int, int, bool, bool)); - MOCK_METHOD5(FX_CheckOverflow, - void(int, int, IRenderElement*, int*, int*)); - MOCK_METHOD1(FX_PreRender, - void(int Stage)); - MOCK_METHOD0(FX_PostRender, - void()); - MOCK_METHOD3(FX_SetState, - void(int, int, int)); - MOCK_METHOD3(FX_CommitStates, - void(const SShaderTechnique * pTech, const SShaderPass * pPass, bool bUseMaterialState)); - MOCK_METHOD1(FX_Commit, - void(bool)); - MOCK_METHOD2(FX_SetVertexDeclaration, - long(int StreamMask, const AZ::Vertex::Format& vertexFormat)); - MOCK_METHOD7(FX_DrawIndexedPrimitive, - void(eRenderPrimitiveType, int, int, int, int, int, bool)); - MOCK_METHOD3(FX_SetIStream, - long(const void* pB, uint32 nOffs, RenderIndexType idxType)); - MOCK_METHOD5(FX_SetVStream, - long(int, const void*, uint32, uint32, uint32)); - MOCK_METHOD4(FX_DrawPrimitive, - void(eRenderPrimitiveType, int, int, int)); - MOCK_METHOD1(FX_ClearTarget, - void(ITexture * pTex)); - MOCK_METHOD1(FX_ClearTarget, - void(SDepthTexture * pTex)); - MOCK_METHOD4(FX_SetRenderTarget, - bool(int, void*, SDepthTexture*, uint32)); - MOCK_METHOD4(FX_PushRenderTarget, - bool(int, void*, SDepthTexture*, uint32)); - MOCK_METHOD7(FX_SetRenderTarget, - bool(int, CTexture*, SDepthTexture*, bool, int, bool, uint32)); - MOCK_METHOD6(FX_PushRenderTarget, - bool(int, CTexture*, SDepthTexture*, int, bool, uint32)); - MOCK_METHOD1(FX_RestoreRenderTarget, - bool(int nTarget)); - MOCK_METHOD1(FX_PopRenderTarget, - bool(int nTarget)); - MOCK_METHOD1(FX_SetActiveRenderTargets, - void(bool bAllowDIP)); - MOCK_METHOD4(FX_Start, - void(CShader * ef, int nTech, CShaderResources * Res, IRenderElement * re)); - MOCK_METHOD1(RT_PopRenderTarget, - void(int nTarget)); - MOCK_METHOD5(RT_SetViewport, - void(int, int, int, int, int)); - MOCK_METHOD4(RT_PushRenderTarget, - void(int nTarget, CTexture * pTex, SDepthTexture * pDS, int nS)); - MOCK_METHOD5(EF_Scissor, - void(bool bEnable, int sX, int sY, int sWdt, int sHgt)); - -#ifdef SUPPORT_HW_MOUSE_CURSOR - MOCK_METHOD0(GetIHWMouseCursor, - IHWMouseCursor * ()); -#endif - - MOCK_METHOD0(GetRecursionLevel, - int()); - MOCK_METHOD2(GetIntegerConfigurationValue, - int(const char* varName, int defaultValue)); - MOCK_METHOD2(GetFloatConfigurationValue, - float(const char* varName, float defaultValue)); - MOCK_METHOD2(GetBooleanConfigurationValue, - bool(const char* varName, bool defaultValue)); - MOCK_METHOD3(ApplyDepthTextureState, - void(int unit, int nFilter, bool clamp)); - MOCK_METHOD0(GetZTargetTexture, - ITexture * ()); - MOCK_METHOD1(GetTextureState, - int(const STexState& TS)); - MOCK_METHOD7(TextureDataSize, - uint32(uint32, uint32, uint32, uint32, uint32, ETEX_Format, ETEX_TileMode)); - MOCK_METHOD6(ApplyForID, - void(int nID, int nTUnit, int nTState, int nTexMaterialSlot, int nSUnit, bool useWhiteDefault)); - MOCK_METHOD9(Create3DTexture, - ITexture * (const char* szName, int nWidth, int nHeight, int nDepth, int nMips, int nFlags, const byte * pData, ETEX_Format eTFSrc, ETEX_Format eTFDst)); - MOCK_METHOD1(IsTextureExist, - bool(const ITexture * pTex)); - MOCK_METHOD1(NameForTextureFormat, - const char*(ETEX_Format eTF)); - MOCK_METHOD1(NameForTextureType, - const char*(ETEX_Type eTT)); - MOCK_METHOD0(IsVideoThreadModeEnabled, - bool()); - MOCK_METHOD5(CreateDynTexture2, - IDynTexture * (uint32 nWidth, uint32 nHeight, uint32 nTexFlags, const char* szSource, ETexPool eTexPool)); - MOCK_METHOD0(GetCurrentTextureAtlasSize, - uint32()); - MOCK_METHOD2(BeginProfilerSection, - void(const char*, uint32)); - MOCK_METHOD1(EndProfilerSection, - void(const char*)); - MOCK_METHOD1(AddProfilerLabel, - void(const char*)); - - MOCK_METHOD5(EF_QueryImpl, - void(ERenderQueryTypes eQuery, void* pInOut0, uint32 nInOutSize0, void* pInOut1, uint32 nInOutSize1)); -}; - - diff --git a/Code/Legacy/CryCommon/Mocks/ISystemMock.h b/Code/Legacy/CryCommon/Mocks/ISystemMock.h index c4566537b1..9d41b9e77d 100644 --- a/Code/Legacy/CryCommon/Mocks/ISystemMock.h +++ b/Code/Legacy/CryCommon/Mocks/ISystemMock.h @@ -60,8 +60,6 @@ public: IViewSystem * ()); MOCK_METHOD0(GetILevelSystem, ILevelSystem * ()); - MOCK_METHOD0(GetINameTable, - INameTable * ()); MOCK_METHOD0(GetICmdLine, ICmdLine * ()); MOCK_METHOD0(GetILog, diff --git a/Code/Legacy/CryCommon/PoolAllocator.h b/Code/Legacy/CryCommon/PoolAllocator.h deleted file mode 100644 index 9125c87c51..0000000000 --- a/Code/Legacy/CryCommon/PoolAllocator.h +++ /dev/null @@ -1,507 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - - -#ifndef CRYINCLUDE_CRYCOMMON_POOLALLOCATOR_H -#define CRYINCLUDE_CRYCOMMON_POOLALLOCATOR_H -#pragma once - - -//--------------------------------------------------------------------------- -// Memory allocation class. Allocates, frees, and reuses fixed-size blocks of -// memory, a scheme sometimes known as Simple Segregated Memory. -// -// Allocation is amortized constant time. The normal case is very fast - -// basically just a couple of dereferences. If many blocks are allocated, -// the system may occasionally need to allocate a further bucket of blocks -// for itself. Deallocation is strictly fast constant time. -// -// Each PoolAllocator allocates blocks of a single size and alignment, specified -// by template arguments. There is no per-block space overhead, except for -// alignment. The free list mechanism uses the memory of the block itself -// when it is deallocated. -// -// In this implementation memory claimed by the system is never deallocated, -// until the entire allocator is deallocated. This is to ensure fast -// allocation/deallocation - reference counting the bucket quickly would -// require a pointer to the bucket be stored, whereas now no memory is used -// while the block is allocated. -// -// The class can optionally support multi-threading, using the second -// template parameter. By default it is multithread-safe. -// See Synchronization.h. -// -// The class is implemented using a HeapAllocator. -//--------------------------------------------------------------------------- - -#include "HeapAllocator.h" - -namespace stl -{ - ////////////////////////////////////////////////////////////////////////// - // Fixed-size pool allocator, using a shared heap. - template - class SharedSizePoolAllocator - { - template - friend struct PoolCommonAllocator; - protected: - - using_type(THeap, Lock); - - struct ObjectNode - { - ObjectNode* pNext; - }; - - static size_t AllocSize(size_t nSize) - { - return max(nSize, sizeof(ObjectNode)); - } - static size_t AllocAlign(size_t nSize, size_t nAlign) - { - return nAlign > 0 ? nAlign : min(nSize, alignof(void*)); - } - - public: - - SharedSizePoolAllocator(THeap& heap, size_t nSize, size_t nAlign = 0) - : _pHeap(&heap) - , _nAllocSize(AllocSize(nSize)) - , _nAllocAlign(AllocAlign(nSize, nAlign)) - , _pFreeList(0) - { - } - - ~SharedSizePoolAllocator() - { - // All allocated objects should be freed by now. - Lock lock(*_pHeap); - Validate(lock); - for (ObjectNode* pFree = _pFreeList; pFree; ) - { - ObjectNode* pNext = pFree->pNext; - _pHeap->Deallocate(lock, pFree, _nAllocSize); - pFree = pNext; - } - } - - // Raw allocation. - void* Allocate() - { - Lock lock(*_pHeap); - if (_pFreeList) - { - ObjectNode* pFree = _pFreeList; - _pFreeList = _pFreeList->pNext; - Validate(lock); - _Counts.nUsed++; - return pFree; - } - - // No free pointer, allocate a new one. - void* pNewMemory = _pHeap->Allocate(lock, _nAllocSize, _nAllocAlign); - if (pNewMemory) - { - _Counts.nUsed++; - _Counts.nAlloc++; - Validate(lock); - } - return pNewMemory; - } - - void Deallocate(void* pObject) - { - Deallocate(Lock(*_pHeap), pObject); - } - - SMemoryUsage GetCounts() const - { - Lock lock(*_pHeap); - return _Counts; - } - SMemoryUsage GetTotalMemory(const Lock&) const - { - return SMemoryUsage(_Counts.nAlloc * _nAllocSize, _Counts.nUsed * _nAllocSize); - } - - protected: - - void Deallocate(const Lock& lock, void* pObject) - { - if (pObject) - { - assert(_pHeap->CheckPtr(lock, pObject)); - - ObjectNode* pNode = static_cast(pObject); - - // Add the object to the front of the free list. - pNode->pNext = _pFreeList; - _pFreeList = pNode; - _Counts.nUsed--; - Validate(lock); - } - } - - void Validate(const Lock& lock) const - { - _pHeap->Validate(lock); - _Counts.Validate(); - assert(_Counts.nAlloc * _nAllocSize <= _pHeap->GetTotalMemory(lock).nUsed); - } - - void Reset(const Lock&, [[maybe_unused]] bool bForce = false) - { - assert(bForce || _Counts.nUsed == 0); - _Counts.Clear(); - _pFreeList = 0; - } - - protected: - const size_t _nAllocSize, _nAllocAlign; - SMemoryUsage _Counts; - - THeap* _pHeap; - ObjectNode* _pFreeList; - }; - - ////////////////////////////////////////////////////////////////////////// - struct SPoolMemoryUsage - : SMemoryUsage - { - size_t nPool; - - SPoolMemoryUsage(size_t _nAlloc = 0, size_t _nPool = 0, size_t _nUsed = 0) - : SMemoryUsage(_nAlloc, _nUsed) - , nPool(_nPool) - { - // These values are pulled from 3 atomic variables and not guaranteed to be a perfect "snapshot" - // Of the current state of the pool memory usage (e.g. Used may be > max, etc) - // Patch the values so that they make sense (it won't be wrong, just mildly out of date) - // This is done to prevent sticking expensive mutexes or potentially forever blocking semaphores in the pool - if (nUsed > nPool) - { - nPool = nUsed; - } - - assert(nPool <= nAlloc); - } - - size_t nPoolFree() const - { - return nPool - nUsed; - } - size_t nNonPoolFree() const - { - return nAlloc - nPool; - } - - void Clear() - { - nAlloc = nUsed = nPool = 0; - } - - void operator += (SPoolMemoryUsage const& op) - { - nAlloc += op.nAlloc; - nPool += op.nPool; - nUsed += op.nUsed; - } - }; - - ////////////////////////////////////////////////////////////////////////// - // SizePoolAllocator with owned heap - template - class SizePoolAllocator - : protected THeap - , public SharedSizePoolAllocator - { - typedef SharedSizePoolAllocator TPool; - - using_type(THeap, Lock); - using_type(THeap, FreeMemLock); - using TPool::AllocSize; - using TPool::_Counts; - using TPool::_nAllocSize; - - public: - - SizePoolAllocator(size_t nSize, size_t nAlign = 0, FHeap opts = 0) - : THeap(opts.PageSize(opts.PageSize * AllocSize(nSize))) - , TPool(*this, nSize, nAlign) - { - } - - using TPool::Allocate; - using THeap::GetMemoryUsage; - - void Deallocate(void* pObject) - { - FreeMemLock lock(*this); - TPool::Deallocate(lock, pObject); - if (THeap::FreeWhenEmpty && _Counts.nUsed == 0) - { - TPool::Reset(lock); - THeap::Clear(lock); - } - } - - void FreeMemoryIfEmpty() - { - FreeMemLock lock(*this); - if (_Counts.nUsed == 0) - { - TPool::Reset(lock); - THeap::Clear(lock); - } - } - - void ResetMemory() - { - FreeMemLock lock(*this); - TPool::Reset(lock); - THeap::Reset(lock); - } - - void FreeMemory() - { - FreeMemLock lock(*this); - TPool::Reset(lock); - THeap::Clear(lock); - } - - - void FreeMemoryForce() - { - FreeMemLock lock(*this); - TPool::Reset(lock, true); - THeap::Clear(lock); - } - - SPoolMemoryUsage GetTotalMemory() - { - Lock lock(*this); - return SPoolMemoryUsage(THeap::GetTotalMemory(lock).nAlloc, _Counts.nAlloc * _nAllocSize, _Counts.nUsed * _nAllocSize); - } - }; - - ////////////////////////////////////////////////////////////////////////// - // Templated size version of SizePoolAllocator - template - class PoolAllocator - : public SizePoolAllocator< HeapAllocator > - { - public: - PoolAllocator(FHeap opts = 0) - : SizePoolAllocator< HeapAllocator >(S, A, opts) - { - } - }; - - ////////////////////////////////////////////////////////////////////////// - template - class PoolAllocatorNoMT - : public SizePoolAllocator< HeapAllocator > - { - public: - PoolAllocatorNoMT(FHeap opts = 0) - : SizePoolAllocator< HeapAllocator >(S, A, opts) - { - } - }; - - ////////////////////////////////////////////////////////////////////////// - template - class TPoolAllocator - : public SizePoolAllocator< HeapAllocator > - { - typedef SizePoolAllocator< HeapAllocator > TSizePool; - - public: - - using TSizePool::Allocate; - using TSizePool::Deallocate; - - TPoolAllocator(FHeap opts = 0) - : TSizePool(sizeof(T), max(alignof(T), A), opts) - {} - - T* New() - { - return new(Allocate())T(); - } - - template - T* New(const I& init) - { - return new(Allocate())T(init); - } - - void Delete(T* ptr) - { - if (ptr) - { - ptr->~T(); - Deallocate(ptr); - } - } - }; - - // Legacy verbose typedefs. - typedef PSyncNone PoolAllocatorSynchronizationSinglethreaded; - typedef PSyncMultiThread PoolAllocatorSynchronizationMultithreaded; - - ////////////////////////////////////////////////////////////////////////// - // Allocator maintaining multiple type-specific pools, sharing a common heap source. - template - struct PoolCommonAllocator - : protected THeap - { - typedef SharedSizePoolAllocator TPool; - - using_type(THeap, Lock); - using_type(THeap, FreeMemLock); - - struct TPoolNode - : SharedSizePoolAllocator - { - TPoolNode* pNext; - - TPoolNode(THeap& heap, TPoolNode*& pList, size_t nSize, size_t nAlign) - : SharedSizePoolAllocator(heap, nSize, nAlign) - { - pNext = pList; - pList = this; - } - }; - - public: - - PoolCommonAllocator() - : _pPoolList(0) - { - } - ~PoolCommonAllocator() - { - TPoolNode* pPool = _pPoolList; - while (pPool) - { - TPoolNode* pNextPool = pPool->pNext; - delete pPool; - pPool = pNextPool; - } - } - - TPool* CreatePool(size_t nSize, size_t nAlign = 0) - { - return new TPoolNode(*this, _pPoolList, nSize, nAlign); - } - - SPoolMemoryUsage GetTotalMemory() - { - Lock lock(*this); - SMemoryUsage mem; - for (TPoolNode* pPool = _pPoolList; pPool; pPool = pPool->pNext) - { - mem += pPool->GetTotalMemory(lock); - } - return SPoolMemoryUsage(THeap::GetTotalMemory(lock).nAlloc, mem.nAlloc, mem.nUsed); - } - - bool FreeMemory(bool bDeallocate = true) - { - FreeMemLock lock(*this); - for (TPoolNode* pPool = _pPoolList; pPool; pPool = pPool->pNext) - { - if (pPool->GetTotalMemory(lock).nUsed) - { - return false; - } - } - - for (TPoolNode* pPool = _pPoolList; pPool; pPool = pPool->pNext) - { - pPool->Reset(lock); - } - - if (bDeallocate) - { - THeap::Clear(lock); - } - else - { - THeap::Reset(lock); - } - return true; - } - - protected: - TPoolNode* _pPoolList; - }; - - ////////////////////////////////////////////////////////////////////////// - // The additional TInstancer type provides a way of instantiating multiple instances - // of this class, without static variables. - template - struct StaticPoolCommonAllocator - { - ILINE static PoolCommonAllocator& StaticAllocator() - { - static PoolCommonAllocator s_Allocator; - return s_Allocator; - } - - typedef SharedSizePoolAllocator TPool; - - template - ILINE static TPool& TypeAllocator() - { - static TPool* sp_Pool = CreatePoolOnGlobalHeap(sizeof(T), alignof(T)); - return *sp_Pool; - } - - template - ILINE static void* Allocate(T*& p) - { return p = (T*)TypeAllocator().Allocate(); } - - template - ILINE static void Deallocate(T* p) - { return TypeAllocator().Deallocate(p); } - - template - static T* New() - { return new(TypeAllocator().Allocate())T(); } - - template - static T* New(const I& init) - { return new(TypeAllocator().Allocate())T(init); } - - template - static void Delete(T* ptr) - { - if (ptr) - { - ptr->~T(); - TypeAllocator().Deallocate(ptr); - } - } - - static SPoolMemoryUsage GetTotalMemory() - { return StaticAllocator().GetTotalMemory(); } - - private: - - ILINE static TPool* CreatePoolOnGlobalHeap(size_t nSize, size_t nAlign = 0) - { - return StaticAllocator().CreatePool(nSize, nAlign); - } - }; -}; - - -#endif // CRYINCLUDE_CRYCOMMON_POOLALLOCATOR_H diff --git a/Code/Legacy/CryCommon/StaticInstance.h b/Code/Legacy/CryCommon/StaticInstance.h index 70739a0a3c..8e14606abf 100644 --- a/Code/Legacy/CryCommon/StaticInstance.h +++ b/Code/Legacy/CryCommon/StaticInstance.h @@ -7,13 +7,24 @@ */ #pragma once +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include template class StaticInstanceSpecialization { }; -// Specializations for std::vector and std::map which allows us to modify the +// Specializations for std::vector and std::map which allows us to modify the // least amount of legacy code by mirroring the std APIs that are in use // These are not intended to be complete, just enough to shim existing legacy code template @@ -30,7 +41,7 @@ public: using size_type = typename Container::size_type; template - AZ_FORCE_INLINE + AZ_FORCE_INLINE typename AZStd::enable_if::value, reference>::type operator[](Integral index) { @@ -322,7 +333,7 @@ public: using size_type = typename Container::size_type; using pair_iter_bool = std::pair; - + AZ_FORCE_INLINE iterator begin() { @@ -360,7 +371,7 @@ public: } template - AZ_FORCE_INLINE + AZ_FORCE_INLINE typename AZStd::enable_if::value, mapped_type&>::type operator[](const K2& keylike) { diff --git a/Code/Legacy/CryCommon/crycommon_files.cmake b/Code/Legacy/CryCommon/crycommon_files.cmake index 8b8df7856e..7131eb7207 100644 --- a/Code/Legacy/CryCommon/crycommon_files.cmake +++ b/Code/Legacy/CryCommon/crycommon_files.cmake @@ -80,14 +80,12 @@ set(FILES CryHeaders_info.cpp CryListenerSet.h CryLegacyAllocator.h - CryName.h CryPath.h CryPodArray.h CrySizer.h CrySystemBus.h CryTypeInfo.h CryVersion.h - HeapAllocator.h LegacyAllocator.cpp LegacyAllocator.h MetaUtils.h @@ -95,7 +93,6 @@ set(FILES MultiThread_Containers.h NullAudioSystem.h PNoise3.h - PoolAllocator.h primitives.h ProjectDefines.h Range.h @@ -120,7 +117,6 @@ set(FILES Cry_Matrix33.h Cry_Matrix34.h Cry_Matrix44.h - Cry_MatrixDiag.h Cry_Vector4.h Cry_Camera.h Cry_Color.h @@ -133,7 +129,6 @@ set(FILES Cry_ValidNumber.h Cry_Vector2.h Cry_Vector3.h - Cry_XOptimise.h CryHalf_info.h CryHalf.inl MathConversion.h diff --git a/Code/Legacy/CryCommon/crycommon_testing_files.cmake b/Code/Legacy/CryCommon/crycommon_testing_files.cmake index b3769c4f63..9c3427d529 100644 --- a/Code/Legacy/CryCommon/crycommon_testing_files.cmake +++ b/Code/Legacy/CryCommon/crycommon_testing_files.cmake @@ -14,7 +14,6 @@ set(FILES Mocks/ISystemMock.h Mocks/ITimerMock.h Mocks/ICVarMock.h - Mocks/IRendererMock.h Mocks/ITextureMock.h Mocks/IRemoteConsoleMock.h ) diff --git a/Code/Legacy/CryCommon/physinterface.h b/Code/Legacy/CryCommon/physinterface.h index b1aaa5aef4..06d07af82b 100644 --- a/Code/Legacy/CryCommon/physinterface.h +++ b/Code/Legacy/CryCommon/physinterface.h @@ -8,10 +8,6 @@ // Description : declarations of all physics interfaces and structures - - -#ifndef CRYINCLUDE_CRYCOMMON_PHYSINTERFACE_H -#define CRYINCLUDE_CRYCOMMON_PHYSINTERFACE_H #pragma once @@ -25,3655 +21,4 @@ #endif #include - #include - -////////////////////////////////////////////////////////////////////////// -// Physics defines. -////////////////////////////////////////////////////////////////////////// - -enum EPE_Params -{ - ePE_params_pos = 0, - ePE_player_dimensions = 1, - ePE_params_car = 2, - ePE_params_particle = 3, - ePE_player_dynamics = 4, - ePE_params_joint = 5, - ePE_params_part = 6, - ePE_params_sensors = 7, - ePE_params_articulated_body = 8, - ePE_params_outer_entity = 9, - ePE_simulation_params = 10, - ePE_params_foreign_data = 11, - ePE_params_buoyancy = 12, - ePE_params_rope = 13, - ePE_params_bbox = 14, - ePE_params_flags = 15, - ePE_params_wheel = 16, - ePE_params_softbody = 17, - ePE_params_area = 18, - ePE_tetrlattice_params = 19, - ePE_params_ground_plane = 20, - ePE_params_structural_joint = 21, - ePE_params_waterman = 22, - ePE_params_timeout = 23, - ePE_params_skeleton = 24, - ePE_params_structural_initial_velocity = 25, - ePE_params_collision_class = 26, - - ePE_Params_Count -}; - -enum EPE_Action -{ - ePE_action_move = 1, - ePE_action_impulse = 2, - ePE_action_drive = 3, - ePE_action_reset = 4, - ePE_action_add_constraint = 5, - ePE_action_update_constraint = 6, - ePE_action_register_coll_event = 7, - ePE_action_awake = 8, - ePE_action_remove_all_parts = 9, - ePE_action_set_velocity = 10, - ePE_action_attach_points = 11, - ePE_action_target_vtx = 12, - ePE_action_reset_part_mtx = 13, - ePE_action_notify = 14, - ePE_action_auto_part_detachment = 15, - ePE_action_move_parts = 16, - ePE_action_batch_parts_update = 17, - ePE_action_slice = 18, - pPE_action_syncliving = 19, - - ePE_Action_Count -}; - -enum EPE_GeomParams -{ - ePE_geomparams = 0, - ePE_cargeomparams = 1, - ePE_articgeomparams = 2, - - ePE_GeomParams_Count -}; - -enum EPE_Status -{ - ePE_status_pos = 1, - ePE_status_living = 2, - ePE_status_vehicle = 4, - ePE_status_wheel = 5, - ePE_status_joint = 6, - ePE_status_awake = 7, - ePE_status_dynamics = 8, - ePE_status_collisions = 9, - ePE_status_id = 10, - ePE_status_timeslices = 11, - ePE_status_nparts = 12, - ePE_status_contains_point = 13, - ePE_status_rope = 14, - ePE_status_vehicle_abilities = 15, - ePE_status_placeholder = 16, - ePE_status_softvtx = 17, - ePE_status_sensors = 18, - ePE_status_sample_contact_area = 19, - ePE_status_caps = 20, - ePE_status_check_stance = 21, - ePE_status_waterman = 22, - ePE_status_area = 23, - ePE_status_extent = 24, - ePE_status_random = 25, - ePE_status_constraint = 26, - ePE_status_netpos = 27, - - ePE_Status_Count -}; - -enum pe_type -{ - PE_NONE = 0, PE_STATIC = 1, PE_RIGID = 2, PE_WHEELEDVEHICLE = 3, PE_LIVING = 4, PE_PARTICLE = 5, PE_ARTICULATED = 6, PE_ROPE = 7, PE_SOFT = 8, PE_AREA = 9 -}; -enum sim_class -{ - SC_STATIC = 0, SC_SLEEPING_RIGID = 1, SC_ACTIVE_RIGID = 2, SC_LIVING = 3, SC_INDEPENDENT = 4, SC_TRIGGER = 6, SC_DELETED = 7 -}; -struct IGeometry; -struct IPhysicalEntity; -struct IGeomManager; -struct IPhysRenderer; -class ICrySizer; -struct IDeferredPhysicsEvent; -struct ILog; -IPhysicalEntity* const WORLD_ENTITY = (IPhysicalEntity*)-10; - -#ifndef USE_IMPROVED_RIGID_ENTITY_SYNCHRONISATION -# define USE_IMPROVED_RIGID_ENTITY_SYNCHRONISATION 1 -#endif - -/** - * 64-bit wrapper for foreign data on physical entities. - * Int and pointer values are regularly stored in foreign data, but we now also support - * 64-bit unsigned integers (AZ::EntityId). - * - Supports implicit two-way conversion as integer, pointer, int, or 64-bit unsigned integer. - * - Supports casting to typed pointers for compatibility with original void* foreign data. - */ -class PhysicsForeignData final -{ -public: - - PhysicsForeignData() - : m_data(0) {} - - /// Explicit or implicit creation from pointer, int, or unsigned int types. - PhysicsForeignData(void* data) - : m_data(reinterpret_cast(data)) {} - PhysicsForeignData(int data) - : m_data(static_cast(data)) {} - PhysicsForeignData(uint64 data) - : m_data(static_cast(data)) {} - - /// Comparison operators. - bool operator==(const PhysicsForeignData& rhs) const - { - return m_data == rhs.m_data; - } - - bool operator!=(const PhysicsForeignData& rhs) const - { - return m_data != rhs.m_data; - } - - template - bool operator==(T* data) const - { - return reinterpret_cast(m_data) == data; - } - - template - bool operator==(const T* data) const - { - return reinterpret_cast(m_data) == data; - } - - bool operator==(int data) const - { - return static_cast(m_data) == data; - } - - bool operator==(uint64 data) const - { - return m_data == data; - } - - /// Using CryPhysics' existing pattern for marking fields as unused. - void MarkUnused() - { - m_data = uint64(1 << 31); - } - - bool IsUnused() const - { - return m_data == uint64(1 << 31); - } - - /// Bool operator for: if (foreignData) - operator bool() const - { - return m_data != 0; - } - - /// Void* cast conversion - operator void*() const - { - return reinterpret_cast(m_data); - } - - /// int cast conversion - operator int() const - { - return static_cast(m_data); - } - - /// 64-bit unsigned int cast conversion - operator uint64() const - { - return m_data; - } - - /// Cast conversion to pointers or arbitrary types. - template - operator T*() const - { - return reinterpret_cast(m_data); - } - -private: - - uint64 m_data; ///< Underlying 64-bit storage. -}; - -///////////////////////////////////////////////////////////////////////////////////// -//////////////////////////// IPhysicsStreamer Interface ///////////////////////////// -///////////////////////////////////////////////////////////////////////////////////// - -// this is a callback interface for on-demand physicalization, physics gets a pointer to an implementation -struct IPhysicsStreamer -{ - // - virtual ~IPhysicsStreamer(){} - // called whenever a placeholder (created through CreatePhysicalPlaceholder) requests a full entity - virtual int CreatePhysicalEntity(PhysicsForeignData foreignData, int iForeignData, int iForeignFlags) = 0; - // called whenever a placeholder-owned entity expires - virtual int DestroyPhysicalEntity(IPhysicalEntity* pent) = 0; - // called when on-demand entities in a box need to be physicalized - // (the grid is activated once RegisterBBoxInPODGrid is called) - virtual int CreatePhysicalEntitiesInBox(const Vec3& boxMin, const Vec3& boxMax) = 0; - // called when on-demand physicalized box expires. - // the streamer is expected to delete those that have a 0 refcounter, and keep the rest - virtual int DestroyPhysicalEntitiesInBox(const Vec3& boxMin, const Vec3& boxMax) = 0; - // -}; - -///////////////////////////////////////////////////////////////////////////////////// -/////////////////////////////// IPhysRenderer Interface ///////////////////////////// -///////////////////////////////////////////////////////////////////////////////////// - -// this is a callback interface for debug rendering, physics gets a pointer to an implementation -struct IPhysRenderer -{ - // - virtual ~IPhysRenderer(){} - // draws helpers for the specified geometry (idxColor is in 0..7 range) - virtual void DrawGeometry(IGeometry* pGeom, struct geom_world_data* pgwd, int idxColor = 0, int bSlowFadein = 0, const Vec3& sweepDir = Vec3(0)) = 0; - // draws a line for wireframe helpers - virtual void DrawLine(const Vec3& pt0, const Vec3& pt1, int idxColor = 0, int bSlowFadein = 0) = 0; - // gets a descriptive name of the phys entity's owner (used solely for debug output) - virtual const char* GetForeignName(PhysicsForeignData foreignData, int iForeignData, int iForeignFlags) = 0; - // draws a text line (stauration is 0..1 and is currently used to represent stress level on a breakable joint) - virtual void DrawText(const Vec3& pt, const char* txt, int idxColor, float saturation = 0) = 0; - // sets an offset that is to be added to all subsequent draw requests - virtual Vec3 SetOffset(const Vec3& offs = Vec3(ZERO)) = 0; - // draw a frame or a partial frame using a scale for the axes. - // pnt is the world space position - // axes are the 3 axes normalized - // scale is a scale applied on the axes - // limits are the x, y, z radians for the Y, Z, X plane. If the pointer is not null, limits will be drawn in form of arcs. - // bitfield for what axes are locked - virtual void DrawFrame(const Vec3& pnt, const Vec3* axes, const float scale, const Vec3* limits, const int axes_locked) = 0; - // -}; - -class CMemStream -{ // For "fastload" serialization -public: - - ILINE CMemStream(bool swap) - { - Prealloc(); - m_iPos = 0; - bDeleteBuf = true; - bSwapEndian = swap; - bMeasureOnly = 0; - } - - ILINE CMemStream(void* pbuf, int sz, bool swap) - { - m_pBuf = (char*)pbuf; - m_nSize = sz; - m_iPos = 0; - bDeleteBuf = false; - bSwapEndian = swap; - bMeasureOnly = 0; - } - ILINE CMemStream() - { - m_pBuf = (char*)m_dummyBuf; - m_iPos = 0; - m_nSize = 0; - bDeleteBuf = false; - bSwapEndian = false; - bMeasureOnly = -1; - } - - virtual ~CMemStream() - { - if (bDeleteBuf) - { - CryModuleFree(m_pBuf); - } - } - virtual void Prealloc() - { - m_pBuf = (char*)CryModuleMalloc(m_nSize = 0x1000); - } - - ILINE void* GetBuf() { return m_pBuf; } - ILINE int GetUsedSize() { return m_iPos; } - ILINE int GetAllocatedSize() { return m_nSize; } - - template - ILINE void Write(const ftype& op) { Write(&op, sizeof(op)); } - ILINE void Write(const void* pbuf, int sz) - { -#if defined(MEMSTREAM_DEBUG) - if (bMeasureOnly <= 0 && m_nSize && m_iPos + sz > m_nSize) - { - printf("overflow: %d + %d >= %d\n", m_iPos, sz, m_nSize); - } -#endif - if (!bMeasureOnly) - { - if (m_iPos + sz > m_nSize) - { - GrowBuf(sz); - } - memcpy(m_pBuf + m_iPos, pbuf, (unsigned int)sz); - } - m_iPos += sz; - } - - virtual void GrowBuf(int sz) - { - int prevsz = m_nSize; - char* prevbuf = m_pBuf; - m_pBuf = (char*)CryModuleMalloc(m_nSize = (m_iPos + sz - 1 & ~0xFFF) + 0x1000); - memcpy(m_pBuf, prevbuf, (unsigned int)prevsz); - CryModuleFree(prevbuf); - } - - template - ILINE void Read(ftype& op) - { - ReadRaw(&op, sizeof(op)); -#if defined (NEED_ENDIAN_SWAP) - if (bSwapEndian) - { - SwapEndian(op); - } -#endif - } - - template - ILINE ftype Read() - { - ftype val; - Read(val); - return val; - } - template - ILINE void ReadType(ftype* op, int count = 1) - { - ReadRaw(op, sizeof(*op) * count); -#if defined (NEED_ENDIAN_SWAP) - if (bSwapEndian) - { - while (count-- > 0) - { - SwapEndian(*op++); - } - } -#endif - } - ILINE void ReadRaw(void* pbuf, int sz) - { -#if defined(MEMSTREAM_DEBUG) - if (bMeasureOnly <= 0 && m_nSize && m_iPos + sz > m_nSize) - { - printf("overflow: %d + %d >= %d\n", m_iPos, sz, m_nSize); - } -#endif - memcpy(pbuf, (m_pBuf + m_iPos), (unsigned int)sz); - m_iPos += sz; - } - - char* m_pBuf, m_dummyBuf[4]; - int m_iPos, m_nSize; - bool bDeleteBuf; - bool bSwapEndian; - int bMeasureOnly; -}; - - -// Workaround for bug in GCC 4.8. The kind of access patterns here leads to an internal -// compiler error in GCC 4.8 when optimizing with debug symbols. Two possible solutions -// are available, compile in Profile mode without debug symbols or remove optimizations -// in the code where the bug occurs -// see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59776 -#if defined(_PROFILE) && !defined(__clang__) && (__GNUC__ == 4) && (__GNUC_MINOR__ == 8) -// Cannot use #pragma GCC optimize("O0") because it causes a system crash when using -// the gcc compiler for another platform -#define CRY_GCC48_AVOID_OPTIMIZE __attribute__((optimize("-O0"))) -#else -#define CRY_GCC48_AVOID_OPTIMIZE -#endif -// unused_marker deliberately fills a variable with invalid data, -// so that later is_unused() can check whether it was initialized -// (this is used in all physics params/status/action structures) -class unused_marker -{ -public: - union f2i - { - float f; - uint32 i; - }; - union d2i - { - double d; - uint32 i[2]; - }; - unused_marker() {} - unused_marker& operator,(float& x) CRY_GCC48_AVOID_OPTIMIZE; - unused_marker& operator,(double& x) CRY_GCC48_AVOID_OPTIMIZE; - unused_marker& operator,(int& x) CRY_GCC48_AVOID_OPTIMIZE; - unused_marker& operator,(unsigned int& x) CRY_GCC48_AVOID_OPTIMIZE; - unused_marker& operator,(PhysicsForeignData& x) CRY_GCC48_AVOID_OPTIMIZE; - template - unused_marker& operator,(ref*& x) { x = (ref*)-1; return *this; } - template - unused_marker& operator,(Vec3_tpl& x) { return *this, x.x; } - template - unused_marker& operator,(Quat_tpl& x) { return *this, x.w; } - template - unused_marker& operator,(strided_pointer& x) { return *this, x.data; } -}; -inline unused_marker& unused_marker::operator,(float& x) { *alias_cast(&x) = 0xFFBFFFFF; return *this; } -inline unused_marker& unused_marker::operator,(double& x) { (alias_cast(&x))[false ? 1 : 0] = 0xFFF7FFFF; return *this; } -inline unused_marker& unused_marker::operator,(int& x) { x = 1 << 31; return *this; } -inline unused_marker& unused_marker::operator,(unsigned int& x) { x = 1u << 31; return *this; } -inline unused_marker& unused_marker::operator,(PhysicsForeignData& x) { x.MarkUnused(); return *this; } - -#undef CRY_GCC48_AVOID_OPTIMIZE - -inline bool is_unused(const float& x) { unused_marker::f2i u; u.f = x; return (u.i & 0xFFA00000) == 0xFFA00000; } - -inline bool is_unused(int x) { return x == 1 << 31; } -inline bool is_unused(unsigned int x) { return x == 1u << 31; } -inline bool is_unused(const PhysicsForeignData& x) { return x.IsUnused(); } -template -bool is_unused(ref* x) { return x == (ref*)-1; } -template -bool is_unused(strided_pointer x) { return is_unused(x.data); } -template -bool is_unused(const Ang3_tpl& x) { return is_unused(x.x); } -template -bool is_unused(const Vec3_tpl& x) { return is_unused(x.x); } -template -bool is_unused(const Quat_tpl& x) { return is_unused(x.w); } -inline bool is_unused(const double& x) { unused_marker::d2i u; u.d = x; return (u.i[eLittleEndian ? 1 : 0] & 0xFFF40000) == 0xFFF40000; } -#define MARK_UNUSED unused_marker(), - - -// validators do nothing in the interface, but inside the physics they are redefined -// so that they check the input for consistency and report errors -#if !defined(VALIDATOR_LOG) -#define VALIDATOR_LOG(pLog, str) -#define VALIDATORS_START -#define VALIDATOR(member) -#define VALIDATOR_NORM(member) -#define VALIDATOR_NORM_MSG(member, msg, member1) -#define VALIDATOR_RANGE(member, minval, maxval) -#define VALIDATOR_RANGE2(member, minval, maxval) -#define VALIDATORS_END -#endif - - - -////////// physics entity collision filtering class enums ///////////////// - -enum pe_collision_class -{ - /// reserved basic collision classes - collision_class_terrain = 1 << 0, - collision_class_wheeled = 1 << 1, - collision_class_living = 1 << 2, - collision_class_articulated = 1 << 3, - collision_class_soft = 1 << 4, - collision_class_rope = 1 << 5, - collision_class_particle = 1 << 6, - // begin game specific ones from this enum - collision_class_game = 1 << 10, -}; - -struct SCollisionClass -{ - uint32 type; // collision_class flags to identify the enity - uint32 ignore; // another entity will be ignored if *any* of these bits are set in its type - - SCollisionClass() {} - - SCollisionClass(uint32 t, uint32 i) - { - type = t; - ignore = i; - } -}; - -ILINE int IgnoreCollision(const SCollisionClass& a, const SCollisionClass& b) -{ - return (a.type & b.ignore) | (b.type & a.ignore); -} - - - -// in physics interface [almost] all parameters are passed via structures -// this allows having stable interface methods and flexible default arguments system - -////////////////////////// Params structures ///////////////////// - -////////// common params -struct pe_params -{ - int type; -}; - -struct pe_params_pos - : pe_params // Sets position and orientation of entity -{ - enum entype - { - type_id = ePE_params_pos - }; - pe_params_pos() - { - type = type_id; - MARK_UNUSED pos, scale, q, iSimClass; - pMtx3x4 = 0; - pMtx3x3 = 0; - bRecalcBounds = 1; - bEntGridUseOBB = 0; - } - - Vec3 pos; - quaternionf q; - float scale; // note that since there's no per-entity scale, it gets 'baked' into individual parts' scales - Matrix34* pMtx3x4; // optional position+orientation - Matrix33* pMtx3x3; // optional orientation via 3x3 matrix - int iSimClass; // see the sim_class enum - int bRecalcBounds; // tells to recompute the bounding boxes - bool bEntGridUseOBB; // whether or not to use part OBBs rather than object AABB when registering in the entity grid - - VALIDATORS_START - VALIDATOR(pos) - VALIDATOR_NORM_MSG(q, "(perhaps non-uniform scaling was used?)", pos) - VALIDATOR(scale) - VALIDATORS_END -}; - -struct pe_params_bbox - : pe_params -{ - enum entype - { - type_id = ePE_params_bbox - }; - pe_params_bbox() { type = type_id; MARK_UNUSED BBox[0], BBox[1]; } - Vec3 BBox[2]; // force this bounding box (note that if the entity recomputes it later, it'll override this) - - VALIDATORS_START - VALIDATOR(BBox[0]) - VALIDATOR(BBox[1]) - VALIDATORS_END -}; - -struct pe_params_outer_entity - : pe_params -{ - enum entype - { - type_id = ePE_params_outer_entity - }; - pe_params_outer_entity() { type = type_id; pOuterEntity = 0; pBoundingGeometry = 0; } - - IPhysicalEntity* pOuterEntity; // outer entity is used to group together SC_INDEPENDENT entities (example: ropes on a tree trunk) - IGeometry* pBoundingGeometry; // optional geometry to test containment (used in pe_status_contains_point) -}; - -struct ITetrLattice; - -struct pe_params_part - : pe_params // Sets geometrical parameters of entity part -{ - enum entype - { - type_id = ePE_params_part - }; - pe_params_part() - { - type = type_id; - MARK_UNUSED pos, q, scale, partid, ipart, mass, density, pPhysGeom, pPhysGeomProxy, idmatBreakable, pLattice, pMatMapping, minContactDist, flagsCond, idSkeleton, invTimeStep, idParent; - pMtx3x4 = 0; - pMtx3x3 = 0; - bRecalcBBox = 1; - bAddrefGeoms = 0; - flagsOR = flagsColliderOR = 0; - flagsAND = flagsColliderAND = (unsigned)-1; - } - - int partid; // partid identifier of part - int ipart; // optionally, internal part slot number - int bRecalcBBox; // whether entity's bounding box should be recalculated - Vec3 pos; - quaternionf q; - float scale; - Matrix34* pMtx3x4; // optional position+orientation - Matrix33* pMtx3x3; // optional orientation via 3x3 matrix - unsigned int flagsCond; // if partid and ipart are not specified, check for parts with flagsCond set - unsigned int flagsOR, flagsAND; // new flags = (flags & flagsAND) | flagsOR - unsigned int flagsColliderOR, flagsColliderAND; - float mass; // either mass of density should be set; mass = density*volume - float density; - float minContactDist; // threshold for contact points generation - struct phys_geometry* pPhysGeom, * pPhysGeomProxy; // if present and different from pPhysGeomProxy, pPhysGeom is used for raytracing - int idmatBreakable; // if >=0, the part is procedurally breakable with this mat_id (see AddExplosionShape) - ITetrLattice* pLattice; // lattice is used for soft bodies and procedural structural breaking - int idSkeleton; // part with this id becomes this part's deformation skeleton - int* pMatMapping; // material mapping table for this part - int nMats; // number of pMatMapping entries - float invTimeStep; // 1.0f/time_step, ragdolls will compute joint's velocity if this and position is set - int bAddrefGeoms; // AddRef returned geometries if used in GetParams - int idParent; // parent for hierarchical breaking; it hides all children until at least one of them breaks off - - VALIDATORS_START - VALIDATOR(pos) - VALIDATOR_NORM_MSG(q, "(perhaps non-uniform scaling was used in the asset?)", pt) - VALIDATOR(scale) - VALIDATORS_END -}; - -struct pe_params_sensors - : pe_params // Attaches optional ray sensors to an entity; only living entities support it -{ - enum entype - { - type_id = ePE_params_sensors - }; - pe_params_sensors() { type = type_id; nSensors = 0; pOrigins = 0; pDirections = 0; } - - int nSensors; // nSensors number of sensors - const Vec3* pOrigins; // pOrigins sensors origins in entity CS - const Vec3* pDirections; // pDirections sensors directions (dir*ray length) in entity CS -}; - -struct pe_simulation_params - : pe_params -{ - enum entype - { - type_id = ePE_simulation_params - }; - pe_simulation_params() - { - type = type_id; - MARK_UNUSED maxTimeStep, gravity, minEnergy, damping, iSimClass, - dampingFreefall, gravityFreefall, mass, density, maxLoggedCollisions, maxRotVel, disablePreCG, maxFriction, collTypes; - } - - int iSimClass; - float maxTimeStep; // maximum time step that entity can accept (larger steps will be split) - float minEnergy; // minimun of kinetic energy below which entity falls asleep (divided by mass) - float damping; // damped velocity = oridinal velocity * (1 - damping*time interval) - Vec3 gravity; // per-entity gravity (note that if there are any phys areas with gravity, they will override it unless pef_ignore_areas is set - float dampingFreefall; // damping and gravity used when there are no collisions, - Vec3 gravityFreefall; // NOTE: if left unused, gravity value will be substituted (if provided) - float maxRotVel; // rotational velocity is clamped to this value - float mass; // either mass of density should be set; mass = density*volume - float density; - int maxLoggedCollisions; // maximum EventPhysCollisions reported per frame (only supported by rigid bodies/ragdolls/vehicles) - int disablePreCG; // disables Pre-CG solver for the group this body is in (recommended for balls) - float maxFriction; // sets upper friction limit for this object and all objects it's currently in contact with - int collTypes; // collision types (a combination of ent_xxx flags) -}; - -struct pe_params_foreign_data - : pe_params -{ - enum entype - { - type_id = ePE_params_foreign_data - }; - pe_params_foreign_data() { type = type_id; MARK_UNUSED pForeignData, iForeignData, iForeignFlags; iForeignFlagsAND = -1; iForeignFlagsOR = 0; } - - PhysicsForeignData pForeignData; // foreign data is an arbitrary pointer used to associate physical entity with its owner object - int iForeignData; // foreign data types (defined in IPhysics.h) - int iForeignFlags; // any flags the owner wants to store - int iForeignFlagsAND, iForeignFlagsOR; // when setting, flagsNew = flags & flagsAND | flagsOR -}; - -struct pe_params_buoyancy - : pe_params -{ - enum entype - { - type_id = ePE_params_buoyancy - }; - pe_params_buoyancy() - { - type = type_id; - iMedium = 0; - MARK_UNUSED waterDensity, kwaterDensity, waterDamping, - waterPlane.n, waterPlane.origin, waterEmin, waterResistance, kwaterResistance, waterFlow, flowVariance; - }; - - float waterDensity; // overrides water density from the current water volume for an entity; sets for water areas - float kwaterDensity; // scales water density from the current water volume (used for entities only) - // NOTE: for entities , waterDensity override is stored as kwaterDensity relative to the global area's density - float waterDamping; // uniform damping while submerged, will be scaled with submerged fraction - float waterResistance, kwaterResistance; // water's medium resistance; same comments on water and kwater.. apply - Vec3 waterFlow; // flow's movement vector; can only be set for a water area - float flowVariance; // not yet supported - primitives::plane waterPlane; // positive normal = above the water surface - float waterEmin; // sleep energy while floating with no contacts (see minEnergy in pe_simulation_params) - int iMedium; // 0 for water, 1 for air -}; - -enum phentity_flags -{ - // PE_PARTICLE-specific flags - particle_single_contact = 0x01, // full stop after first contact - particle_constant_orientation = 0x02, // forces constant orientation - particle_no_roll = 0x04, // 'sliding' mode; entity's 'normal' vector axis will be alinged with the ground normal - particle_no_path_alignment = 0x08, // unless set, entity's y axis will be aligned along the movement trajectory - particle_no_spin = 0x10, // disables spinning while flying - particle_no_self_collisions = 0x100, // disables collisions with other particles - particle_no_impulse = 0x200, // particle will not add hit impulse (expecting that some other system will) - - // PE_LIVING-specific flags - lef_push_objects = 0x01, lef_push_players = 0x02, // push objects and players during contacts - lef_snap_velocities = 0x04, // quantizes velocities after each step (was ised in MP for precise deterministic sync) - lef_loosen_stuck_checks = 0x08, // don't do additional intersection checks after each step (recommended for NPCs to improve performance) - lef_report_sliding_contacts = 0x10, // unless set, 'grazing' contacts are not reported - - // PE_ROPE-specific flags - rope_findiff_attached_vel = 0x01, // approximate velocity of the parent object as v = (pos1-pos0)/time_interval - rope_no_solver = 0x02, // no velocity solver; will rely on stiffness (if set) and positional length enforcement - rope_ignore_attachments = 0x4, // no collisions with objects the rope is attached to - rope_target_vtx_rel0 = 0x08, rope_target_vtx_rel1 = 0x10, // whether target vertices are set in the parent entity's frame - rope_subdivide_segs = 0x100, // turns on 'dynamic subdivision' mode (only in this mode contacts in a strained state are handled correctly) - rope_no_tears = 0x200, // rope will not tear when it reaches its force limit, but stretch - rope_collides = 0x200000, // rope will collide with objects other than the terrain - rope_collides_with_terrain = 0x400000, // rope will collide with the terrain - rope_collides_with_attachment = 0x80, // rope will collide with the objects it's attached to even if the other collision flags are not set - rope_no_stiffness_when_colliding = 0x10000000, // rope will use stiffness 0 if it has contacts - - // PE_SOFT-specific flags - se_skip_longest_edges = 0x01, // the longest edge in each triangle with not participate in the solver - se_rigid_core = 0x02, // soft body will have an additional rigid body core - - // PE_RIGID-specific flags (note that PE_ARTICULATED and PE_WHEELEDVEHICLE are derived from it) - ref_use_simple_solver = 0x01, // use penalty-based solver (obsolete) - ref_no_splashes = 0x04, // will not generate EventPhysCollisions when contacting water - ref_checksum_received = 0x04, ref_checksum_outofsync = 0x08, // obsolete - ref_small_and_fast = 0x100, // entity will trace rays against alive characters; set internally unless overriden - - // PE_ARTICULATED-specific flags - aef_recorded_physics = 0x02, // specifies a an entity that contains pre-baked physics simulation - - // PE_WHEELEDVEHICLE-specific flags - wwef_fake_inner_wheels = 0x08, // exclude wheels between the first and the last one from the solver - // (only wheels with non-0 suspension are considered) - - // general flags - pef_parts_traceable = 0x10, // each entity part will be registered separately in the entity grid - pef_disabled = 0x20, // entity will not be simulated - pef_never_break = 0x40, // entity will not break or deform other objects - pef_deforming = 0x80, // entity undergoes a dynamic breaking/deforming - pef_pushable_by_players = 0x200, // entity can be pushed by playerd - pef_traceable = 0x400, particle_traceable = 0x400, rope_traceable = 0x400, // entity is registered in the entity grid - pef_update = 0x800, // only entities with this flag are updated if ent_flagged_only is used in TimeStep() - pef_monitor_state_changes = 0x1000, // generate immediate events for simulation class changed (typically rigid bodies falling asleep) - pef_monitor_collisions = 0x2000, // generate immediate events for collisions - pef_monitor_env_changes = 0x4000, // generate immediate events when something breaks nearby - pef_never_affect_triggers = 0x8000, // don't generate events when moving through triggers - pef_invisible = 0x10000, // will apply certain optimizations for invisible entities - pef_ignore_ocean = 0x20000, // entity will ignore global water area - pef_fixed_damping = 0x40000, // entity will force its damping onto the entire group - pef_monitor_poststep = 0x80000, // entity will generate immediate post step events - pef_always_notify_on_deletion = 0x100000, // when deleted, entity will awake objects around it even if it's not referenced (has refcount 0) - pef_override_impulse_scale = 0x200000, // entity will ignore breakImpulseScale in PhysVars - pef_players_can_break = 0x400000, // playes can break the entiy by bumping into it - pef_cannot_squash_players = 0x10000000, // entity will never trigger 'squashed' state when colliding with players - pef_ignore_areas = 0x800000, // entity will ignore phys areas (gravity and water) - pef_log_state_changes = 0x1000000, // entity will log simulation class change events - pef_log_collisions = 0x2000000, // entity will log collision events - pef_log_env_changes = 0x4000000, // entity will log EventPhysEnvChange when something breaks nearby - pef_log_poststep = 0x8000000, // entity will log EventPhysPostStep events -}; - -struct pe_params_flags - : pe_params -{ - enum entype - { - type_id = ePE_params_flags - }; - pe_params_flags() { type = type_id; MARK_UNUSED flags, flagsOR, flagsAND; } - unsigned int flags; - unsigned int flagsOR; // when setting, flagsNew = (flags set ? flags:flagsOld) & flagsAND | flagsOR - unsigned int flagsAND; // when getting, only flags is filled -}; - - -struct pe_params_collision_class - : pe_params -{ - enum entype - { - type_id = ePE_params_collision_class - }; - pe_params_collision_class() { type = type_id; collisionClassOR.type = collisionClassOR.ignore = 0; collisionClassAND.type = collisionClassAND.ignore = (unsigned)-1; } - SCollisionClass collisionClassOR; // When getting both collisionClassOR and collisionClassAND are filled out - SCollisionClass collisionClassAND; // When setting first collisionClassAND is applied to mask bits, then collisionClassOR is applied to turn on collision bits -}; - -struct pe_params_ground_plane - : pe_params -{ - // used for breakable objects; pieces that are below ground (at least partially) stay in the entity - enum entype - { - type_id = ePE_params_ground_plane - }; - pe_params_ground_plane() { type = type_id; iPlane = 0; MARK_UNUSED ground.origin, ground.n; } - int iPlane; // index of the plane to be set (-1 removes existing planes) - primitives::plane ground; -}; - -enum special_joint_ids -{ - joint_impulse = 1000000 -}; -struct pe_params_structural_joint - : pe_params -{ - enum entype - { - type_id = ePE_params_structural_joint - }; - pe_params_structural_joint() - { - type = type_id; - id = 0; - bReplaceExisting = 0; - MARK_UNUSED idx, partid[0], partid[1], pt, n, maxForcePush, maxForcePull, maxForceShift, maxTorqueBend, maxTorqueTwist, damageAccum, damageAccumThresh, - bBreakable, szSensor, bBroken, partidEpicenter, axisx, limitConstraint, bConstraintWillIgnoreCollisions, dampingConstraint; - } - - int id; // joint's 'foreign' identifier - int idx; // joint's internal index - int bReplaceExisting; // if not set, SetParams will add a new joint even if id is already used - int partid[2]; // ids of the parts this joint connects (-1 for ground) - Vec3 pt; // point in entity space - Vec3 n; // push/pull direction in entity space - Vec3 axisx; // x axis in entity frame; only used for joints that can become dynamic constraints - float maxForcePush, maxForcePull, maxForceShift; // linear force limits - float maxTorqueBend, maxTorqueTwist; // angular force (torque) limits - float damageAccum, damageAccumThresh; // fraction of tension that gets accumulated, can be used to emulate an health system - Vec3 limitConstraint; // x=min angle, y=max angle, z=force limit - int bBreakable; // joint is at all breakable - int bConstraintWillIgnoreCollisions; // dynamic constraints will have constraint_ignore_buddy flag - int bDirectBreaksOnly; // joint can only be broken by direct impulses to one of the parts it connects - float dampingConstraint; // dynamic constraint's damping - float szSensor; // sensor geometry size; used to re-attach the joint when parts break off - int bBroken; // joint is broken - int partidEpicenter; // tension recomputation will start from this part (used for network playback, for instance) -}; - -struct pe_params_structural_initial_velocity - : pe_params -{ - // Setting of initial velocities of parts before breaking joints on clients through pe_params_structural_joint - enum entype - { - type_id = ePE_params_structural_initial_velocity - }; - pe_params_structural_initial_velocity() { type = type_id; } - - int partid; // id of the part to prepare for breakage - Vec3 v; // Initial velocity - Vec3 w; // Initial ang velocity -}; - - -struct pe_params_timeout - : pe_params -{ - // entities can be forced to go to sleep after some time without external impulses - enum entype - { - type_id = ePE_params_timeout - }; - pe_params_timeout() { type = type_id; MARK_UNUSED timeIdle, maxTimeIdle; } - float timeIdle; // current 'idle' time (time without any 'prods' from outside) - float maxTimeIdle; // sleep when timeIdle>maxTimeIdle; 0 turns this feature off -}; - -struct pe_params_skeleton - : pe_params -{ - // skeleton is a hidden mesh that uses cloth simulation to skin the main physics geometry - enum entype - { - type_id = ePE_params_skeleton - }; - pe_params_skeleton() { type = type_id; MARK_UNUSED partid, ipart, stiffness, thickness, maxStretch, maxImpulse, timeStep, nSteps, hardness, explosionScale, bReset; } - - int partid; // id of the skinned part - int ipart; // ..or its internal index - float stiffness; // skeleton's hardness against bending and shearing - float thickness; // skeleton's thickness for collisions - float maxStretch; // skeleton's maximal stretching - float maxImpulse; // skeleton impulse cap - float timeStep; // time step, used to simulate the skeleton (typically small) - int nSteps; // number of skeleton sub-steps per each structure update - float hardness; // skeleton's hardness against stretching - float explosionScale; // skeleton's explosion impulse scale - int bReset; // resets the skeleton to its original pose -}; - - -////////// articulated entity params -enum joint_flags -{ - angle0_locked = 1, all_angles_locked = 7, angle0_limit_reached = 010, angle0_auto_kd = 0100, joint_no_gravity = 01000, - joint_isolated_accelerations = 02000, joint_expand_hinge = 04000, angle0_gimbal_locked = 010000, - joint_dashpot_reached = 0100000, joint_ignore_impulses = 0200000 -}; - -struct pe_params_joint - : pe_params -{ - enum entype - { - type_id = ePE_params_joint - }; - pe_params_joint() - { - type = type_id; - for (int i = 0; i < 3; i++) - { - MARK_UNUSED limits[0][i], limits[1][i], qdashpot[i], kdashpot[i], bounciness[i], q[i], qext[i], ks[i], kd[i], qtarget[i]; - } - bNoUpdate = 0; - pMtx0 = 0; - flagsPivot = 3; - MARK_UNUSED flags, q0, pivot, ranimationTimeStep, nSelfCollidingParts, animationTimeStep, op[0]; - } - - unsigned int flags; // should be a combination of angle0,1,2_locked, angle0,1,2_auto_kd, joint_no_gravity - int flagsPivot; // if bit 0 is set, update pivot point in parent frame, if bit 1 - in child - Vec3 pivot; // joint pivot in entity CS - quaternionf q0; // orientation of child in parent coordinates that corresponds to angles (0,0,0) - Matrix33* pMtx0; // same as q0 - Vec3 limits[2]; // limits for each angle - Vec3 bounciness; // bounciness for each angle (applied when limit is reached) - Vec3 ks, kd; // stiffness and damping koefficients for each angle angular spring - Vec3 qdashpot; // limit vicinity where joints starts resisting movement - Vec3 kdashpot; // when dashpot is activated, this is roughly the angular speed, stopped in 2 sec - Ang3 q; // angles values - Ang3 qext; // additional angles values (angle[i] = q[i]+qext[i]; only q[i] is taken into account - // while calculating spring torque - Ang3 qtarget; - int op[2]; // body identifiers of parent (optional) and child respectively - int nSelfCollidingParts, * pSelfCollidingParts; // part ids of only parts that should be checked for self-collision - int bNoUpdate; // omit recalculation of body parameters after changing this joint - float animationTimeStep; // used to calculate joint velocities of animation - float ranimationTimeStep; // 1/animation time step, can be not specified (specifying just saves extra division operation) - - VALIDATORS_START - VALIDATOR(pivot) - VALIDATOR_NORM(q0) - VALIDATOR(q) - VALIDATOR(qext) - VALIDATORS_END -}; - -struct pe_params_articulated_body - : pe_params -{ - enum entype - { - type_id = ePE_params_articulated_body - }; - pe_params_articulated_body() - { - type = type_id; - MARK_UNUSED bGrounded, bInheritVel, bCheckCollisions, bCollisionResp, nJointsAlloc; - MARK_UNUSED bGrounded, bInheritVel, bCheckCollisions, bCollisionResp, a, wa, w, v, pivot, scaleBounceResponse, posHostPivot, qHostPivot; - MARK_UNUSED bAwake, pHost, nCollLyingMode, gravityLyingMode, dampingLyingMode, minEnergyLyingMode, iSimType, iSimTypeLyingMode, nRoots; - bApply_dqext = 0; - bRecalcJoints = 1; - } - - int bGrounded; // whether body's pivot is firmly attached to something or free - int bCheckCollisions; // only works with bCollisionResp set - int bCollisionResp; // when on, uses 'ragdoll' simulation mode, when off - 'skeleton' (for hit simulation on alive actors) - Vec3 pivot; // attachment position for grounded entities - Vec3 a; // acceleration of the ground for grounded entities - Vec3 wa; // angular acceleration of the ground for grounded entities - Vec3 w; // angular velocity of the ground for grounded entities - Vec3 v; // linear velocity of the ground for grounded entities - float scaleBounceResponse; // scales impulsive torque that is applied at a joint that has just reached its limit - int bApply_dqext; // adds current dqext to joints velocities. dqext is the speed of external animation and is calculated each time - // qext is set for joint (as difference between new value and current value, multiplied by inverse of animation timestep) - int bAwake; // current state - - IPhysicalEntity* pHost; // 'ground' entity - Vec3 posHostPivot; // attachment position inside pHost - quaternionf qHostPivot; - int bInheritVel; // take pHost velocity into account during the simulation - - int nCollLyingMode; // number of contacts that triggers 'lying mode' - Vec3 gravityLyingMode; // gravity override in lying mode - float dampingLyingMode; // damping override - float minEnergyLyingMode; // sleep speed override - int iSimType; // simulation type: 0-'joint-based', 1-'body-based'; fast motion forces joint-based mode automatically - int iSimTypeLyingMode; // simulation type override - int nRoots; // only used in GetParams - int nJointsAlloc; // pre-allocates this amount of joints and parts - - int bRecalcJoints; // re-build geometry positions from joint agnles -}; - -////////// living entity params - -struct pe_player_dimensions - : pe_params -{ - enum entype - { - type_id = ePE_player_dimensions - }; - pe_player_dimensions() - : dirUnproj(0, 0, 1) - , maxUnproj(0) - { - type = type_id; - MARK_UNUSED sizeCollider, heightPivot, heightCollider, heightEye, heightHead, headRadius, bUseCapsule, groundContactEps; - } - - float heightPivot; // offset from central ground position that is considered entity center - float heightEye; // vertical offset of camera - Vec3 sizeCollider; // collision cylinder dimensions - float heightCollider; // vertical offset of collision geometry center - float headRadius; // radius of the 'head' geometry (used for camera offset) - float heightHead; // center.z of the head geometry - Vec3 dirUnproj; // unprojection direction to test in case the new position overlaps with the environment (can be 0 for 'auto') - float maxUnproj; // maximum allowed unprojection - int bUseCapsule; // switches between capsule and cylinder collider geometry - float groundContactEps; // the amount that the living needs to move upwards before ground contact is lost. defaults to which ever is greater 0.004, or 0.01*geometryHeight - - VALIDATORS_START - VALIDATOR(heightPivot) - VALIDATOR(heightEye) - VALIDATOR_RANGE2(sizeCollider, 0, 100) - VALIDATORS_END -}; - -struct pe_player_dynamics - : pe_params -{ - enum entype - { - type_id = ePE_player_dynamics - }; - pe_player_dynamics() - { - type = type_id; - MARK_UNUSED kInertia, kInertiaAccel, kAirControl, gravity, gravity.z, nodSpeed, mass, bSwimming, surface_idx, bActive, collTypes, pLivingEntToIgnore; - MARK_UNUSED minSlideAngle, maxClimbAngle, maxJumpAngle, minFallAngle, kAirResistance, maxVelGround, timeImpulseRecover, bReleaseGroundColliderWhenNotActive; - } - - float kInertia; // inertia koefficient, the more it is, the less inertia is; 0 means no inertia - float kInertiaAccel; // inertia on acceleration - float kAirControl; // air control coefficient 0..1, 1 - special value (total control of movement) - float kAirResistance; // standard air resistance - Vec3 gravity; // gravity vector - float nodSpeed; // vertical camera shake speed after landings - int bSwimming; // whether entity is swimming (is not bound to ground plane) - float mass; // mass (in kg) - int surface_idx; // surface identifier for collisions - float minSlideAngle; // if surface slope is more than this angle, player starts sliding (angle is in degrees) - float maxClimbAngle; // player cannot climb surface which slope is steeper than this angle (angle is in degrees) - float maxJumpAngle; // player is not allowed to jump towards ground if this angle is exceeded (angle is in degrees) - float minFallAngle; // player starts falling when slope is steeper than this (angle is in degrees) - float maxVelGround; // player cannot stand on surfaces that are moving faster than this - float timeImpulseRecover; // forcefully turns on inertia for that duration after receiving an impulse - int collTypes; // entity types to check collisions against - IPhysicalEntity* pLivingEntToIgnore; // ignore collisions with this *living entity* (doesn't work with other entity types) - int bActive; // 0 disables all simulation for the character, apart from moving along the requested velocity - int bReleaseGroundColliderWhenNotActive; // when not 0, if the living entity is not active, the ground collider, if any, will be explicitly released during the simulation step. -}; - -////////// particle entity params - -struct pe_params_particle - : pe_params -{ - enum entype - { - type_id = ePE_params_particle - }; - pe_params_particle() - { - type = type_id; - MARK_UNUSED mass, size, thickness, wspin, accThrust, kAirResistance, kWaterResistance, velocity, heading, accLift, accThrust, gravity, waterGravity; - MARK_UNUSED surface_idx, normal, q0, minBounceVel, rollAxis, flags, pColliderToIgnore, iPierceability, areaCheckPeriod, minVel, collTypes, dontPlayHitEffect; - } - - unsigned int flags; // see entity flags - float mass; - float size; // pseudo-radius - float thickness; // thickness when lying on a surface (if left unused, size will be used) - Vec3 heading; // direction of movement - float velocity; // velocity along "heading" - float kAirResistance; // air resistance koefficient, F = kv - float kWaterResistance; // same for water - float accThrust; // acceleration along direction of movement - float accLift; // acceleration that lifts particle with the current speed - int surface_idx; - Vec3 wspin; // angular velocity - Vec3 gravity; // stores this gravity and uses it if the current area's gravity is equal to the global gravity - Vec3 waterGravity; // gravity when underwater - Vec3 normal; // aligns this direction with the surface normal when sliding - Vec3 rollAxis; // aligns this directon with the roll axis when rolling (0,0,0 to disable alignment) - quaternionf q0; // initial orientation (zero means x along direction of movement, z up) - float minBounceVel; // velocity threshold for bouncing->sliding switch - float minVel; // sleep speed threshold - IPhysicalEntity* pColliderToIgnore; // physical entity to ignore during collisions - int iPierceability; // pierceability for ray tests; pierceble hits slow the particle down, but don't stop it - int collTypes; // 'objtype' passed to RayWorldntersection - int areaCheckPeriod; // how often (in frames) world area checks are made - int dontPlayHitEffect; // prevent playing of material FX from now on - - VALIDATORS_START - VALIDATOR(mass) - VALIDATOR(size) - VALIDATOR(thickness) - VALIDATOR_NORM(heading) - VALIDATOR_NORM(q0) - VALIDATORS_END -}; - -////////// vehicle entity params - -struct pe_params_car - : pe_params -{ - enum entype - { - type_id = ePE_params_car - }; - pe_params_car() - { - type = type_id; - MARK_UNUSED engineMaxRPM, iIntegrationType, axleFriction, enginePower, maxSteer, maxTimeStep, minEnergy, damping, brakeTorque; - MARK_UNUSED engineMinRPM, engineShiftUpRPM, engineShiftDownRPM, engineIdleRPM, engineStartRPM, clutchSpeed, nGears, gearRatios, kStabilizer; - MARK_UNUSED slipThreshold, gearDirSwitchRPM, kDynFriction, minBrakingFriction, maxBrakingFriction, steerTrackNeutralTurn, maxGear, minGear, pullTilt; - MARK_UNUSED maxTilt, bKeepTractionWhenTilted; - } - - float axleFriction; // friction torque at axes divided by mass of vehicle - float enginePower; // power of engine (about 10,000 - 100,000) - float maxSteer; // maximum steering angle - float engineMaxRPM; // engine torque decreases to 0 after reaching this rotation speed - float brakeTorque; // torque applied when breaking using the engine - int iIntegrationType; // for suspensions; 0-explicit Euler, 1-implicit Euler - float maxTimeStep; // maximum time step when vehicle has only wheel contacts - float minEnergy; // minimum awake energy when vehicle has only wheel contacts - float damping; // damping when vehicle has only wheel contacts - float minBrakingFriction; // limits the the tire friction when handbraked - float maxBrakingFriction; // limits the the tire friction when handbraked - float kStabilizer; // stabilizer force, as a multiplier for kStiffness of respective suspensions - int nWheels; // the number of wheels - float engineMinRPM; // disengages the clutch when falling behind this limit, if braking with the engine - float engineShiftUpRPM; // RPM threshold for for automatic gear switching - float engineShiftDownRPM; - float engineIdleRPM; // RPM for idle state - float engineStartRPM; // sets this RPM when activating the engine - float clutchSpeed; // clutch engagement/disengagement speed - int nGears; - float* gearRatios; // assumes 0-backward gear, 1-neutral, 2 and above - forward - int maxGear, minGear; // additional gear index clamping - float slipThreshold; // lateral speed threshold for switchig a wheel to a 'slipping' mode - float gearDirSwitchRPM; // RPM threshold for switching back and forward gears - float kDynFriction; // friction modifier for sliping wheels - float steerTrackNeutralTurn; // for tracked vehicles, steering angle that causes equal but opposite forces on tracks - float pullTilt; // for tracked vehicles, tilt angle of pulling force towards ground - float maxTilt; // maximum wheel contact normal tilt (left or right) after which it acts as a locked part of the hull; it's a cosine of the angle - int bKeepTractionWhenTilted; // keeps wheel traction in tilted mode -}; - -struct pe_params_wheel - : pe_params -{ - enum entype - { - type_id = ePE_params_wheel - }; - pe_params_wheel() - { - type = type_id; - iWheel = 0; - MARK_UNUSED bDriving, iAxle, suspLenMax, suspLenInitial, minFriction, maxFriction, surface_idx, bCanBrake, bBlocked, - bRayCast, kStiffness, kDamping, kLatFriction, Tscale, w, bCanSteer, kStiffnessWeight; - } - - int iWheel; - int bDriving; - int iAxle; // wheels on the same axle align their coordinates (if only slightly misaligned) - // and apply stabilizer force (if set); axle<0 means the wheel does not affect the physics - int bCanBrake; // handbrake applies - int bBlocked; // locks the wheel (acts like a forced handbrake) - int bCanSteer; // can this wheel steer, 0 or 1 - float suspLenMax; // full suspension length (relaxed) - float suspLenInitial; // length in the initial state (used for automatic computations) - float minFriction; // surface friction is cropped to this min-max range - float maxFriction; - int surface_idx; - int bRayCast; // uses raycasts instead of cylinders - float kStiffness; // if 0, will be computed based on mass distribution, lenMax, and lenInitial - float kStiffnessWeight; // When autocalculating stiffness use this weight for this wheel. Note weights for wheels in front of the centre of mass do not influence the weights of wheels behind the centre of mass - // By default all weights are 1.0 and the sum doesn't have to add up to 1.0! - // Also a <=0 weight will leave the wheel out of the autocalculation. It will be get a stiffness of weight*mass*gravity/defaultLength/numWheels. weight=-1 is a good starting point for these wheels - float kDamping; // absolute value if >=0, otherwise -(fraction of 0-oscillation damping) - float kLatFriction; // lateral friction scale (doesn't apply when on handbrake) - float Tscale; // optional driving torque scale - float w; // rotational velocity; it's computed automatically, but can be overriden if needed -}; - -////////// rope entity params - -struct pe_params_rope - : pe_params -{ - enum entype - { - type_id = ePE_params_rope - }; - pe_params_rope() - { - type = type_id; - //START: Per bone UDP for stiffness, damping and thickness for touch bending vegetation - MARK_UNUSED length, mass, collDist, surface_idx, friction, nSegments, pPoints.data, pVelocities.data, pDamping, pStiffness, pThickness; - //END: Per bone UDP for stiffness, damping and thickness for touch bending vegetation - MARK_UNUSED pEntTiedTo[0], ptTiedTo[0], idPartTiedTo[0], pEntTiedTo[1], ptTiedTo[1], idPartTiedTo[1], stiffnessAnim, maxForce, - flagsCollider, nMaxSubVtx, stiffnessDecayAnim, dampingAnim, bTargetPoseActive, wind, windVariance, airResistance, waterResistance, density, collTypes, - jointLimit, jointLimitDecay, sensorRadius, frictionPull, stiffness, collisionBBox[0], penaltyScale, maxIters, attachmentZone, minSegLen, unprojLimit, noCollDist, hingeAxis; - bLocalPtTied = 0; - } - - float length; // 'target' length; 0 is allowed for ropes with dynamic subdivision - float mass; - float collDist; // thickness for collisions - int surface_idx; // for collision reports; friction is overriden - float friction; // friction for free state and lateral friction in strained state - float frictionPull; // friction in pull direction in strained state - float stiffness; // stiffness against stretching (used in the solver; it's *not* a spring, though) - float stiffnessAnim; // shape-preservation stiffness - float stiffnessDecayAnim; // the final shape stiffness will be interpolated from full to full*(1-decay) at the end - float dampingAnim; // damping for shape preservation forces - int bTargetPoseActive; // 0-no target pose (no shape-preservation stiffness), - // 1-simplified target pose (vertices are pulled directly to targets) - // 2-physically correct target pose (the rope applies penalty torques at joints) - Vec3 wind; // local wind in addition to one from phys areas - float windVariance; // wariance (applied to local only) - float airResistance; // needs to be >0 in order to be affetcted by the wind - float waterResistance; // medium resistance when underwater - float density; // used only to compute buoyancy - float jointLimit; // joint rotation limit (doesn't work when both ends are tied) - float jointLimitDecay; // joint limit change (0..1) towards the unattached rope end; can be positive or negative - float sensorRadius; // size of the sensor used to re-attach the rope if the host entity breaks - float maxForce; // force limit; when breached, the rope will detach itself unless rope_no_tears is set - float penaltyScale; // for the solver in strained state with subdivision on - float attachmentZone; // don't register solver contacts within this distance around attachment points (subdivision mode) - float minSegLen; // delete segments below this length in subdivision mode - float unprojLimit; // rotational unprojection limit per frame (no-subdivision mode) - float noCollDist; // fraction of the segment near the attachment point that doesn't collide (no-subdivision mode) - int maxIters; // tweak for the internal vertex solver - int nSegments; // segment count, changin will reset vertex positions - int flagsCollider; // only collide with entity parts flagged this way - int collTypes; // a selection of ent_xxx flags to collide against - int nMaxSubVtx; // maximum internal vertices per segment in subdivision mode - Vec3 collisionBBox[2]; // bbox for entity proximity query in host's space - // (used make all ropes belonging to one host share the same box, to automatically reuse the query results) - Vec3 hingeAxis; // only allow rotation around this axis (in parent's frame if rope_target_vtx_rel is set) - strided_pointer pPoints; - strided_pointer pVelocities; - - IPhysicalEntity* pEntTiedTo[2]; - int bLocalPtTied; // ptTiedTo is in tied part's local coordinates - Vec3 ptTiedTo[2]; - int idPartTiedTo[2]; - //START: Per bone UDP for stiffness, damping and thickness for touch bending vegetation - float* pDamping; - float* pStiffness; - float* pThickness; - //END: Per bone UDP for stiffness, damping and thickness for touch bending vegetation -}; - -////////// soft entity params - -struct pe_params_softbody - : pe_params -{ - enum entype - { - type_id = ePE_params_softbody - }; - pe_params_softbody() - { - type = type_id; - MARK_UNUSED thickness, maxSafeStep, ks, kdRatio, airResistance, wind, windVariance, nMaxIters, - accuracy, friction, impulseScale, explosionScale, collisionImpulseScale, maxCollisionImpulse, collTypes, waterResistance, massDecay, - shapeStiffnessNorm, shapeStiffnessTang, stiffnessAnim, stiffnessDecayAnim, dampingAnim, maxDistAnim, hostSpaceSim; - } - - float thickness; // thickness for collisions - float maxSafeStep; // time step cap - float ks; // stiffness against stretching (for soft bodies, <0 means fraction of maximum stable) - float kdRatio; // damping in stretch direction, in fractions of 0-oscillation damping - float friction; // overrides material friction - float waterResistance; - float airResistance; - Vec3 wind; // wind in addition to phys area wind - float windVariance; // wind variance, in fractions of 1 (currently changes 4 times/sec) - int nMaxIters; // tweak for the solver (complexity = O(nMaxIters*numVertices)) - float accuracy; // accuracy for the solver (velocity) - float impulseScale; // scale general incoming impulses - float explosionScale; // scale impulses from explosions - float collisionImpulseScale; // not used - float maxCollisionImpulse; // not used - int collTypes; // combination of ent_... flags - float massDecay; // decreases mass from attached points to free ends; mass_free = mass_attached/(1+decay) (can impove stability) - float shapeStiffnessNorm; // resistance to bending - float shapeStiffnessTang; // resistance to shearing - float stiffnessAnim; // strength of linear target pose pull - float stiffnessDecayAnim; // decay of stiffnessAnim - float dampingAnim; // damping for target pose pull - float maxDistAnim; // max deviation from the target pose at the rim; uses stiffnessDecalAnim to scale down closer to attached vtx - float hostSpaceSim; // 0 - world-space simulation, 1 - fully host-space simulation -}; - -/////////// area params - -struct params_wavesim -{ - params_wavesim() { MARK_UNUSED timeStep, waveSpeed, dampingCenter, dampingRim, minhSpread, minVel, simDepth, heightLimit, resistance; } - float timeStep; // fixed timestep used for the simulation - float waveSpeed; // wave propagation speed - float simDepth; // assumed height of moving water layer (relative to cell size) - float heightLimit; // hard limit on height changes (relative to cell size) - float resistance; // rate of velocity transfer from floating objects - float dampingCenter; // damping in the central tile - float dampingRim; // damping in the outer tiles - float minhSpread; // minimum height perturbation that activates a neighbouring tile - float minVel; // sleep speed threshold -}; - -struct pe_params_area - : pe_params -{ - enum entype - { - type_id = ePE_params_area - }; - pe_params_area() { type = type_id; MARK_UNUSED gravity, bUniform, damping, falloff0, bUseCallback, pGeom, volume, borderPad, bConvexBorder, objectVolumeThreshold, cellSize, growthReserve, volumeAccuracy; } - // water/air area params are set through pe_params_buoyancy - - Vec3 gravity; // see also bUniform - float falloff0; // parametric distance (0..1) where falloff starts - int bUniform; // gravity has same direction in every point or always points to the center - int bUseCallback; // will generate immediate EventPhysArea when needs to apply params to an entity - float damping; // uniform damping - IGeometry* pGeom; // phys geometry used in the area - float volume; // the area will try to maintain this volume by adjusting water level - float volumeAccuracy; // accuracy of level computation based on volume (in fractions of the volume) - float borderPad; // after adjusting level, expand the border by this distance - int bConvexBorder; // forces convex border after water level adjustments - float objectVolumeThreshold; // only consider entities larger than this for level adjustment (set in fractions of area volume) - float cellSize; // cell size for wave simulation - params_wavesim waveSim; - float growthReserve; // assume this area increase during level adjustment (only used for wave simulation) -}; - - -////////// water manager params - -struct pe_params_waterman - : pe_params - , params_wavesim -{ - enum entype - { - type_id = ePE_params_waterman - }; - pe_params_waterman() - { - type = type_id; - MARK_UNUSED posViewer, nExtraTiles, nCells, tileSize, timeStep, waveSpeed, - dampingCenter, dampingRim, minhSpread, minVel, simDepth, heightLimit, resistance; - } - - Vec3 posViewer; // water will only be simulated around this point - int nExtraTiles; // number of additional tiles in each direction around the one below posViewer (so total = (nExtarTiles*2+1)^2) - int nCells; // number of cells in each tile - float tileSize; -}; - - -////////////////////////// Action structures ///////////////////// - -////////// common actions -struct pe_action -{ - int type; -}; - -struct pe_action_impulse - : pe_action -{ - enum entype - { - type_id = ePE_action_impulse - }; - pe_action_impulse() { type = type_id; impulse.Set(0, 0, 0); MARK_UNUSED point, angImpulse, partid, ipart; iApplyTime = 2; iSource = 0; } - - Vec3 impulse; - Vec3 angImpulse; // optional - Vec3 point; // point of application, in world CS, optional - int partid; // receiver part identifier - int ipart; // alternatively, part index can be used - int iApplyTime; // 0-apply immediately, 1-apply before the next time step, 2-apply after the next time step - int iSource; // reserved for internal use - - VALIDATORS_START - VALIDATOR_RANGE2(impulse, 0, 1E12f) - VALIDATOR_RANGE2(angImpulse, 0, 1E8f) - VALIDATOR_RANGE2(point, 0, 1E6f) - VALIDATOR_RANGE(ipart, 0, 10000) - VALIDATORS_END -}; - -struct pe_action_reset - : pe_action // Resets dynamic state of an entity -{ - enum entype - { - type_id = ePE_action_reset - }; - pe_action_reset() { type = type_id; bClearContacts = 1; } - int bClearContacts; -}; - -enum constrflags // see pe_action_add_constraint -{ - local_frames = 1, // pt and qframe are in respective entities' coordinate frames - world_frames = 2, // pt and qframe are in the world frame - local_frames_part = 4, // pt and qframe are if respective entity parts' coordinate frames - constraint_inactive = 0x100, // constraint does nothing, except applying _ignore_buddy if set - constraint_ignore_buddy = 0x200, // disables collisions between the constrained entities - constraint_line = 0x400, // position if constrained to a line - constraint_plane = 0x800, // position is constrained to a plane - constraint_free_position = 0x1000, // position is unconstrained - constraint_no_rotation = 0x2000, // relative rotation is fully constrained - constraint_no_enforcement = 0x4000, // disables positional enforcement during fast movement (currently disabled unconditionally) - constraint_no_tears = 0x8000 // constraint is not deleted when force limit is reached -}; - -struct pe_action_add_constraint - : pe_action -{ - enum entype - { - type_id = ePE_action_add_constraint - }; - pe_action_add_constraint() - { - type = type_id; - pBuddy = 0; - flags = world_frames; - MARK_UNUSED id, pt[0], pt[1], partid[0], partid[1], qframe[0], qframe[1], xlimits[0], yzlimits[0], - pConstraintEntity, damping, sensorRadius, maxPullForce, maxBendTorque; - } - int id; // if not set, will be auto-assigned; return value of Action() - IPhysicalEntity* pBuddy; // the second constrained entity; can be WORLD_ENTITY for static attachments - Vec3 pt[2]; // pt[0] must be set; if pt[1] is not set, assumed to be equal to pt[1] - int partid[2]; // if not set, the first part is assumed - quaternionf qframe[2]; // constraint frames for constraint angles computation; if not set, identity in the specified frame is assumed - float xlimits[2]; // rotation limits around x axis ("twist"); if xlimits[0]>=[1], x axis is locked - float yzlimits[2]; // combined yz-rotation - "bending" of x axis; yzlimits[0] is ignored and assumed to be 0 during simulation - unsigned int flags; // see enum constrflags - float damping; // internal constraint damping - float sensorRadius; // used for sampling environment and re-attaching the constraint when something breaks - float maxPullForce, maxBendTorque; // positional and rotational force limits - IPhysicalEntity* pConstraintEntity; // used internally for creating dynamic rope constraints -}; - -struct pe_action_update_constraint - : pe_action -{ - enum entype - { - type_id = ePE_action_update_constraint - }; - pe_action_update_constraint() - { - type = type_id; - MARK_UNUSED idConstraint, pt[0], pt[1], qframe[0], qframe[1], maxPullForce, maxBendTorque, damping; - flagsOR = 0; - flagsAND = (unsigned int)-1; - bRemove = 0; - flags = world_frames; - } - int idConstraint; // doesn't have to be unique - can update several constraints with one id; if not set, updates all constraints - unsigned int flagsOR; - unsigned int flagsAND; - int bRemove; // permanently delete the constraint - Vec3 pt[2]; // local_frames_part is not supported currently - quaternionf qframe[2]; // update to constraint frames - float maxPullForce, maxBendTorque; - float damping; - int flags; // generally it's better to use flagsOR and/or flagsAND -}; - -struct pe_action_register_coll_event - : pe_action -{ - // this can be used to ask an entity to post a fake collision event to the log - enum entype - { - type_id = ePE_action_register_coll_event - }; - pe_action_register_coll_event() { type = type_id; MARK_UNUSED vSelf; } - - Vec3 pt; // collision point - Vec3 n; // collision normal - Vec3 v; // collider's velocity at pt - Vec3 vSelf; // optional override for the current entity's velocity at pt - float collMass; // collider's mass - IPhysicalEntity* pCollider; // collider entity - int partid[2]; - int idmat[2]; - short iPrim[2]; -}; - -struct pe_action_awake - : pe_action -{ - enum entype - { - type_id = ePE_action_awake - }; - pe_action_awake() { type = type_id; bAwake = 1; MARK_UNUSED minAwakeTime; } - int bAwake; - float minAwakeTime; // minimum time to stay awake after executing the action; supported only by some entity types -}; - -struct pe_action_remove_all_parts - : pe_action -{ - enum entype - { - type_id = ePE_action_remove_all_parts - }; - pe_action_remove_all_parts() { type = type_id; } -}; - -struct pe_action_reset_part_mtx - : pe_action -{ - // this will bake the part's matrix into the entity's matrix and clear the former - enum entype - { - type_id = ePE_action_reset_part_mtx - }; - pe_action_reset_part_mtx() { type = type_id; MARK_UNUSED ipart, partid; } - int ipart; - int partid; -}; - -struct pe_action_set_velocity - : pe_action -{ - enum entype - { - type_id = ePE_action_set_velocity - }; - pe_action_set_velocity() { type = type_id; MARK_UNUSED ipart, partid, v, w; bRotationAroundPivot = 0; } - int ipart; // if part is not set, vel is applied to the whole entity; the distinction makes sense only for ragdolls - int partid; - Vec3 v, w; - int bRotationAroundPivot; // if set, w is rotation around the entity's pivot, otherwise around its center of mass - - VALIDATORS_START - VALIDATOR_RANGE2(v, 0, 1E5f) - VALIDATOR_RANGE2(w, 0, 1E5f) - VALIDATORS_END -}; - -struct pe_action_notify - : pe_action -{ - enum entype - { - type_id = ePE_action_notify - }; - enum encodes - { - ParentChange = 0 - }; // the entity this one is attached to moved; only ropes handle it ATM, by immediately enforcing length - pe_action_notify() { type = type_id; iCode = ParentChange; } - int iCode; -}; - -struct pe_action_auto_part_detachment - : pe_action -{ - // this is used to PE_ARTICULATED entities with pre-baked physics simulation - enum entype - { - type_id = ePE_action_auto_part_detachment - }; - pe_action_auto_part_detachment() { type = type_id; MARK_UNUSED threshold, autoDetachmentDist; } - float threshold; // each part will receive a breakable joint with this force limit (which is assumed to be set in fractions of gravity) - float autoDetachmentDist; // additionally, a part will auto-detach itself once it's farther than that from the entity's pivot -}; - -struct pe_action_move_parts - : pe_action -{ - // this will move parts from one entity to another - enum entype - { - type_id = ePE_action_move_parts - }; - int idStart, idEnd; - int idOffset; // added once parts are in the new entity - IPhysicalEntity* pTarget; - Matrix34 mtxRel; // mtxInNewEntity = mtxRel*mtxCurrent - pe_action_move_parts() { type = type_id; idStart = 0; idEnd = 1 << 30; idOffset = 0; mtxRel.SetIdentity(); pTarget = 0; } -}; - -struct pe_action_batch_parts_update - : pe_action -{ - // updates positions of all parts from arrays - enum entype - { - type_id = ePE_action_batch_parts_update - }; - pe_action_batch_parts_update() { type = type_id; qOffs.SetIdentity(); posOffs.zero(); numParts = 0; pnumParts = 0; pIds = 0; pValidator = 0; } - int* pIds; - strided_pointer qParts; - strided_pointer posParts; - int numParts; - int* pnumParts; - quaternionf qOffs; // extra rotation - Vec3 posOffs; // extra offset - struct Validator - { - virtual ~Validator() {} - virtual bool Lock() = 0; - virtual void Unlock() = 0; - }* pValidator; -}; - -struct pe_action_slice - : pe_action -{ - // slices entity's geometry with a shape - enum entype - { - type_id = ePE_action_slice - }; - pe_action_slice() { type = type_id; MARK_UNUSED ipart, partid; npt = 3; } - int ipart; - int partid; - Vec3* pt; - int npt; // only 3 is supported currently -}; - -////////// living entity actions - -struct pe_action_move - : pe_action // movement request for living entities -{ - enum entype - { - type_id = ePE_action_move - }; - pe_action_move() { type = type_id; iJump = 0; dt = 0; MARK_UNUSED dir; } - - Vec3 dir; // requested velocity vector - int iJump; // jump mode - 1-instant velocity change, 2-just adds to current velocity - float dt; // time interval for this action (doesn't need to be set normally) - - VALIDATORS_START - VALIDATOR_RANGE2(dir, 0, 1000) - VALIDATOR_RANGE(dt, 0, 2) - VALIDATORS_END -}; - -struct pe_action_syncliving - : pe_action // syncing living entity physics -{ - enum entype - { - type_id = pPE_action_syncliving - }; - pe_action_syncliving() { type = type_id; pos.zero(); vel.zero(); velRequested.zero(); } - Vec3 pos; - Vec3 vel; - Vec3 velRequested; -}; - -////////// vehicle entity actions - -struct pe_action_drive - : pe_action -{ - enum entype - { - type_id = ePE_action_drive - }; - pe_action_drive() { type = type_id; MARK_UNUSED pedal, dpedal, steer, dsteer, bHandBrake, clutch, iGear; ackermanOffset = 0.f; } - - float pedal; // engine pedal absolute value; active pedal always awakes the entity - float dpedal; // engine pedal delta - float steer; // steering angle absolute value - float ackermanOffset; // apply ackerman steering, 0.0 -> normal driving front wheels steer, back fixed. 1.0 -> front fixed, back steer. 0.5 -> both front and back steer - float dsteer; // steering angle delta - float clutch; // forces clutch; 0..1 - int bHandBrake; // removing handbrake will automatically awaken the vehicle if it's sleeping - int iGear; // 0-back; 1-neutral; 2+-forward -}; - -////////// rope entity actions - -struct pe_action_target_vtx - : pe_action -{ - enum entype - { - type_id = ePE_action_target_vtx - }; - pe_action_target_vtx() { type = type_id; MARK_UNUSED points, nPoints; posHost.zero(); qHost.SetIdentity(); } - - int nPoints; - Vec3* points; // coordinate frame is world, unless the rope has one of rope_target_vtx_rel flags - Vec3 posHost; // world position of the host the vertices are attached to - Quat qHost; -}; - -////////// soft entity actions - -struct pe_action_attach_points - : pe_action -{ - enum entype - { - type_id = ePE_action_attach_points - }; - pe_action_attach_points() { type = type_id; MARK_UNUSED partid, points; nPoints = 1; pEntity = WORLD_ENTITY; bLocal = 0; } - - IPhysicalEntity* pEntity; - int partid; - int* piVtx; // vertex indices to be attached to pEntity.partid - Vec3* points; // can set the desired attachment points; if not set, current positions are fixed in the target's frame - int nPoints; - int bLocal; // if true, points are in the attached part's CS -}; - -////////////////////////// Status structures ///////////////////// - -////////// common statuses -struct pe_status -{ - int type; -}; - -enum status_pos_flags -{ - status_local = 1, status_thread_safe = 2, status_addref_geoms = 4 -}; - -struct pe_status_pos - : pe_status -{ - enum entype - { - type_id = ePE_status_pos - }; - pe_status_pos() { type = type_id; ipart = partid = -1; flags = 0; pMtx3x4 = 0; pMtx3x3 = 0; iSimClass = 0; timeBack = 0; } - - int partid; // part identifier, -1 for entire entity - int ipart; // optionally, part slot index - unsigned int flags; // status_local if part coordinates should be returned in entity CS rather than world CS - unsigned int flagsOR; // boolean OR for all parts flags of the object (or just flags for the selected part) - unsigned int flagsAND; // boolean AND for all parts flags of the object (or just flags for the selected part) - Vec3 pos; // position of center - Vec3 BBox[2]; // bounding box relative to pos (bbox[0]-min, bbox[1]-max) - quaternionf q; - float scale; - int iSimClass; - Matrix34* pMtx3x4; // optional 3x4 transformation matrix - Matrix33* pMtx3x3; // optional 3x3 rotation+scale matrix - IGeometry* pGeom, * pGeomProxy; - float timeBack; // can retrieve previous position; only supported by rigid entities; pos and q; one step back -}; - -// Only works when USE_IMPROVED_RIGID_ENTITY_SYNCHRONISATION is 1 -struct pe_status_netpos - : pe_status -{ - enum entype - { - type_id = ePE_status_netpos - }; - pe_status_netpos() { type = type_id; } - - Vec3 pos; - quaternionf rot; - Vec3 vel; - Vec3 angvel; - float timeOffset; -}; - -struct pe_status_extent - : pe_status // Caches eForm extent of entity in pGeo -{ - enum entype - { - type_id = ePE_status_extent - }; - pe_status_extent() { type = type_id; eForm = EGeomForm(-1); extent = 0; } - - EGeomForm eForm; - float extent; -}; - -struct pe_status_random - : pe_status_extent // Generates random pos on entity, also caches extent -{ - enum entype - { - type_id = ePE_status_random - }; - pe_status_random() { type = type_id; ran.vPos.zero(); ran.vNorm.zero(); } - PosNorm ran; -}; - -struct pe_status_sensors - : pe_status // Requests status of attached to the entity sensors -{ - enum entype - { - type_id = ePE_status_sensors - }; - pe_status_sensors() { type = type_id; } - - Vec3* pPoints; // pointer to array of points where sensors touch environment (assigned by physical entity) - Vec3* pNormals; // pointer to array of surface normals at points where sensors touch environment - unsigned int flags; // bitmask of flags, bit==1 - sensor touched environment -}; - -struct pe_status_dynamics - : pe_status -{ - enum entype - { - type_id = ePE_status_dynamics - }; - pe_status_dynamics() - : v(ZERO) - , w(ZERO) - , a(ZERO) - , wa(ZERO) - , centerOfMass(ZERO) - { - MARK_UNUSED partid, ipart; - type = type_id; - mass = energy = 0; - nContacts = 0; - time_interval = 0; - submergedFraction = 0; - } - - int partid; - int ipart; - Vec3 v; // velocity - Vec3 w; // angular velocity - Vec3 a; // linear acceleration - Vec3 wa; // angular acceleration - Vec3 centerOfMass; - float submergedFraction; // percentage of the entity that is underwater; 0..1. not supported for individual parts - float mass; // entity's or part's mass - float energy; // kinetic energy; only supported by PE_ARTICULATED currently - int nContacts; - float time_interval; // not used -}; - -struct coll_history_item -{ - Vec3 pt; // collision area center - Vec3 n; // collision normal in entity CS - Vec3 v[2]; // velocities of contacting bodies at the point of impact - float mass[2]; // masses of contacting bodies - float age; // age of collision event - int idCollider; // id of collider (not a pointer, since collider can be destroyed before history item is queried) - int partid[2]; - int idmat[2]; // 0-this body material, 1-collider material -}; - -struct pe_status_collisions - : pe_status -{ - // obsolete, replaced with EventPhysCollision events - enum entype - { - type_id = ePE_status_collisions - }; - pe_status_collisions() { type = type_id; age = 0; len = 1; pHistory = 0; bClearHistory = 0; } - - coll_history_item* pHistory; // pointer to a user-provided array of history items - int len; // length of this array - float age; // maximum age of collision events (older events are ignored) - int bClearHistory; -}; - -struct pe_status_id - : pe_status -{ - // retrives surface id from geometry - enum entype - { - type_id = ePE_status_id - }; - pe_status_id() { type = type_id; ipart = partid = -1; bUseProxy = 1; } - - int ipart; - int partid; - int iPrim; // primitive index (only makes sense for meshes) - int iFeature; // feature id inside the primitive; doesn't affect the result currently - int bUseProxy; // use pPhysGeomProxy or pPhysGeom - int id; // surface id -}; - -struct pe_status_timeslices - : pe_status -{ - // only implemented for PE_LIVING and is obsolete, although still supported - enum entype - { - type_id = ePE_status_timeslices - }; - pe_status_timeslices() { type = type_id; pTimeSlices = 0; sz = 1; precision = 0.0001f; MARK_UNUSED time_interval; } - - float* pTimeSlices; - int sz; - float precision; // time surplus below this threshhold will be discarded - float time_interval; // if unused, time elapsed since the last action will be used -}; - -struct pe_status_nparts - : pe_status // GetStuts will return the number of parts -{ - enum entype - { - type_id = ePE_status_nparts - }; - pe_status_nparts() { type = type_id; } -}; - -struct pe_status_awake - : pe_status -{ - enum entype - { - type_id = ePE_status_awake - }; - pe_status_awake() { type = type_id; lag = 0; } - int lag; // GetStatus returns 1 ("awake") if the entity fell asleep later than this amount of frames before -}; - -struct pe_status_contains_point - : pe_status -{ - enum entype - { - type_id = ePE_status_contains_point - }; - pe_status_contains_point() { type = type_id; } - Vec3 pt; -}; - -struct pe_status_placeholder - : pe_status -{ - enum entype - { - type_id = ePE_status_placeholder - }; - pe_status_placeholder() { type = type_id; } - IPhysicalEntity* pFullEntity; // if called on a placeholder, returns the corresponding full entity -}; - -struct pe_status_sample_contact_area - : pe_status -{ - enum entype - { - type_id = ePE_status_sample_contact_area - }; - pe_status_sample_contact_area() { type = type_id; } - Vec3 ptTest; // checks if ptTest, projected along dirTest falls inside the convex hull of this entity's contacts - Vec3 dirTest; -}; - -struct pe_status_caps - : pe_status -{ - enum entype - { - type_id = ePE_status_caps - }; - pe_status_caps() { type = type_id; } - unsigned int bCanAlterOrientation; // the entity can change orientation that is explicitly set from outside (by baking it into parts/geometries) -}; - -struct pe_status_constraint - : pe_status -{ - enum entype - { - type_id = ePE_status_constraint - }; - pe_status_constraint() { type = type_id; idx = -1; } - int id; - int idx; - int flags; - Vec3 pt[2]; - Vec3 n; - IPhysicalEntity* pBuddyEntity; - IPhysicalEntity* pConstraintEntity; -}; - -////////// area status - -struct pe_status_area - : pe_status -{ - enum entype - { - type_id = ePE_status_area - }; - pe_status_area() { type = type_id; bUniformOnly = false; ctr.zero(); size.zero(); vel.zero(); MARK_UNUSED gravity; pLockUpdate = 0; pSurface = 0; } - - // inputs. - Vec3 ctr, size; // query bounds - Vec3 vel; - bool bUniformOnly; - - // outputs. - Vec3 gravity; - pe_params_buoyancy pb; - volatile int* pLockUpdate; - IGeometry* pSurface; -}; - -////////// living entity statuses - -struct pe_status_living - : pe_status -{ - enum entype - { - type_id = ePE_status_living - }; - pe_status_living() { type = type_id; } - - int bFlying; // whether entity has no contact with ground - float timeFlying; // for how long the entity was flying - Vec3 camOffset; // camera offset - Vec3 vel; // actual velocity (as rate of position change) - Vec3 velUnconstrained; // 'physical' movement velocity - Vec3 velRequested; // velocity requested in the last action - Vec3 velGround; // velocity of the object entity is standing on - float groundHeight; // position where the last contact with the ground occured - Vec3 groundSlope; - int groundSurfaceIdx; - int groundSurfaceIdxAux; // contact with the ground that also has default collision flags - IPhysicalEntity* pGroundCollider; // only returns an actual entity if the ground collider is not static - int iGroundColliderPart; - float timeSinceStanceChange; - //int bOnStairs; // tries to detect repeated abrupt ground height changes - int bStuck; // tries to detect cases when the entity cannot move as before because of collisions - volatile int* pLockStep; // internal timestepping lock - int iCurTime; // quantised time - int bSquashed; // entity is being pushed by heavy objects from opposite directions -}; - -struct pe_status_check_stance - : pe_status -{ - // checks whether new dimensions cause collisions; params have the same meaning as in pe_player_dimensions - enum entype - { - type_id = ePE_status_check_stance - }; - pe_status_check_stance() - : dirUnproj(0, 0, 1) - , unproj(0) { type = type_id; MARK_UNUSED pos, q, sizeCollider, heightCollider, bUseCapsule; } - - Vec3 pos; - quaternionf q; - Vec3 sizeCollider; - float heightCollider; - Vec3 dirUnproj; - float unproj; - int bUseCapsule; -}; - -////////// vehicle entity statuses - -struct pe_status_vehicle - : pe_status -{ - enum entype - { - type_id = ePE_status_vehicle - }; - pe_status_vehicle() { type = type_id; } - - float steer; // current steering angle - float pedal; // current engine pedal - int bHandBrake; // nonzero if handbrake is on - float footbrake; // nonzero if footbrake is pressed (range 0..1) - Vec3 vel; - int bWheelContact; // nonzero if at least one wheel touches ground - int iCurGear; - float engineRPM; - float clutch; - float drivingTorque; - int nActiveColliders; // number of non-static contacting entities -}; - -struct pe_status_wheel - : pe_status -{ - enum entype - { - type_id = ePE_status_wheel - }; - pe_status_wheel() { type = type_id; iWheel = 0; MARK_UNUSED partid; } - int iWheel; - int partid; - - int bContact; // nonzero if wheel touches ground - Vec3 ptContact; // point where wheel touches ground - Vec3 normContact; // contact normal - float w; // rotation speed - int bSlip; - Vec3 velSlip; // slip velocity - int contactSurfaceIdx; - float friction; // current friction applied - float suspLen; // current suspension spring length - float suspLenFull; // relaxed suspension spring length - float suspLen0; // initial suspension spring length - float r; // wheel radius - float torque; // driving torque - float steer; // current streeing angle - IPhysicalEntity* pCollider; -}; - -struct pe_status_vehicle_abilities - : pe_status -{ - enum entype - { - type_id = ePE_status_vehicle_abilities - }; - pe_status_vehicle_abilities() { type = type_id; MARK_UNUSED steer; } - - float steer; // should be set to requested steering angle - Vec3 rotPivot; // returns turning circle center - float maxVelocity; // calculates maximum velocity of forward movement along a plane (steer is ignored) -}; - -////////// articulated entity statuses - -struct pe_status_joint - : pe_status -{ - enum entype - { - type_id = ePE_status_joint - }; - pe_status_joint() { type = type_id; MARK_UNUSED partid, idChildBody; } - - int idChildBody; // requested joint is identified by child body id - int partid; // ..or, alternatively, by any of parts that belong to it - unsigned int flags; // joint flags - Ang3 q; // current joint angles (controlled by physics) - Ang3 qext; // external angles (from animation) - Ang3 dq; // current joint angular velocities - quaternionf quat0; // orientation of child inside parent that corresponds to 0 angles -}; - -////////// rope entity statuses - -struct pe_status_rope - : pe_status -{ - enum entype - { - type_id = ePE_status_rope - }; - pe_status_rope() - : pContactEnts(0) - { - type = type_id; - pPoints = pVelocities = pVtx = pContactNorms = 0; - nCollStat = nCollDyn = bTargetPoseActive = bStrained = 0; - stiffnessAnim = timeLastActive = 0; - nVtx = 0; - lock = 0; - } - - int nSegments; - Vec3* pPoints; // expects the caller to provide an array of nSegments+1, if 0, no points are returned - Vec3* pVelocities; // expects the caller to provide an array of nSegments+1, if 0, no velocities are returned - int nCollStat, nCollDyn; // number of rope contacts with static and dynamic objects - int bTargetPoseActive; // current traget pose mode (0, 1, or 2) - float stiffnessAnim; // current target pose stiffness - int bStrained; // whether the rope is strained, either along a line or wrapped around objects - strided_pointer pContactEnts; // returns a pointer to internal data, the caller doesn't need to provide it - int nVtx; // current number of vertices, used for ropes with dynamic subdivision - Vec3* pVtx; // expects the caller to provide the array - Vec3* pContactNorms; // normals for points (not vertices), expects a pointer from the caller - float timeLastActive; // physics time when the rope was last active (not asleep) - Vec3 posHost; // host (the entity part it's attached to) position that corresponds to the returned state - quaternionf qHost; // host's orientation - int lock; // for subdivided ropes: +1 to leave read-locked, -1 to release from a previously read-locked state; 0 - local locking only -}; - -////////// soft entity statuses - -enum ESSVFlags -{ - eSSV_LockPos = 1, // locks vertices (soft entity won't be able to update them until released) - eSSV_UnlockPos = 2 // release the vertices -}; - -struct pe_status_softvtx - : pe_status -{ - enum entype - { - type_id = ePE_status_softvtx - }; - pe_status_softvtx() - : pVtx(0) - , pNormals(0) { type = type_id; pVtxMap = 0; flags = 0; } - - int nVtx; - strided_pointer pVtx; // a pointer to an internal data; doesn't need to be filled - strided_pointer pNormals; // a pointer to an internal data; doesn't need to be filled - int* pVtxMap; // mapping table mesh vertex->simulated vertex (can be 0) - IGeometry* pMesh; // phys mesh that reflects the simulated data - int flags; // see ESSVFlags - quaternionf qHost; // host's orientation - Vec3 posHost; // host (the entity part it's attached to) position that corresponds to the returned state - Vec3 pos; // entity position that corresponds to the returned state - quaternionf q; // entity's orientation -}; - -////////// waterman statuses - -struct SWaterTileBase -{ - int bActive; - float* ph; // heights - Vec3* pvel; // velocities -}; - -struct pe_status_waterman - : pe_status -{ - enum entype - { - type_id = ePE_status_waterman - }; - pe_status_waterman() { type = type_id; } - - int bActive; - Matrix33 R; - Vec3 origin; - int nTiles, nCells; // number of tiles and cells in one dimension - SWaterTileBase** pTiles; // nTiles^2 entries -}; - -////////////////////////// Geometry structures ///////////////////// - -////////// common geometries -enum geom_flags -{ - // collisions between parts are checked if (part0->flagsCollider & part1->flags) !=0 - geom_colltype0 = 0x0001, geom_colltype1 = 0x0002, geom_colltype2 = 0x0004, geom_colltype3 = 0x0008, geom_colltype4 = 0x0010, - geom_colltype5 = 0x0020, geom_colltype6 = 0x0040, geom_colltype7 = 0x0080, geom_colltype8 = 0x0100, geom_colltype9 = 0x0200, - geom_colltype10 = 0x0400, geom_colltype11 = 0x0800, geom_colltype12 = 0x1000, geom_colltype13 = 0x2000, geom_colltype14 = 0x4000, - geom_colltype_ray = 0x8000, // special colltype used by raytracing by default - geom_floats = 0x10000, // colltype required to apply buoyancy - geom_proxy = 0x20000, // only used in AddGeometry to specify that this geometry should go to pPhysGeomProxy - geom_structure_changes = 0x40000, // part is breaking/deforming - geom_can_modify = 0x80000, // geometry is cloned and is used in this entity only - geom_squashy = 0x100000, // part has 'soft' collisions (used for tree foliage proxy) - geom_log_interactions = 0x200000, // part will post EventPhysBBoxOverlap whenever something happens inside its bbox - geom_monitor_contacts = 0x400000, // part needs collision callback from the solver (used internally) - geom_manually_breakable = 0x800000, // part is breakable outside the physics - geom_no_coll_response = 0x1000000, // collisions are detected and reported, but not processed - geom_mat_substitutor = 0x2000000, // geometry is used to change other collision's material id if the collision point is inside it - geom_break_approximation = 0x4000000, // applies capsule approximation after breaking (used for tree trunks) - geom_no_particle_impulse = 0x8000000, // phys particles don't apply impulses to this part; should be used in flagsCollider - geom_destroyed_on_break = 0x2000000, // should be used in flagsCollider - // mnemonic group names - geom_colltype_player = geom_colltype1, geom_colltype_explosion = geom_colltype2, - geom_colltype_vehicle = geom_colltype3, geom_colltype_foliage = geom_colltype4, geom_colltype_debris = geom_colltype5, - geom_colltype_foliage_proxy = geom_colltype13, geom_colltype_obstruct = geom_colltype14, - geom_colltype_solid = 0x0FFF & ~geom_colltype_explosion, geom_collides = 0xFFFF -}; - - - -struct pe_geomparams -{ - enum entype - { - type_id = ePE_geomparams - }; - pe_geomparams() - { - type = type_id; - density = mass = 0; - pos.Set(0, 0, 0); - q.SetIdentity(); - bRecalcBBox = 1; - flags = geom_colltype_solid | geom_colltype_ray | geom_floats | geom_colltype_explosion; - flagsCollider = geom_colltype0; - pMtx3x4 = 0; - pMtx3x3 = 0; - scale = 1.0f; - pLattice = 0; - pMatMapping = 0; - nMats = 0; - MARK_UNUSED surface_idx, minContactDist, idmatBreakable; - } - - int type; - float density; // 0 if mass is used - float mass; // 0 if density is used - Vec3 pos; // offset from object's geometrical pivot - quaternionf q; // orientation relative to object - float scale; - Matrix34* pMtx3x4; // optional full transform matrix - Matrix33* pMtx3x3; // optional 3x3 orintation+scale matrix - int surface_idx; // surface identifier (used if corresponding CGeometry does not contain materials) - unsigned int flags, flagsCollider; - float minContactDist; // contacts closer then this threshold are merged - int idmatBreakable; // index for procedural (boolean) breakability - ITetrLattice* pLattice; // optional tetrahedral lattice (for lattice breaking and soft bodies) - int* pMatMapping; // mapping of mat ids from geometry to final mat ids - int nMats; - int bRecalcBBox; // recalculate all bbox info after the part is added - - VALIDATORS_START - VALIDATOR_RANGE(density, -1E8, 1E8) - VALIDATOR_RANGE(mass, -1E8, 1E8) - VALIDATOR(pos) - VALIDATOR_NORM_MSG(q, "(perhaps non-uniform scaling was used in the asset?)", pt) - VALIDATORS_END -}; - -////////// articulated entity geometries - -struct pe_articgeomparams - : pe_geomparams -{ - enum entype - { - type_id = ePE_articgeomparams - }; - pe_articgeomparams() { type = type_id; idbody = 0; } - pe_articgeomparams(pe_geomparams& src) - { - type = type_id; - density = src.density; - mass = src.mass; - pos = src.pos; - q = src.q; - scale = src.scale; - surface_idx = src.surface_idx; - pLattice = src.pLattice; - pMatMapping = src.pMatMapping; - nMats = src.nMats; - pMtx3x4 = src.pMtx3x4; - pMtx3x3 = src.pMtx3x3; - flags = src.flags; - flagsCollider = src.flagsCollider; - idbody = 0; - idmatBreakable = src.idmatBreakable; - bRecalcBBox = src.bRecalcBBox; - if (!is_unused(src.minContactDist)) - { - minContactDist = src.minContactDist; - } - else - { - MARK_UNUSED minContactDist; - } - } - int idbody; // id of the subbody this geometry is attached to, the 1st add geometry specifies frame CS of this subbody -}; - -////////// vehicle entity geometries - -const int NMAXWHEELS = 30; -struct pe_cargeomparams - : pe_geomparams -{ - enum entype - { - type_id = ePE_cargeomparams - }; - pe_cargeomparams() - : pe_geomparams() { type = type_id; MARK_UNUSED bDriving, minFriction, maxFriction, bRayCast, kLatFriction; bCanBrake = 1; bCanSteer = 1; kStiffnessWeight = 1.f; } - pe_cargeomparams(pe_geomparams& src) - { - type = type_id; - density = src.density; - mass = src.mass; - pos = src.pos; - q = src.q; - surface_idx = src.surface_idx; - idmatBreakable = src.idmatBreakable; - pLattice = src.pLattice; - pMatMapping = src.pMatMapping; - nMats = src.nMats; - pMtx3x4 = src.pMtx3x4; - pMtx3x3 = src.pMtx3x3; - flags = src.flags; - flagsCollider = src.flagsCollider; - MARK_UNUSED bDriving, minFriction, maxFriction, bRayCast; - bCanBrake = 1, bCanSteer = 1; - kStiffnessWeight = 1.f; - } - int bDriving; // whether wheel is driving, -1 - geometry os not a wheel - int iAxle; // wheel axle, currently not used - int bCanBrake; // whether the wheel is locked during handbrakes - int bRayCast; // whether the wheel use simple raycasting instead of geometry sweep check - int bCanSteer; // wheel the wheel can steer - Vec3 pivot; // upper suspension point in vehicle CS - float lenMax; // relaxed suspension length - float lenInitial; // current suspension length (assumed to be length in rest state) - float kStiffness; // suspension stiffness, if 0 - calculate from lenMax, lenInitial, and vehicle mass and geometry - float kStiffnessWeight; // When autocalculating stiffness use this weight for this wheel. Note weights for wheels in front of the centre of mass do not influence the weights of wheels behind the centre of mass - float kDamping; // suspension damping, if <0 - calculate as -kdamping*(approximate zero oscillations damping) - float minFriction, maxFriction; // additional friction limits for tire friction - float kLatFriction; // coefficient for lateral friction -}; - -///////////////// tetrahedra lattice params //////////////////////// - -struct pe_tetrlattice_params - : pe_params -{ - enum entype - { - type_id = ePE_tetrlattice_params - }; - pe_tetrlattice_params() - { - type = type_id; - MARK_UNUSED nMaxCracks, maxForcePush, maxForcePull, maxForceShift, maxTorqueTwist, maxTorqueBend, crackWeaken, density; - } - - int nMaxCracks; // maximum cracks per update - float maxForcePush, maxForcePull, maxForceShift; // linear force limits - float maxTorqueTwist, maxTorqueBend; // angular force limits - float crackWeaken; // weakens faces neighbouring a newly generated crack (0..1) - float density; // also affects all force limits -}; - -///////////////////////////////////////////////////////////////////////////////////// -//////////////////////////// IGeometry Interface //////////////////////////////////// -///////////////////////////////////////////////////////////////////////////////////// - -struct geom_world_data // geometry orientation for Intersect() requests -{ - geom_world_data() - { - v.Set(0, 0, 0); - w.Set(0, 0, 0); - offset.Set(0, 0, 0); - R.SetIdentity(); - centerOfMass.Set(0, 0, 0); - scale = 1.0f; - iStartNode = 0; - } - Vec3 offset; - Matrix33 R; - float scale; - Vec3 v, w; // used to give hints about unprojection direction - Vec3 centerOfMass; // w is rotation around this point - int iStartNode; // for warm-starting (checks collisions in this node first) -}; - -struct intersection_params -{ - intersection_params() - { - iUnprojectionMode = 0; - vrel_min = 1E-6f; - time_interval = 100.0f; - maxSurfaceGapAngle = 1.0f * float(g_PI / 180); - pGlobalContacts = 0; - minAxisDist = 0; - bSweepTest = false; - centerOfRotation.Set(0, 0, 0); - axisContactNormal.Set(0, 0, 1); - unprojectionPlaneNormal.Set(0, 0, 0); - axisOfRotation.Set(0, 0, 0); - bKeepPrevContacts = false; - bStopAtFirstTri = false; - ptOutsidePivot[0].Set(1E11f, 1E11f, 1E11f); - ptOutsidePivot[1].Set(1E11f, 1E11f, 1E11f); - maxUnproj = 1E10f; - bNoAreaContacts = false; - bNoBorder = false; - bNoIntersection = 0; - bExactBorder = 0; - bThreadSafe = bThreadSafeMesh = 0; - } - int iUnprojectionMode; // 0-angular, 1-rotational - Vec3 centerOfRotation; // for mode 1 only - Vec3 axisOfRotation; // if left 0, will be set based on collision area normal - float time_interval; // used to set unprojection limits - float vrel_min; // if local relative velocity in contact area is above this, unprojects along its derection; otherwise along area normal - float maxSurfaceGapAngle; // theshold for generating area contacts - float minAxisDist; // disables rotational unprojection if contact point is closer than this to the axis - Vec3 unprojectionPlaneNormal; // restrict linear unprojection to this plane - Vec3 axisContactNormal; // a mild hint about possible contact normal - float maxUnproj; // unprojections longer than this are discarded - Vec3 ptOutsidePivot[2]; // discard contacts that are not facing outward wrt this point - bool bSweepTest; // requests a linear sweep test along v*time_interval (v from geom_world_data) - bool bKeepPrevContacts; // append results to existing contact buffer - bool bStopAtFirstTri; // stop after the first collision is detected - bool bNoAreaContacts; // don't try to detect contact areas - bool bNoBorder; // don't trace contact border - int bExactBorder; // always tries to return a consequtive border (useful for boolean ops) - int bNoIntersection; // don't find all intersection points (only applies to primitive-primitive collisions) - int bBothConvex; // (output) both operands were convex - int bThreadSafe; // set if it's known that no other thread will contend for the internal intersection data (only used in PrimitiveWorldIntersection now) - int bThreadSafeMesh; // set if it's known that no other thread will try to modify the colliding geometry - geom_contact* pGlobalContacts; // pointer to thread's global contact buffer -}; - -struct phys_geometry -{ - IGeometry* pGeom; - Vec3 Ibody; // tensor of inertia in body frame - quaternionf q; // body frame - Vec3 origin; - float V; // volume - int nRefCount; - int surface_idx; // used for primitives and meshes without per-face ids - int* pMatMapping; // mat mapping; can later be overridden inside entity part - int nMats; - PhysicsForeignData pForeignData; // any external pointer to be associated with phys geometry -}; - -struct bop_newvtx -{ - int idx; // vertex index in the resulting A phys mesh - int iBvtx; // -1 if intersection vertex, >=0 if B vertex - int idxTri[2]; // intersecting triangles' foreign indices -}; - -struct bop_newtri -{ - int idxNew; // a newly generated foreign index (can be remapped later) - int iop; // triangle source 0=A, 1=B - int idxOrg; // original (triangulated) triangle's foreign index - int iVtx[3]; // for each vertex, existing vertex index if >=0, -(new vertex index+1) if <0 - float areaOrg; // original triangle's area - Vec3 area[3]; // areas of compementary triangles for each vertex (divide by original tri area to get barycentric coords) -}; - -struct bop_vtxweld -{ - void set(int _ivtxDst, int _ivtxWelded) { ivtxDst = _ivtxDst; ivtxWelded = _ivtxWelded; } - int ivtxDst : 16; // ivtxWelded is getting replaced with ivtxDst - int ivtxWelded : 16; -}; - -struct bop_TJfix -{ - void set(int _iACJ, int _iAC, int _iABC, int _iCA, int _iTJvtx) { iACJ = _iACJ; iAC = _iAC; iABC = _iABC; iCA = _iCA; iTJvtx = _iTJvtx; } - // A _____J____ C (ACJ is a thin triangle on top of ABC; J is 'the junction vertex') - // \ . / in ABC: set A->Jnew - // \ . / in ACJ: set J->Jnew, A -> A from original ABC, C -> B from original ABC - // \/ - // B - int iABC; // big triangle's foreign idx - int iACJ; // small triangle's foreign idx - int iCA; // CA edge number in ABC - int iAC; // AC edge number in ACJ - int iTJvtx; // J vertex index -}; - -struct bop_meshupdate_thunk -{ - bop_meshupdate_thunk() { prevRef = nextRef = this; } - virtual ~bop_meshupdate_thunk() { prevRef->nextRef = nextRef; nextRef->prevRef = prevRef; prevRef = nextRef = this; } - bop_meshupdate_thunk* prevRef, * nextRef; -}; - -struct bop_meshupdate - : bop_meshupdate_thunk -{ - bop_meshupdate() { Reset(); } - virtual ~bop_meshupdate(); - - void Reset() - { - pRemovedVtx = 0; - pRemovedTri = 0; - pNewVtx = 0; - pNewTri = 0; - pWeldedVtx = 0; - pTJFixes = 0; - pMovedBoxes = 0; - nRemovedVtx = nRemovedTri = nNewVtx = nNewTri = nWeldedVtx = nTJFixes = nMovedBoxes = 0; - next = 0; - pMesh[0] = pMesh[1] = 0; - relScale = 1.0f; - } - - IGeometry* pMesh[2]; // 0-dst (A), 1-src (B) - int* pRemovedVtx; - int nRemovedVtx; - int* pRemovedTri; - int nRemovedTri; - bop_newvtx* pNewVtx; - int nNewVtx; - bop_newtri* pNewTri; - int nNewTri; - bop_vtxweld* pWeldedVtx; - int nWeldedVtx; - bop_TJfix* pTJFixes; - int nTJFixes; - bop_meshupdate* next; - primitives::box* pMovedBoxes; - int nMovedBoxes; - float relScale; -}; - -struct trinfo -{ - trinfo& operator=(trinfo& src) { ibuddy[0] = src.ibuddy[0]; ibuddy[1] = src.ibuddy[1]; ibuddy[2] = src.ibuddy[2]; return *this; } - index_t ibuddy[3]; -}; - -struct mesh_island // mesh island is a connected group of trinagles -{ - int itri; // first triangle - int nTris; // trinagle count - int iParent; // outer island is V<0 - int iChild; // first islands inside it with V<0 - int iNext; // maintains a linked list of iChild's inside iParent - float V; // can be negative (means it represents an inner surface) - Vec3 center; // geometrical center - int bProcessed; // for internal use -}; - -struct tri2isle // maintains a linked triangle list inside an island -{ - unsigned int inext : 16; - unsigned int isle : 15; - unsigned int bFree : 1; -}; - -struct mesh_data - : primitives::primitive -{ - index_t* pIndices; - char* pMats; - int* pForeignIdx; // an int associated with each face - strided_pointer pVertices; - Vec3* pNormals; - int* pVtxMap; // original vertex index->merged vertex index - trinfo* pTopology; // neighbours for each triangle's edge - int nTris, nVertices; - mesh_island* pIslands; - int nIslands; - tri2isle* pTri2Island; - int flags; -}; - -const int BOP_NEWIDX0 = 0x8000000; - -enum geomtypes -{ - GEOM_TRIMESH = primitives::triangle::type, GEOM_HEIGHTFIELD = primitives::heightfield::type, GEOM_CYLINDER = primitives::cylinder::type, - GEOM_CAPSULE = primitives::capsule::type, GEOM_RAY = primitives::ray::type, GEOM_SPHERE = primitives::sphere::type, - GEOM_BOX = primitives::box::type, GEOM_VOXELGRID = primitives::voxelgrid::type -}; -enum foreigntypes -{ - DATA_OWNED_OBJECT = 1, DATA_MESHUPDATE = -1, DATA_UNUSED = -2 -}; - -enum meshflags -{ - // mesh_shared_... flags mean that the mesh will not attempt to free the corresponding array upon deletion - mesh_shared_vtx = 1, mesh_shared_idx = 2, mesh_shared_mats = 4, mesh_shared_foreign_idx = 8, mesh_shared_normals = 0x10, - // bounding volume flags (if several are specified in CreateMesh(), the best fitting one will be used) - mesh_OBB = 0x20, mesh_AABB = 0x40, mesh_SingleBB = 0x80, mesh_AABB_rotated = 0x40000, mesh_VoxelGrid = 0x80000, - // mesh_multicontact is a hint on how many contacts per node to expect; 0-one contact, 2-no limit, 1-balanced - mesh_multicontact0 = 0x100, mesh_multicontact1 = 0x200, mesh_multicontact2 = 0x400, - // mesh_approx flags are used in CreateMesh to specify which primitive approximations to try - mesh_approx_cylinder = 0x800, mesh_approx_box = 0x1000, mesh_approx_sphere = 0x2000, mesh_approx_capsule = 0x200000, - mesh_keep_vtxmap = 0x8000, // keeps vertex map after adjacent vertices were merged - mesh_keep_vtxmap_for_saving = 0x10000, // deletes vertex map after loading - mesh_no_vtx_merge = 0x20000, // does not attempt to merge adjacent vertices - mesh_always_static = 0x100000, // simplifies phys mass properties calculation if by just setting them to 0 - mesh_full_serialization = 0x400000, // mesh will save all data to stream unconditionally - mesh_transient = 0x800000, // all mesh allocations will go to a flushable pool - mesh_no_booleans = 0x1000000, // disables boolean operations on the mesh - mesh_AABB_plane_optimise = 0x4000, // aabb generation is faster since it assumes the tri's are in a plane and distributed uniformly - mesh_no_filter = 0x2000000 // doesn't attempt to filter away degenerate triangles -}; -enum meshAuxData -{ - mesh_data_materials = 1, mesh_data_foreign_idx = 2, mesh_data_vtxmap = 4 -}; // used in DestroyAuxiliaryMeshData - -struct IOwnedObject -{ - // - virtual ~IOwnedObject(){} - virtual int Release() = 0; - // -}; - -struct SOcclusionCubeMap; - -struct IGeometry -{ - struct SBoxificationParams - { - SBoxificationParams() { minFaceArea = sqr(0.4f); distFilter = 0.2f; voxResolution = 100; maxFaceTiltAngle = DEG2RAD(10); minLayerFilling = 0.5f; maxLayerReusage = 0.8f; maxVoxIslandConnections = 0.5f; } - float minFaceArea; // ignore patches smaller than this in the box growing process - float distFilter; // smooth away details smaller than this (in terms of linear size) - int voxResolution; // resolution of the grid in the longest direction - float maxFaceTiltAngle; // tolerance for patch alignment with box faces - float minLayerFilling; // stop growing boxes once layer fill percentage falls below this - float maxLayerReusage; // stop growing a box if it goes through already used cells (> than this percentage) - float maxVoxIslandConnections; // ignore isolated voxel islands that have more than this amount of connections to the used ones - }; - // - virtual ~IGeometry(){} - virtual int GetType() = 0; // see enum geomtypes - virtual int AddRef() = 0; - virtual void Release() = 0; - virtual void Lock(int bWrite = 1) = 0; // locks the geometry for reading or writing - virtual void Unlock(int bWrite = 1) = 0; // bWrite should match the preceding Lock - virtual void GetBBox(primitives::box* pbox) = 0; // possibly oriented bbox (depends on BV tree type) - virtual int CalcPhysicalProperties(phys_geometry* pgeom) = 0; // O(num_triangles) for meshes, unless mesh_always_static is set - virtual int PointInsideStatus(const Vec3& pt) = 0; // for meshes, will create an auxiliary hashgrid for acceleration - // IntersectLocked - the main function for geomtries. pdata1,pdata2,pparams can be 0 - defaults will be assumed. - // returns a pointer to an internal thread-specific contact buffer, locked with the lock argument - virtual int IntersectLocked(IGeometry* pCollider, geom_world_data* pdata1, geom_world_data* pdata2, intersection_params* pparams, geom_contact*& pcontacts, AZStd::spin_mutex& lock) = 0; - virtual int IntersectLocked(IGeometry* pCollider, geom_world_data* pdata1, geom_world_data* pdata2, intersection_params* pparams, geom_contact*& pcontacts, AZStd::spin_mutex& lock, int iCaller) = 0; - // Intersect - same as Intersect, but doesn't lock pcontacts - virtual int Intersect(IGeometry* pCollider, geom_world_data* pdata1, geom_world_data* pdata2, intersection_params* pparams, geom_contact*& pcontacts) = 0; - // FindClosestPoint - for non-convex meshes only does local search, doesn't guarantee global minimum - // iFeature's format: (feature type: 2-face, 1-edge, 0-vertex)<<9 | feature index - // if ptdst0 and ptdst1 are different, searches for a closest point on a line segment - // ptres[0] is the closest point on the geometry, ptres[1] - on the test line segment - virtual int FindClosestPoint(geom_world_data* pgwd, int& iPrim, int& iFeature, const Vec3& ptdst0, const Vec3& ptdst1, Vec3* ptres, int nMaxIters = 10) = 0; - // CalcVolumetricPressure: a fairly correct computation of volumetric pressure with inverse-quadratic falloff (ex: explosions) - // for a surface fragment dS, impulse is: k*dS*cos(surface_normal,direction to epicenter) / max(rmin, distance to epicenter)^2 - // returns integral impulse and angular impulse - virtual void CalcVolumetricPressure(geom_world_data* gwd, const Vec3& epicenter, float k, float rmin, const Vec3& centerOfMass, Vec3& P, Vec3& L) = 0; - // CalculateBuoyancy: computes the submerged volume (return value) and the mass center of the submerged part - virtual float CalculateBuoyancy(const primitives::plane* pplane, const geom_world_data* pgwd, Vec3& submergedMassCenter) = 0; - // CalculateMediumResistance: computes medium resistance integral of the surface; self flow of the medium should be baked into pgwd - // for a surface fragment dS with normal n and velocity v impulse is: -n*max(0,n*v) (can be scaled by the medium resistance coeff. later) - virtual void CalculateMediumResistance(const primitives::plane* pplane, const geom_world_data* pgwd, Vec3& dPres, Vec3& dLres) = 0; - // DrawWireframe: draws physics helpers; iLevel>0 will draaw a level in the bounding volume tree - virtual void DrawWireframe(IPhysRenderer* pRenderer, geom_world_data* gwd, int iLevel, int idxColor) = 0; - virtual int GetPrimitiveId(int iPrim, int iFeature) = 0; // get material id for a primitive (iFeature is ignored currently) - // GetPrimitive: expects a valid pprim pointer, type depends on GetType; meshes return primitives::triangle - virtual int GetPrimitive(int iPrim, primitives::primitive* pprim) = 0; - virtual int GetForeignIdx(int iPrim) = 0; // only works for meshes - virtual Vec3 GetNormal(int iPrim, const Vec3& pt) = 0; // only implemented for meshes currently; pt is ignored - virtual int GetFeature(int iPrim, int iFeature, Vec3* pt) = 0; // returns vertices of face, edge, or vertex; only for boxes and meshes currently - virtual int IsConvex(float tolerance) = 0; - // PrepareForRayTest: creates an auxiliary hash structure for short rays test acceleration - virtual void PrepareForRayTest(float raylen) = 0; // raylen - 'expected' ray length to optimize the hash for - // BuildOcclusionCubemap: cubemap projection-based occlusion (used for explosions); pGrids are 6 [nRes^2] arrays - // iMode: 0 - update cubemap in pGrid0; 1 - build cubemap in pGrid1, grow edges by nGrow cells, and compare with pGrid0 - // all geometry closer than rmin is ignored (to avoid large projection scale); same if farther than rmax - virtual float BuildOcclusionCubemap(geom_world_data* pgwd, int iMode, SOcclusionCubeMap* cubemap0, SOcclusionCubeMap* cubemap1, int nGrow) = 0; - virtual void GetMemoryStatistics(ICrySizer* pSizer) = 0; - virtual void Save(CMemStream& stm) = 0; - virtual void Load(CMemStream& stm) = 0; - // Load: meshes can avoid storing vertex, index, and mat id data, in this case same arrays should be provided during loading - virtual void Load(CMemStream& stm, strided_pointer pVertices, strided_pointer pIndices, char* pIds) = 0; - virtual int GetPrimitiveCount() = 0; - virtual const primitives::primitive* GetData() = 0; // returns an pointer to an internal structure; for meshes returns mesh_data - virtual void SetData(const primitives::primitive*) = 0; // not supported by meshes - virtual float GetVolume() = 0; - virtual Vec3 GetCenter() = 0; - // Subtract: performs boolean subtraction; if bLogUpdates==1, will create bop_meshupdate inside the mesh - virtual int Subtract(IGeometry* pGeom, geom_world_data* pdata1, geom_world_data* pdata2, int bLogUpdates = 1) = 0; - virtual int GetSubtractionsCount() = 0; // number of Subtract()s the mesh has survived so far - // GetForeignData: returns a pointer associated with the geometry - // special: GetForeignData(DATA_MESHUPDATE) returns the internal bop_meshupdate list (does not interfere with the main foreign pointer) - virtual PhysicsForeignData GetForeignData(int iForeignData = 0) = 0; - virtual int GetiForeignData() = 0; // foreign data type - virtual void SetForeignData(PhysicsForeignData pForeignData, int iForeignData) = 0; - virtual int GetErrorCount() = 0; // for meshes, the number of edges that don't belong to exactly 2 triangles - virtual void DestroyAuxilaryMeshData(int idata) = 0; // see meshAuxData enum - virtual void RemapForeignIdx(int* pCurForeignIdx, int* pNewForeignIdx, int nTris) = 0; // used in rendermesh-physics sync after boolean ops - virtual void AppendVertices(Vec3* pVtx, int* pVtxMap, int nVtx) = 0; // used in rendermesh-physics sync after boolean ops - virtual float GetExtent(EGeomForm eForm) const = 0; - virtual void GetRandomPos(PosNorm& ran, EGeomForm eForm) const = 0; - virtual void CompactMemory() = 0; // used only by non-breakable meshes to compact non-shared vertices into same contingous block of memory - // Boxify: attempts to build a set of boxes covering the geometry's volume (only supported by trimeshes) - virtual int Boxify(primitives::box* pboxes, int nMaxBoxes, const SBoxificationParams& params) = 0; - // Sanity check the geometry. i.e. its tree doesn't have an excessive depth. returns 0 if fails - virtual int SanityCheck() = 0; - // -}; - - -///////////////////////////////////////////////////////////////////////////////////// -//////////////////////////// IGeometryManager Interface ///////////////////////////// -///////////////////////////////////////////////////////////////////////////////////// - -struct SMeshBVParams {}; - -struct SBVTreeParams - : SMeshBVParams -{ - int nMinTrisPerNode; // if a split creates a node with - virtual ~ITetrLattice(){} - virtual int SetParams(const pe_params*) = 0; // only accepts pe_tetrlattice_params - virtual int GetParams(pe_params*) = 0; - virtual void DrawWireframe(IPhysRenderer* pRenderer, geom_world_data* gwd, int idxColor) = 0; - virtual IGeometry* CreateSkinMesh(int nMaxTrisPerBVNode = 8) = 0; // builds triangle mesh for exterior faces - virtual int CheckPoint(const Vec3& pt, int* idx, float* w) = 0; // check if a point is inside any tetrahedron, fills barycentric weights[4] - virtual void Release() = 0; - // -}; - -struct IBreakableGrid2d -{ - // - virtual ~IBreakableGrid2d(){} - // BreakIntoChunks: emulates fracure in the grid around pt with dimensions r x ry - // ptout receives a pointer to a vertex array - // return value is an allocated array of indices, 3 per triangle, -1 marks contour end, -2 array end - // maxPatchTris tells to unite broken trianges into patches of up to this size; 0 means broken triangles are discarded - // jointhresh (0..1) affects the way triangles unite into patches - // seed bootsraps the RNG if >=0 - // hole edges are filtered to removes corners sharper than filterAng (except those that are formed by several joined triangles) - virtual int* BreakIntoChunks(const vector2df& pt, float r, vector2df*& ptout, int maxPatchTris, float jointhresh, int seed = -1, float filterAng = 0.0f, float ry = 0.0f) = 0; - virtual primitives::grid* GetGridData() = 0; - virtual bool IsEmpty() = 0; - virtual void Release() = 0; - virtual float GetFracture() = 0; // destroyed percentage so far - virtual void GetMemoryStatistics(ICrySizer* pSizer) const = 0; - // -}; - - -struct IGeomManager -{ - // - virtual ~IGeomManager(){} - virtual void InitGeoman() = 0; - virtual void ShutDownGeoman() = 0; - - // CreateMesh - depending on flags (see enum meshflags) can create either a mesh or a primitive that approximates - // approx_tolerance is the approximation tolerance in relative units - // pMats are per-face material ids (which can later be mapped via pMatMapping) - // pForeignIdx store any user data per face (internally indices might be sorted when building BV structure, pForegnIdx will reflect that) - virtual IGeometry* CreateMesh(strided_pointer pVertices, strided_pointer pIndices, char* pMats, int* pForeignIdx, int nTris, int flags, float approx_tolerance = 0.05f, int nMinTrisPerNode = 2, int nMaxTrisPerNode = 4, float favorAABB = 1.0f) = 0; - virtual IGeometry* CreateMesh(strided_pointer pVertices, strided_pointer pIndices, char* pMats, int* pForeignIdx, int nTris, int flags, float approx_tolerance, SMeshBVParams* pParams) = 0; // this version can take SVoxGridParams in pParams, if mesh_VoxelGrid is set - virtual IGeometry* CreatePrimitive(int type, const primitives::primitive* pprim) = 0; // used to create primitives explicitly - virtual void DestroyGeometry(IGeometry* pGeom) = 0; // just calls Release() on pGeom - - // RegisterGeometry: creates a phys_geometry structure for IGeometry, computes mass properties - // phys_geometries are managed in pools internally; the new structure has nRefCount 1 - // defSurfaceIdx will be used (until overwritten in entity part) if the geometry doesn't have per-face materials - virtual phys_geometry* RegisterGeometry(IGeometry* pGeom, int defSurfaceIdx = 0, int* pMatMapping = 0, int nMats = 0) = 0; - virtual int AddRefGeometry(phys_geometry* pgeom) = 0; - virtual int UnregisterGeometry(phys_geometry* pgeom) = 0; // decreases nRefCount, frees the pool slot if <=0 - virtual void SetGeomMatMapping(phys_geometry* pgeom, int* pMatMapping, int nMats) = 0; - - virtual void SaveGeometry(CMemStream& stm, IGeometry* pGeom) = 0; - virtual IGeometry* LoadGeometry(CMemStream& stm, strided_pointer pVertices, strided_pointer pIndices, char* pMats) = 0; - virtual void SavePhysGeometry(CMemStream& stm, phys_geometry* pgeom) = 0; - virtual phys_geometry* LoadPhysGeometry(CMemStream& stm, strided_pointer pVertices, strided_pointer pIndices, char* pIds) = 0; - virtual IGeometry* CloneGeometry(IGeometry* pGeom) = 0; - - virtual ITetrLattice* CreateTetrLattice(const Vec3* pt, int npt, const int* pTets, int nTets) = 0; - // RegisterCrack: cracks are used for ITertLattice-induced breaking to subtract a shape whenever a tetrahedral face breaks - // pVtx specify 3 control vertices; when applying, they are affinely stretched to match the broken face's corners - // idmat is breakability index - virtual int RegisterCrack(IGeometry* pGeom, Vec3* pVtx, int idmat) = 0; - virtual void UnregisterCrack(int id) = 0; - virtual void UnregisterAllCracks(void (* OnRemoveGeom)(IGeometry* pGeom) = 0) = 0; - // GetCrackGeom - creates a stretched crack based on the three corner vertices (pt[3]) - // pgwd receives it world transformation - virtual IGeometry* GetCrackGeom(const Vec3* pt, int idmat, geom_world_data* pgwd) = 0; - - // GenerateBreakebleGrid - creates a perturbed regular grid of points - // ptsrc's bbox is split into a nCells grid (with an additional border) - // vertices are randomly perturbed up to 0.4 cell size (seed can bootstrap the randomizer) - // ptsrc is "painted" into the grid, snapping the closest grid vertices to ptsrc (but no new ones are created at this stage) - // bStatic is ignored currently - virtual IBreakableGrid2d* GenerateBreakableGrid(vector2df* ptsrc, int npt, const vector2di& nCells, int bStatic = 1, int seed = -1) = 0; - - virtual void ReleaseGeomsImmediately(bool bReleaseImmediately) = 0; - // -}; - - -///////////////////////////////////////////////////////////////////////////////////// -////////////////////////////// IPhysUtils Interface ///////////////////////////////// -///////////////////////////////////////////////////////////////////////////////////// - -typedef void* (* qhullmalloc)(size_t); - -struct IPhysUtils -{ - // - virtual ~IPhysUtils(){} - // CoverPolygonWithCircles - attempts to fits circles to roughly cover a polygon (can used to generate round spalshes over an area) - // bConsecutive is false, uses convex hull of the points - // center is a pre-calculated geometrical center of pt's - // outputs data into centers and radii arrays, which use global buffers; returns the number of circles - virtual int CoverPolygonWithCircles(strided_pointer pt, int npt, bool bConsecutive, const vector2df& center, vector2df*& centers, float*& radii, float minCircleRadius) = 0; - virtual int qhull(strided_pointer pts, int npts, index_t*& pTris, qhullmalloc qmalloc = 0) = 0; - virtual void DeletePointer(void* pdata) = 0; // should be used to free data allocated in physics - virtual int TriangulatePoly(vector2df* pVtx, int nVtx, int* pTris, int szTriBuf) = 0; - // -}; - -///////////////////////////////////////////////////////////////////////////////////// -//////////////////////////// IPhysicalEntity Interface ////////////////////////////// -///////////////////////////////////////////////////////////////////////////////////// - -enum snapshot_flags -{ - ssf_compensate_time_diff = 1, ssf_checksum_only = 2, ssf_no_update = 4 -}; - -struct IPhysicalEntity -{ - // - virtual ~IPhysicalEntity(){} - virtual pe_type GetType() const = 0; // returns pe_type - - virtual int AddRef() = 0; - virtual int Release() = 0; - - // SetParams - changes parameters; can be queued and executed later if the physics is busy (unless bThreadSafe is flagged) - // returns !0 if successful - virtual int SetParams(const pe_params* params, int bThreadSafe = 0) = 0; - virtual int GetParams(pe_params* params) const = 0; // uses the same structures as SetParams; returns !0 if successful - virtual int GetStatus(pe_status* status) const = 0; // generally returns >0 if successful, but some pe_status'es have special meaning - virtual int Action(const pe_action*, int bThreadSafe = 0) = 0; // like SetParams, can get queued - - // AddGeometry - add a new entity part, containing pgeom; request can get queued - // params can be specialized depending on the entity type - // id is a requested geometry id (expected to be unique), if -1 - assign automatically - // returns geometry id (0..some number), -1 means error - virtual int AddGeometry(phys_geometry* pgeom, pe_geomparams* params, int id = -1, int bThreadSafe = 0) = 0; - virtual void RemoveGeometry(int id, int bThreadSafe = 0) = 0; // returns !0 if successful; can get queued - - virtual PhysicsForeignData GetForeignData(int itype = 0) const = 0; // returns entity's pForeignData if itype matches iForeignData, 0 otherwise - virtual int GetiForeignData() const = 0; // returns entity's iForegnData - - virtual int GetStateSnapshot(class CStream& stm, float time_back = 0, int flags = 0) = 0; // obsolete, was used in Far Cry - virtual int GetStateSnapshot(TSerialize ser, float time_back = 0, int flags = 0) = 0; - virtual int SetStateFromSnapshot(class CStream& stm, int flags = 0) = 0; // obsolete - virtual int PostSetStateFromSnapshot() = 0; // obsolete - virtual unsigned int GetStateChecksum() = 0; // obsolete - virtual void SetNetworkAuthority(int authoritive = -1, int paused = -1) = 0; // -1 dont change, 0 - set to false, 1 - set to true - - virtual int SetStateFromSnapshot(TSerialize ser, int flags = 0) = 0; - virtual int SetStateFromTypedSnapshot(TSerialize ser, int type, int flags = 0) = 0; - virtual int GetStateSnapshotTxt(char* txtbuf, int szbuf, float time_back = 0) = 0; // packs state into ASCII text - virtual void SetStateFromSnapshotTxt(const char* txtbuf, int szbuf) = 0; - - // DoStep: evolves entity in time. Normally this is called from PhysicalWorld::TimeStep - virtual int DoStep(float time_interval) = 0; - virtual int DoStep(float time_interval, int iCaller) = 0; - virtual void StartStep(float time_interval) = 0; // must be called before DoStep - virtual void StepBack(float time_interval) = 0; - - virtual void GetMemoryStatistics(ICrySizer* pSizer) const = 0; - // -}; - - -///////////////////////////////////////////////////////////////////////////////////// -//////////////////////////// IPhysicsEventClient Interface ////////////////////////// -///////////////////////////////////////////////////////////////////////////////////// - -struct IPhysicsEventClient // obsolete, replaced with event system (EventPhys...) -{ // - virtual ~IPhysicsEventClient(){} - virtual void OnBBoxOverlap(IPhysicalEntity* pEntity, PhysicsForeignData pForeignData, int iForeignData, IPhysicalEntity* pCollider, void* pColliderForeignData, int iColliderForeignData) = 0; - virtual void OnStateChange(IPhysicalEntity* pEntity, PhysicsForeignData pForeignData, int iForeignData, int iOldSimClass, int iNewSimClass) = 0; - virtual void OnCollision(IPhysicalEntity* pEntity, PhysicsForeignData pForeignData, int iForeignData, coll_history_item* pCollision) = 0; - virtual int OnImpulse(IPhysicalEntity* pEntity, PhysicsForeignData pForeignData, int iForeignData, pe_action_impulse* impulse) = 0; - virtual void OnPostStep(IPhysicalEntity* pEntity, PhysicsForeignData pForeignData, int iForeignData, float dt) = 0; - // -}; - -///////////////////////////////////////////////////////////////////////////////////// -///////////////////////////// IPhysicalWorld Interface ////////////////////////////// -///////////////////////////////////////////////////////////////////////////////////// - -enum draw_helper_flags -{ - pe_helper_collisions = 1, pe_helper_geometry = 2, pe_helper_bbox = 4, pe_helper_lattice = 8 -}; -enum surface_flags -{ - sf_pierceable_mask = 0x0F, sf_max_pierceable = 0x0F, sf_important = 0x200, sf_manually_breakable = 0x400, sf_matbreakable_bit = 16 -}; -#define sf_pierceability(i) (i) -#define sf_matbreakable(i) (((i) + 1) << sf_matbreakable_bit) -enum rwi_flags // see RayWorldIntersection -{ - rwi_ignore_terrain_holes = 0x20, rwi_ignore_noncolliding = 0x40, rwi_ignore_back_faces = 0x80, rwi_ignore_solid_back_faces = 0x100, - rwi_pierceability_mask = 0x0F, rwi_pierceability0 = 0, rwi_stop_at_pierceable = 0x0F, - rwi_separate_important_hits = sf_important, // among pierceble hits, materials with sf_important will have priority - rwi_colltype_bit = 16, // used to manually specify collision geometry types (default is geom_colltype_ray) - rwi_colltype_any = 0x400, // if several colltype flag are specified, switches between requiring all or any of them in a geometry - rwi_queue = 0x800, // queues the RWI request, when done it'll generate EventPhysRWIResult - rwi_force_pierceable_noncoll = 0x1000, // non-colliding geometries will be treated as pierceable regardless of the actual material - rwi_update_last_hit = 0x4000, // update phitLast with the current hit results (should be set if the last hit should be reused for a "warm" start) - rwi_any_hit = 0x8000 // returns the first found hit for meshes, not necessarily the closets -}; -#define rwi_pierceability(pty) (pty) -#define rwi_colltype_all(colltypes) ((colltypes) << rwi_colltype_bit) -#define rwi_colltype_any(colltypes) ((colltypes) << rwi_colltype_bit | rwi_colltype_any) -enum entity_query_flags // see GetEntitiesInBox and RayWorldIntersection -{ - ent_static = 1, ent_sleeping_rigid = 2, ent_rigid = 4, ent_living = 8, ent_independent = 16, ent_deleted = 128, ent_terrain = 0x100, - ent_all = ent_static | ent_sleeping_rigid | ent_rigid | ent_living | ent_independent | ent_terrain, - ent_flagged_only = pef_update, ent_skip_flagged = pef_update * 2, // "flagged" meas has pef_update set - ent_areas = 32, ent_triggers = 64, - ent_ignore_noncolliding = 0x10000, - ent_sort_by_mass = 0x20000, // sort by mass in ascending order - ent_allocate_list = 0x40000, // if not set, the function will return an internal pointer - ent_addref_results = 0x100000, // will call AddRef on each entity in the list (expecting the caller call Release) - ent_water = 0x200, // can only be used in RayWorldIntersection - ent_no_ondemand_activation = 0x80000, // can only be used in RayWorldIntersection - ent_delayed_deformations = 0x80000 // queues procedural breakage requests; can only be used in SimulateExplosion -}; -enum phys_locks -{ - PLOCK_WORLD_STEP = 1, PLOCK_CALLER0, PLOCK_CALLER1, PLOCK_QUEUE, PLOCK_AREAS -}; - -struct phys_profile_info -{ - IPhysicalEntity* pEntity; - int nTicks, nCalls; - int nTicksLast, nCallsLast; - int nTicksAvg; - float nCallsAvg; - int nTicksPeak, nCallsPeak, peakAge; - int nTicksStep; - int id; - const char* pName; -}; - -struct phys_job_info -{ - int jobType; - int nInvocations; - int nFallbacks; - int64 nTicks, nLatency, nLatencyAbs; - int64 nTicksPeak, nLatencyPeak, nLatencyAbsPeak, peakAge; - const char* pName; -}; - -struct SolverSettings -{ - int nMaxStackSizeMC; // def 8 - float maxMassRatioMC; // def 50 - int nMaxMCiters; // def 1400 - int nMinMCiters; // def 4 - int nMaxMCitersHopeless; // def 400 - float accuracyMC; // def 0.005 - float accuracyLCPCG; // def 0.005 - int nMaxContacts; // def 150 - int nMaxPlaneContacts; // def 7 - int nMaxPlaneContactsDistress; // def 4 - int nMaxLCPCGsubiters; // def 120 - int nMaxLCPCGsubitersFinal; // def 250 - int nMaxLCPCGmicroiters; - int nMaxLCPCGmicroitersFinal; - int nMaxLCPCGiters; // def 5 - float minLCPCGimprovement; // def 0.1 - int nMaxLCPCGFruitlessIters; // def 4 - float accuracyLCPCGnoimprovement; // def 0.05 - float minSeparationSpeed; // def 0.02 - float maxvCG; - float maxwCG; - float maxvUnproj; - int bCGUnprojVel; - float maxMCMassRatio; - float maxMCVel; - int maxLCPCGContacts; -}; - -enum entity_out_of_bounds_flags -{ - raycast_out_of_bounds = 1, // Affects ray casts. NB, ray casting out of bounds entities can cause performance issues - get_entities_out_of_bounds = 2, // Affects GetEntitiesAround. -}; - -struct PhysicsVars - : SolverSettings -{ - int bFlyMode; - int iCollisionMode; - int bSingleStepMode; - int bDoStep; - float fixedTimestep; - float timeGranularity; - float maxWorldStep; - int iDrawHelpers; - int iOutOfBounds; - float maxContactGap; - float maxContactGapPlayer; - float minBounceSpeed; - int bProhibitUnprojection; - int bUseDistanceContacts; - float unprojVelScale; - float maxUnprojVel; - float maxUnprojVelRope; - int bEnforceContacts; - int nMaxSubsteps; - int nMaxSurfaces; - Vec3 gravity; - int nGroupDamping; - float groupDamping; - int nMaxSubstepsLargeGroup; - int nBodiesLargeGroup; - int bBreakOnValidation; - int bLogActiveObjects; - int bProfileEntities; - int bProfileFunx; - int bProfileGroups; - int nGEBMaxCells; - int nMaxEntityCells; - int nMaxAreaCells; - float maxVel; - float maxVelPlayers; - float maxVelBones; - float maxContactGapSimple; - float penaltyScale; - int bSkipRedundantColldet; - int bLimitSimpleSolverEnergy; - int nMaxEntityContacts; - int bLogLatticeTension; - int nMaxLatticeIters; - int bLogStructureChanges; - float tickBreakable; - float approxCapsLen; - int nMaxApproxCaps; - int bPlayersCanBreak; - float lastTimeStep; - int bMultithreaded; - float breakImpulseScale; - float rtimeGranularity; - float massLimitDebris; - int flagsColliderDebris; - int flagsANDDebris; - int maxRopeColliderSize; - int maxSplashesPerObj; - float splashDist0, minSplashForce0, minSplashVel0; - float splashDist1, minSplashForce1, minSplashVel1; - int bDebugExplosions; - float jointGravityStep; - float jointDmgAccum; - float jointDmgAccumThresh; - float timeScalePlayers; - float threadLag; - int numThreads; - int physCPU; - int physWorkerCPU; - Vec3 helperOffset; - int64 ticksPerSecond; - // net-synchronization related -#if USE_IMPROVED_RIGID_ENTITY_SYNCHRONISATION - float netInterpTime; - float netExtrapMaxTime; - int netSequenceFrequency; - int netDebugDraw; -#else - float netMinSnapDist; - float netVelSnapMul; - float netMinSnapDot; - float netAngSnapMul; - float netSmoothTime; -#endif - - int bEntGridUseOBB; - int nStartupOverloadChecks; - float breakageMinAxisInertia; // For procedural breaking, each axis must have a minium inertia compared to the axis with the largest inertia (0.01-1.00) - - int bForceSyncPhysics; -}; - -struct ray_hit -{ - float dist; - IPhysicalEntity* pCollider; - int ipart; - int partid; - short surface_idx; - short idmatOrg; // original material index, not mapped with material mapping - int foreignIdx; - int iNode; // BV tree node that had the intersection; can be used for "warm start" next time - Vec3 pt; - Vec3 n; // surface normal - int bTerrain; // global terrain hit - int iPrim; // hit triangle index - ray_hit* next; // reserved for internal use, do not change -}; - -struct ray_hit_cached // used in conjunction with rwi_reuse_last_hit -{ - ray_hit_cached() { pCollider = 0; ipart = 0; } - ray_hit_cached(const ray_hit& hit) { pCollider = hit.pCollider; ipart = hit.ipart; iNode = hit.iNode; } - ray_hit_cached& operator=(const ray_hit& hit) { pCollider = hit.pCollider; ipart = hit.ipart; iNode = hit.iNode; return *this; } - - IPhysicalEntity* pCollider; - int ipart; - int iNode; -}; - -#ifndef PWI_NAME_TAG -#define PWI_NAME_TAG "PrimitiveWorldIntersection" -#endif -#ifndef RWI_NAME_TAG -#define RWI_NAME_TAG "RayWorldIntersection" -#endif - -struct pe_explosion // see SimulateExplosion -{ - pe_explosion() { nOccRes = 0; nGrow = 0; rminOcc = 0.1f; holeSize = 0; explDir.Set(0, 0, 1); iholeType = 0; forceDeformEntities = false; } - Vec3 epicenter; // epicenter for the occlusion computation - Vec3 epicenterImp; // epicenter for impulse computation - // the impulse a surface fragment with area dS and normal n gets is: dS*k*n*max(0,n*dir_to_epicenter)/max(rmin, dist_to_epicenter)^2 - // k is selected in such way that at impulsivePressureAtR = k/r^2 - float rmin, rmax, r; - float impulsivePressureAtR; - int nOccRes; // resolution of the occlusion map (0 disables) - int nGrow; // grow occlusion projections by this amount of cells to allow explosion to reach around corners a bit - float rminOcc; // ignores geometry closer than this for occlusion computations - float holeSize; // explosion shape for iholeType will be scaled by this holeSize / shape's declared size - Vec3 explDir; // hit direction, for aligning the explosion boolean shape - int iholeType; // breakability index for the explosion (<0 disables) - bool forceDeformEntities; // force deformation even if breakImpulseScale is zero - // filled as results - IPhysicalEntity** pAffectedEnts; - float* pAffectedEntsExposure; // 0..1 exposure, computed from the occlusion map - int nAffectedEnts; -}; - -// Physics events can be logged or immediate. The former are posted to the event queue and the client handler is called -// during PumpLoggedEvents function. The latter are call client handlers immediately when they happen, which is likely -// to be inside the physics thread, so the handler must be thread-safe. -// In most cases, in order to generate events the entity must have the corresponding flag set -// Important Note: Please keep event ids contigous in respect to being stereo or mono events -struct EventPhys -{ - EventPhys* next; - int idval; -}; - -struct EventPhysStereo - : EventPhys // base for two-entity events, ids 0-2 -{ - IPhysicalEntity* pEntity[2]; - PhysicsForeignData pForeignData[2]; - int iForeignData[2]; -}; - -struct EventPhysMono - : EventPhys // base for one-entity events, ids 3-16 -{ - IPhysicalEntity* pEntity; - PhysicsForeignData pForeignData; - int iForeignData; -}; - -struct EventPhysBBoxOverlap - : EventPhysStereo // generated by triggers and parts with geom_log_interactions -{ - enum entype - { - id = 0, flagsCall = 0, flagsLog = 0 - }; - EventPhysBBoxOverlap() { idval = id; } -}; - -enum EventPhysCollisionState -{ - EPC_DEFERRED_INITIAL, EPC_DEFERRED_REQUEUE, EPC_DEFERRED_FINISHED -}; - -struct EventPhysCollision - : EventPhysStereo -{ - enum entype - { - id = 2, flagsCall = pef_monitor_collisions, flagsLog = pef_log_collisions - }; - EventPhysCollision() { idval = id; pEntContact = 0; iPrim[0] = iPrim[1] = -1; deferredState = EPC_DEFERRED_INITIAL; fDecalPlacementTestMaxSize = 1000.f; } - int idCollider; // in addition to pEntity[1] - Vec3 pt; // contact point in world coordinates - Vec3 n; // contact normal - Vec3 vloc[2]; // velocities at the contact point - float mass[2]; - int partid[2]; - short idmat[2]; - short iPrim[2]; - float penetration; // contact's penetration depth - float normImpulse; // impulse applied by the solver to resolve the collision - float radius; // some characteristic size of the contact area - void* pEntContact; // reserved for internal use - char deferredState; // EventPhysCollisionState - char deferredResult; // stores the result returned by the deferred event - float fDecalPlacementTestMaxSize; // maximum allowed size of decals caused by this collision -}; - -struct EventPhysStateChange - : EventPhysMono // triggered by simclass changes, even those caused by SetParams -{ - enum entype - { - id = 8, flagsCall = pef_monitor_state_changes, flagsLog = pef_log_state_changes - }; - EventPhysStateChange() { idval = id; } - int iSimClass[2]; - float timeIdle; // how long the entity stayed without external activation (such as impulses) - Vec3 BBoxOld[2]; - Vec3 BBoxNew[2]; -}; - -struct EventPhysEnvChange - : EventPhysMono // called when something around the entityy breaks -{ - enum entype - { - id = 3, flagsCall = pef_monitor_env_changes, flagsLog = pef_log_env_changes - }; - enum encode - { - EntStructureChange = 0 - }; - EventPhysEnvChange() { idval = id; } - int iCode; - IPhysicalEntity* pentSrc; // entity that broke - IPhysicalEntity* pentNew; // new entity that broke off the original one -}; - -struct EventPhysPostStep - : EventPhysMono // entity has just completed its step -{ - enum entype - { - id = 4, flagsCall = pef_monitor_poststep, flagsLog = pef_log_poststep - }; - EventPhysPostStep() { idval = id; } - float dt; - Vec3 pos; - quaternionf q; - int idStep; // world's internal step count -}; - -struct EventPhysUpdateMesh - : EventPhysMono // physics mesh changed -{ - enum entype - { - id = 5, flagsCall = 1, flagsLog = 2 - }; - enum reason - { - ReasonExplosion, ReasonFracture, ReasonRequest, ReasonDeform - }; - EventPhysUpdateMesh() { idval = id; idx = -1; pMesh = 0; } - int partid; - int bInvalid; - int iReason; // see enum reason - IGeometry* pMesh; // ->GetForeignData(DATA_MESHUPDATE) returns a list of bop_meshupdates - bop_meshupdate* pLastUpdate; // the last mesh update for at moment when the event was generated - Matrix34 mtxSkelToMesh; // skeleton's frame -> mesh's frame transform - IGeometry* pMeshSkel; // for deformable bodies - int idx; // used for event deferring by listeners -}; - -struct EventPhysCreateEntityPart - : EventPhysMono // a part broke off an existing entity -{ - enum entype - { - id = 6, flagsCall = 1, flagsLog = 2 - }; - enum reason - { - ReasonMeshSplit, ReasonJointsBroken - }; - EventPhysCreateEntityPart() { idval = id; idx = -1; } - IPhysicalEntity* pEntNew; // new physical entity (has type PE_RIGID) - int partidSrc; // original part id - int partidNew; // part id assigned to it in the new entity - int nTotParts; // total number of parts that broke off during this update (each will have its own event) - int bInvalid; // generated mesh was invalid (degenerate or flipped) - int iReason; - Vec3 breakImpulse; // impulse that initiated the breaking - Vec3 breakAngImpulse; - Vec3 v; // initial vel of ejected product - Vec3 w; // initial ang vel of ejected product - float breakSize; // if caused by an explosion, the explosion's rmin - float cutRadius; // if updated mesh was successfully approximated with capsules, this is their cross section at the point of breakage - Vec3 cutPtLoc[2]; // the cut's center in both entities' frames - Vec3 cutDirLoc[2]; // the cut area's normal - IGeometry* pMeshNew; // new mesh if was caused by boolean breaking, 0 if by joint breaking (i.e. no new mesh was created) - bop_meshupdate* pLastUpdate; // last meshupdate for the moment the event was reported - int idx; // used for event deferring by listeners -}; - -struct EventPhysRemoveEntityParts - : EventPhysMono -{ - enum entype - { - id = 7, flagsCall = 1, flagsLog = 2 - }; - EventPhysRemoveEntityParts() { idval = id; idOffs = 0; } - unsigned int partIds[4]; // remove parts with ids corresponding to the set bits in partIds[], +idOffs - int idOffs; - float massOrg; // entity's mass before the parts were removed -}; - -struct EventPhysRevealEntityPart - : EventPhysMono -{ - enum entype - { - id = 13, flagsCall = 1, flagsLog = 2 - }; - EventPhysRevealEntityPart() { idval = id; } - int partId; // id of a part that was hidden due to hierarchical breakability, but should be revealed now -}; - -struct EventPhysJointBroken - : EventPhysStereo -{ - enum entype - { - id = 1, flagsCall = 1, flagsLog = 2 - }; - EventPhysJointBroken() { idval = id; } - int idJoint; - int bJoint; // structural joint if 1, dynamics constraint if 0 - int partidEpicenter; // the "seed" part during the update - Vec3 pt; // joint's position in the entity frame - Vec3 n; // joint's z axis - int partid[2]; - int partmat[2]; // material id from the parts' first primitive - IPhysicalEntity* pNewEntity[2]; // only set for broken constraints -}; - -struct EventPhysRWIResult - : EventPhysMono -{ - enum entype - { - id = 9, flagsCall = 0, flagsLog = 0 - }; - EventPhysRWIResult() { idval = id; } - int (* OnEvent)(const EventPhysRWIResult*); - ray_hit* pHits; - int nHits, nMaxHits; - int bHitsFromPool; // 1 if hits reside in the internal physics hits pool -}; - -struct EventPhysPWIResult - : EventPhysMono -{ - enum entype - { - id = 10, flagsCall = 0, flagsLog = 0 - }; - EventPhysPWIResult() { idval = id; } - int (* OnEvent)(const EventPhysPWIResult*); - float dist; - Vec3 pt; - Vec3 n; - int idxMat; - int partId; -}; - -struct EventPhysArea - : EventPhysMono // for callback phys areas -{ - enum entype - { - id = 11, flagsCall = 0, flagsLog = 0 - }; - EventPhysArea() { idval = id; } - - Vec3 pt; // entity's center - Vec3 ptref; // for splines - closest point on spline to pt; for normal areas - area's world position - Vec3 dirref; // for splines, calculated force direction - pe_params_buoyancy pb; // can be filled by the caller - Vec3 gravity; // can be filled by the caller - IPhysicalEntity* pent; // the entity that entered the area and caused this event -}; - -struct EventPhysAreaChange - : EventPhysMono -{ - enum entype - { - id = 12, flagsCall = 0, flagsLog = 0 - }; - EventPhysAreaChange() { idval = id; pContainer = 0; } - - Vec3 boxAffected[2]; - quaternion q; - Vec3 pos; - float depth; - IPhysicalEntity* pContainer; - quaternion qContainer; - Vec3 posContainer; -}; - -struct EventPhysEntityDeleted - : EventPhysMono -{ - enum entype - { - id = 14, flagsCall = 0, flagsLog = 0 - }; - EventPhysEntityDeleted() { idval = id; } - int mode; -}; - -struct EventPhysPostPump - : EventPhys -{ - enum entype - { - id = 15, flagsCall = 0, flagsLog = 0 - }; - EventPhysPostPump() { idval = id; } -}; - -const int EVENT_TYPES_NUM = 16; - -// Physical entity iterator interface. This interface is used to traverse trough all the physical entities in an physical world. In a way, -// this iterator works a lot like a stl iterator. -struct IPhysicalEntityIt -{ - // - virtual ~IPhysicalEntityIt(){} - virtual void AddRef() = 0; - virtual void Release() = 0; // Deletes this iterator and frees any memory it might have allocated. - - virtual bool IsEnd() = 0; // Check whether current iterator position is the end position. - virtual IPhysicalEntity* Next() = 0; // returns the entity that the iterator points to before it goes to the next - virtual IPhysicalEntity* This() = 0; // returns the entity that the iterator points to - virtual void MoveFirst() = 0; // positions the iterator at the begining of the entity list - // -}; - - - -#endif // CRYINCLUDE_CRYCOMMON_PHYSINTERFACE_H diff --git a/Code/Legacy/CrySystem/CrySystem_precompiled.h b/Code/Legacy/CrySystem/CrySystem_precompiled.h index daf1c335e4..79fbbd92be 100644 --- a/Code/Legacy/CrySystem/CrySystem_precompiled.h +++ b/Code/Legacy/CrySystem/CrySystem_precompiled.h @@ -99,7 +99,6 @@ inline int RoundToClosestMB(size_t memSize) #include #include #include -#include #include #include #include diff --git a/Code/Legacy/CrySystem/LevelSystem/LevelSystem.cpp b/Code/Legacy/CrySystem/LevelSystem/LevelSystem.cpp index bb2f36e69c..0bb09fc027 100644 --- a/Code/Legacy/CrySystem/LevelSystem/LevelSystem.cpp +++ b/Code/Legacy/CrySystem/LevelSystem/LevelSystem.cpp @@ -16,6 +16,7 @@ #include "CryPath.h" #include +#include #include #include diff --git a/Code/Legacy/CrySystem/LocalizedStringManager.cpp b/Code/Legacy/CrySystem/LocalizedStringManager.cpp index 8b09667f13..6551e2344b 100644 --- a/Code/Legacy/CrySystem/LocalizedStringManager.cpp +++ b/Code/Legacy/CrySystem/LocalizedStringManager.cpp @@ -20,12 +20,14 @@ #include "System.h" // to access InitLocalization() #include #include +#include #include #include #include #include #include +#include #define MAX_CELL_COUNT 32 @@ -209,7 +211,7 @@ CLocalizedStringsManager::CLocalizedStringsManager(ISystem* pSystem) AZStd::string sPath; const AZStd::string sLocalizationFolder(PathUtil::GetLocalizationFolder()); ILocalizationManager::TLocalizationBitfield availableLanguages = 0; - + AZ::IO::FileIOBase* fileIO = AZ::IO::FileIOBase::GetInstance(); // test language name against supported languages for (int i = 0; i < ILocalizationManager::ePILID_MAX_OR_INVALID; i++) @@ -1319,7 +1321,7 @@ bool CLocalizedStringsManager::DoLoadExcelXmlSpreadsheet(const char* sFileName, } //Compute the CRC32 of the key - keyCRC = CCrc32::Compute(szLowerCaseKey); + keyCRC = AZ::Crc32(szLowerCaseKey); if (m_cvarLocalizationDebug >= 3) { CryLogAlways(" CRC32: 0x%8X, Key: %s", keyCRC, szLowerCaseKey); @@ -1507,7 +1509,7 @@ bool CLocalizedStringsManager::DoLoadExcelXmlSpreadsheet(const char* sFileName, if (m_cvarLocalizationEncode == 1) { pEncoder->Finalize(); - + { uint8 compressionBuffer[COMPRESSION_FIXED_BUFFER_LENGTH]; //uint8 decompressionBuffer[COMPRESSION_FIXED_BUFFER_LENGTH]; @@ -1647,7 +1649,7 @@ bool CLocalizedStringsManager::DoLoadAGSXmlDocument(const char* sFileName, uint8 } lowerKey = keyString; AZStd::to_lower(lowerKey.begin(), lowerKey.end()); - keyCRC = CCrc32::Compute(lowerKey.c_str()); + keyCRC = AZ::Crc32(lowerKey); if (m_cvarLocalizationDebug >= 3) { CryLogAlways(" CRC32: 0%8X, Key: %s", keyCRC, lowerKey.c_str()); @@ -1755,7 +1757,7 @@ void CLocalizedStringsManager::AddLocalizedString(SLanguage* pLanguage, SLocaliz pLanguage->m_vLocalizedStrings.push_back(pEntry); int nId = (int)pLanguage->m_vLocalizedStrings.size() - 1; pLanguage->m_keysMap[keyCRC32] = pEntry; - + if (m_cvarLocalizationDebug >= 2) { CryLog(" Add new string <%u> with ID %d to <%s>", keyCRC32, nId, pLanguage->sLanguage.c_str()); @@ -1861,7 +1863,7 @@ void CLocalizedStringsManager::LocalizeAndSubstituteInternal(AZStd::string& locS startIndex += substituteOut.length(); } startIndex = locString.find_first_of('{', startIndex); - endIndex = locString.find_first_of('}', startIndex); + endIndex = locString.find_first_of('}', startIndex); } } #if defined(LOG_DECOMP_TIMES) @@ -2002,7 +2004,7 @@ bool CLocalizedStringsManager::LocalizeLabel(const char* sLabel, AZStd::string& // Label sign. if (sLabel[0] == '@') { - uint32 labelCRC32 = CCrc32::ComputeLowercase(sLabel + 1); // skip @ character. + uint32 labelCRC32 = AZ::Crc32(sLabel + 1); // skip @ character. { AutoLock lock(m_cs); //Lock here, to prevent strings etc being modified underneath this lookup SLocalizedStringEntry* entry = stl::find_in_map(m_pLanguage->m_keysMap, labelCRC32, NULL); @@ -2051,10 +2053,10 @@ bool CLocalizedStringsManager::GetEnglishString(const char* sKey, AZStd::string& // Label sign. if (sKey[0] == '@') { - uint32 keyCRC32 = CCrc32::ComputeLowercase(sKey + 1); + uint32 keyCRC32 = AZ::Crc32(sKey + 1); { - AutoLock lock(m_cs); //Lock here, to prevent strings etc being modified underneath this lookup - SLocalizedStringEntry* entry = stl::find_in_map(m_pLanguage->m_keysMap, keyCRC32, NULL); // skip @ character. + AutoLock lock(m_cs); // Lock here, to prevent strings etc being modified underneath this lookup + SLocalizedStringEntry* entry = stl::find_in_map(m_pLanguage->m_keysMap, keyCRC32, NULL); // skip @ character. if (entry != NULL && entry->pEditorExtension != NULL) { sLocalizedString = entry->pEditorExtension->sOriginalText; @@ -2062,7 +2064,7 @@ bool CLocalizedStringsManager::GetEnglishString(const char* sKey, AZStd::string& } else { - keyCRC32 = CCrc32::ComputeLowercase(sKey); + keyCRC32 = AZ::Crc32(sKey); entry = stl::find_in_map(m_pLanguage->m_keysMap, keyCRC32, NULL); if (entry != NULL && entry->pEditorExtension != NULL) { @@ -2080,7 +2082,8 @@ bool CLocalizedStringsManager::GetEnglishString(const char* sKey, AZStd::string& } else { - // CryWarning( VALIDATOR_MODULE_SYSTEM,VALIDATOR_WARNING,"Not a valid localized string Label <%s>, must start with @ symbol", sKey ); + // CryWarning( VALIDATOR_MODULE_SYSTEM,VALIDATOR_WARNING,"Not a valid localized string Label <%s>, must start with @ symbol", sKey + // ); } sLocalizedString = sKey; @@ -2093,7 +2096,7 @@ bool CLocalizedStringsManager::IsLocalizedInfoFound(const char* sKey) { return false; } - uint32 keyCRC32 = CCrc32::ComputeLowercase(sKey); + uint32 keyCRC32 = AZ::Crc32(sKey); { AutoLock lock(m_cs); //Lock here, to prevent strings etc being modified underneath this lookup const SLocalizedStringEntry* entry = stl::find_in_map(m_pLanguage->m_keysMap, keyCRC32, NULL); @@ -2109,7 +2112,7 @@ bool CLocalizedStringsManager::GetLocalizedInfoByKey(const char* sKey, SLocalize return false; } - uint32 keyCRC32 = CCrc32::ComputeLowercase(sKey); + uint32 keyCRC32 = AZ::Crc32(sKey); { AutoLock lock(m_cs); //Lock here, to prevent strings etc being modified underneath this lookup const SLocalizedStringEntry* entry = stl::find_in_map(m_pLanguage->m_keysMap, keyCRC32, NULL); @@ -2140,7 +2143,7 @@ bool CLocalizedStringsManager::GetLocalizedInfoByKey(const char* sKey, SLocalize bool bResult = false; - uint32 keyCRC32 = CCrc32::ComputeLowercase(sKey); + uint32 keyCRC32 = AZ::Crc32(sKey); { AutoLock lock(m_cs); //Lock here, to prevent strings etc being modified underneath this lookup const SLocalizedStringEntry* pEntry = stl::find_in_map(m_pLanguage->m_keysMap, keyCRC32, NULL); @@ -2293,7 +2296,7 @@ bool CLocalizedStringsManager::GetSubtitle(const char* sKeyOrLabel, AZStd::strin ++sKeyOrLabel; } - uint32 keyCRC32 = CCrc32::ComputeLowercase(sKeyOrLabel); + uint32 keyCRC32 = AZ::Crc32(sKeyOrLabel); { AutoLock lock(m_cs); //Lock here, to prevent strings etc being modified underneath this lookup const SLocalizedStringEntry* pEntry = stl::find_in_map(m_pLanguage->m_keysMap, keyCRC32, NULL); @@ -2457,7 +2460,7 @@ namespace { "nl-NL", 0x0413 }, // Dutch (The Netherlands) { "fi-FI", 0x040b }, // Finnish { "sv-SE", 0x041d }, // Swedish - { "cs-CZ", 0x0405 }, // Czech + { "cs-CZ", 0x0405 }, // Czech { "no-NO", 0x0414 }, // Norwegian (Norway) { "ar-SA", 0x0401 }, // Arabic (Saudi Arabia) { "da-DK", 0x0406 }, // Danish (Denmark) diff --git a/Code/Legacy/CrySystem/RemoteConsole/RemoteConsole.h b/Code/Legacy/CrySystem/RemoteConsole/RemoteConsole.h index f6c59a384a..23edafa736 100644 --- a/Code/Legacy/CrySystem/RemoteConsole/RemoteConsole.h +++ b/Code/Legacy/CrySystem/RemoteConsole/RemoteConsole.h @@ -11,8 +11,9 @@ #define CRYINCLUDE_CRYSYSTEM_REMOTECONSOLE_REMOTECONSOLE_H #pragma once -#include -#include +#include +#include +#include #if !defined(RELEASE) || defined(RELEASE_LOGGING) || defined(ENABLE_PROFILING_CODE) #define USE_REMOTE_CONSOLE diff --git a/Code/Legacy/CrySystem/System.cpp b/Code/Legacy/CrySystem/System.cpp index 8c950e900c..5ba19b6479 100644 --- a/Code/Legacy/CrySystem/System.cpp +++ b/Code/Legacy/CrySystem/System.cpp @@ -19,6 +19,7 @@ #include "CryLibrary.h" #include #include +#include #include #include #include @@ -257,7 +258,6 @@ CSystem::CSystem(SharedEnvironmentInstance* pSharedEnvironment) // Initialize global environment interface pointers. m_env.pSystem = this; m_env.pTimer = &m_Time; - m_env.pNameTable = &m_nameTable; m_env.bIgnoreAllAsserts = false; m_env.bNoAssertDialog = false; diff --git a/Code/Legacy/CrySystem/System.h b/Code/Legacy/CrySystem/System.h index 952de817e7..738ffd4bfb 100644 --- a/Code/Legacy/CrySystem/System.h +++ b/Code/Legacy/CrySystem/System.h @@ -11,13 +11,11 @@ #include #include -#include #include #include "Timer.h" #include #include "CmdLine.h" -#include "CryName.h" #include #include "RenderBus.h" @@ -25,6 +23,7 @@ #include #include +#include namespace AzFramework { @@ -330,7 +329,6 @@ public: ICryFont* GetICryFont(){ return m_env.pCryFont; } ILog* GetILog(){ return m_env.pLog; } ICmdLine* GetICmdLine(){ return m_pCmdLine; } - INameTable* GetINameTable() { return m_env.pNameTable; }; IViewSystem* GetIViewSystem(); ILevelSystem* GetILevelSystem(); ISystemEventDispatcher* GetISystemEventDispatcher() { return m_pSystemEventDispatcher; } @@ -490,27 +488,27 @@ private: // ------------------------------------------------------ // System environment. SSystemGlobalEnvironment m_env; - CTimer m_Time; //!< - bool m_bInitializedSuccessfully; //!< true if the system completed all initialization steps - bool m_bRelaunch; //!< relaunching the app or not (true beforerelaunch) - int m_iLoadingMode; //!< Game is loading w/o changing context (0 not, 1 quickloading, 2 full loading) - bool m_bTestMode; //!< If running in testing mode. - bool m_bEditor; //!< If running in Editor. - bool m_bNoCrashDialog; - bool m_bNoErrorReportWindow; + CTimer m_Time; //!< + bool m_bInitializedSuccessfully; //!< true if the system completed all initialization steps + bool m_bRelaunch; //!< relaunching the app or not (true beforerelaunch) + int m_iLoadingMode; //!< Game is loading w/o changing context (0 not, 1 quickloading, 2 full loading) + bool m_bTestMode; //!< If running in testing mode. + bool m_bEditor; //!< If running in Editor. + bool m_bNoCrashDialog; + bool m_bNoErrorReportWindow; bool m_bPreviewMode; //!< If running in Preview mode. - bool m_bDedicatedServer; //!< If running as Dedicated server. - bool m_bIgnoreUpdates; //!< When set to true will ignore Update and Render calls, - bool m_bForceNonDevMode; //!< true when running on a cheat protected server or a client that is connected to it (not used in singlplayer) - bool m_bWasInDevMode; //!< Set to true if was in dev mode. - bool m_bInDevMode; //!< Set to true if was in dev mode. + bool m_bDedicatedServer; //!< If running as Dedicated server. + bool m_bIgnoreUpdates; //!< When set to true will ignore Update and Render calls, + bool m_bForceNonDevMode; //!< true when running on a cheat protected server or a client that is connected to it (not used in singlplayer) + bool m_bWasInDevMode; //!< Set to true if was in dev mode. + bool m_bInDevMode; //!< Set to true if was in dev mode. bool m_bGameFolderWritable;//!< True when verified that current game folder have write access. - int m_ttMemStatSS; //!< Time to memstat screenshot - bool m_bDrawConsole; //!< Set to true if OK to draw the console. - bool m_bDrawUI; //!< Set to true if OK to draw UI. + int m_ttMemStatSS; //!< Time to memstat screenshot + bool m_bDrawConsole; //!< Set to true if OK to draw the console. + bool m_bDrawUI; //!< Set to true if OK to draw UI. - std::map > m_moduleDLLHandles; + std::map > m_moduleDLLHandles; //! current active process IProcess* m_pProcess; @@ -632,9 +630,6 @@ private: // ------------------------------------------------------ class CLocalizedStringsManager* m_pLocalizationManager; - // Name table. - CNameTable m_nameTable; - ESystemConfigSpec m_nServerConfigSpec; ESystemConfigSpec m_nMaxConfigSpec; ESystemConfigPlatform m_ConfigPlatform; diff --git a/Code/Legacy/CrySystem/SystemInit.cpp b/Code/Legacy/CrySystem/SystemInit.cpp index ebd3d91a3d..89916853bd 100644 --- a/Code/Legacy/CrySystem/SystemInit.cpp +++ b/Code/Legacy/CrySystem/SystemInit.cpp @@ -475,7 +475,7 @@ bool CSystem::UnloadDLL(const char* dllName) { bool isSuccess = false; - CCryNameCRC key(dllName); + AZ::Crc32 key(dllName); AZStd::unique_ptr empty; AZStd::unique_ptr& hModule = stl::find_in_map_ref(m_moduleDLLHandles, key, empty); if ((hModule) && (hModule->IsLoaded())) @@ -1184,7 +1184,7 @@ bool CSystem::Init(const SSystemInitParams& startupParams) { azConsole->LinkDeferredFunctors(AZ::ConsoleFunctorBase::GetDeferredHead()); } - + if (auto settingsRegistry = AZ::SettingsRegistry::Get(); settingsRegistry) { AZ::SettingsRegistryInterface::FixedValueString assetPlatform; diff --git a/Code/Legacy/CrySystem/XConsole.cpp b/Code/Legacy/CrySystem/XConsole.cpp index 46eea1528c..88a7fc262e 100644 --- a/Code/Legacy/CrySystem/XConsole.cpp +++ b/Code/Legacy/CrySystem/XConsole.cpp @@ -20,8 +20,8 @@ #include #include #include -#include -#include +#include +#include #include "ConsoleHelpGen.h" // CConsoleHelpGen #include diff --git a/Code/Legacy/CrySystem/XML/XmlUtils.cpp b/Code/Legacy/CrySystem/XML/XmlUtils.cpp index ecc10508f1..56944eb344 100644 --- a/Code/Legacy/CrySystem/XML/XmlUtils.cpp +++ b/Code/Legacy/CrySystem/XML/XmlUtils.cpp @@ -24,7 +24,6 @@ #include ////////////////////////////////////////////////////////////////////////// -CXmlNode_PoolAlloc* g_pCXmlNode_PoolAlloc = 0; #ifdef CRY_COLLECT_XML_NODE_STATS SXmlNodeStats* g_pCXmlNode_Stats = 0; #endif @@ -35,11 +34,9 @@ extern bool g_bEnableBinaryXmlLoading; CXmlUtils::CXmlUtils(ISystem* pSystem) { m_pSystem = pSystem; - m_pSystem->GetISystemEventDispatcher()->RegisterListener(this); // create IReadWriteXMLSink object m_pReadWriteXMLSink = new CReadWriteXMLSink(); - g_pCXmlNode_PoolAlloc = new CXmlNode_PoolAlloc; #ifdef CRY_COLLECT_XML_NODE_STATS g_pCXmlNode_Stats = new SXmlNodeStats(); #endif @@ -53,8 +50,6 @@ CXmlUtils::CXmlUtils(ISystem* pSystem) ////////////////////////////////////////////////////////////////////////// CXmlUtils::~CXmlUtils() { - m_pSystem->GetISystemEventDispatcher()->RemoveListener(this); - delete g_pCXmlNode_PoolAlloc; #ifdef CRY_COLLECT_XML_NODE_STATS delete g_pCXmlNode_Stats; #endif @@ -200,13 +195,8 @@ IXmlSerializer* CXmlUtils::CreateXmlSerializer() } ////////////////////////////////////////////////////////////////////////// -void CXmlUtils::GetMemoryUsage(ICrySizer* pSizer) +void CXmlUtils::GetMemoryUsage([[maybe_unused]] ICrySizer* pSizer) { - { - SIZER_COMPONENT_NAME(pSizer, "Nodes"); - g_pCXmlNode_PoolAlloc->GetMemoryUsage(pSizer); - } - #ifdef CRY_COLLECT_XML_NODE_STATS // yes, slow std::vector rootNodes; @@ -260,18 +250,6 @@ void CXmlUtils::GetMemoryUsage(ICrySizer* pSizer) #endif } -////////////////////////////////////////////////////////////////////////// -void CXmlUtils::OnSystemEvent(ESystemEvent event, [[maybe_unused]] UINT_PTR wparam, [[maybe_unused]] UINT_PTR lparam) -{ - switch (event) - { - case ESYSTEM_EVENT_LEVEL_POST_UNLOAD: - case ESYSTEM_EVENT_LEVEL_LOAD_END: - g_pCXmlNode_PoolAlloc->FreeMemoryIfEmpty(); - break; - } -} - ////////////////////////////////////////////////////////////////////////// class CXmlBinaryDataWriterFile : public XMLBinary::IDataWriter diff --git a/Code/Legacy/CrySystem/XML/XmlUtils.h b/Code/Legacy/CrySystem/XML/XmlUtils.h index 8e44b86e41..d81dc4b642 100644 --- a/Code/Legacy/CrySystem/XML/XmlUtils.h +++ b/Code/Legacy/CrySystem/XML/XmlUtils.h @@ -27,7 +27,6 @@ class CXMLPatcher; ////////////////////////////////////////////////////////////////////////// class CXmlUtils : public IXmlUtils - , public ISystemEventListener { public: CXmlUtils(ISystem* pSystem); @@ -62,12 +61,6 @@ public: virtual IXmlTableReader* CreateXmlTableReader(); ////////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////////// - // ISystemEventListener - ////////////////////////////////////////////////////////////////////////// - virtual void OnSystemEvent(ESystemEvent event, UINT_PTR wparam, UINT_PTR lparam); - ////////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////////// virtual void GetMemoryUsage(ICrySizer* pSizer); diff --git a/Code/Legacy/CrySystem/XML/xml.h b/Code/Legacy/CrySystem/XML/xml.h index cb20c351f4..912767eae7 100644 --- a/Code/Legacy/CrySystem/XML/xml.h +++ b/Code/Legacy/CrySystem/XML/xml.h @@ -6,14 +6,10 @@ * */ - -#ifndef CRYINCLUDE_CRYSYSTEM_XML_XML_H -#define CRYINCLUDE_CRYSYSTEM_XML_XML_H #pragma once #include -#include #include #include "IXml.h" @@ -344,9 +340,6 @@ private: friend class XmlParserImp; }; -typedef stl::PoolAllocatorNoMT CXmlNode_PoolAlloc; -extern CXmlNode_PoolAlloc* g_pCXmlNode_PoolAlloc; - #ifdef CRY_COLLECT_XML_NODE_STATS typedef std::set TXmlNodeSet; // yes, slow, but really only for one-shot debugging struct SXmlNodeStats @@ -361,35 +354,6 @@ struct SXmlNodeStats extern SXmlNodeStats* g_pCXmlNode_Stats; #endif -/* -////////////////////////////////////////////////////////////////////////// -inline void* CXmlNode::operator new( size_t nSize ) -{ - void *ptr = g_pCXmlNode_PoolAlloc->Allocate(); - if (ptr) - { - memset( ptr,0,nSize ); // Clear objects memory. -#ifdef CRY_COLLECT_XML_NODE_STATS - g_pCXmlNode_Stats->nodeSet.insert(reinterpret_cast (ptr)); - ++g_pCXmlNode_Stats->nAllocs; -#endif - } - return ptr; -} - -////////////////////////////////////////////////////////////////////////// -inline void CXmlNode::operator delete( void *ptr ) -{ - if (ptr) - { - g_pCXmlNode_PoolAlloc->Deallocate(ptr); -#ifdef CRY_COLLECT_XML_NODE_STATS - g_pCXmlNode_Stats->nodeSet.erase(reinterpret_cast (ptr)); - ++g_pCXmlNode_Stats->nFrees; -#endif - } -} -*/ ////////////////////////////////////////////////////////////////////////// // @@ -434,6 +398,3 @@ private: unsigned int m_nAllocated; std::stack m_pNodePool; }; - - -#endif // CRYINCLUDE_CRYSYSTEM_XML_XML_H diff --git a/Gems/AudioSystem/Code/Source/Engine/ATL.cpp b/Gems/AudioSystem/Code/Source/Engine/ATL.cpp index 3122ddcbd3..a1ea317112 100644 --- a/Gems/AudioSystem/Code/Source/Engine/ATL.cpp +++ b/Gems/AudioSystem/Code/Source/Engine/ATL.cpp @@ -22,7 +22,8 @@ #include #include -#include +#include +#include #include namespace Audio diff --git a/Gems/EMotionFX/Code/Tests/UI/LODSkinnedMeshTests.cpp b/Gems/EMotionFX/Code/Tests/UI/LODSkinnedMeshTests.cpp index 65bb056654..6e5e14e9fc 100644 --- a/Gems/EMotionFX/Code/Tests/UI/LODSkinnedMeshTests.cpp +++ b/Gems/EMotionFX/Code/Tests/UI/LODSkinnedMeshTests.cpp @@ -32,7 +32,6 @@ #include #include -#include #include namespace EMotionFX @@ -73,7 +72,6 @@ namespace EMotionFX struct DataMembers { - testing::NiceMock m_renderer; testing::NiceMock m_system; }; diff --git a/Gems/Gestures/Code/Include/Gestures/GestureRecognizerClickOrTap.inl b/Gems/Gestures/Code/Include/Gestures/GestureRecognizerClickOrTap.inl index 57716c7d9f..9333c5cbc9 100644 --- a/Gems/Gestures/Code/Include/Gestures/GestureRecognizerClickOrTap.inl +++ b/Gems/Gestures/Code/Include/Gestures/GestureRecognizerClickOrTap.inl @@ -9,6 +9,8 @@ #include #include #include +#include +#include //////////////////////////////////////////////////////////////////////////////////////////////////// inline void Gestures::RecognizerClickOrTap::Config::Reflect(AZ::ReflectContext* context) diff --git a/Gems/Gestures/Code/Include/Gestures/GestureRecognizerDrag.inl b/Gems/Gestures/Code/Include/Gestures/GestureRecognizerDrag.inl index 2c1af6fbc9..642ae9b852 100644 --- a/Gems/Gestures/Code/Include/Gestures/GestureRecognizerDrag.inl +++ b/Gems/Gestures/Code/Include/Gestures/GestureRecognizerDrag.inl @@ -8,6 +8,7 @@ #include #include +#include #include //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/Gems/Gestures/Code/Include/Gestures/GestureRecognizerHold.h b/Gems/Gestures/Code/Include/Gestures/GestureRecognizerHold.h index 87c53d815a..facdd899c8 100644 --- a/Gems/Gestures/Code/Include/Gestures/GestureRecognizerHold.h +++ b/Gems/Gestures/Code/Include/Gestures/GestureRecognizerHold.h @@ -10,6 +10,7 @@ #include "IGestureRecognizer.h" #include +#include #include //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/Gems/Gestures/Code/Include/Gestures/GestureRecognizerHold.inl b/Gems/Gestures/Code/Include/Gestures/GestureRecognizerHold.inl index b399639f6d..a85acfe466 100644 --- a/Gems/Gestures/Code/Include/Gestures/GestureRecognizerHold.inl +++ b/Gems/Gestures/Code/Include/Gestures/GestureRecognizerHold.inl @@ -8,6 +8,7 @@ #include #include +#include #include //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/Gems/Gestures/Code/Include/Gestures/GestureRecognizerPinch.inl b/Gems/Gestures/Code/Include/Gestures/GestureRecognizerPinch.inl index f6c0427b2c..1a198eab59 100644 --- a/Gems/Gestures/Code/Include/Gestures/GestureRecognizerPinch.inl +++ b/Gems/Gestures/Code/Include/Gestures/GestureRecognizerPinch.inl @@ -8,6 +8,7 @@ #include #include +#include #include //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/Gems/Gestures/Code/Include/Gestures/GestureRecognizerRotate.inl b/Gems/Gestures/Code/Include/Gestures/GestureRecognizerRotate.inl index 9dff9a115a..6cc82f47dc 100644 --- a/Gems/Gestures/Code/Include/Gestures/GestureRecognizerRotate.inl +++ b/Gems/Gestures/Code/Include/Gestures/GestureRecognizerRotate.inl @@ -9,6 +9,7 @@ #include #include #include +#include //////////////////////////////////////////////////////////////////////////////////////////////////// inline void Gestures::RecognizerRotate::Config::Reflect(AZ::ReflectContext* context) diff --git a/Gems/Gestures/Code/Include/Gestures/GestureRecognizerSwipe.h b/Gems/Gestures/Code/Include/Gestures/GestureRecognizerSwipe.h index d745454d69..bf0181e2b9 100644 --- a/Gems/Gestures/Code/Include/Gestures/GestureRecognizerSwipe.h +++ b/Gems/Gestures/Code/Include/Gestures/GestureRecognizerSwipe.h @@ -8,7 +8,7 @@ #pragma once #include "IGestureRecognizer.h" - +#include #include //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/Gems/LmbrCentral/Code/Source/Shape/CapsuleShape.cpp b/Gems/LmbrCentral/Code/Source/Shape/CapsuleShape.cpp index a47041f767..fb2d2bd8ae 100644 --- a/Gems/LmbrCentral/Code/Source/Shape/CapsuleShape.cpp +++ b/Gems/LmbrCentral/Code/Source/Shape/CapsuleShape.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #include namespace LmbrCentral diff --git a/Gems/LmbrCentral/Code/Source/Shape/CompoundShapeComponent.cpp b/Gems/LmbrCentral/Code/Source/Shape/CompoundShapeComponent.cpp index fa6f3e3702..7f4c58512d 100644 --- a/Gems/LmbrCentral/Code/Source/Shape/CompoundShapeComponent.cpp +++ b/Gems/LmbrCentral/Code/Source/Shape/CompoundShapeComponent.cpp @@ -8,7 +8,6 @@ #include "CompoundShapeComponent.h" #include -#include "Cry_GeoOverlap.h" namespace LmbrCentral @@ -147,7 +146,7 @@ namespace LmbrCentral { m_currentlyActiveChildren++; ShapeComponentNotificationsBus::MultiHandler::BusConnect(id); - + if (ShapeComponentRequestsBus::Handler::BusIsConnected() && CompoundShapeComponentRequestsBus::Handler::BusIsConnected()) { EBUS_EVENT_ID(GetEntityId(), ShapeComponentNotificationsBus, OnShapeChanged, ShapeComponentNotifications::ShapeChangeReasons::ShapeChanged); diff --git a/Gems/LmbrCentral/Code/Source/Shape/CylinderShape.cpp b/Gems/LmbrCentral/Code/Source/Shape/CylinderShape.cpp index 85f28bcbbd..3c65dafbbc 100644 --- a/Gems/LmbrCentral/Code/Source/Shape/CylinderShape.cpp +++ b/Gems/LmbrCentral/Code/Source/Shape/CylinderShape.cpp @@ -243,7 +243,6 @@ namespace LmbrCentral AZ::Vector3 diff = m_intersectionDataCache.m_baseCenterPoint - point; return diff.GetLengthSq(); } - return Distance::Point_CylinderSq( point, m_intersectionDataCache.m_baseCenterPoint, m_intersectionDataCache.m_baseCenterPoint + m_intersectionDataCache.m_axisVector, diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewSequenceManager.h b/Gems/LyShine/Code/Editor/Animation/UiAnimViewSequenceManager.h index e26a1ceec3..f29f0e58e1 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewSequenceManager.h +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewSequenceManager.h @@ -15,6 +15,7 @@ #include #include "UiEditorAnimationBus.h" #include "UiAnimUndoManager.h" +#include "CryCommon/StlUtils.h" #include diff --git a/Gems/LyShine/Code/Editor/Animation/UiAnimViewTrack.cpp b/Gems/LyShine/Code/Editor/Animation/UiAnimViewTrack.cpp index 2984e152cd..d5983f8a40 100644 --- a/Gems/LyShine/Code/Editor/Animation/UiAnimViewTrack.cpp +++ b/Gems/LyShine/Code/Editor/Animation/UiAnimViewTrack.cpp @@ -16,6 +16,7 @@ #include "UiEditorAnimationBus.h" #include +#include ////////////////////////////////////////////////////////////////////////// void CUiAnimViewTrackBundle::AppendTrack(CUiAnimViewTrack* pTrack) diff --git a/Gems/LyShine/Code/Editor/Animation/Util/UiEditorUtils.cpp b/Gems/LyShine/Code/Editor/Animation/Util/UiEditorUtils.cpp index 82d764491f..41f7300002 100644 --- a/Gems/LyShine/Code/Editor/Animation/Util/UiEditorUtils.cpp +++ b/Gems/LyShine/Code/Editor/Animation/Util/UiEditorUtils.cpp @@ -120,7 +120,7 @@ QColor ColorLinearToGamma(ColorF col) g = (float)(g <= 0.0031308 ? (12.92 * g) : (1.055 * pow((double)g, 1.0 / 2.4) - 0.055)); b = (float)(b <= 0.0031308 ? (12.92 * b) : (1.055 * pow((double)b, 1.0 / 2.4) - 0.055)); - return QColor(FtoI(r * 255.0f), FtoI(g * 255.0f), FtoI(b * 255.0f)); + return QColor(int(r * 255.0f), int(g * 255.0f), int(b * 255.0f)); } ////////////////////////////////////////////////////////////////////////// diff --git a/Gems/LyShine/Code/Source/Animation/TrackEventTrack.h b/Gems/LyShine/Code/Source/Animation/TrackEventTrack.h index bbfba486c8..5896b19a2a 100644 --- a/Gems/LyShine/Code/Source/Animation/TrackEventTrack.h +++ b/Gems/LyShine/Code/Source/Animation/TrackEventTrack.h @@ -9,6 +9,7 @@ #pragma once #include +#include "CryCommon/StlUtils.h" #include "AnimTrack.h" #include "AnimKey.h" diff --git a/Gems/LyShine/Code/Source/Animation/UiAnimationSystem.cpp b/Gems/LyShine/Code/Source/Animation/UiAnimationSystem.cpp index 35fde93e83..813d0de38f 100644 --- a/Gems/LyShine/Code/Source/Animation/UiAnimationSystem.cpp +++ b/Gems/LyShine/Code/Source/Animation/UiAnimationSystem.cpp @@ -16,6 +16,7 @@ #include #include +#include #include #include #include @@ -746,8 +747,9 @@ void UiAnimationSystem::ShowPlayedSequencesDebug() continue; } - const char* fullname = playingSequence.sequence->GetName(); - gEnv->pRenderer->Draw2dLabel(1.0f, y, 1.3f, green, false, "Sequence %s : %f (x %f)", fullname, playingSequence.currentTime, playingSequence.currentSpeed); + AZ_Assert(false,"gEnv->pRenderer is always null so it can't be used here"); + //const char* fullname = playingSequence.sequence->GetName(); + //gEnv->pRenderer->Draw2dLabel(1.0f, y, 1.3f, green, false, "Sequence %s : %f (x %f)", fullname, playingSequence.currentTime, playingSequence.currentSpeed); y += 16.0f; @@ -771,7 +773,7 @@ void UiAnimationSystem::ShowPlayedSequencesDebug() names.push_back(name); } - gEnv->pRenderer->Draw2dLabel((21.0f + 100.0f * i), ((i % 2) ? (y + 8.0f) : y), 1.0f, alreadyThere ? white : purple, false, "%s", name); + //gEnv->pRenderer->Draw2dLabel((21.0f + 100.0f * i), ((i % 2) ? (y + 8.0f) : y), 1.0f, alreadyThere ? white : purple, false, "%s", name); } y += 32.0f; diff --git a/Gems/LyShine/Code/Source/Animation/UiAnimationSystem.h b/Gems/LyShine/Code/Source/Animation/UiAnimationSystem.h index 8b2d6937ad..c1dbdcfcda 100644 --- a/Gems/LyShine/Code/Source/Animation/UiAnimationSystem.h +++ b/Gems/LyShine/Code/Source/Animation/UiAnimationSystem.h @@ -11,6 +11,7 @@ #include #include +#include struct PlayingUIAnimSequence { @@ -165,13 +166,13 @@ private: CTimeValue m_lastUpdateTime; - typedef AZStd::vector > Sequences; + using Sequences = AZStd::vector >; Sequences m_sequences; PlayingSequences m_playingSequences; - typedef std::vector TUiAnimationListenerVec; - typedef std::map TUiAnimationListenerMap; + using TUiAnimationListenerVec = AZStd::vector; + using TUiAnimationListenerMap = AZStd::map ; // a container which maps sequences to all interested listeners // listeners is a vector (could be a set in case we have a lot of listeners, stl::push_back_unique!) diff --git a/Gems/LyShine/Code/Source/LyShineLoadScreen.cpp b/Gems/LyShine/Code/Source/LyShineLoadScreen.cpp index 64a577efa2..279c0527bd 100644 --- a/Gems/LyShine/Code/Source/LyShineLoadScreen.cpp +++ b/Gems/LyShine/Code/Source/LyShineLoadScreen.cpp @@ -61,8 +61,11 @@ namespace LyShine { return false; } - - if (!gEnv || !gEnv->pRenderer || !gEnv->pLyShine) + //TODO: gEnv->pRenderer is always null, fix the logic below + AZ_ErrorOnce(nullptr, false, "NotifyGameLoadStart needs to be removed/ported to use Atom"); + return false; +#if 0 + if (!gEnv || gEnv->pRenderer || !gEnv->pLyShine) { return false; } @@ -87,6 +90,7 @@ namespace LyShine } return m_isPlaying; +#endif } bool LyShineLoadScreenComponent::NotifyLevelLoadStart(bool usingLoadingThread) @@ -97,7 +101,11 @@ namespace LyShine return false; } - if (!gEnv || !gEnv->pRenderer || !gEnv->pLyShine) + AZ_ErrorOnce(nullptr, false, "NotifyLevelLoadStart needs to be removed/ported to use Atom"); + return false; + //TODO: gEnv->pRenderer is always null, fix the logic below +#if 0 + if (!gEnv || gEnv->pRenderer || !gEnv->pLyShine) { return false; } @@ -123,6 +131,7 @@ namespace LyShine } return m_isPlaying; +#endif } void LyShineLoadScreenComponent::NotifyLoadEnd() @@ -130,10 +139,13 @@ namespace LyShine Reset(); } - void LyShineLoadScreenComponent::UpdateAndRender(float deltaTimeInSeconds) + void LyShineLoadScreenComponent::UpdateAndRender([[maybe_unused]] float deltaTimeInSeconds) { AZ_Assert(m_isPlaying, "LyShineLoadScreenComponent should not be connected to LoadScreenUpdateNotificationBus while not playing"); + AZ_ErrorOnce(nullptr, m_isPlaying && gEnv && gEnv->pLyShine, "UpdateAndRender needs to be removed/ported to use Atom"); + //TODO: gEnv->pRenderer is always null, fix the logic below +#if 0 if (m_isPlaying && gEnv && gEnv->pLyShine && gEnv->pRenderer) { AZ_Assert(GetCurrentThreadId() == gEnv->mMainThreadId, "UpdateAndRender should only be called from the main thread"); @@ -148,6 +160,7 @@ namespace LyShine gEnv->pLyShine->Render(); gEnv->pRenderer->EndFrame(); } +#endif } void LyShineLoadScreenComponent::LoadThreadUpdate([[maybe_unused]] float deltaTimeInSeconds) diff --git a/Gems/LyShine/Code/Source/RenderGraph.cpp b/Gems/LyShine/Code/Source/RenderGraph.cpp index 51f62fc7ad..c50738c740 100644 --- a/Gems/LyShine/Code/Source/RenderGraph.cpp +++ b/Gems/LyShine/Code/Source/RenderGraph.cpp @@ -150,7 +150,7 @@ namespace LyShine // [LYSHINE_ATOM_TODO][ATOM-15073] - need to combine into a single DrawIndexed call to take advantage of the draw call // optimization done by this RenderGraph. This option will be added to DynamicDrawContext. For // now we could combine the vertices ourselves - for (const IRenderer::DynUiPrimitive& primitive : m_primitives) + for (const DynUiPrimitive& primitive : m_primitives) { dynamicDraw->DrawIndexed(primitive.m_vertices, primitive.m_numVertices, primitive.m_indices, primitive.m_numIndices, AZ::RHI::IndexFormat::Uint16, drawSrg); } @@ -159,7 +159,7 @@ namespace LyShine } //////////////////////////////////////////////////////////////////////////////////////////////////// - void PrimitiveListRenderNode::AddPrimitive(IRenderer::DynUiPrimitive* primitive) + void PrimitiveListRenderNode::AddPrimitive(DynUiPrimitive* primitive) { // always clear the next pointer before adding to list primitive->m_next = nullptr; @@ -170,9 +170,9 @@ namespace LyShine } //////////////////////////////////////////////////////////////////////////////////////////////////// - IRenderer::DynUiPrimitiveList& PrimitiveListRenderNode::GetPrimitives() const + DynUiPrimitiveList& PrimitiveListRenderNode::GetPrimitives() const { - return const_cast(m_primitives); + return const_cast(m_primitives); } //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -194,7 +194,7 @@ namespace LyShine } //////////////////////////////////////////////////////////////////////////////////////////////////// - bool PrimitiveListRenderNode::HasSpaceToAddPrimitive(IRenderer::DynUiPrimitive* primitive) const + bool PrimitiveListRenderNode::HasSpaceToAddPrimitive(DynUiPrimitive* primitive) const { return primitive->m_numVertices + m_totalNumVertices < std::numeric_limits::max(); } @@ -218,9 +218,9 @@ namespace LyShine { size_t numPrims = m_primitives.size(); size_t primCount = 0; - const IRenderer::DynUiPrimitive* lastPrim = nullptr; + const DynUiPrimitive* lastPrim = nullptr; int highestTexUnit = 0; - for (const IRenderer::DynUiPrimitive& primitive : m_primitives) + for (const DynUiPrimitive& primitive : m_primitives) { if (primCount > numPrims) { @@ -709,25 +709,8 @@ namespace LyShine } } - void RenderGraph::AddPrimitive( - IRenderer::DynUiPrimitive* primitive, - ITexture* texture, - bool isClampTextureMode, - bool isTextureSRGB, - bool isTexturePremultipliedAlpha, - BlendMode blendMode) - { - // LYSHINE_ATOM_TODO - this function will be removed when all IRenderer references are gone from UI components - AZ_UNUSED(primitive); - AZ_UNUSED(texture); - AZ_UNUSED(isClampTextureMode); - AZ_UNUSED(isTextureSRGB); - AZ_UNUSED(isTexturePremultipliedAlpha); - AZ_UNUSED(blendMode); - } - //////////////////////////////////////////////////////////////////////////////////////////////////// - void RenderGraph::AddPrimitiveAtom(IRenderer::DynUiPrimitive* primitive, const AZ::Data::Instance& texture, + void RenderGraph::AddPrimitiveAtom(DynUiPrimitive* primitive, const AZ::Data::Instance& texture, bool isClampTextureMode, bool isTextureSRGB, bool isTexturePremultipliedAlpha, BlendMode blendMode) { AZStd::vector* renderNodeList = m_renderNodeListStack.top(); @@ -800,15 +783,7 @@ namespace LyShine } //////////////////////////////////////////////////////////////////////////////////////////////////// - void RenderGraph::AddAlphaMaskPrimitive([[maybe_unused]] IRenderer::DynUiPrimitive* primitive, - [[maybe_unused]] ITexture* texture, [[maybe_unused]] ITexture* maskTexture, - [[maybe_unused]] bool isClampTextureMode, [[maybe_unused]] bool isTextureSRGB, [[maybe_unused]] bool isTexturePremultipliedAlpha, [[maybe_unused]] BlendMode blendMode) - { - // LYSHINE_ATOM_TODO - this function will be removed when all IRenderer references are gone from UI components - } - - //////////////////////////////////////////////////////////////////////////////////////////////////// - void RenderGraph::AddAlphaMaskPrimitiveAtom(IRenderer::DynUiPrimitive* primitive, + void RenderGraph::AddAlphaMaskPrimitiveAtom(DynUiPrimitive* primitive, AZ::Data::Instance contentAttachmentImage, AZ::Data::Instance maskAttachmentImage, bool isClampTextureMode, @@ -892,7 +867,7 @@ namespace LyShine } //////////////////////////////////////////////////////////////////////////////////////////////////// - IRenderer::DynUiPrimitive* RenderGraph::GetDynamicQuadPrimitive(const AZ::Vector2* positions, uint32 packedColor) + DynUiPrimitive* RenderGraph::GetDynamicQuadPrimitive(const AZ::Vector2* positions, uint32 packedColor) { const int numVertsInQuad = 4; const int numIndicesInQuad = 6; @@ -1181,10 +1156,10 @@ namespace LyShine const PrimitiveListRenderNode* primListRenderNode = static_cast(renderNode); - IRenderer::DynUiPrimitiveList& primitives = primListRenderNode->GetPrimitives(); + DynUiPrimitiveList& primitives = primListRenderNode->GetPrimitives(); info.m_numPrimitives += static_cast(primitives.size()); { - for (const IRenderer::DynUiPrimitive& primitive : primitives) + for (const DynUiPrimitive& primitive : primitives) { info.m_numTriangles += primitive.m_numIndices / 3; } @@ -1365,10 +1340,10 @@ namespace LyShine previousNodeAlreadyCounted = false; } - IRenderer::DynUiPrimitiveList& primitives = primListRenderNode->GetPrimitives(); + DynUiPrimitiveList& primitives = primListRenderNode->GetPrimitives(); int numPrimitives = static_cast(primitives.size()); int numTriangles = 0; - for (const IRenderer::DynUiPrimitive& primitive : primitives) + for (const DynUiPrimitive& primitive : primitives) { numTriangles += primitive.m_numIndices / 3; } diff --git a/Gems/LyShine/Code/Source/RenderGraph.h b/Gems/LyShine/Code/Source/RenderGraph.h index bc5bd094c8..a7ef0919c6 100644 --- a/Gems/LyShine/Code/Source/RenderGraph.h +++ b/Gems/LyShine/Code/Source/RenderGraph.h @@ -79,8 +79,8 @@ namespace LyShine , const AZ::Matrix4x4& modelViewProjMat , AZ::RHI::Ptr dynamicDraw) override; - void AddPrimitive(IRenderer::DynUiPrimitive* primitive); - IRenderer::DynUiPrimitiveList& GetPrimitives() const; + void AddPrimitive(DynUiPrimitive* primitive); + DynUiPrimitiveList& GetPrimitives() const; int GetOrAddTexture(const AZ::Data::Instance& texture, bool isClampTextureMode); int GetNumTextures() const { return m_numTextures; } @@ -92,7 +92,7 @@ namespace LyShine bool GetIsPremultiplyAlpha() const { return m_preMultiplyAlpha; } AlphaMaskType GetAlphaMaskType() const { return m_alphaMaskType; } - bool HasSpaceToAddPrimitive(IRenderer::DynUiPrimitive* primitive) const; + bool HasSpaceToAddPrimitive(DynUiPrimitive* primitive) const; // Search to see if this texture is already used by this texture unit, returns -1 if not used int FindTexture(const AZ::Data::Instance& texture, bool isClampTextureMode) const; @@ -122,7 +122,7 @@ namespace LyShine int m_totalNumVertices; int m_totalNumIndices; - IRenderer::DynUiPrimitiveList m_primitives; + DynUiPrimitiveList m_primitives; }; // A mask render node handles using one set of render nodes to mask another set of render nodes @@ -268,14 +268,7 @@ namespace LyShine void EndRenderToTexture() override; - void AddPrimitive(IRenderer::DynUiPrimitive* primitive, ITexture* texture, - bool isClampTextureMode, bool isTextureSRGB, bool isTexturePremultipliedAlpha, BlendMode blendMode) override; - - void AddAlphaMaskPrimitive(IRenderer::DynUiPrimitive* primitive, - ITexture* texture, ITexture* maskTexture, - bool isClampTextureMode, bool isTextureSRGB, bool isTexturePremultipliedAlpha, BlendMode blendMode) override; - - IRenderer::DynUiPrimitive* GetDynamicQuadPrimitive(const AZ::Vector2* positions, uint32 packedColor) override; + DynUiPrimitive* GetDynamicQuadPrimitive(const AZ::Vector2* positions, uint32 packedColor) override; bool IsRenderingToMask() const override; void SetIsRenderingToMask(bool isRenderingToMask) override; @@ -287,11 +280,11 @@ namespace LyShine // ~IRenderGraph // LYSHINE_ATOM_TODO - this can be renamed back to AddPrimitive after removal of IRenderer from all UI components - void AddPrimitiveAtom(IRenderer::DynUiPrimitive* primitive, const AZ::Data::Instance& texture, + void AddPrimitiveAtom(DynUiPrimitive* primitive, const AZ::Data::Instance& texture, bool isClampTextureMode, bool isTextureSRGB, bool isTexturePremultipliedAlpha, BlendMode blendMode); //! Add an indexed triangle list primitive to the render graph which will use maskTexture as an alpha (gradient) mask - void AddAlphaMaskPrimitiveAtom(IRenderer::DynUiPrimitive* primitive, + void AddAlphaMaskPrimitiveAtom(DynUiPrimitive* primitive, AZ::Data::Instance contentAttachmentImage, AZ::Data::Instance maskAttachmentImage, bool isClampTextureMode, @@ -341,7 +334,7 @@ namespace LyShine struct DynamicQuad { SVF_P2F_C4B_T2F_F4B m_quadVerts[4]; - IRenderer::DynUiPrimitive m_primitive; + DynUiPrimitive m_primitive; }; protected: // member functions diff --git a/Gems/LyShine/Code/Source/UiCanvasComponent.cpp b/Gems/LyShine/Code/Source/UiCanvasComponent.cpp index 9d17f90f0b..4b5f072966 100644 --- a/Gems/LyShine/Code/Source/UiCanvasComponent.cpp +++ b/Gems/LyShine/Code/Source/UiCanvasComponent.cpp @@ -3637,9 +3637,13 @@ void UiCanvasComponent::DestroyRenderTarget() if (m_renderTargetHandle > 0) { ISystem::CrySystemNotificationBus::Handler::BusDisconnect(); +#ifdef LYSHINE_ATOM_TODO // [LYN-3359] Support RTT using Atom gEnv->pRenderer->DestroyDepthSurface(m_renderTargetDepthSurface); +#endif m_renderTargetDepthSurface = nullptr; +#ifdef LYSHINE_ATOM_TODO // [LYN-3359] Support RTT using Atom gEnv->pRenderer->DestroyRenderTarget(m_renderTargetHandle); +#endif m_renderTargetHandle = -1; } } diff --git a/Gems/LyShine/Code/Source/UiCanvasManager.cpp b/Gems/LyShine/Code/Source/UiCanvasManager.cpp index d13a8f5034..04cb5c4a1f 100644 --- a/Gems/LyShine/Code/Source/UiCanvasManager.cpp +++ b/Gems/LyShine/Code/Source/UiCanvasManager.cpp @@ -13,6 +13,7 @@ #include "UiGameEntityContext.h" #include +#include #include #include diff --git a/Gems/LyShine/Code/Source/UiElementComponent.cpp b/Gems/LyShine/Code/Source/UiElementComponent.cpp index d06b87cf6a..0aa57e4041 100644 --- a/Gems/LyShine/Code/Source/UiElementComponent.cpp +++ b/Gems/LyShine/Code/Source/UiElementComponent.cpp @@ -27,6 +27,8 @@ #include #include +#include + #include "UiTransform2dComponent.h" #include "IConsole.h" diff --git a/Gems/LyShine/Code/Source/UiFaderComponent.h b/Gems/LyShine/Code/Source/UiFaderComponent.h index 560c1beaaa..218eab3794 100644 --- a/Gems/LyShine/Code/Source/UiFaderComponent.h +++ b/Gems/LyShine/Code/Source/UiFaderComponent.h @@ -169,5 +169,5 @@ private: // data int m_renderTargetHeight = 0; //! cached rendering data for performance optimization of rendering the render target to screen - IRenderer::DynUiPrimitive m_cachedPrimitive; + DynUiPrimitive m_cachedPrimitive; }; diff --git a/Gems/LyShine/Code/Source/UiImageComponent.h b/Gems/LyShine/Code/Source/UiImageComponent.h index 4cffbc4b88..0b93d5f8e5 100644 --- a/Gems/LyShine/Code/Source/UiImageComponent.h +++ b/Gems/LyShine/Code/Source/UiImageComponent.h @@ -294,6 +294,6 @@ private: // data bool m_isAlphaOverridden; // cached rendering data for performance optimization - IRenderer::DynUiPrimitive m_cachedPrimitive; + DynUiPrimitive m_cachedPrimitive; bool m_isRenderCacheDirty = true; }; diff --git a/Gems/LyShine/Code/Source/UiImageSequenceComponent.h b/Gems/LyShine/Code/Source/UiImageSequenceComponent.h index fb8087f525..84be0021f4 100644 --- a/Gems/LyShine/Code/Source/UiImageSequenceComponent.h +++ b/Gems/LyShine/Code/Source/UiImageSequenceComponent.h @@ -157,6 +157,6 @@ private: // data ImageType m_imageType = ImageType::Fixed; //!< Affects how the texture/sprite is mapped to the image rectangle // cached rendering data for performance optimization - IRenderer::DynUiPrimitive m_cachedPrimitive; + DynUiPrimitive m_cachedPrimitive; bool m_isRenderCacheDirty = true; }; diff --git a/Gems/LyShine/Code/Source/UiMaskComponent.h b/Gems/LyShine/Code/Source/UiMaskComponent.h index 8635f048f5..8e04fa0b4f 100644 --- a/Gems/LyShine/Code/Source/UiMaskComponent.h +++ b/Gems/LyShine/Code/Source/UiMaskComponent.h @@ -205,7 +205,7 @@ private: // data int m_renderTargetHeight = 0; //! cached rendering data for performance optimization of rendering the render target to screen - IRenderer::DynUiPrimitive m_cachedPrimitive; + DynUiPrimitive m_cachedPrimitive; #ifndef _RELEASE //! This variable is only used to prevent spamming a warning message each frame (for nested stencil masks) diff --git a/Gems/LyShine/Code/Source/UiParticleEmitterComponent.h b/Gems/LyShine/Code/Source/UiParticleEmitterComponent.h index cb8152265d..452e0ad01a 100644 --- a/Gems/LyShine/Code/Source/UiParticleEmitterComponent.h +++ b/Gems/LyShine/Code/Source/UiParticleEmitterComponent.h @@ -349,5 +349,5 @@ protected: // data AZStd::vector m_particleContainer; AZ::u32 m_particleBufferSize = 0; - IRenderer::DynUiPrimitive m_cachedPrimitive; + DynUiPrimitive m_cachedPrimitive; }; diff --git a/Gems/LyShine/Code/Source/UiTextComponent.cpp b/Gems/LyShine/Code/Source/UiTextComponent.cpp index f9544a9954..ae5c03e447 100644 --- a/Gems/LyShine/Code/Source/UiTextComponent.cpp +++ b/Gems/LyShine/Code/Source/UiTextComponent.cpp @@ -1827,7 +1827,7 @@ void UiTextComponent::Render(LyShine::IRenderGraph* renderGraph) for (UiTransformInterface::RectPoints& rect : rectPoints) { - IRenderer::DynUiPrimitive* primitive = renderGraph->GetDynamicQuadPrimitive(rect.pt, packedColor); + DynUiPrimitive* primitive = renderGraph->GetDynamicQuadPrimitive(rect.pt, packedColor); primitive->m_next = nullptr; LyShine::RenderGraph* lyRenderGraph = dynamic_cast(renderGraph); diff --git a/Gems/LyShine/Code/Source/UiTextComponent.h b/Gems/LyShine/Code/Source/UiTextComponent.h index 600f0dc148..cc1f9bf393 100644 --- a/Gems/LyShine/Code/Source/UiTextComponent.h +++ b/Gems/LyShine/Code/Source/UiTextComponent.h @@ -153,8 +153,8 @@ public: //types InlineImage* image = nullptr; - AZ::Vector2 size; //!< The size in pixels of the batch content - + AZ::Vector2 size; //!< The size in pixels of the batch content + float yOffset; //!< While calculating, the yOffset is set to the offset from the text draw y position. //!< Once all batches in the line are calculated, the yOffset will become the offset //!< from the y draw position of the batch line @@ -475,7 +475,7 @@ protected: // member functions //! Handles overflow and shrink-to-text settings to text void HandleOverflowText(UiTextComponent::DrawBatchLines& drawBatchLinesOut); - //! Handles shrink-to-fit for text, if applicable. + //! Handles shrink-to-fit for text, if applicable. void HandleShrinkToFit(UiTextComponent::DrawBatchLines& drawBatchLinesOut, float availableHeight = -1.0f); //! Handles the "uniform" shrink-to-fit setting. @@ -506,18 +506,18 @@ protected: // member functions void GetDrawBatchStartPositions(DrawBatchStartPositions& startPositions, DrawBatchLine* lineToEllipsis, const AZ::Vector2& currentElementSize); //! Returns the draw batch that will have ellipsis inserted, along with required position information to do so. - DrawBatch* GetDrawBatchToEllipseAndPositions(const char* ellipseText, - const STextDrawContext& ctx, - const AZ::Vector2& currentElementSize, + DrawBatch* GetDrawBatchToEllipseAndPositions(const char* ellipseText, + const STextDrawContext& ctx, + const AZ::Vector2& currentElementSize, DrawBatchStartPositions* startPositions, - float* drawBatchStartPos, + float* drawBatchStartPos, float* ellipsisPos); //! Removes all draw batches following the given DrawBatch on the given DrawBatchLine. void TruncateDrawBatches(DrawBatchLine* lineToTruncate, const DrawBatch* truncateAfterBatch); //! Given a draw batch, get the character index where ellipsis should be inserted in the string. - int GetStartEllipseIndexInDrawBatch(const DrawBatch* drawBatchToEllipse, + int GetStartEllipseIndexInDrawBatch(const DrawBatch* drawBatchToEllipse, const STextDrawContext& ctx, const float drawBatchStartPos, const float ellipsePos); @@ -546,7 +546,7 @@ protected: // member functions //! Given rect points and number of lines of text to display, returns the position to display text. //! //! The number of lines of text determines the Y offset of the first line to display. For - //! top-aligned text, this offset will be zero (regardless of the number of lines of text) + //! top-aligned text, this offset will be zero (regardless of the number of lines of text) //! because the first line to display will always be displayed at the top of the rect, while //! bottom-aligned text will be offset by the number of lines to display, and vertically //! centered text will be offset by half of that amount. @@ -608,13 +608,13 @@ private: // types ColorB m_color; IFFont* m_font; uint32 m_fontTextureVersion; - IRenderer::DynUiPrimitive m_cachedPrimitive; + DynUiPrimitive m_cachedPrimitive; }; struct RenderCacheImageBatch { AZ::Data::Instance m_texture; - IRenderer::DynUiPrimitive m_cachedPrimitive; + DynUiPrimitive m_cachedPrimitive; }; struct RenderCacheData @@ -642,11 +642,11 @@ private: // data //!< font size. In GetTextDrawContextPrototype, this value ultimately gets converted to pixels and //!< stored in STextDrawContext::m_tracking. This value and STextDrawContext::m_tracking aren't //!< necessarily 1:1, just as m_fontSize and STextDrawContext::m_size aren't necessarily 1:1. - //!< Although the component values of m_charSpacing and m_fontSize are unaffected by scaling, - //!< scaling (such as scaling performed by shrink-to-fit overflow handling) is applied to these + //!< Although the component values of m_charSpacing and m_fontSize are unaffected by scaling, + //!< scaling (such as scaling performed by shrink-to-fit overflow handling) is applied to these //!< values and the resulting scaled value is stored in STextDrawContext for rendering. As a result, //!< it's possible for the value of m_charSpacing to never change, but STextDrawContext::m_tracking - //!< can vary in value independently of m_charSpacing as the font size (and/or scaled font size) + //!< can vary in value independently of m_charSpacing as the font size (and/or scaled font size) //!< changes over time. See also DrawBatchLines::fontSizeScale. float m_lineSpacing; diff --git a/Gems/LyShine/Code/Source/UiTextInputComponent.cpp b/Gems/LyShine/Code/Source/UiTextInputComponent.cpp index df2d85eb74..e789301572 100644 --- a/Gems/LyShine/Code/Source/UiTextInputComponent.cpp +++ b/Gems/LyShine/Code/Source/UiTextInputComponent.cpp @@ -17,6 +17,7 @@ #include #include +#include #include #include #include @@ -27,6 +28,7 @@ #include #include + #include "UiNavigationHelpers.h" #include "UiSerialize.h" #include "Sprite.h" diff --git a/Gems/LyShine/Code/Source/UiTransform2dComponent.cpp b/Gems/LyShine/Code/Source/UiTransform2dComponent.cpp index 48b2c2a8c4..190b9b769f 100644 --- a/Gems/LyShine/Code/Source/UiTransform2dComponent.cpp +++ b/Gems/LyShine/Code/Source/UiTransform2dComponent.cpp @@ -23,6 +23,9 @@ #include "UiElementComponent.h" #include "UiCanvasComponent.h" +#include +#include + namespace { bool AxisAlignedBoxesIntersect(const AZ::Vector2& minA, const AZ::Vector2& maxA, const AZ::Vector2& minB, const AZ::Vector2& maxB) @@ -273,7 +276,7 @@ AZ::Vector2 UiTransform2dComponent::GetViewportSpacePivot() AZ::Matrix4x4 transform; parentTransformComponent->GetTransformToViewport(transform); - point3 = transform * point3; + point3 = transform * point3; } return AZ::Vector2(point3.GetX(), point3.GetY()); diff --git a/Gems/LyShine/Code/Tests/LyShineEditorTest.cpp b/Gems/LyShine/Code/Tests/LyShineEditorTest.cpp index 597874d5d6..ff4e054ac7 100644 --- a/Gems/LyShine/Code/Tests/LyShineEditorTest.cpp +++ b/Gems/LyShine/Code/Tests/LyShineEditorTest.cpp @@ -54,7 +54,6 @@ #include #include #include -#include AZ_UNIT_TEST_HOOK(DEFAULT_UNIT_TEST_ENV); @@ -80,7 +79,6 @@ protected: m_data = AZStd::make_unique(); memset(&m_data->m_stubEnv, 0, sizeof(SSystemGlobalEnvironment)); - m_data->m_stubEnv.pRenderer = &m_data->m_renderer; m_data->m_stubEnv.pSystem = &m_data->m_mockSystem; gEnv = &m_data->m_stubEnv; @@ -212,7 +210,6 @@ protected: struct DataMembers { SSystemGlobalEnvironment m_stubEnv; - NiceMock m_renderer; NiceMock m_mockSystem; }; diff --git a/Gems/LyShine/Code/Tests/SpriteTest.cpp b/Gems/LyShine/Code/Tests/SpriteTest.cpp index 84b47955b4..ff9095a7d9 100644 --- a/Gems/LyShine/Code/Tests/SpriteTest.cpp +++ b/Gems/LyShine/Code/Tests/SpriteTest.cpp @@ -8,7 +8,6 @@ #include "LyShineTest.h" #include -#include #include #include @@ -42,23 +41,13 @@ namespace UnitTest { LyShineTest::SetupEnvironment(); - m_data = AZStd::make_unique(); - m_env->m_stubEnv.pRenderer = &m_data->m_renderer; } void TearDown() override { - m_data.reset(); - LyShineTest::TearDown(); } - struct DataMembers - { - testing::NiceMock m_renderer; - }; - - AZStd::unique_ptr m_data; }; #ifdef LYSHINE_ATOM_TODO // [LYN-3359] - render target support using Atom diff --git a/Gems/LyShine/Code/Tests/TextInputComponentTest.cpp b/Gems/LyShine/Code/Tests/TextInputComponentTest.cpp index 6a9560da27..97c178a557 100644 --- a/Gems/LyShine/Code/Tests/TextInputComponentTest.cpp +++ b/Gems/LyShine/Code/Tests/TextInputComponentTest.cpp @@ -8,7 +8,6 @@ #include "LyShineTest.h" -#include #include "UiGameEntityContext.h" #include "UiElementComponent.h" #include "UiTransform2dComponent.h" @@ -118,13 +117,10 @@ namespace UnitTest m_priorEnv = gEnv; gEnv = &m_env->m_stubEnv; - m_data = AZStd::make_unique(); - m_env->m_stubEnv.pRenderer = &m_data->m_renderer; } void TearDown() override { - m_data.reset(); m_env.reset(); gEnv = m_priorEnv; @@ -140,12 +136,7 @@ namespace UnitTest SSystemGlobalEnvironment m_stubEnv; }; - struct DataMembers - { - testing::NiceMock m_renderer; - }; - AZStd::unique_ptr m_data; AZStd::unique_ptr m_env; SSystemGlobalEnvironment* m_priorEnv = nullptr; diff --git a/Gems/LyShineExamples/Code/Source/UiCustomImageComponent.h b/Gems/LyShineExamples/Code/Source/UiCustomImageComponent.h index ccd886df87..f696228f5a 100644 --- a/Gems/LyShineExamples/Code/Source/UiCustomImageComponent.h +++ b/Gems/LyShineExamples/Code/Source/UiCustomImageComponent.h @@ -136,7 +136,7 @@ namespace LyShineExamples float m_overrideAlpha; // cached rendering data for performance optimization - IRenderer::DynUiPrimitive m_cachedPrimitive; + DynUiPrimitive m_cachedPrimitive; bool m_isRenderCacheDirty = true; }; } diff --git a/Gems/Maestro/Code/Source/Cinematics/AnimSequence.h b/Gems/Maestro/Code/Source/Cinematics/AnimSequence.h index f69017c3a6..0a1d4a931c 100644 --- a/Gems/Maestro/Code/Source/Cinematics/AnimSequence.h +++ b/Gems/Maestro/Code/Source/Cinematics/AnimSequence.h @@ -18,6 +18,8 @@ #include "TrackEventTrack.h" +#include + class CAnimSequence : public IAnimSequence { diff --git a/Gems/Maestro/Code/Source/Cinematics/Movie.cpp b/Gems/Maestro/Code/Source/Cinematics/Movie.cpp index cf51ef3729..8f2975aecf 100644 --- a/Gems/Maestro/Code/Source/Cinematics/Movie.cpp +++ b/Gems/Maestro/Code/Source/Cinematics/Movie.cpp @@ -27,6 +27,7 @@ #include #include +#include #include #include diff --git a/Gems/Maestro/Code/Source/Cinematics/Movie.h b/Gems/Maestro/Code/Source/Cinematics/Movie.h index 6ac857d652..7c8edd15ae 100644 --- a/Gems/Maestro/Code/Source/Cinematics/Movie.h +++ b/Gems/Maestro/Code/Source/Cinematics/Movie.h @@ -16,6 +16,7 @@ #include #include "IMovieSystem.h" +#include "IShader.h" struct PlayingSequence { diff --git a/Gems/Maestro/Code/Source/Cinematics/ScreenFaderTrack.cpp b/Gems/Maestro/Code/Source/Cinematics/ScreenFaderTrack.cpp index 9ac19f91ea..1b2fbe0baf 100644 --- a/Gems/Maestro/Code/Source/Cinematics/ScreenFaderTrack.cpp +++ b/Gems/Maestro/Code/Source/Cinematics/ScreenFaderTrack.cpp @@ -9,7 +9,7 @@ #include #include "ScreenFaderTrack.h" -#include +#include //----------------------------------------------------------------------------- CScreenFaderTrack::CScreenFaderTrack() diff --git a/Gems/Maestro/Code/Source/Cinematics/SoundTrack.h b/Gems/Maestro/Code/Source/Cinematics/SoundTrack.h index ac6eca4f03..58ba8c78c6 100644 --- a/Gems/Maestro/Code/Source/Cinematics/SoundTrack.h +++ b/Gems/Maestro/Code/Source/Cinematics/SoundTrack.h @@ -11,6 +11,7 @@ #define CRYINCLUDE_CRYMOVIE_SOUNDTRACK_H #include "AnimTrack.h" +#include struct SSoundInfo { diff --git a/Gems/Maestro/Code/Source/Cinematics/TrackEventTrack.h b/Gems/Maestro/Code/Source/Cinematics/TrackEventTrack.h index 3993194bcf..13a6549220 100644 --- a/Gems/Maestro/Code/Source/Cinematics/TrackEventTrack.h +++ b/Gems/Maestro/Code/Source/Cinematics/TrackEventTrack.h @@ -15,6 +15,7 @@ #include "IMovieSystem.h" #include "AnimTrack.h" #include "AnimKey.h" +#include "StlUtils.h" class CAnimStringTable : public IAnimStringTable From 058f6e0f227c0786cc653a35e6823692cb2374ee Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Wed, 25 Aug 2021 14:06:26 -0700 Subject: [PATCH 099/131] PR comments/fixes Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Code/Editor/Core/LevelEditorMenuHandler.cpp | 3 +- Code/Editor/Core/LevelEditorMenuHandler.h | 2 +- ...bjectSelectionReferenceFrameCalculator.cpp | 74 ------------------- ...bObjectSelectionReferenceFrameCalculator.h | 41 ---------- ...bObjectSelectionReferenceFrameCalculator.h | 24 ------ Code/Editor/MainWindow.cpp | 2 +- Code/Editor/Objects/BaseObject.h | 2 - Code/Editor/Platform/Mac/main_dummy.cpp | 2 +- Code/Editor/editor_lib_files.cmake | 3 - .../AzCore/AzCore/Debug/BudgetTracker.cpp | 2 - Code/Framework/AzCore/AzCore/Math/Guid.h | 24 ++---- .../AzCore/AzCore/Memory/AllocatorScope.h | 4 +- .../AzCore/AzCore/RTTI/BehaviorContext.h | 3 +- .../AzCore/AzCore/std/string/string_view.h | 17 ----- .../Tools/UpgradeTool/VersionExplorer.cpp | 2 +- 15 files changed, 15 insertions(+), 190 deletions(-) delete mode 100644 Code/Editor/EditMode/SubObjectSelectionReferenceFrameCalculator.cpp delete mode 100644 Code/Editor/EditMode/SubObjectSelectionReferenceFrameCalculator.h delete mode 100644 Code/Editor/Include/ISubObjectSelectionReferenceFrameCalculator.h diff --git a/Code/Editor/Core/LevelEditorMenuHandler.cpp b/Code/Editor/Core/LevelEditorMenuHandler.cpp index 8c757a361e..e568f05167 100644 --- a/Code/Editor/Core/LevelEditorMenuHandler.cpp +++ b/Code/Editor/Core/LevelEditorMenuHandler.cpp @@ -154,8 +154,7 @@ namespace } } -LevelEditorMenuHandler::LevelEditorMenuHandler( - MainWindow* mainWindow, QtViewPaneManager* const viewPaneManager, [[maybe_unused]] QSettings& settings) +LevelEditorMenuHandler::LevelEditorMenuHandler(MainWindow* mainWindow, QtViewPaneManager* const viewPaneManager) : QObject(mainWindow) , m_mainWindow(mainWindow) , m_viewPaneManager(viewPaneManager) diff --git a/Code/Editor/Core/LevelEditorMenuHandler.h b/Code/Editor/Core/LevelEditorMenuHandler.h index 95f2f70703..5ac8e63786 100644 --- a/Code/Editor/Core/LevelEditorMenuHandler.h +++ b/Code/Editor/Core/LevelEditorMenuHandler.h @@ -33,7 +33,7 @@ class LevelEditorMenuHandler { Q_OBJECT public: - LevelEditorMenuHandler(MainWindow* mainWindow, QtViewPaneManager* const viewPaneManager, QSettings& settings); + LevelEditorMenuHandler(MainWindow* mainWindow, QtViewPaneManager* const viewPaneManager); ~LevelEditorMenuHandler(); void Initialize(); diff --git a/Code/Editor/EditMode/SubObjectSelectionReferenceFrameCalculator.cpp b/Code/Editor/EditMode/SubObjectSelectionReferenceFrameCalculator.cpp deleted file mode 100644 index 99f4ab1ca6..0000000000 --- a/Code/Editor/EditMode/SubObjectSelectionReferenceFrameCalculator.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - - -// Description : Calculate the reference frame for sub-object selections. - -#include "EditorDefs.h" - -#include "SubObjectSelectionReferenceFrameCalculator.h" - -SubObjectSelectionReferenceFrameCalculator::SubObjectSelectionReferenceFrameCalculator([[maybe_unused]] ESubObjElementType selectionType) - : m_anySelected(false) - , pos(0.0f, 0.0f, 0.0f) - , normal(0.0f, 0.0f, 0.0f) - , nNormals(0) - , bUseExplicitFrame(false) - , bExplicitAnySelected(false) -{ -} - -void SubObjectSelectionReferenceFrameCalculator::SetExplicitFrame(bool bAnySelected, const Matrix34& refFrame) -{ - this->m_refFrame = refFrame; - this->bUseExplicitFrame = true; - this->bExplicitAnySelected = bAnySelected; -} - -bool SubObjectSelectionReferenceFrameCalculator::GetFrame(Matrix34& refFrame) -{ - if (this->bUseExplicitFrame) - { - refFrame = this->m_refFrame; - return this->bExplicitAnySelected; - } - else - { - refFrame.SetIdentity(); - - if (this->nNormals > 0) - { - this->normal = this->normal / static_cast(this->nNormals); - if (!this->normal.IsZero()) - { - this->normal.Normalize(); - } - - // Average position. - this->pos = this->pos / static_cast(this->nNormals); - refFrame.SetTranslation(this->pos); - } - - if (this->m_anySelected) - { - if (!this->normal.IsZero()) - { - Vec3 xAxis(1, 0, 0), yAxis(0, 1, 0), zAxis(0, 0, 1); - if (this->normal.IsEquivalent(zAxis) || normal.IsEquivalent(-zAxis)) - { - zAxis = xAxis; - } - xAxis = this->normal.Cross(zAxis).GetNormalized(); - yAxis = xAxis.Cross(this->normal).GetNormalized(); - refFrame.SetFromVectors(xAxis, yAxis, normal, pos); - } - } - - return m_anySelected; - } -} diff --git a/Code/Editor/EditMode/SubObjectSelectionReferenceFrameCalculator.h b/Code/Editor/EditMode/SubObjectSelectionReferenceFrameCalculator.h deleted file mode 100644 index dd33342feb..0000000000 --- a/Code/Editor/EditMode/SubObjectSelectionReferenceFrameCalculator.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - - -// Description : Calculate the reference frame for sub-object selections. - - -#ifndef CRYINCLUDE_EDITOR_EDITMODE_SUBOBJECTSELECTIONREFERENCEFRAMECALCULATOR_H -#define CRYINCLUDE_EDITOR_EDITMODE_SUBOBJECTSELECTIONREFERENCEFRAMECALCULATOR_H -#pragma once - - -#include "ISubObjectSelectionReferenceFrameCalculator.h" -#include "Objects/SubObjSelection.h" - -class SubObjectSelectionReferenceFrameCalculator - : public ISubObjectSelectionReferenceFrameCalculator -{ -public: - SubObjectSelectionReferenceFrameCalculator(ESubObjElementType selectionType); - - virtual void SetExplicitFrame(bool bAnySelected, const Matrix34& refFrame); - bool GetFrame(Matrix34& refFrame); - -private: - bool m_anySelected; - Vec3 pos; - Vec3 normal; - int nNormals; - std::vector positions; - Matrix34 m_refFrame; - bool bUseExplicitFrame; - bool bExplicitAnySelected; -}; - -#endif // CRYINCLUDE_EDITOR_EDITMODE_SUBOBJECTSELECTIONREFERENCEFRAMECALCULATOR_H diff --git a/Code/Editor/Include/ISubObjectSelectionReferenceFrameCalculator.h b/Code/Editor/Include/ISubObjectSelectionReferenceFrameCalculator.h deleted file mode 100644 index ff82b57de1..0000000000 --- a/Code/Editor/Include/ISubObjectSelectionReferenceFrameCalculator.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - - -// Description : Calculate the reference frame for sub-object selections. - - -#ifndef CRYINCLUDE_EDITOR_INCLUDE_ISUBOBJECTSELECTIONREFERENCEFRAMECALCULATOR_H -#define CRYINCLUDE_EDITOR_INCLUDE_ISUBOBJECTSELECTIONREFERENCEFRAMECALCULATOR_H -#pragma once - - -class ISubObjectSelectionReferenceFrameCalculator -{ -public: - virtual void SetExplicitFrame(bool bAnySelected, const Matrix34& refFrame) = 0; -}; - -#endif // CRYINCLUDE_EDITOR_INCLUDE_ISUBOBJECTSELECTIONREFERENCEFRAMECALCULATOR_H diff --git a/Code/Editor/MainWindow.cpp b/Code/Editor/MainWindow.cpp index bec61df984..beb338b732 100644 --- a/Code/Editor/MainWindow.cpp +++ b/Code/Editor/MainWindow.cpp @@ -297,7 +297,7 @@ MainWindow::MainWindow(QWidget* parent) , m_settings("O3DE", "O3DE") , m_toolbarManager(new ToolbarManager(m_actionManager, this)) , m_assetImporterManager(new AssetImporterManager(this)) - , m_levelEditorMenuHandler(new LevelEditorMenuHandler(this, m_viewPaneManager, m_settings)) + , m_levelEditorMenuHandler(new LevelEditorMenuHandler(this, m_viewPaneManager)) , m_sourceControlNotifHandler(new AzToolsFramework::QtSourceControlNotificationHandler(this)) , m_viewPaneHost(nullptr) , m_autoSaveTimer(nullptr) diff --git a/Code/Editor/Objects/BaseObject.h b/Code/Editor/Objects/BaseObject.h index 47dba99ab7..ece0bf67c3 100644 --- a/Code/Editor/Objects/BaseObject.h +++ b/Code/Editor/Objects/BaseObject.h @@ -33,7 +33,6 @@ class CGizmo; class CObjectArchive; struct SSubObjSelectionModifyContext; struct SRayHitInfo; -class ISubObjectSelectionReferenceFrameCalculator; class CPopupMenuItem; class QMenu; struct IRenderNode; @@ -571,7 +570,6 @@ public: // Return true if object support selecting of this sub object element type. virtual bool StartSubObjSelection([[maybe_unused]] int elemType) { return false; }; virtual void EndSubObjectSelection() {}; - virtual void CalculateSubObjectSelectionReferenceFrame([[maybe_unused]] ISubObjectSelectionReferenceFrameCalculator* pCalculator) { }; virtual void ModifySubObjSelection([[maybe_unused]] SSubObjSelectionModifyContext& modCtx) {}; virtual void AcceptSubObjectModify() {}; diff --git a/Code/Editor/Platform/Mac/main_dummy.cpp b/Code/Editor/Platform/Mac/main_dummy.cpp index 082384db58..814cbfde66 100644 --- a/Code/Editor/Platform/Mac/main_dummy.cpp +++ b/Code/Editor/Platform/Mac/main_dummy.cpp @@ -66,7 +66,7 @@ int main(int argc, char* argv[]) processLaunchInfo.m_environmentVariables = &envVars; processLaunchInfo.m_showWindow = true; - AzFramework::ProcessWatcher::LaunchProcess(processLaunchInfo, AzFramework::ProcessCommunicationType::COMMUNICATOR_TYPE_NONE); + AZStd::unique_ptr processWatcher(AzFramework::ProcessWatcher::LaunchProcess(processLaunchInfo, AzFramework::ProcessCommunicationType::COMMUNICATOR_TYPE_NONE)); application.Destroy(); diff --git a/Code/Editor/editor_lib_files.cmake b/Code/Editor/editor_lib_files.cmake index 6c5096a8f5..bc8f835fc7 100644 --- a/Code/Editor/editor_lib_files.cmake +++ b/Code/Editor/editor_lib_files.cmake @@ -290,7 +290,6 @@ set(FILES Include/IPreferencesPage.h Include/IRenderListener.h Include/ISourceControl.h - Include/ISubObjectSelectionReferenceFrameCalculator.h Include/ITextureDatabaseUpdater.h Include/ITransformManipulator.h Include/IViewPane.h @@ -460,8 +459,6 @@ set(FILES Dialogs/PythonScriptsDialog.ui Dialogs/Generic/UserOptions.cpp Dialogs/Generic/UserOptions.h - EditMode/SubObjectSelectionReferenceFrameCalculator.cpp - EditMode/SubObjectSelectionReferenceFrameCalculator.h Export/ExportManager.cpp Export/ExportManager.h Export/OBJExporter.cpp diff --git a/Code/Framework/AzCore/AzCore/Debug/BudgetTracker.cpp b/Code/Framework/AzCore/AzCore/Debug/BudgetTracker.cpp index 255a740e32..2dac9a566e 100644 --- a/Code/Framework/AzCore/AzCore/Debug/BudgetTracker.cpp +++ b/Code/Framework/AzCore/AzCore/Debug/BudgetTracker.cpp @@ -17,8 +17,6 @@ namespace AZ::Debug { - constexpr static const char* BudgetTrackerEnvName = "budgetTrackerEnv"; - struct BudgetTracker::BudgetTrackerImpl { AZStd::unordered_map m_budgets; diff --git a/Code/Framework/AzCore/AzCore/Math/Guid.h b/Code/Framework/AzCore/AzCore/Math/Guid.h index 9889092743..3a2db1693f 100644 --- a/Code/Framework/AzCore/AzCore/Math/Guid.h +++ b/Code/Framework/AzCore/AzCore/Math/Guid.h @@ -10,23 +10,16 @@ #ifndef GUID_DEFINED #define GUID_DEFINED -typedef struct _GUID { - _GUID(unsigned long d1, unsigned short d2, unsigned short d3, std::initializer_list d4) - : Data1(d1), - Data2(d2), - Data3(d3) - { - for (auto it = d4.begin(); it != d4.end(); ++it) - Data4[it - d4.begin()] = *it; - } - _GUID() = default; +#include +struct _GUID { uint32_t Data1; unsigned short Data2; unsigned short Data3; - unsigned char Data4[ 8 ]; -} GUID; + AZStd::array Data4; +}; +using GUID = _GUID; #endif // GUID_DEFINED #if !defined _SYS_GUID_OPERATOR_EQ_ && !defined _NO_SYS_GUID_OPERATOR_EQ_ @@ -36,7 +29,7 @@ static bool inline operator==(const _GUID& lhs, const _GUID& rhs) return lhs.Data1 == rhs.Data1 && lhs.Data2 == rhs.Data2 && lhs.Data3 == rhs.Data3 && - memcmp(lhs.Data4, rhs.Data4, 8) == 0; + lhs.Data4 == rhs.Data4; } static bool inline operator!=(const _GUID& lhs, const _GUID& rhs) { @@ -66,10 +59,9 @@ typedef const GUID& REFIID; const GUID name \ = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } } -inline REFGUID GUID_NULL() +inline constexpr GUID GUID_NULL() { - static GUID guid = { 0x00000000L, 0x0000, 0x0000, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} }; - return guid; + return { 0x00000000L, 0x0000, 0x0000, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} }; } #define GUID_NULL GUID_NULL() diff --git a/Code/Framework/AzCore/AzCore/Memory/AllocatorScope.h b/Code/Framework/AzCore/AzCore/Memory/AllocatorScope.h index 7637db3967..4f9aabb4be 100644 --- a/Code/Framework/AzCore/AzCore/Memory/AllocatorScope.h +++ b/Code/Framework/AzCore/AzCore/Memory/AllocatorScope.h @@ -20,9 +20,7 @@ namespace AZ public: void ActivateAllocators() { - // Note the parameter pack expansion, this creates the equivalent of a fold expression - // For each type, call InitAllocator(), then put 0 in the initializer list - [[maybe_unused]] std::initializer_list init{(InitAllocator(), 0)...}; + (InitAllocator(), ...); } void DeactivateAllocators() diff --git a/Code/Framework/AzCore/AzCore/RTTI/BehaviorContext.h b/Code/Framework/AzCore/AzCore/RTTI/BehaviorContext.h index 48bb72dd52..f02c37492b 100644 --- a/Code/Framework/AzCore/AzCore/RTTI/BehaviorContext.h +++ b/Code/Framework/AzCore/AzCore/RTTI/BehaviorContext.h @@ -3774,8 +3774,7 @@ namespace AZ template inline void OnDemandReflectFunctions(OnDemandReflectionOwner* onDemandReflection, AZStd::Internal::pack_traits_arg_sequence) { - using PackExpander = bool[]; - [[maybe_unused]] PackExpander pe = { true, (BehaviorOnDemandReflectHelper::raw_fp_type>::QueueReflect(onDemandReflection), true)... }; + (BehaviorOnDemandReflectHelper::raw_fp_type>::QueueReflect(onDemandReflection), ...); } // Assumes parameters array is big enough to store all parameters diff --git a/Code/Framework/AzCore/AzCore/std/string/string_view.h b/Code/Framework/AzCore/AzCore/std/string/string_view.h index 29589ec063..d831f0d276 100644 --- a/Code/Framework/AzCore/AzCore/std/string/string_view.h +++ b/Code/Framework/AzCore/AzCore/std/string/string_view.h @@ -869,30 +869,13 @@ namespace AZStd constexpr size_t hash_string(RandomAccessIterator first, size_t length) { size_t hash = 14695981039346656037ULL; -#if AZ_COMPILER_MSVC >= 1924 constexpr size_t fnvPrime = 1099511628211ULL; -#endif const RandomAccessIterator last(first + length); for (; first != last; ++first) { hash ^= static_cast(*first); -#if AZ_COMPILER_MSVC < 1924 - // Workaround for integer overflow warning for hash function when used in a constexpr context - // The warning must be disabled at the call site and is a compiler bug that has been fixed - // with Visual Studio 2019 version 16.4 - // https://developercommunity.visualstudio.com/content/problem/211134/unsigned-integer-overflows-in-constexpr-functionsa.html?childToView=211580#comment-211580 - constexpr size_t fnvPrimeHigh{ 0x100ULL }; - constexpr size_t fnvPrimeLow{ 0x000001b3 }; - const uint64_t hashHigh{ hash >> 32 }; - const uint64_t hashLow{ hash & 0xFFFF'FFFF }; - const uint64_t lowResult{ hashLow * fnvPrimeLow }; - const uint64_t fnvPrimeHighResult{ hashLow * fnvPrimeHigh }; - const uint64_t hashHighResult{ hashHigh * fnvPrimeLow }; - hash = (lowResult & 0xffff'ffff) + (((lowResult >> 32) + (fnvPrimeHighResult & 0xffff'ffff) + (hashHighResult & 0xffff'ffff)) << 32); -#else hash *= fnvPrime; -#endif } return hash; } diff --git a/Gems/ScriptCanvas/Code/Editor/View/Windows/Tools/UpgradeTool/VersionExplorer.cpp b/Gems/ScriptCanvas/Code/Editor/View/Windows/Tools/UpgradeTool/VersionExplorer.cpp index a039ad7b53..738cfd8d22 100644 --- a/Gems/ScriptCanvas/Code/Editor/View/Windows/Tools/UpgradeTool/VersionExplorer.cpp +++ b/Gems/ScriptCanvas/Code/Editor/View/Windows/Tools/UpgradeTool/VersionExplorer.cpp @@ -762,7 +762,7 @@ namespace ScriptCanvasEditor rowGoToButton->setEnabled(false); m_inProgressAsset = AZStd::find_if(m_assetsToUpgrade.begin(), m_assetsToUpgrade.end() - , [this, asset](const UpgradeAssets::value_type& assetToUpgrade) + , [asset](const UpgradeAssets::value_type& assetToUpgrade) { return assetToUpgrade.GetId() == asset.GetId(); }); From c30642d855d63e60f25f879d48362ad9a2aaaf2b Mon Sep 17 00:00:00 2001 From: jckand-amzn Date: Wed, 25 Aug 2021 16:13:10 -0500 Subject: [PATCH 100/131] Renaming test files for standardization and setting optimized tests to run alongside existing Signed-off-by: jckand-amzn --- .../PythonTests/largeworlds/CMakeLists.txt | 34 +++- ...gnal_Periodic.py => TestSuite_Periodic.py} | 0 ...zed.py => TestSuite_Periodic_Optimized.py} | 0 .../test_GradientIncompatibilities.py | 103 ----------- .../test_GradientPreviewSettings.py | 118 ------------ .../gradient_signal/test_GradientSampling.py | 86 --------- .../test_GradientSurfaceTagEmitter.py | 116 ------------ .../gradient_signal/test_GradientTransform.py | 157 ---------------- .../gradient_signal/test_ImageGradient.py | 69 ------- ...dscapeCanvas_Main.py => TestSuite_Main.py} | 0 ...timized.py => TestSuite_Main_Optimized.py} | 8 +- ...nvas_Periodic.py => TestSuite_Periodic.py} | 0 .../landscape_canvas/test_AreaNodes.py | 125 ------------- .../test_EditFunctionality.py | 84 --------- .../test_GeneralGraphFunctionality.py | 173 ------------------ .../test_GradientModifierNodes.py | 92 ---------- .../landscape_canvas/test_GradientNodes.py | 109 ----------- .../test_GraphComponentSync.py | 167 ----------------- .../test_LandscapeCanvas_Main_Optimized.py | 22 --- .../landscape_canvas/test_ShapeNodes.py | 82 --------- 20 files changed, 38 insertions(+), 1507 deletions(-) rename AutomatedTesting/Gem/PythonTests/largeworlds/gradient_signal/{test_GradientSignal_Periodic.py => TestSuite_Periodic.py} (100%) rename AutomatedTesting/Gem/PythonTests/largeworlds/gradient_signal/{test_GradientSignal_Periodic_Optimized.py => TestSuite_Periodic_Optimized.py} (100%) delete mode 100755 AutomatedTesting/Gem/PythonTests/largeworlds/gradient_signal/test_GradientIncompatibilities.py delete mode 100755 AutomatedTesting/Gem/PythonTests/largeworlds/gradient_signal/test_GradientPreviewSettings.py delete mode 100755 AutomatedTesting/Gem/PythonTests/largeworlds/gradient_signal/test_GradientSampling.py delete mode 100755 AutomatedTesting/Gem/PythonTests/largeworlds/gradient_signal/test_GradientSurfaceTagEmitter.py delete mode 100755 AutomatedTesting/Gem/PythonTests/largeworlds/gradient_signal/test_GradientTransform.py delete mode 100755 AutomatedTesting/Gem/PythonTests/largeworlds/gradient_signal/test_ImageGradient.py rename AutomatedTesting/Gem/PythonTests/largeworlds/landscape_canvas/{test_LandscapeCanvas_Main.py => TestSuite_Main.py} (100%) rename AutomatedTesting/Gem/PythonTests/largeworlds/landscape_canvas/{test_LandscapeCanvas_Periodic_Optimized.py => TestSuite_Main_Optimized.py} (92%) rename AutomatedTesting/Gem/PythonTests/largeworlds/landscape_canvas/{test_LandscapeCanvas_Periodic.py => TestSuite_Periodic.py} (100%) delete mode 100755 AutomatedTesting/Gem/PythonTests/largeworlds/landscape_canvas/test_AreaNodes.py delete mode 100755 AutomatedTesting/Gem/PythonTests/largeworlds/landscape_canvas/test_EditFunctionality.py delete mode 100644 AutomatedTesting/Gem/PythonTests/largeworlds/landscape_canvas/test_GeneralGraphFunctionality.py delete mode 100755 AutomatedTesting/Gem/PythonTests/largeworlds/landscape_canvas/test_GradientModifierNodes.py delete mode 100755 AutomatedTesting/Gem/PythonTests/largeworlds/landscape_canvas/test_GradientNodes.py delete mode 100755 AutomatedTesting/Gem/PythonTests/largeworlds/landscape_canvas/test_GraphComponentSync.py delete mode 100644 AutomatedTesting/Gem/PythonTests/largeworlds/landscape_canvas/test_LandscapeCanvas_Main_Optimized.py delete mode 100755 AutomatedTesting/Gem/PythonTests/largeworlds/landscape_canvas/test_ShapeNodes.py diff --git a/AutomatedTesting/Gem/PythonTests/largeworlds/CMakeLists.txt b/AutomatedTesting/Gem/PythonTests/largeworlds/CMakeLists.txt index f133780fbc..b3030e84ac 100644 --- a/AutomatedTesting/Gem/PythonTests/largeworlds/CMakeLists.txt +++ b/AutomatedTesting/Gem/PythonTests/largeworlds/CMakeLists.txt @@ -124,13 +124,14 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS AND PAL_TRAIT_ COMPONENT LargeWorlds ) + ## LandscapeCanvas ## ly_add_pytest( NAME AutomatedTesting::LandscapeCanvasTests_Main TEST_SERIAL TEST_SUITE main - PATH ${CMAKE_CURRENT_LIST_DIR}/landscape_canvas/test_LandscapeCanvas_Main.py + PATH ${CMAKE_CURRENT_LIST_DIR}/landscape_canvas/TestSuite_Main.py RUNTIME_DEPENDENCIES AZ::AssetProcessor Legacy::Editor @@ -143,7 +144,20 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS AND PAL_TRAIT_ NAME AutomatedTesting::LandscapeCanvasTests_Periodic TEST_SERIAL TEST_SUITE periodic - PATH ${CMAKE_CURRENT_LIST_DIR}/landscape_canvas/test_LandscapeCanvas_Periodic.py + PATH ${CMAKE_CURRENT_LIST_DIR}/landscape_canvas/TestSuite_Periodic.py + RUNTIME_DEPENDENCIES + AZ::AssetProcessor + Legacy::Editor + AutomatedTesting.Assets + COMPONENT + LargeWorlds + ) + + ly_add_pytest( + NAME AutomatedTesting::LandscapeCanvasTests_Main_Optimized + TEST_SERIAL + TEST_SUITE main + PATH ${CMAKE_CURRENT_LIST_DIR}/landscape_canvas/TestSuite_Main_Optimized.py RUNTIME_DEPENDENCIES AZ::AssetProcessor Legacy::Editor @@ -153,11 +167,25 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS AND PAL_TRAIT_ ) ## GradientSignal ## + ly_add_pytest( NAME AutomatedTesting::GradientSignalTests_Periodic TEST_SERIAL TEST_SUITE periodic - PATH ${CMAKE_CURRENT_LIST_DIR}/gradient_signal/test_GradientSignal_Periodic.py + PATH ${CMAKE_CURRENT_LIST_DIR}/gradient_signal/TestSuite_Periodic.py + RUNTIME_DEPENDENCIES + AZ::AssetProcessor + Legacy::Editor + AutomatedTesting.Assets + COMPONENT + LargeWorlds + ) + + ly_add_pytest( + NAME AutomatedTesting::GradientSignalTests_Periodic_Optimized + TEST_SERIAL + TEST_SUITE periodic + PATH ${CMAKE_CURRENT_LIST_DIR}/gradient_signal/TestSuite_Periodic_Optimized.py RUNTIME_DEPENDENCIES AZ::AssetProcessor Legacy::Editor diff --git a/AutomatedTesting/Gem/PythonTests/largeworlds/gradient_signal/test_GradientSignal_Periodic.py b/AutomatedTesting/Gem/PythonTests/largeworlds/gradient_signal/TestSuite_Periodic.py similarity index 100% rename from AutomatedTesting/Gem/PythonTests/largeworlds/gradient_signal/test_GradientSignal_Periodic.py rename to AutomatedTesting/Gem/PythonTests/largeworlds/gradient_signal/TestSuite_Periodic.py diff --git a/AutomatedTesting/Gem/PythonTests/largeworlds/gradient_signal/test_GradientSignal_Periodic_Optimized.py b/AutomatedTesting/Gem/PythonTests/largeworlds/gradient_signal/TestSuite_Periodic_Optimized.py similarity index 100% rename from AutomatedTesting/Gem/PythonTests/largeworlds/gradient_signal/test_GradientSignal_Periodic_Optimized.py rename to AutomatedTesting/Gem/PythonTests/largeworlds/gradient_signal/TestSuite_Periodic_Optimized.py diff --git a/AutomatedTesting/Gem/PythonTests/largeworlds/gradient_signal/test_GradientIncompatibilities.py b/AutomatedTesting/Gem/PythonTests/largeworlds/gradient_signal/test_GradientIncompatibilities.py deleted file mode 100755 index ec9fb7cb0b..0000000000 --- a/AutomatedTesting/Gem/PythonTests/largeworlds/gradient_signal/test_GradientIncompatibilities.py +++ /dev/null @@ -1,103 +0,0 @@ -""" -Copyright (c) Contributors to the Open 3D Engine Project. -For complete copyright and license terms please see the LICENSE at the root of this distribution. - -SPDX-License-Identifier: Apache-2.0 OR MIT -""" - - -""" -Tests that the Gradient Generator components are incompatible with Vegetation Area components -""" - -import os -import pytest -pytest.importorskip('ly_test_tools') - -import ly_test_tools.environment.file_system as file_system -import editor_python_test_tools.hydra_test_utils as hydra - -test_directory = os.path.join(os.path.dirname(__file__), 'EditorScripts') - -gradient_generators = [ - 'Altitude Gradient', - 'Constant Gradient', - 'FastNoise Gradient', - 'Image Gradient', - 'Perlin Noise Gradient', - 'Random Noise Gradient', - 'Shape Falloff Gradient', - 'Slope Gradient', - 'Surface Mask Gradient' -] - -gradient_modifiers = [ - 'Dither Gradient Modifier', - 'Gradient Mixer', - 'Invert Gradient Modifier', - 'Levels Gradient Modifier', - 'Posterize Gradient Modifier', - 'Smooth-Step Gradient Modifier', - 'Threshold Gradient Modifier' -] - -vegetation_areas = [ - 'Vegetation Layer Spawner', - 'Vegetation Layer Blender', - 'Vegetation Layer Blocker', - 'Vegetation Layer Blocker (Mesh)' -] - -all_gradients = gradient_modifiers + gradient_generators - - -@pytest.mark.parametrize('project', ['AutomatedTesting']) -@pytest.mark.parametrize('level', ['tmp_level']) -@pytest.mark.usefixtures("automatic_process_killer") -@pytest.mark.parametrize("launcher_platform", ['windows_editor']) -class TestGradientIncompatibilities(object): - @pytest.fixture(autouse=True) - def setup_teardown(self, request, workspace, project, level): - def teardown(): - file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True) - - request.addfinalizer(teardown) - - @pytest.mark.test_case_id('C2691648', 'C2691649', 'C2691650', 'C2691651', - 'C2691653', 'C2691656', 'C2691657', 'C2691658', - 'C2691647', 'C2691655') - @pytest.mark.SUITE_periodic - def test_GradientGenerators_Incompatibilities(self, request, editor, level, launcher_platform): - cfg_args = [level] - - expected_lines = [] - for gradient_generator in gradient_generators: - for vegetation_area in vegetation_areas: - expected_lines.append(f"{gradient_generator} is disabled before removing {vegetation_area} component") - expected_lines.append(f"{gradient_generator} is enabled after removing {vegetation_area} component") - expected_lines.append("GradientGeneratorIncompatibilities: result=SUCCESS") - hydra.launch_and_validate_results(request, test_directory, editor, - 'GradientGenerators_Incompatibilities.py', - expected_lines=expected_lines, cfg_args=cfg_args) - - @pytest.mark.test_case_id('C3416464', 'C3416546', 'C3961318', 'C3961319', - 'C3961323', 'C3961324', 'C3980656', 'C3980657', - 'C3980661', 'C3980662', 'C3980666', 'C3980667', - 'C2691652') - @pytest.mark.SUITE_periodic - def test_GradientModifiers_Incompatibilities(self, request, editor, level, launcher_platform): - cfg_args = [level] - - expected_lines = [] - for gradient_modifier in gradient_modifiers: - for vegetation_area in vegetation_areas: - expected_lines.append(f"{gradient_modifier} is disabled before removing {vegetation_area} component") - expected_lines.append(f"{gradient_modifier} is enabled after removing {vegetation_area} component") - - for conflicting_gradient in all_gradients: - expected_lines.append(f"{gradient_modifier} is disabled before removing {conflicting_gradient} component") - expected_lines.append(f"{gradient_modifier} is enabled after removing {conflicting_gradient} component") - expected_lines.append("GradientModifiersIncompatibilities: result=SUCCESS") - hydra.launch_and_validate_results(request, test_directory, editor, - 'GradientModifiers_Incompatibilities.py', - expected_lines=expected_lines, cfg_args=cfg_args) diff --git a/AutomatedTesting/Gem/PythonTests/largeworlds/gradient_signal/test_GradientPreviewSettings.py b/AutomatedTesting/Gem/PythonTests/largeworlds/gradient_signal/test_GradientPreviewSettings.py deleted file mode 100755 index f41dd605e6..0000000000 --- a/AutomatedTesting/Gem/PythonTests/largeworlds/gradient_signal/test_GradientPreviewSettings.py +++ /dev/null @@ -1,118 +0,0 @@ -""" -Copyright (c) Contributors to the Open 3D Engine Project. -For complete copyright and license terms please see the LICENSE at the root of this distribution. - -SPDX-License-Identifier: Apache-2.0 OR MIT -""" - -import os -import pytest - -# Bail on the test if ly_test_tools doesn't exist. -pytest.importorskip('ly_test_tools') -import ly_test_tools.environment.file_system as file_system -import editor_python_test_tools.hydra_test_utils as hydra - -test_directory = os.path.join(os.path.dirname(__file__), 'EditorScripts') - - -@pytest.mark.parametrize('project', ['AutomatedTesting']) -@pytest.mark.parametrize('level', ['tmp_level']) -@pytest.mark.usefixtures("automatic_process_killer") -@pytest.mark.parametrize("launcher_platform", ['windows_editor']) -class TestGradientPreviewSettings(object): - - @pytest.fixture(autouse=True) - def setup_teardown(self, request, workspace, project, level): - def teardown(): - file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True) - request.addfinalizer(teardown) - - file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True) - - @pytest.mark.test_case_id('C3980668', 'C2676825', 'C2676828', 'C2676822', 'C3416547', 'C3961320', 'C3961325', - 'C3980658', 'C3980663') - @pytest.mark.SUITE_periodic - def test_GradientPreviewSettings_DefaultPinnedEntityIsSelf(self, request, editor, level, launcher_platform): - - expected_lines = [ - "Perlin Noise Gradient has Preview pinned to own Entity result: SUCCESS", - "Random Noise Gradient has Preview pinned to own Entity result: SUCCESS", - "FastNoise Gradient has Preview pinned to own Entity result: SUCCESS", - "Dither Gradient Modifier has Preview pinned to own Entity result: SUCCESS", - "Invert Gradient Modifier has Preview pinned to own Entity result: SUCCESS", - "Levels Gradient Modifier has Preview pinned to own Entity result: SUCCESS", - "Posterize Gradient Modifier has Preview pinned to own Entity result: SUCCESS", - "Smooth-Step Gradient Modifier has Preview pinned to own Entity result: SUCCESS", - "Threshold Gradient Modifier has Preview pinned to own Entity result: SUCCESS", - "GradientPreviewSettings_DefaultPinnedEntity: result=SUCCESS" - ] - - hydra.launch_and_validate_results( - request, - test_directory, - editor, - "GradientPreviewSettings_DefaultPinnedEntityIsSelf.py", - expected_lines, - cfg_args=[level] - ) - - @pytest.mark.test_case_id("C2676829", "C3961326", "C3980659", "C3980664", "C3980669", "C3416548", "C2676823", - "C3961321", "C2676826") - @pytest.mark.SUITE_periodic - def test_GradientPreviewSettings_ClearingPinnedEntitySetsPreviewToOrigin(self, request, editor, level, - launcher_platform): - - expected_lines = [ - "Random Noise Gradient entity Created", - "Entity has a Random Noise Gradient component", - "Entity has a Gradient Transform Modifier component", - "Entity has a Box Shape component", - "Random Noise Gradient Preview Settings|Pin Preview to Shape: SUCCESS", - "Random Noise Gradient --- Preview Position set to world origin", - "Random Noise Gradient --- Preview Size set to (1, 1, 1)", - "Levels Gradient Modifier entity Created", - "Entity has a Levels Gradient Modifier component", - "Levels Gradient Modifier Preview Settings|Pin Preview to Shape: SUCCESS", - "Levels Gradient Modifier --- Preview Position set to world origin", - "Posterize Gradient Modifier entity Created", - "Entity has a Posterize Gradient Modifier component", - "Posterize Gradient Modifier Preview Settings|Pin Preview to Shape: SUCCESS", - "Posterize Gradient Modifier --- Preview Position set to world origin", - "Smooth-Step Gradient Modifier entity Created", - "Entity has a Smooth-Step Gradient Modifier component", - "Smooth-Step Gradient Modifier Preview Settings|Pin Preview to Shape: SUCCESS", - "Smooth-Step Gradient Modifier --- Preview Position set to world origin", - "Threshold Gradient Modifier entity Created", - "Entity has a Threshold Gradient Modifier component", - "Threshold Gradient Modifier Preview Settings|Pin Preview to Shape: SUCCESS", - "Threshold Gradient Modifier --- Preview Position set to world origin", - "FastNoise Gradient entity Created", - "Entity has a FastNoise Gradient component", - "FastNoise Gradient Preview Settings|Pin Preview to Shape: SUCCESS", - "FastNoise Gradient --- Preview Position set to world origin", - "FastNoise Gradient --- Preview Size set to (1, 1, 1)", - "Dither Gradient Modifier entity Created", - "Entity has a Dither Gradient Modifier component", - "Dither Gradient Modifier Preview Settings|Pin Preview to Shape: SUCCESS", - "Dither Gradient Modifier --- Preview Position set to world origin", - "Dither Gradient Modifier --- Preview Size set to (1, 1, 1)", - "Invert Gradient Modifier entity Created", - "Entity has a Invert Gradient Modifier component", - "Invert Gradient Modifier Preview Settings|Pin Preview to Shape: SUCCESS", - "Invert Gradient Modifier --- Preview Position set to world origin", - "Perlin Noise Gradient entity Created", - "Entity has a Perlin Noise Gradient component", - "Perlin Noise Gradient Preview Settings|Pin Preview to Shape: SUCCESS", - "Perlin Noise Gradient --- Preview Position set to world origin", - "Perlin Noise Gradient --- Preview Size set to (1, 1, 1)", - ] - - hydra.launch_and_validate_results( - request, - test_directory, - editor, - "GradientPreviewSettings_ClearingPinnedEntitySetsPreviewToOrigin.py", - expected_lines, - cfg_args=[level] - ) diff --git a/AutomatedTesting/Gem/PythonTests/largeworlds/gradient_signal/test_GradientSampling.py b/AutomatedTesting/Gem/PythonTests/largeworlds/gradient_signal/test_GradientSampling.py deleted file mode 100755 index 099a9404e1..0000000000 --- a/AutomatedTesting/Gem/PythonTests/largeworlds/gradient_signal/test_GradientSampling.py +++ /dev/null @@ -1,86 +0,0 @@ -""" -Copyright (c) Contributors to the Open 3D Engine Project. -For complete copyright and license terms please see the LICENSE at the root of this distribution. - -SPDX-License-Identifier: Apache-2.0 OR MIT -""" - -import os -import pytest -import logging - -# Bail on the test if ly_test_tools doesn't exist. -pytest.importorskip("ly_test_tools") -import ly_test_tools.environment.file_system as file_system -import editor_python_test_tools.hydra_test_utils as hydra - -logger = logging.getLogger(__name__) -test_directory = os.path.join(os.path.dirname(__file__), "EditorScripts") - - -@pytest.mark.parametrize('project', ['AutomatedTesting']) -@pytest.mark.parametrize('level', ['tmp_level']) -@pytest.mark.usefixtures("automatic_process_killer") -@pytest.mark.parametrize("launcher_platform", ['windows_editor']) -class TestGradientSampling(object): - - @pytest.fixture(autouse=True) - def setup_teardown(self, request, workspace, project, level): - def teardown(): - file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True) - request.addfinalizer(teardown) - - file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True) - - @pytest.mark.test_case_id("C3526311") - @pytest.mark.SUITE_periodic - def test_GradientSampling_GradientReferencesAddRemoveSuccessfully(self, request, editor, level, launcher_platform): - - expected_lines = [ - "Entity has a Random Noise Gradient component", - "Entity has a Gradient Transform Modifier component", - "Entity has a Box Shape component", - "Entity has a Dither Gradient Modifier component", - "Gradient Generator is pinned to the Dither Gradient Modifier successfully", - "Gradient Generator is cleared from the Dither Gradient Modifier successfully", - "Entity has a Invert Gradient Modifier component", - "Gradient Generator is pinned to the Invert Gradient Modifier successfully", - "Gradient Generator is cleared from the Invert Gradient Modifier successfully", - "Entity has a Levels Gradient Modifier component", - "Gradient Generator is pinned to the Levels Gradient Modifier successfully", - "Gradient Generator is cleared from the Levels Gradient Modifier successfully", - "Entity has a Posterize Gradient Modifier component", - "Gradient Generator is pinned to the Posterize Gradient Modifier successfully", - "Gradient Generator is cleared from the Posterize Gradient Modifier successfully", - "Entity has a Smooth-Step Gradient Modifier component", - "Gradient Generator is pinned to the Smooth-Step Gradient Modifier successfully", - "Gradient Generator is cleared from the Smooth-Step Gradient Modifier successfully", - "Entity has a Threshold Gradient Modifier component", - "Gradient Generator is pinned to the Threshold Gradient Modifier successfully", - "Gradient Generator is cleared from the Threshold Gradient Modifier successfully", - ] - - unexpected_lines = [ - "Failed to pin Gradient Generator to the Dither Gradient Modifier", - "Failed to clear Gradient Generator from the Dither Gradient Modifier", - "Failed to pin Gradient Generator to the Invert Gradient Modifier", - "Failed to clear Gradient Generator from the Invert Gradient Modifier", - "Failed to pin Gradient Generator to the Levels Gradient Modifier", - "Failed to clear Gradient Generator from the Levels Gradient Modifier", - "Failed to pin Gradient Generator to the Posterize Gradient Modifier", - "Failed to clear Gradient Generator from the Posterize Gradient Modifier", - "Failed to pin Gradient Generator to the Smooth-Step Gradient Modifier", - "Failed to clear Gradient Generator from the Smooth-Step Gradient Modifier", - "Failed to pin Gradient Generator to the Threshold Gradient Modifier", - "Failed to clear Gradient Generator from the Threshold Gradient Modifier", - ] - - hydra.launch_and_validate_results( - request, - test_directory, - editor, - "GradientSampling_GradientReferencesAddRemoveSuccessfully.py", - expected_lines, - unexpected_lines, - cfg_args=[level] - ) diff --git a/AutomatedTesting/Gem/PythonTests/largeworlds/gradient_signal/test_GradientSurfaceTagEmitter.py b/AutomatedTesting/Gem/PythonTests/largeworlds/gradient_signal/test_GradientSurfaceTagEmitter.py deleted file mode 100755 index 6d4a832875..0000000000 --- a/AutomatedTesting/Gem/PythonTests/largeworlds/gradient_signal/test_GradientSurfaceTagEmitter.py +++ /dev/null @@ -1,116 +0,0 @@ -""" -Copyright (c) Contributors to the Open 3D Engine Project. -For complete copyright and license terms please see the LICENSE at the root of this distribution. - -SPDX-License-Identifier: Apache-2.0 OR MIT -""" - -import os -import pytest -import logging - -# Bail on the test if ly_test_tools doesn't exist. -pytest.importorskip("ly_test_tools") -import ly_test_tools.environment.file_system as file_system -import editor_python_test_tools.hydra_test_utils as hydra - -logger = logging.getLogger(__name__) -test_directory = os.path.join(os.path.dirname(__file__), "EditorScripts") - - -@pytest.mark.parametrize("project", ["AutomatedTesting"]) -@pytest.mark.parametrize("level", ["tmp_level"]) -@pytest.mark.usefixtures("automatic_process_killer") -@pytest.mark.parametrize("launcher_platform", ['windows_editor']) -class TestGradientSurfaceTagEmitter(object): - - @pytest.fixture(autouse=True) - def setup_teardown(self, request, workspace, project, level): - # Cleanup temp level before and after test runs - def teardown(): - file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True) - request.addfinalizer(teardown) - - file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True) - - @pytest.mark.test_case_id("C3297302") - @pytest.mark.SUITE_periodic - def test_GradientSurfaceTagEmitter_ComponentDependencies(self, request, editor, level, workspace, - launcher_platform): - cfg_args = [level] - - expected_lines = [ - "GradientSurfaceTagEmitter_ComponentDependencies: test started", - "GradientSurfaceTagEmitter_ComponentDependencies: Gradient Surface Tag Emitter is Disabled", - "GradientSurfaceTagEmitter_ComponentDependencies: Dither Gradient Modifier and Gradient Surface Tag Emitter are enabled", - "GradientSurfaceTagEmitter_ComponentDependencies: Gradient Mixer and Gradient Surface Tag Emitter are enabled", - "GradientSurfaceTagEmitter_ComponentDependencies: Invert Gradient Modifier and Gradient Surface Tag Emitter are enabled", - "GradientSurfaceTagEmitter_ComponentDependencies: Levels Gradient Modifier and Gradient Surface Tag Emitter are enabled", - "GradientSurfaceTagEmitter_ComponentDependencies: Posterize Gradient Modifier and Gradient Surface Tag Emitter are enabled", - "GradientSurfaceTagEmitter_ComponentDependencies: Smooth-Step Gradient Modifier and Gradient Surface Tag Emitter are enabled", - "GradientSurfaceTagEmitter_ComponentDependencies: Threshold Gradient Modifier and Gradient Surface Tag Emitter are enabled", - "GradientSurfaceTagEmitter_ComponentDependencies: Altitude Gradient and Gradient Surface Tag Emitter are enabled", - "GradientSurfaceTagEmitter_ComponentDependencies: Constant Gradient and Gradient Surface Tag Emitter are enabled", - "GradientSurfaceTagEmitter_ComponentDependencies: FastNoise Gradient and Gradient Surface Tag Emitter are enabled", - "GradientSurfaceTagEmitter_ComponentDependencies: Image Gradient and Gradient Surface Tag Emitter are enabled", - "GradientSurfaceTagEmitter_ComponentDependencies: Perlin Noise Gradient and Gradient Surface Tag Emitter are enabled", - "GradientSurfaceTagEmitter_ComponentDependencies: Random Noise Gradient and Gradient Surface Tag Emitter are enabled", - "GradientSurfaceTagEmitter_ComponentDependencies: Reference Gradient and Gradient Surface Tag Emitter are enabled", - "GradientSurfaceTagEmitter_ComponentDependencies: Shape Falloff Gradient and Gradient Surface Tag Emitter are enabled", - "GradientSurfaceTagEmitter_ComponentDependencies: Slope Gradient and Gradient Surface Tag Emitter are enabled", - "GradientSurfaceTagEmitter_ComponentDependencies: Surface Mask Gradient and Gradient Surface Tag Emitter are enabled", - "GradientSurfaceTagEmitter_ComponentDependencies: result=SUCCESS", - ] - - unexpected_lines = [ - "GradientSurfaceTagEmitter_ComponentDependencies: Gradient Surface Tag Emitter is Enabled, but should be Disabled without dependencies met", - "GradientSurfaceTagEmitter_ComponentDependencies: Dither Gradient Modifier and Gradient Surface Tag Emitter are disabled", - "GradientSurfaceTagEmitter_ComponentDependencies: Gradient Mixer and Gradient Surface Tag Emitter are disabled", - "GradientSurfaceTagEmitter_ComponentDependencies: Invert Gradient Modifier and Gradient Surface Tag Emitter are disabled", - "GradientSurfaceTagEmitter_ComponentDependencies: Levels Gradient Modifier and Gradient Surface Tag Emitter are disabled", - "GradientSurfaceTagEmitter_ComponentDependencies: Posterize Gradient Modifier and Gradient Surface Tag Emitter are disabled", - "GradientSurfaceTagEmitter_ComponentDependencies: Smooth-Step Gradient Modifier and Gradient Surface Tag Emitter are disabled", - "GradientSurfaceTagEmitter_ComponentDependencies: Threshold Gradient Modifier and Gradient Surface Tag Emitter are disabled", - "GradientSurfaceTagEmitter_ComponentDependencies: Altitude Gradient and Gradient Surface Tag Emitter are disabled", - "GradientSurfaceTagEmitter_ComponentDependencies: Constant Gradient and Gradient Surface Tag Emitter are disabled", - "GradientSurfaceTagEmitter_ComponentDependencies: FastNoise Gradient and Gradient Surface Tag Emitter are disabled", - "GradientSurfaceTagEmitter_ComponentDependencies: Image Gradient and Gradient Surface Tag Emitter are disabled", - "GradientSurfaceTagEmitter_ComponentDependencies: Perlin Noise Gradient and Gradient Surface Tag Emitter are disabled", - "GradientSurfaceTagEmitter_ComponentDependencies: Random Noise Gradient and Gradient Surface Tag Emitter are disabled", - "GradientSurfaceTagEmitter_ComponentDependencies: Reference Gradient and Gradient Surface Tag Emitter are disabled", - "GradientSurfaceTagEmitter_ComponentDependencies: Shape Falloff Gradient and Gradient Surface Tag Emitter are disabled", - "GradientSurfaceTagEmitter_ComponentDependencies: Slope Gradient and Gradient Surface Tag Emitter are disabled", - "GradientSurfaceTagEmitter_ComponentDependencies: Surface Mask Gradient and Gradient Surface Tag Emitter are disabled", - ] - - hydra.launch_and_validate_results( - request, - test_directory, - editor, - "GradientSurfaceTagEmitter_ComponentDependencies.py", - expected_lines=expected_lines, - unexpected_lines=unexpected_lines, - cfg_args=cfg_args - ) - - @pytest.mark.test_case_id("C3297303") - @pytest.mark.SUITE_periodic - def test_GradientSurfaceTagEmitter_SurfaceTagsAddRemoveSuccessfully(self, request, editor, level, - launcher_platform): - - expected_lines = [ - "Entity has a Gradient Surface Tag Emitter component", - "Entity has a Reference Gradient component", - "Added SurfaceTag: container count is 1", - "Removed SurfaceTag: container count is 0", - "GradientSurfaceTagEmitter_SurfaceTagsAddRemoveSucessfully: result=SUCCESS" - ] - - hydra.launch_and_validate_results( - request, - test_directory, - editor, - "GradientSurfaceTagEmitter_SurfaceTagsAddRemoveSuccessfully.py", - expected_lines, - cfg_args=[level] - ) diff --git a/AutomatedTesting/Gem/PythonTests/largeworlds/gradient_signal/test_GradientTransform.py b/AutomatedTesting/Gem/PythonTests/largeworlds/gradient_signal/test_GradientTransform.py deleted file mode 100755 index 447a548abb..0000000000 --- a/AutomatedTesting/Gem/PythonTests/largeworlds/gradient_signal/test_GradientTransform.py +++ /dev/null @@ -1,157 +0,0 @@ -""" -Copyright (c) Contributors to the Open 3D Engine Project. -For complete copyright and license terms please see the LICENSE at the root of this distribution. - -SPDX-License-Identifier: Apache-2.0 OR MIT -""" - - -""" -Tests that the Gradient Transform Modifier component isn't enabled unless it has a component on -the same Entity that provides the ShapeService (e.g. box shape, or reference shape) -""" - -import os -import pytest - -# Bail on the test if ly_test_tools doesn't exist. -pytest.importorskip('ly_test_tools') -import ly_test_tools.environment.file_system as file_system -import editor_python_test_tools.hydra_test_utils as hydra - -test_directory = os.path.join(os.path.dirname(__file__), 'EditorScripts') - - -@pytest.mark.parametrize('project', ['AutomatedTesting']) -@pytest.mark.parametrize('level', ['tmp_level']) -@pytest.mark.usefixtures("automatic_process_killer") -@pytest.mark.parametrize("launcher_platform", ['windows_editor']) -class TestGradientTransformRequiresShape(object): - - @pytest.fixture(autouse=True) - def setup_teardown(self, request, workspace, project, level): - def teardown(): - file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True) - - request.addfinalizer(teardown) - file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True) - - @pytest.mark.test_case_id('C3430289') - @pytest.mark.SUITE_periodic - def test_GradientTransform_RequiresShape(self, request, editor, level, launcher_platform): - - expected_lines = [ - "Gradient Transform Modifier component was added to entity, but the component is disabled", - "Gradient Transform component is not active without a Shape component on the Entity", - "Box Shape component was added to entity", - "Gradient Transform Modifier component is active now that the Entity has a Shape", - "GradientTransformRequiresShape: result=SUCCESS" - ] - - hydra.launch_and_validate_results( - request, - test_directory, - editor, - "GradientTransform_RequiresShape.py", - expected_lines, - cfg_args=[level] - ) - - @pytest.mark.test_case_id("C3430292") - @pytest.mark.SUITE_periodic - def test_GradientTransform_FrequencyZoomCanBeSetBeyondSliderRange(self, request, editor, level, launcher_platform): - - expected_lines = [ - "Entity Created", - "Entity has a Random Noise Gradient component", - "Entity has a Gradient Transform Modifier component", - "Entity has a Box Shape component", - "Components added to the entity", - "entity Configuration|Frequency Zoom: SUCCESS", - "Frequency Zoom is equal to expected value", - ] - - unexpected_lines = ["Frequency Zoom is not equal to expected value"] - - hydra.launch_and_validate_results( - request, - test_directory, - editor, - "GradientTransform_FrequencyZoomCanBeSetBeyondSliderRange.py", - expected_lines, - unexpected_lines=unexpected_lines, - cfg_args=[level] - ) - - @pytest.mark.test_case_id("C3430297") - @pytest.mark.SUITE_periodic - def test_GradientTransform_ComponentIncompatibleWithSpawners(self, request, editor, launcher_platform, level): - # C3430297: Component cannot be active on the same Entity as an active Vegetation Layer Spawner - expected_lines = [ - "Entity has a Gradient Transform Modifier component", - "Entity has a Box Shape component", - "New Entity Created", - "Gradient Transform Modifier is Enabled", - "Box Shape is Enabled", - "Entity has a Vegetation Layer Spawner component", - "Vegetation Layer Spawner is incompatible and disabled", - "GradientTransform_ComponentIncompatibleWithSpawners: result=SUCCESS" - ] - - unexpected_lines = [ - "Gradient Transform Modifier is Disabled. But It should be Enabled in an Entity", - "Box Shape is Disabled. But It should be Enabled in an Entity", - "Vegetation Layer Spawner is compatible and enabled. But It should be Incompatible and disabled", - ] - - hydra.launch_and_validate_results( - request, - test_directory, - editor, - "GradientTransform_ComponentIncompatibleWithSpawners.py", - expected_lines, - unexpected_lines, - cfg_args=[level] - ) - - @pytest.mark.test_case_id("C4753767") - @pytest.mark.SUITE_periodic - def test_GradientTransform_ComponentIncompatibleWithExpectedGradients(self, request, editor, launcher_platform, level): - expected_lines = [ - "Entity has a Gradient Transform Modifier component", - "Entity has a Box Shape component", - "New Entity Created", - "Gradient Transform Modifier is Enabled", - "Box Shape is Enabled", - "Entity has a Constant Gradient component", - "Entity has a Altitude Gradient component", - "Entity has a Gradient Mixer component", - "Entity has a Reference Gradient component", - "Entity has a Shape Falloff Gradient component", - "Entity has a Slope Gradient component", - "Entity has a Surface Mask Gradient component", - "All newly added components are incompatible and disabled", - "GradientTransform_ComponentIncompatibleWithExpectedGradients: result=SUCCESS" - ] - - unexpected_lines = [ - "Gradient Transform Modifier is disabled, but it should be enabled", - "Box Shape is disabled, but it should be enabled", - "Constant Gradient is enabled, but should be disabled", - "Altitude Gradient is enabled, but should be disabled", - "Gradient Mixer is enabled, but should be disabled", - "Reference Gradient is enabled, but should be disabled", - "Shape Falloff Gradient is enabled, but should be disabled", - "Slope Gradient is enabled, but should be disabled", - "Surface Mask Gradient component is enabled, but should be disabled", - ] - - hydra.launch_and_validate_results( - request, - test_directory, - editor, - "GradientTransform_ComponentIncompatibleWithExpectedGradients.py", - expected_lines, - unexpected_lines, - cfg_args=[level] - ) diff --git a/AutomatedTesting/Gem/PythonTests/largeworlds/gradient_signal/test_ImageGradient.py b/AutomatedTesting/Gem/PythonTests/largeworlds/gradient_signal/test_ImageGradient.py deleted file mode 100755 index c4280678ee..0000000000 --- a/AutomatedTesting/Gem/PythonTests/largeworlds/gradient_signal/test_ImageGradient.py +++ /dev/null @@ -1,69 +0,0 @@ -""" -Copyright (c) Contributors to the Open 3D Engine Project. -For complete copyright and license terms please see the LICENSE at the root of this distribution. - -SPDX-License-Identifier: Apache-2.0 OR MIT -""" - -import os -import pytest - -# Bail on the test if ly_test_tools doesn't exist. -pytest.importorskip('ly_test_tools') -import ly_test_tools.environment.file_system as file_system -import editor_python_test_tools.hydra_test_utils as hydra - -test_directory = os.path.join(os.path.dirname(__file__), 'EditorScripts') - - -@pytest.mark.parametrize('project', ['AutomatedTesting']) -@pytest.mark.parametrize('level', ['tmp_level']) -@pytest.mark.usefixtures("automatic_process_killer") -@pytest.mark.parametrize("launcher_platform", ['windows_editor']) -class TestImageGradientRequiresShape(object): - @pytest.fixture(autouse=True) - def setup_teardown(self, request, workspace, project, level): - def teardown(): - file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True) - - request.addfinalizer(teardown) - - @pytest.mark.test_case_id('C2707570') - @pytest.mark.SUITE_periodic - def test_ImageGradient_RequiresShape(self, request, editor, level, launcher_platform): - cfg_args = [level] - expected_lines = [ - "Image Gradient component was added to entity, but the component is disabled", - "Gradient Transform Modifier component was added to entity, but the component is disabled", - "Image Gradient component is not active without a Shape component on the Entity", - "Box Shape component was added to entity", - "Image Gradient component is active now that the Entity has a Shape", - "ImageGradientRequiresShape: result=SUCCESS" - ] - - hydra.launch_and_validate_results(request, test_directory, editor, - 'ImageGradient_RequiresShape.py', - expected_lines=expected_lines, cfg_args=cfg_args) - - @pytest.mark.test_case_id("C3829430") - @pytest.mark.SUITE_periodic - def test_ImageGradient_ProcessedImageAssignedSuccessfully(self, request, editor, level, launcher_platform): - - expected_lines = [ - "Image Gradient Entity created", - "Entity has a Image Gradient component", - "Entity has a Gradient Transform Modifier component", - "Entity has a Box Shape component", - "image_grad_test_gsi.png was found in the workspace", - "Entity Configuration|Image Asset: SUCCESS", - "ImageGradient_ProcessedImageAssignedSucessfully: result=SUCCESS", - ] - - hydra.launch_and_validate_results( - request, - test_directory, - editor, - "ImageGradient_ProcessedImageAssignedSuccessfully.py", - expected_lines, - cfg_args=[level] - ) diff --git a/AutomatedTesting/Gem/PythonTests/largeworlds/landscape_canvas/test_LandscapeCanvas_Main.py b/AutomatedTesting/Gem/PythonTests/largeworlds/landscape_canvas/TestSuite_Main.py similarity index 100% rename from AutomatedTesting/Gem/PythonTests/largeworlds/landscape_canvas/test_LandscapeCanvas_Main.py rename to AutomatedTesting/Gem/PythonTests/largeworlds/landscape_canvas/TestSuite_Main.py diff --git a/AutomatedTesting/Gem/PythonTests/largeworlds/landscape_canvas/test_LandscapeCanvas_Periodic_Optimized.py b/AutomatedTesting/Gem/PythonTests/largeworlds/landscape_canvas/TestSuite_Main_Optimized.py similarity index 92% rename from AutomatedTesting/Gem/PythonTests/largeworlds/landscape_canvas/test_LandscapeCanvas_Periodic_Optimized.py rename to AutomatedTesting/Gem/PythonTests/largeworlds/landscape_canvas/TestSuite_Main_Optimized.py index 59e8b1fe90..8c662a9b45 100644 --- a/AutomatedTesting/Gem/PythonTests/largeworlds/landscape_canvas/test_LandscapeCanvas_Periodic_Optimized.py +++ b/AutomatedTesting/Gem/PythonTests/largeworlds/landscape_canvas/TestSuite_Main_Optimized.py @@ -17,6 +17,12 @@ from ly_test_tools.o3de.editor_test import EditorSingleTest, EditorSharedTest, E @pytest.mark.parametrize("project", ["AutomatedTesting"]) class TestAutomation(EditorTestSuite): + class test_LandscapeCanvas_SlotConnections_UpdateComponentReferences(EditorSharedTest): + from .EditorScripts import SlotConnections_UpdateComponentReferences as test_module + + class test_LandscapeCanvas_GradientMixer_NodeConstruction(EditorSharedTest): + from .EditorScripts import GradientMixer_NodeConstruction as test_module + class test_LandscapeCanvas_AreaNodes_DependentComponentsAdded(EditorSharedTest): from .EditorScripts import AreaNodes_DependentComponentsAdded as test_module @@ -86,4 +92,4 @@ class TestAutomation(EditorTestSuite): from .EditorScripts import ShapeNodes_EntityCreatedOnNodeAdd as test_module class test_LandscapeCanvas_ShapeNodes_EntityRemovedOnNodeDelete(EditorSharedTest): - from .EditorScripts import ShapeNodes_EntityRemovedOnNodeDelete as test_module + from .EditorScripts import ShapeNodes_EntityRemovedOnNodeDelete as test_module \ No newline at end of file diff --git a/AutomatedTesting/Gem/PythonTests/largeworlds/landscape_canvas/test_LandscapeCanvas_Periodic.py b/AutomatedTesting/Gem/PythonTests/largeworlds/landscape_canvas/TestSuite_Periodic.py similarity index 100% rename from AutomatedTesting/Gem/PythonTests/largeworlds/landscape_canvas/test_LandscapeCanvas_Periodic.py rename to AutomatedTesting/Gem/PythonTests/largeworlds/landscape_canvas/TestSuite_Periodic.py diff --git a/AutomatedTesting/Gem/PythonTests/largeworlds/landscape_canvas/test_AreaNodes.py b/AutomatedTesting/Gem/PythonTests/largeworlds/landscape_canvas/test_AreaNodes.py deleted file mode 100755 index e5736d9db9..0000000000 --- a/AutomatedTesting/Gem/PythonTests/largeworlds/landscape_canvas/test_AreaNodes.py +++ /dev/null @@ -1,125 +0,0 @@ -""" -Copyright (c) Contributors to the Open 3D Engine Project. -For complete copyright and license terms please see the LICENSE at the root of this distribution. - -SPDX-License-Identifier: Apache-2.0 OR MIT -""" - -""" -C13815919 - Appropriate component dependencies are automatically added to node entities -C13767844 - All Vegetation Area nodes can be added to a graph -C17605868 - All Vegetation Area nodes can be removed from a graph -C13815873 - All Filters/Modifiers/Selectors can be added to/removed from a Layer node -""" - -import os -import pytest - -# Bail on the test if ly_test_tools doesn't exist. -pytest.importorskip('ly_test_tools') -import ly_test_tools.environment.file_system as file_system -import editor_python_test_tools.hydra_test_utils as hydra - -test_directory = os.path.join(os.path.dirname(__file__), 'EditorScripts') - - -@pytest.mark.parametrize('project', ['AutomatedTesting']) -@pytest.mark.parametrize('level', ['tmp_level']) -@pytest.mark.usefixtures("automatic_process_killer") -@pytest.mark.parametrize("launcher_platform", ['windows_editor']) -class TestAreaNodes(object): - - @pytest.fixture(autouse=True) - def setup_teardown(self, request, workspace, project, level): - def teardown(): - file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True) - - request.addfinalizer(teardown) - - file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True) - - @pytest.mark.test_case_id('C13815919') - @pytest.mark.SUITE_periodic - def test_LandscapeCanvas_AreaNodes_DependentComponentsAdded(self, request, editor, level, launcher_platform): - cfg_args = [level] - - expected_lines = [ - "Landscape Canvas pane is open", - "New graph created", - "Graph registered with Landscape Canvas", - "SpawnerAreaNode created new Entity with all required components", - "MeshBlockerAreaNode created new Entity with all required components", - "BlockerAreaNode created new Entity with all required components", - "AreaNodeComponentDependency: result=SUCCESS" - ] - - hydra.launch_and_validate_results(request, test_directory, editor, 'AreaNodes_DependentComponentsAdded.py', - expected_lines, cfg_args=cfg_args) - - @pytest.mark.test_case_id('C13767844') - @pytest.mark.SUITE_periodic - def test_LandscapeCanvas_AreaNodes_EntityCreatedOnNodeAdd(self, request, editor, level, launcher_platform): - """ - Verifies all Area nodes can be successfully added to a Landscape Canvas graph, and the proper entity - creation occurs. - """ - cfg_args = [level] - - expected_lines = [ - "Landscape Canvas pane is open", - "New graph created", - "Graph registered with Landscape Canvas", - "AreaBlenderNode created new Entity with Vegetation Layer Blender Component", - "BlockerAreaNode created new Entity with Vegetation Layer Blocker Component", - "MeshBlockerAreaNode created new Entity with Vegetation Layer Blocker (Mesh) Component", - "SpawnerAreaNode created new Entity with Vegetation Layer Spawner Component", - "AreaNodeEntityCreate: result=SUCCESS" - ] - - hydra.launch_and_validate_results(request, test_directory, editor, 'AreaNodes_EntityCreatedOnNodeAdd.py', - expected_lines, cfg_args=cfg_args) - - @pytest.mark.test_case_id('C17605868') - @pytest.mark.SUITE_periodic - def test_LandscapeCanvas_AreaNodes_EntityRemovedOnNodeDelete(self, request, editor, level, launcher_platform): - """ - Verifies all Area nodes can be successfully removed from a Landscape Canvas graph, and the proper entity - cleanup occurs. - """ - cfg_args = [level] - - expected_lines = [ - "Landscape Canvas pane is open", - "New graph created", - "Graph registered with Landscape Canvas", - "AreaBlenderNode corresponding Entity was deleted when node is removed", - "MeshBlockerAreaNode corresponding Entity was deleted when node is removed", - "SpawnerAreaNode corresponding Entity was deleted when node is removed", - "BlockerAreaNode corresponding Entity was deleted when node is removed", - "AreaNodeEntityDelete: result=SUCCESS" - ] - - hydra.launch_and_validate_results(request, test_directory, editor, - 'AreaNodes_EntityRemovedOnNodeDelete.py', expected_lines, cfg_args=cfg_args) - - @pytest.mark.test_case_id('C13815873') - @pytest.mark.SUITE_periodic - def test_LandscapeCanvas_LayerExtenderNodes_ComponentEntitySync(self, request, editor, level, launcher_platform): - """ - Verifies all Area Extender nodes can be successfully added to and removed from a Landscape Canvas graph, and the - proper entity creation/cleanup occurs. - """ - cfg_args = [level] - - expected_lines = [ - "Landscape Canvas pane is open", - "New graph created", - "Graph registered with Landscape Canvas", - "AreaBlenderNode successfully added and removed all filters/modifiers/selectors", - "SpawnerAreaNode successfully added and removed all filters/modifiers/selectors", - "LayerExtenderNodeComponentEntitySync: result=SUCCESS" - ] - - hydra.launch_and_validate_results(request, test_directory, editor, - 'LayerExtenderNodes_ComponentEntitySync.py', expected_lines, - cfg_args=cfg_args) diff --git a/AutomatedTesting/Gem/PythonTests/largeworlds/landscape_canvas/test_EditFunctionality.py b/AutomatedTesting/Gem/PythonTests/largeworlds/landscape_canvas/test_EditFunctionality.py deleted file mode 100755 index 7ff110d6b0..0000000000 --- a/AutomatedTesting/Gem/PythonTests/largeworlds/landscape_canvas/test_EditFunctionality.py +++ /dev/null @@ -1,84 +0,0 @@ -""" -Copyright (c) Contributors to the Open 3D Engine Project. -For complete copyright and license terms please see the LICENSE at the root of this distribution. - -SPDX-License-Identifier: Apache-2.0 OR MIT -""" - -""" -C29278563 - Disabled nodes can be successfully duplicated -C30813586 - Editor remains stable after Undoing deletion of a node on a slice entity -""" - -import os -import pytest - -# Bail on the test if ly_test_tools doesn't exist. -pytest.importorskip('ly_test_tools') -import ly_test_tools.environment.file_system as file_system -import editor_python_test_tools.hydra_test_utils as hydra - -test_directory = os.path.join(os.path.dirname(__file__), 'EditorScripts') - - -@pytest.mark.parametrize('project', ['AutomatedTesting']) -@pytest.mark.parametrize('level', ['tmp_level']) -@pytest.mark.usefixtures("automatic_process_killer") -@pytest.mark.parametrize("launcher_platform", ['windows_editor']) -class TestEditFunctionality(object): - - @pytest.fixture(autouse=True) - def setup_teardown(self, request, workspace, project, level): - def teardown(): - file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True) - request.addfinalizer(teardown) - - file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True) - - @pytest.mark.test_case_id('C29278563') - @pytest.mark.SUITE_periodic - def test_LandscapeCanvas_DuplicateDisabledNodes(self, request, editor, level, launcher_platform): - cfg_args = [level] - - expected_lines = [ - "Landscape Canvas pane is open", - "New graph created", - "SpawnerAreaNode duplicated with disabled component", - "SpawnerAreaNode duplicated with deleted component", - "MeshBlockerAreaNode duplicated with disabled component", - "MeshBlockerAreaNode duplicated with deleted component", - "BlockerAreaNode duplicated with disabled component", - "BlockerAreaNode duplicated with deleted component", - "FastNoiseGradientNode duplicated with disabled component", - "FastNoiseGradientNode duplicated with deleted component", - "ImageGradientNode duplicated with disabled component", - "ImageGradientNode duplicated with deleted component", - "PerlinNoiseGradientNode duplicated with disabled component", - "PerlinNoiseGradientNode duplicated with deleted component", - "RandomNoiseGradientNode duplicated with disabled component", - "RandomNoiseGradientNode duplicated with deleted component", - "DisabledNodeDuplication: result=SUCCESS" - ] - - hydra.launch_and_validate_results(request, test_directory, editor, 'Edit_DisabledNodeDuplication.py', - expected_lines, cfg_args=cfg_args) - - @pytest.mark.test_case_id('C30813586') - @pytest.mark.SUITE_periodic - def test_LandscapeCanvas_UndoNodeDelete_SliceEntity(self, request, editor, level, launcher_platform): - cfg_args = [level] - - expected_lines = [ - "Vegetation Layer Spawner node found on graph", - "Vegetation Layer Spawner node was removed", - "Editor is still responsive", - "UndoNodeDeleteSlice: result=SUCCESS" - ] - - unexpected_lines = [ - "Vegetation Layer Spawner node not found", - "Vegetation Layer Spawner node was not removed" - ] - - hydra.launch_and_validate_results(request, test_directory, editor, 'Edit_UndoNodeDelete_SliceEntity.py', - expected_lines, unexpected_lines=unexpected_lines, cfg_args=cfg_args) diff --git a/AutomatedTesting/Gem/PythonTests/largeworlds/landscape_canvas/test_GeneralGraphFunctionality.py b/AutomatedTesting/Gem/PythonTests/largeworlds/landscape_canvas/test_GeneralGraphFunctionality.py deleted file mode 100644 index 4ab5a41b85..0000000000 --- a/AutomatedTesting/Gem/PythonTests/largeworlds/landscape_canvas/test_GeneralGraphFunctionality.py +++ /dev/null @@ -1,173 +0,0 @@ -""" -Copyright (c) Contributors to the Open 3D Engine Project. -For complete copyright and license terms please see the LICENSE at the root of this distribution. - -SPDX-License-Identifier: Apache-2.0 OR MIT -""" - -""" -C2735988 - Landscape Canvas tool can be opened/closed -C13815862 - New graph can be created -C13767840 - New root entity is created when a new graph is created through Landscape Canvas -""" - -import os -import pytest - -# Bail on the test if ly_test_tools doesn't exist. -pytest.importorskip("ly_test_tools") -import ly_test_tools.environment.file_system as file_system -import editor_python_test_tools.hydra_test_utils as hydra - -test_directory = os.path.join(os.path.dirname(__file__), "EditorScripts") - - -@pytest.mark.parametrize("project", ["AutomatedTesting"]) -@pytest.mark.parametrize("level", ["tmp_level"]) -@pytest.mark.usefixtures("automatic_process_killer") -@pytest.mark.parametrize("launcher_platform", ['windows_editor']) -class TestGeneralGraphFunctionality(object): - @pytest.fixture(autouse=True) - def setup_teardown(self, request, workspace, project, level): - def teardown(): - file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True) - file_system.delete([os.path.join(workspace.paths.engine_root(), project, "slices", "TestSlice.slice")], True, True) - - request.addfinalizer(teardown) - - file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True) - file_system.delete([os.path.join(workspace.paths.engine_root(), project, "slices", "TestSlice.slice")], True, True) - - @pytest.mark.test_case_id("C2735988", "C13815862", "C13767840") - @pytest.mark.SUITE_periodic - def test_LandscapeCanvas_NewGraph_CreatedSuccessfully(self, request, editor, level, launcher_platform): - cfg_args = [level] - - expected_lines = [ - "Landscape Canvas pane is open", - "New graph created", - "Graph registered with Landscape Canvas", - "Root entity has Landscape Canvas component", - "Landscape Canvas pane is closed", - "CreateNewGraph: result=SUCCESS", - ] - - hydra.launch_and_validate_results( - request, - test_directory, - editor, - "CreateNewGraph.py", - expected_lines, - cfg_args=cfg_args - ) - - @pytest.mark.test_case_id("C2735990") - @pytest.mark.SUITE_periodic - def test_LandscapeCanvas_Component_AddedRemoved(self, request, editor, level, launcher_platform): - cfg_args = [level] - - expected_lines = [ - "Landscape Canvas Component added to Entity", - "Landscape Canvas Component removed from Entity", - "LandscapeCanvasComponentAddedRemoved: result=SUCCESS", - ] - - hydra.launch_and_validate_results( - request, - test_directory, - editor, - "LandscapeCanvasComponent_AddedRemoved.py", - expected_lines, - cfg_args=cfg_args - ) - - @pytest.mark.test_case_id("C14212352") - @pytest.mark.SUITE_periodic - def test_LandscapeCanvas_GraphClosed_OnLevelChange(self, request, editor, level, launcher_platform): - cfg_args = [level] - - expected_lines = [ - "Landscape Canvas pane is open", - "New graph created", - "Graph registered with Landscape Canvas", - "Graph is no longer open in Landscape Canvas", - "GraphClosedOnLevelChange: result=SUCCESS", - ] - - hydra.launch_and_validate_results( - request, - test_directory, - editor, - "GraphClosed_OnLevelChange.py", - expected_lines, - cfg_args=cfg_args - ) - - @pytest.mark.test_case_id("C17488412") - @pytest.mark.SUITE_periodic - @pytest.mark.xfail(reason="https://github.com/o3de/o3de/issues/2201") - def test_LandscapeCanvas_GraphClosed_OnEntityDelete(self, request, editor, level, launcher_platform): - cfg_args = [level] - - expected_lines = [ - "Landscape Canvas pane is open", - "Graph registered with Landscape Canvas", - "The graph is no longer open after deleting the Entity", - "GraphClosedOnEntityDelete: result=SUCCESS", - ] - - hydra.launch_and_validate_results( - request, - test_directory, - editor, - "GraphClosed_OnEntityDelete.py", - expected_lines, - cfg_args=cfg_args - ) - - @pytest.mark.test_case_id("C15167461") - @pytest.mark.SUITE_periodic - def test_LandscapeCanvas_GraphClosed_TabbedGraphClosesIndependently(self, request, editor, level, - launcher_platform): - cfg_args = [level] - - expected_lines = [ - "Landscape Canvas pane is open", - "New graph created", - "2nd new graph created", - "3rd new graph created", - "Graphs registered with Landscape Canvas", - "Graph 2 was successfully closed", - "GraphClosedTabbedGraph: result=SUCCESS", - ] - - hydra.launch_and_validate_results( - request, - test_directory, - editor, - "GraphClosed_TabbedGraph.py", - expected_lines, - cfg_args=cfg_args - ) - - @pytest.mark.test_case_id("C22602016") - @pytest.mark.SUITE_periodic - def test_LandscapeCanvas_SliceCreateInstantiate(self, request, editor, level, workspace, launcher_platform): - cfg_args = [level] - - expected_lines = [ - "LandscapeCanvas_SliceCreateInstantiate: test started", - "landscape_canvas_entity Entity successfully created", - "LandscapeCanvas_SliceCreateInstantiate: Slice has been created successfully: True", - "LandscapeCanvas_SliceCreateInstantiate: Slice instantiated: True", - "LandscapeCanvas_SliceCreateInstantiate: result=SUCCESS", - ] - - hydra.launch_and_validate_results( - request, - test_directory, - editor, - "LandscapeCanvas_SliceCreateInstantiate.py", - expected_lines=expected_lines, - cfg_args=cfg_args - ) diff --git a/AutomatedTesting/Gem/PythonTests/largeworlds/landscape_canvas/test_GradientModifierNodes.py b/AutomatedTesting/Gem/PythonTests/largeworlds/landscape_canvas/test_GradientModifierNodes.py deleted file mode 100755 index 99f342a574..0000000000 --- a/AutomatedTesting/Gem/PythonTests/largeworlds/landscape_canvas/test_GradientModifierNodes.py +++ /dev/null @@ -1,92 +0,0 @@ -""" -Copyright (c) Contributors to the Open 3D Engine Project. -For complete copyright and license terms please see the LICENSE at the root of this distribution. - -SPDX-License-Identifier: Apache-2.0 OR MIT -""" - -""" -C13767841 - All Gradient Modifier nodes can be added to a graph -C18055051 - All Gradient Modifier nodes can be removed from a graph -""" - -import os -import pytest - -# Bail on the test if ly_test_tools doesn't exist. -pytest.importorskip('ly_test_tools') -import ly_test_tools.environment.file_system as file_system -import editor_python_test_tools.hydra_test_utils as hydra - -test_directory = os.path.join(os.path.dirname(__file__), 'EditorScripts') - - -@pytest.mark.parametrize('project', ['AutomatedTesting']) -@pytest.mark.parametrize('level', ['tmp_level']) -@pytest.mark.usefixtures("automatic_process_killer") -@pytest.mark.parametrize("launcher_platform", ['windows_editor']) -class TestGradientModifierNodes(object): - - @pytest.fixture(autouse=True) - def setup_teardown(self, request, workspace, project, level): - def teardown(): - file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True) - request.addfinalizer(teardown) - - file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True) - - @pytest.mark.test_case_id('C13767841') - @pytest.mark.SUITE_periodic - def test_LandscapeCanvas_GradientModifierNodes_EntityCreatedOnNodeAdd(self, request, editor, level, - launcher_platform): - """ - Verifies all Gradient Modifier nodes can be successfully added to a Landscape Canvas graph, and the proper - entity creation occurs. - """ - cfg_args = [level] - - expected_lines = [ - "Landscape Canvas pane is open", - "New graph created", - "Graph registered with Landscape Canvas", - "DitherGradientModifierNode created new Entity with Dither Gradient Modifier Component", - "GradientMixerNode created new Entity with Gradient Mixer Component", - "InvertGradientModifierNode created new Entity with Invert Gradient Modifier Component", - "LevelsGradientModifierNode created new Entity with Levels Gradient Modifier Component", - "PosterizeGradientModifierNode created new Entity with Posterize Gradient Modifier Component", - "SmoothStepGradientModifierNode created new Entity with Smooth-Step Gradient Modifier Component", - "ThresholdGradientModifierNode created new Entity with Threshold Gradient Modifier Component", - "GradientModifierNodeEntityCreate: result=SUCCESS" - ] - - hydra.launch_and_validate_results(request, test_directory, editor, - 'GradientModifierNodes_EntityCreatedOnNodeAdd.py', - expected_lines, cfg_args=cfg_args) - - @pytest.mark.test_case_id('C18055051') - @pytest.mark.SUITE_periodic - def test_LandscapeCanvas_GradientModifierNodes_EntityRemovedOnNodeDelete(self, request, editor, level, - launcher_platform): - """ - Verifies all Gradient Modifier nodes can be successfully removed from a Landscape Canvas graph, and the proper - entity cleanup occurs. - """ - cfg_args = [level] - - expected_lines = [ - "Landscape Canvas pane is open", - "New graph created", - "Graph registered with Landscape Canvas", - "DitherGradientModifierNode corresponding Entity was deleted when node is removed", - "GradientMixerNode corresponding Entity was deleted when node is removed", - "InvertGradientModifierNode corresponding Entity was deleted when node is removed", - "LevelsGradientModifierNode corresponding Entity was deleted when node is removed", - "PosterizeGradientModifierNode corresponding Entity was deleted when node is removed", - "SmoothStepGradientModifierNode corresponding Entity was deleted when node is removed", - "ThresholdGradientModifierNode corresponding Entity was deleted when node is removed", - "GradientModifierNodeEntityDelete: result=SUCCESS" - ] - - hydra.launch_and_validate_results(request, test_directory, editor, - 'GradientModifierNodes_EntityRemovedOnNodeDelete.py', - expected_lines, cfg_args=cfg_args) diff --git a/AutomatedTesting/Gem/PythonTests/largeworlds/landscape_canvas/test_GradientNodes.py b/AutomatedTesting/Gem/PythonTests/largeworlds/landscape_canvas/test_GradientNodes.py deleted file mode 100755 index 1fdb254e98..0000000000 --- a/AutomatedTesting/Gem/PythonTests/largeworlds/landscape_canvas/test_GradientNodes.py +++ /dev/null @@ -1,109 +0,0 @@ -""" -Copyright (c) Contributors to the Open 3D Engine Project. -For complete copyright and license terms please see the LICENSE at the root of this distribution. - -SPDX-License-Identifier: Apache-2.0 OR MIT -""" - -""" -C13815920 - Appropriate component dependencies are automatically added to node entities -C13767842 - All Gradient nodes can be added to a graph -C17461363 - All Gradient nodes can be removed from a graph -""" - -import os -import pytest - -# Bail on the test if ly_test_tools doesn't exist. -pytest.importorskip('ly_test_tools') -import ly_test_tools.environment.file_system as file_system -import editor_python_test_tools.hydra_test_utils as hydra - -test_directory = os.path.join(os.path.dirname(__file__), 'EditorScripts') - - -@pytest.mark.parametrize('project', ['AutomatedTesting']) -@pytest.mark.parametrize('level', ['tmp_level']) -@pytest.mark.usefixtures("automatic_process_killer") -@pytest.mark.parametrize("launcher_platform", ['windows_editor']) -class TestGradientNodes(object): - - @pytest.fixture(autouse=True) - def setup_teardown(self, request, workspace, project, level): - def teardown(): - file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True) - request.addfinalizer(teardown) - - file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True) - - @pytest.mark.test_case_id('C13815920') - @pytest.mark.SUITE_periodic - def test_LandscapeCanvas_GradientNodes_DependentComponentsAdded(self, request, editor, level, launcher_platform): - cfg_args = [level] - - expected_lines = [ - "Landscape Canvas pane is open", - "New graph created", - "Graph registered with Landscape Canvas", - "FastNoiseGradientNode created new Entity with all required components", - "ImageGradientNode created new Entity with all required components", - "PerlinNoiseGradientNode created new Entity with all required components", - "RandomNoiseGradientNode created new Entity with all required components" - ] - - hydra.launch_and_validate_results(request, test_directory, editor, 'GradientNodes_DependentComponentsAdded.py', - expected_lines, cfg_args=cfg_args) - - @pytest.mark.test_case_id('C13767842') - @pytest.mark.SUITE_periodic - def test_LandscapeCanvas_GradientNodes_EntityCreatedOnNodeAdd(self, request, editor, level, launcher_platform): - """ - Verifies all Gradient nodes can be successfully added to a Landscape Canvas graph, and the proper entity - creation occurs. - """ - cfg_args = [level] - - expected_lines = [ - "Landscape Canvas pane is open", - "New graph created", - "Graph registered with Landscape Canvas", - "AltitudeGradientNode created new Entity with Altitude Gradient Component", - "ConstantGradientNode created new Entity with Constant Gradient Component", - "FastNoiseGradientNode created new Entity with FastNoise Gradient Component", - "ImageGradientNode created new Entity with Image Gradient Component", - "PerlinNoiseGradientNode created new Entity with Perlin Noise Gradient Component", - "RandomNoiseGradientNode created new Entity with Random Noise Gradient Component", - "ShapeAreaFalloffGradientNode created new Entity with Shape Falloff Gradient Component", - "SlopeGradientNode created new Entity with Slope Gradient Component", - "SurfaceMaskGradientNode created new Entity with Surface Mask Gradient Component" - ] - - hydra.launch_and_validate_results(request, test_directory, editor, 'GradientNodes_EntityCreatedOnNodeAdd.py', - expected_lines, cfg_args=cfg_args) - - @pytest.mark.test_case_id('C17461363') - @pytest.mark.SUITE_periodic - def test_LandscapeCanvas_GradientNodes_EntityRemovedOnNodeDelete(self, request, editor, level, launcher_platform): - """ - Verifies all Gradient nodes can be successfully removed from a Landscape Canvas graph, and the proper entity - cleanup occurs. - """ - cfg_args = [level] - - expected_lines = [ - "Landscape Canvas pane is open", - "New graph created", - "Graph registered with Landscape Canvas", - "FastNoiseGradientNode corresponding Entity was deleted when node is removed", - "AltitudeGradientNode corresponding Entity was deleted when node is removed", - "ConstantGradientNode corresponding Entity was deleted when node is removed", - "RandomNoiseGradientNode corresponding Entity was deleted when node is removed", - "ShapeAreaFalloffGradientNode corresponding Entity was deleted when node is removed", - "SlopeGradientNode corresponding Entity was deleted when node is removed", - "PerlinNoiseGradientNode corresponding Entity was deleted when node is removed", - "ImageGradientNode corresponding Entity was deleted when node is removed", - "SurfaceMaskGradientNode corresponding Entity was deleted when node is removed" - ] - - hydra.launch_and_validate_results(request, test_directory, editor, 'GradientNodes_EntityRemovedOnNodeDelete.py', - expected_lines, cfg_args=cfg_args) diff --git a/AutomatedTesting/Gem/PythonTests/largeworlds/landscape_canvas/test_GraphComponentSync.py b/AutomatedTesting/Gem/PythonTests/largeworlds/landscape_canvas/test_GraphComponentSync.py deleted file mode 100755 index 71389dcf5b..0000000000 --- a/AutomatedTesting/Gem/PythonTests/largeworlds/landscape_canvas/test_GraphComponentSync.py +++ /dev/null @@ -1,167 +0,0 @@ -""" -Copyright (c) Contributors to the Open 3D Engine Project. -For complete copyright and license terms please see the LICENSE at the root of this distribution. - -SPDX-License-Identifier: Apache-2.0 OR MIT -""" - -""" -C4705586 - Altering connections on graph nodes appropriately updates component properties -C22715182 - Components are updated when nodes are added/removed/updated -C22602072 - Graph is updated when underlying components are added/removed -C15987206 - Gradient Mixer Layers are properly setup when constructing in a graph -C21333743 - Vegetation Layer Blenders are properly setup when constructing in a graph -""" - -import os -import pytest - -# Bail on the test if ly_test_tools doesn't exist. -pytest.importorskip('ly_test_tools') -import ly_test_tools.environment.file_system as file_system -import ly_test_tools._internal.pytest_plugin as internal_plugin -import editor_python_test_tools.hydra_test_utils as hydra - -test_directory = os.path.join(os.path.dirname(__file__), 'EditorScripts') - - -@pytest.mark.parametrize('project', ['AutomatedTesting']) -@pytest.mark.parametrize('level', ['tmp_level']) -@pytest.mark.usefixtures("automatic_process_killer") -@pytest.mark.parametrize("launcher_platform", ['windows_editor']) -class TestGraphComponentSync(object): - - @pytest.fixture(autouse=True) - def setup_teardown(self, request, workspace, project, level): - def teardown(): - file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True) - request.addfinalizer(teardown) - - file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True) - - @pytest.mark.test_case_id('C4705586') - @pytest.mark.BAT - @pytest.mark.SUITE_main - def test_LandscapeCanvas_SlotConnections_UpdateComponentReferences(self, request, editor, level, launcher_platform): - - # Skip test if running against Debug build - if "debug" in internal_plugin.build_directory: - pytest.skip("Does not execute against debug builds.") - - cfg_args = [level] - - expected_lines = [ - "Landscape Canvas pane is open", - "New graph created", - "Graph registered with Landscape Canvas", - "Random Noise Gradient component Preview Entity property set to Box Shape EntityId", - "Dither Gradient Modifier component Inbound Gradient property set to Random Noise Gradient EntityId", - "Gradient Mixer component Inbound Gradient extendable property set to Dither Gradient Modifier EntityId", - "SlotConnectionsUpdateComponents: result=SUCCESS" - ] - - hydra.launch_and_validate_results(request, test_directory, editor, - 'SlotConnections_UpdateComponentReferences.py', expected_lines, - cfg_args=cfg_args) - - @pytest.mark.test_case_id('C22715182') - @pytest.mark.SUITE_periodic - def test_LandscapeCanvas_GraphUpdates_UpdateComponents(self, request, editor, level, launcher_platform): - cfg_args = [level] - - expected_lines = [ - 'Rotation Modifier component was removed from entity', - 'BushSpawner entity was deleted', - 'Gradient Entity Id reference was properly updated', - 'GraphUpdatesUpdateComponents: result=SUCCESS' - ] - - unexpected_lines = [ - 'Rotation Modifier component is still present on entity', - 'Failed to delete BushSpawner entity', - 'Gradient Entity Id was not updated properly' - ] - - hydra.launch_and_validate_results(request, test_directory, editor, 'GraphUpdates_UpdateComponents.py', - expected_lines, unexpected_lines=unexpected_lines, - cfg_args=cfg_args) - - @pytest.mark.test_case_id('C22602072') - @pytest.mark.SUITE_periodic - def test_LandscapeCanvas_ComponentUpdates_UpdateGraph(self, request, editor, level, launcher_platform): - cfg_args = [level] - - expected_lines = [ - "LandscapeCanvas entity found", - "BushSpawner entity found", - "Vegetation Distribution Filter on BushSpawner entity found", - "Graph opened", - "Distribution Filter node found on graph", - "Vegetation Altitude Filter on BushSpawner entity found", - "Altitude Filter node found on graph", - "Vegetation Distribution Filter removed from BushSpawner entity", - "Distribution Filter node was removed from the graph", - "New entity successfully added as a child of the BushSpawner entity", - "Box Shape on Box entity found", - "Box Shape node found on graph", - 'ComponentUpdatesUpdateGraph: result=SUCCESS' - ] - - unexpected_lines = [ - "Distribution Filter node not found on graph", - "Distribution Filter node is still present on the graph", - "Altitude Filter node not found on graph", - "New entity added with an unexpected parent", - "Box Shape node not found on graph" - ] - - hydra.launch_and_validate_results(request, test_directory, editor, 'ComponentUpdates_UpdateGraph.py', - expected_lines, unexpected_lines=unexpected_lines, cfg_args=cfg_args) - - @pytest.mark.test_case_id('C15987206') - @pytest.mark.SUITE_main - def test_LandscapeCanvas_GradientMixer_NodeConstruction(self, request, editor, level, launcher_platform): - """ - Verifies a Gradient Mixer can be setup in Landscape Canvas and all references are property set. - """ - - # Skip test if running against Debug build - if "debug" in internal_plugin.build_directory: - pytest.skip("Does not execute against debug builds.") - - cfg_args = [level] - - expected_lines = [ - 'Landscape Canvas pane is open', - 'New graph created', - 'Graph registered with Landscape Canvas', - 'Perlin Noise Gradient component Preview Entity property set to Box Shape EntityId', - 'Gradient Mixer component Inbound Gradient extendable property set to Perlin Noise Gradient EntityId', - 'Gradient Mixer component Inbound Gradient extendable property set to FastNoise Gradient EntityId', - 'Configuration|Layers|[0]|Operation set to 0', - 'Configuration|Layers|[1]|Operation set to 6', - 'GradientMixerNodeConstruction: result=SUCCESS' - ] - - hydra.launch_and_validate_results(request, test_directory, editor, 'GradientMixer_NodeConstruction.py', - expected_lines, cfg_args=cfg_args) - - @pytest.mark.test_case_id('C21333743') - @pytest.mark.SUITE_periodic - def test_LandscapeCanvas_LayerBlender_NodeConstruction(self, request, editor, level, launcher_platform): - """ - Verifies a Layer Blender can be setup in Landscape Canvas and all references are property set. - """ - cfg_args = [level] - - expected_lines = [ - 'Landscape Canvas pane is open', - 'New graph created', - 'Graph registered with Landscape Canvas', - 'Vegetation Layer Blender component Vegetation Areas[0] property set to Vegetation Layer Spawner EntityId', - 'Vegetation Layer Blender component Vegetation Areas[1] property set to Vegetation Layer Blocker EntityId', - 'LayerBlenderNodeConstruction: result=SUCCESS' - ] - - hydra.launch_and_validate_results(request, test_directory, editor, 'LayerBlender_NodeConstruction.py', - expected_lines, cfg_args=cfg_args) diff --git a/AutomatedTesting/Gem/PythonTests/largeworlds/landscape_canvas/test_LandscapeCanvas_Main_Optimized.py b/AutomatedTesting/Gem/PythonTests/largeworlds/landscape_canvas/test_LandscapeCanvas_Main_Optimized.py deleted file mode 100644 index 68bac24452..0000000000 --- a/AutomatedTesting/Gem/PythonTests/largeworlds/landscape_canvas/test_LandscapeCanvas_Main_Optimized.py +++ /dev/null @@ -1,22 +0,0 @@ -""" -Copyright (c) Contributors to the Open 3D Engine Project. -For complete copyright and license terms please see the LICENSE at the root of this distribution. - -SPDX-License-Identifier: Apache-2.0 OR MIT -""" - -import pytest - -from ly_test_tools.o3de.editor_test import EditorSingleTest, EditorSharedTest, EditorParallelTest, EditorTestSuite - - -@pytest.mark.SUITE_periodic -@pytest.mark.parametrize("launcher_platform", ['windows_editor']) -@pytest.mark.parametrize("project", ["AutomatedTesting"]) -class TestAutomation(EditorTestSuite): - - class test_LandscapeCanvas_SlotConnections_UpdateComponentReferences(EditorSharedTest): - from .EditorScripts import SlotConnections_UpdateComponentReferences as test_module - - class test_LandscapeCanvas_GradientMixer_NodeConstruction(EditorSharedTest): - from .EditorScripts import GradientMixer_NodeConstruction as test_module diff --git a/AutomatedTesting/Gem/PythonTests/largeworlds/landscape_canvas/test_ShapeNodes.py b/AutomatedTesting/Gem/PythonTests/largeworlds/landscape_canvas/test_ShapeNodes.py deleted file mode 100755 index 8356d5a404..0000000000 --- a/AutomatedTesting/Gem/PythonTests/largeworlds/landscape_canvas/test_ShapeNodes.py +++ /dev/null @@ -1,82 +0,0 @@ -""" -Copyright (c) Contributors to the Open 3D Engine Project. -For complete copyright and license terms please see the LICENSE at the root of this distribution. - -SPDX-License-Identifier: Apache-2.0 OR MIT -""" - -""" -C13767843 - All Shape nodes can be added to a graph -C17412059 - All Shape nodes can be removed from a graph -""" - -import os -import pytest - -# Bail on the test if ly_test_tools doesn't exist. -pytest.importorskip('ly_test_tools') -import ly_test_tools.environment.file_system as file_system -import editor_python_test_tools.hydra_test_utils as hydra - -test_directory = os.path.join(os.path.dirname(__file__), 'EditorScripts') - - -@pytest.mark.parametrize('project', ['AutomatedTesting']) -@pytest.mark.parametrize('level', ['tmp_level']) -@pytest.mark.usefixtures("automatic_process_killer") -@pytest.mark.parametrize("launcher_platform", ['windows_editor']) -class TestShapeNodes(object): - - @pytest.fixture(autouse=True) - def setup_teardown(self, request, workspace, project, level): - def teardown(): - file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True) - request.addfinalizer(teardown) - - file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True) - - @pytest.mark.test_case_id('C13767843') - @pytest.mark.SUITE_periodic - def test_LandscapeCanvas_ShapeNodes_EntityCreatedOnNodeAdd(self, request, editor, level, launcher_platform): - cfg_args = [level] - - expected_lines = [ - "Landscape Canvas pane is open", - "New graph created", - "Graph registered with Landscape Canvas", - "BoxShapeNode created new Entity with Box Shape Component", - "CapsuleShapeNode created new Entity with Capsule Shape Component", - "CompoundShapeNode created new Entity with Compound Shape Component", - "CylinderShapeNode created new Entity with Cylinder Shape Component", - "PolygonPrismShapeNode created new Entity with Polygon Prism Shape Component", - "SphereShapeNode created new Entity with Sphere Shape Component", - "TubeShapeNode created new Entity with Tube Shape Component", - "DiskShapeNode created new Entity with Disk Shape Component", - "ShapeNodeEntityCreate: result=SUCCESS" - ] - - hydra.launch_and_validate_results(request, test_directory, editor, 'ShapeNodes_EntityCreatedOnNodeAdd.py', - expected_lines, cfg_args=cfg_args) - - @pytest.mark.test_case_id('C17412059') - @pytest.mark.SUITE_periodic - def test_LandscapeCanvas_ShapeNodes_EntityRemovedOnNodeDelete(self, request, editor, level, launcher_platform): - cfg_args = [level] - - expected_lines = [ - "Landscape Canvas pane is open", - "New graph created", - "Graph registered with Landscape Canvas", - "BoxShapeNode corresponding Entity was deleted when node is removed", - "CapsuleShapeNode corresponding Entity was deleted when node is removed", - "CompoundShapeNode corresponding Entity was deleted when node is removed", - "CylinderShapeNode corresponding Entity was deleted when node is removed", - "PolygonPrismShapeNode corresponding Entity was deleted when node is removed", - "SphereShapeNode corresponding Entity was deleted when node is removed", - "TubeShapeNode corresponding Entity was deleted when node is removed", - "DiskShapeNode corresponding Entity was deleted when node is removed", - "ShapeNodeEntityDelete: result=SUCCESS" - ] - - hydra.launch_and_validate_results(request, test_directory, editor, 'ShapeNodes_EntityRemovedOnNodeDelete.py', - expected_lines, cfg_args=cfg_args) From 032366f9c96deb9f953215e7b3a829ce898f476c Mon Sep 17 00:00:00 2001 From: Jeremy Ong Date: Wed, 25 Aug 2021 14:41:01 -0600 Subject: [PATCH 101/131] Move undefs of problematic Windows defines to PlatformIncl_Windows.h Signed-off-by: Jeremy Ong --- Code/Framework/AzCore/AzCore/Debug/Profiler.h | 7 ------- .../Platform/Windows/AzCore/PlatformIncl_Windows.h | 10 ++++++++++ Code/Tools/GridHub/GridHub/main.cpp | 2 +- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/Code/Framework/AzCore/AzCore/Debug/Profiler.h b/Code/Framework/AzCore/AzCore/Debug/Profiler.h index c8911a6ac4..8af48e47f6 100644 --- a/Code/Framework/AzCore/AzCore/Debug/Profiler.h +++ b/Code/Framework/AzCore/AzCore/Debug/Profiler.h @@ -77,11 +77,4 @@ namespace AZ::Debug }; } // namespace AZ::Debug -#ifdef USE_PIX -// The pix3 header unfortunately brings in other Windows macros we need to undef -#undef DeleteFile -#undef LoadImage -#undef GetCurrentTime -#endif - #include diff --git a/Code/Framework/AzCore/Platform/Windows/AzCore/PlatformIncl_Windows.h b/Code/Framework/AzCore/Platform/Windows/AzCore/PlatformIncl_Windows.h index f58e772155..38e1f59fc7 100644 --- a/Code/Framework/AzCore/Platform/Windows/AzCore/PlatformIncl_Windows.h +++ b/Code/Framework/AzCore/Platform/Windows/AzCore/PlatformIncl_Windows.h @@ -74,3 +74,13 @@ #if defined(GetCommandLine) #undef GetCommandLine #endif +#if defined(LoadImage) +#undef LoadImage +#endif +#if defined(DeleteFile) +#undef DeleteFile +#endif +#if defined(GetCurrentTime) +#undef GetCurrentTime +#endif + diff --git a/Code/Tools/GridHub/GridHub/main.cpp b/Code/Tools/GridHub/GridHub/main.cpp index bfb82efd0d..3b853910be 100644 --- a/Code/Tools/GridHub/GridHub/main.cpp +++ b/Code/Tools/GridHub/GridHub/main.cpp @@ -361,7 +361,7 @@ public: else { // remove from start up folder - DeleteFile(fullLinkName); + DeleteFileW(fullLinkName); } #endif #if AZ_TRAIT_OS_PLATFORM_APPLE From fded2bafad10fe5c4a4ca0ca46a1185ac544a24f Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Wed, 25 Aug 2021 15:35:37 -0700 Subject: [PATCH 102/131] More PR comments/fixes Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Code/Tools/AssetProcessor/Platform/Mac/main_dummy.cpp | 2 +- Gems/LyShine/Code/Source/Animation/UiAnimationSystem.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Code/Tools/AssetProcessor/Platform/Mac/main_dummy.cpp b/Code/Tools/AssetProcessor/Platform/Mac/main_dummy.cpp index cd080f9572..e624b40787 100644 --- a/Code/Tools/AssetProcessor/Platform/Mac/main_dummy.cpp +++ b/Code/Tools/AssetProcessor/Platform/Mac/main_dummy.cpp @@ -66,7 +66,7 @@ int main(int argc, char* argv[]) processLaunchInfo.m_environmentVariables = &envVars; processLaunchInfo.m_showWindow = true; - AzFramework::ProcessWatcher::LaunchProcess(processLaunchInfo, AzFramework::ProcessCommunicationType::COMMUNICATOR_TYPE_NONE); + AZStd::unique_ptr processWatcher(AzFramework::ProcessWatcher::LaunchProcess(processLaunchInfo, AzFramework::ProcessCommunicationType::COMMUNICATOR_TYPE_NONE)); application.Destroy(); diff --git a/Gems/LyShine/Code/Source/Animation/UiAnimationSystem.cpp b/Gems/LyShine/Code/Source/Animation/UiAnimationSystem.cpp index 1e9086c7a0..ace82c4944 100644 --- a/Gems/LyShine/Code/Source/Animation/UiAnimationSystem.cpp +++ b/Gems/LyShine/Code/Source/Animation/UiAnimationSystem.cpp @@ -731,9 +731,9 @@ void UiAnimationSystem::StillUpdate() ////////////////////////////////////////////////////////////////////////// void UiAnimationSystem::ShowPlayedSequencesDebug() { - f32 green[4] = {0, 1, 0, 1}; - f32 purple[4] = {1, 0, 1, 1}; - f32 white[4] = {1, 1, 1, 1}; + //f32 green[4] = {0, 1, 0, 1}; + //f32 purple[4] = {1, 0, 1, 1}; + //f32 white[4] = {1, 1, 1, 1}; float y = 10.0f; std::vector names; From db1a89a4924cfb2ed070f5bcc81b89429d61abbf Mon Sep 17 00:00:00 2001 From: amzn-phist <52085794+amzn-phist@users.noreply.github.com> Date: Wed, 25 Aug 2021 17:43:04 -0500 Subject: [PATCH 103/131] Fix level creation on Linux (#3488) * Fix level creation on Linux Creating a new level on linux would fail due to backslashes being used in mkdir. Fixed the slashes to use the AZ_CORRECT_FILESYSTEM_SEPARATOR. Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com> * Removed extra line that wasn't needed Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com> --- Code/Editor/Util/FileUtil.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Code/Editor/Util/FileUtil.cpp b/Code/Editor/Util/FileUtil.cpp index 435ec67a99..610a9c6e16 100644 --- a/Code/Editor/Util/FileUtil.cpp +++ b/Code/Editor/Util/FileUtil.cpp @@ -1221,15 +1221,14 @@ bool CFileUtil::CreatePath(const QString& strPath) if (!strDriveLetter.isEmpty()) { strCurrentDirectoryPath = strDriveLetter; - strCurrentDirectoryPath += "\\"; + strCurrentDirectoryPath += AZ_CORRECT_FILESYSTEM_SEPARATOR_STRING; } - nTotalPathQueueElements = cstrDirectoryQueue.size(); for (nCurrentPathQueue = 0; nCurrentPathQueue < nTotalPathQueueElements; ++nCurrentPathQueue) { strCurrentDirectoryPath += cstrDirectoryQueue[static_cast(nCurrentPathQueue)]; - strCurrentDirectoryPath += "\\"; + strCurrentDirectoryPath += AZ_CORRECT_FILESYSTEM_SEPARATOR_STRING; // The value which will go out of this loop is the result of the attempt to create the // last directory, only. @@ -2158,7 +2157,6 @@ uint32 CFileUtil::GetAttributes(const char* filename, bool bUseSourceControl /*= return SCC_FILE_ATTRIBUTE_READONLY | SCC_FILE_ATTRIBUTE_INPAK; } - const char* adjustedFile = file.GetAdjustedFilename(); if (!AZ::IO::SystemFile::Exists(adjustedFile)) { From e5e271f45a3203a55d5d91398eebd26dc25f4ecf Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Wed, 25 Aug 2021 16:42:01 -0700 Subject: [PATCH 104/131] One more fix Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Code/Editor/Objects/TrackGizmo.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Code/Editor/Objects/TrackGizmo.cpp b/Code/Editor/Objects/TrackGizmo.cpp index 2dc1a93128..3b753e737a 100644 --- a/Code/Editor/Objects/TrackGizmo.cpp +++ b/Code/Editor/Objects/TrackGizmo.cpp @@ -27,9 +27,11 @@ ////////////////////////////////////////////////////////////////////////// #define AXIS_SIZE 0.1f +#if 0 namespace { int s_highlightAxis = 0; } +#endif ////////////////////////////////////////////////////////////////////////// CTrackGizmo::CTrackGizmo() From ae9dd275b44685cbfed45fa8b0e17bc4b0a85e89 Mon Sep 17 00:00:00 2001 From: puvvadar Date: Wed, 25 Aug 2021 16:45:16 -0700 Subject: [PATCH 105/131] Correct default value issue with PacketDispatchResult Signed-off-by: puvvadar --- .../AzNetworking/AzNetworking/PacketLayer/IPacketHeader.h | 4 ++-- .../AzNetworking/UdpTransport/UdpNetworkInterface.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Code/Framework/AzNetworking/AzNetworking/PacketLayer/IPacketHeader.h b/Code/Framework/AzNetworking/AzNetworking/PacketLayer/IPacketHeader.h index f7ca7f0166..0d097429c0 100644 --- a/Code/Framework/AzNetworking/AzNetworking/PacketLayer/IPacketHeader.h +++ b/Code/Framework/AzNetworking/AzNetworking/PacketLayer/IPacketHeader.h @@ -16,9 +16,9 @@ namespace AzNetworking { AZ_ENUM_CLASS(PacketDispatchResult - , Success - , Pending , Failure + , Pending + , Success ); AZ_ENUM_CLASS(PacketFlag diff --git a/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpNetworkInterface.cpp b/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpNetworkInterface.cpp index c450d27dc8..70fa9258df 100644 --- a/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpNetworkInterface.cpp +++ b/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpNetworkInterface.cpp @@ -277,7 +277,7 @@ namespace AzNetworking timeoutItem->UpdateTimeoutTime(startTimeMs); - PacketDispatchResult handledPacket; + PacketDispatchResult handledPacket = PacketDispatchResult::Failure; if (header.GetPacketType() < aznumeric_cast(CorePackets::PacketType::MAX)) { handledPacket = connection->HandleCorePacket(m_connectionListener, header, packetSerializer); From b49b5a7c54ceb0f3984a94d371a8dd05bcaa0096 Mon Sep 17 00:00:00 2001 From: Jeremy Ong Date: Wed, 25 Aug 2021 21:59:04 -0600 Subject: [PATCH 106/131] Add missing AzToolsFramework budget declaration Signed-off-by: Jeremy Ong --- Gems/WhiteBox/Code/Source/Core/WhiteBoxToolApi.cpp | 2 ++ Gems/WhiteBox/Code/Source/EditorWhiteBoxComponentModeTypes.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/Gems/WhiteBox/Code/Source/Core/WhiteBoxToolApi.cpp b/Gems/WhiteBox/Code/Source/Core/WhiteBoxToolApi.cpp index 961eef2176..7e96c83810 100644 --- a/Gems/WhiteBox/Code/Source/Core/WhiteBoxToolApi.cpp +++ b/Gems/WhiteBox/Code/Source/Core/WhiteBoxToolApi.cpp @@ -40,6 +40,8 @@ AZ_PUSH_DISABLE_WARNING(4702, "-Wunknown-warning-option") // OpenMesh\Core\Utils #include AZ_POP_DISABLE_WARNING +AZ_DECLARE_BUDGET(AzToolsFramework); + namespace OpenMesh { template<> diff --git a/Gems/WhiteBox/Code/Source/EditorWhiteBoxComponentModeTypes.cpp b/Gems/WhiteBox/Code/Source/EditorWhiteBoxComponentModeTypes.cpp index cbde5f4f4b..ff4961a55c 100644 --- a/Gems/WhiteBox/Code/Source/EditorWhiteBoxComponentModeTypes.cpp +++ b/Gems/WhiteBox/Code/Source/EditorWhiteBoxComponentModeTypes.cpp @@ -11,6 +11,8 @@ #include #include +AZ_DECLARE_BUDGET(AzToolsFramework); + namespace WhiteBox { void DrawEdges( From 7aa24fd58f3bc43625c0b84b94f0c37c49905e26 Mon Sep 17 00:00:00 2001 From: santorac <55155825+santorac@users.noreply.github.com> Date: Thu, 26 Aug 2021 00:26:35 -0700 Subject: [PATCH 107/131] Fixed shader variant hot reload which was failing due to mismatched timestamps. The ShaderAsset was using microseconds and the ShaderVariantAsset was using system ticks. Since ticks will always be higher than microseconds, stale variants were not prevented from being used. Signed-off-by: santorac <55155825+santorac@users.noreply.github.com> --- .../Editor/AzslShaderBuilderSystemComponent.cpp | 4 ++-- .../Code/Source/Editor/ShaderAssetBuilder.cpp | 17 +++++++++-------- .../Source/Editor/ShaderVariantAssetBuilder.cpp | 6 ++++-- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/Gems/Atom/Asset/Shader/Code/Source/Editor/AzslShaderBuilderSystemComponent.cpp b/Gems/Atom/Asset/Shader/Code/Source/Editor/AzslShaderBuilderSystemComponent.cpp index 16cebef6ac..cacb310918 100644 --- a/Gems/Atom/Asset/Shader/Code/Source/Editor/AzslShaderBuilderSystemComponent.cpp +++ b/Gems/Atom/Asset/Shader/Code/Source/Editor/AzslShaderBuilderSystemComponent.cpp @@ -81,7 +81,7 @@ namespace AZ // Register Shader Asset Builder AssetBuilderSDK::AssetBuilderDesc shaderAssetBuilderDescriptor; shaderAssetBuilderDescriptor.m_name = "Shader Asset Builder"; - shaderAssetBuilderDescriptor.m_version = 103; // ATOM-15058 + shaderAssetBuilderDescriptor.m_version = 104; // ATOM-15871 // .shader file changes trigger rebuilds shaderAssetBuilderDescriptor.m_patterns.push_back(AssetBuilderSDK::AssetBuilderPattern( AZStd::string::format("*.%s", RPI::ShaderSourceData::Extension), AssetBuilderSDK::AssetBuilderPattern::PatternType::Wildcard)); shaderAssetBuilderDescriptor.m_busId = azrtti_typeid(); @@ -96,7 +96,7 @@ namespace AZ shaderVariantAssetBuilderDescriptor.m_name = "Shader Variant Asset Builder"; // Both "Shader Variant Asset Builder" and "Shader Asset Builder" produce ShaderVariantAsset products. If you update // ShaderVariantAsset you will need to update BOTH version numbers, not just "Shader Variant Asset Builder". - shaderVariantAssetBuilderDescriptor.m_version = 24; // ATOM-15978 + shaderVariantAssetBuilderDescriptor.m_version = 25; // ATOM-15871 shaderVariantAssetBuilderDescriptor.m_patterns.push_back(AssetBuilderSDK::AssetBuilderPattern(AZStd::string::format("*.%s", RPI::ShaderVariantListSourceData::Extension), AssetBuilderSDK::AssetBuilderPattern::PatternType::Wildcard)); shaderVariantAssetBuilderDescriptor.m_busId = azrtti_typeid(); shaderVariantAssetBuilderDescriptor.m_createJobFunction = AZStd::bind(&ShaderVariantAssetBuilder::CreateJobs, &m_shaderVariantAssetBuilder, AZStd::placeholders::_1, AZStd::placeholders::_2); diff --git a/Gems/Atom/Asset/Shader/Code/Source/Editor/ShaderAssetBuilder.cpp b/Gems/Atom/Asset/Shader/Code/Source/Editor/ShaderAssetBuilder.cpp index 87eb6dc97d..2ebcb981fa 100644 --- a/Gems/Atom/Asset/Shader/Code/Source/Editor/ShaderAssetBuilder.cpp +++ b/Gems/Atom/Asset/Shader/Code/Source/Editor/ShaderAssetBuilder.cpp @@ -43,6 +43,7 @@ #include #include #include +#include #include "AzslCompiler.h" #include "ShaderVariantAssetBuilder.h" @@ -236,7 +237,9 @@ namespace AZ void ShaderAssetBuilder::ProcessJob(const AssetBuilderSDK::ProcessJobRequest& request, AssetBuilderSDK::ProcessJobResponse& response) const { - const AZStd::sys_time_t startTime = AZStd::GetTimeNowTicks(); + AZ::Debug::Timer timer; + timer.Stamp(); + AZStd::string shaderFullPath; AzFramework::StringFunc::Path::ConstructFull(request.m_watchFolder.c_str(), request.m_sourceFile.c_str(), shaderFullPath, true); // Save .shader file name (no extension and no parent directory path) @@ -283,6 +286,8 @@ namespace AZ } } + AZ_TracePrintf(ShaderAssetBuilderName, "Build Timestamp %zu", shaderAssetBuildTimestamp); + auto supervariantList = ShaderBuilderUtility::GetSupervariantListFromShaderSourceData(shaderSourceData); RPI::ShaderAssetCreator shaderAssetCreator; @@ -579,7 +584,7 @@ namespace AZ request.m_platformInfo, buildOptions.m_compilerArguments, request.m_tempDirPath, - startTime, + shaderAssetBuildTimestamp, shaderSourceData, *shaderOptionGroupLayout.get(), shaderEntryPoints, @@ -660,12 +665,8 @@ namespace AZ } response.m_resultCode = AssetBuilderSDK::ProcessJobResult_Success; - - const AZStd::sys_time_t endTime = AZStd::GetTimeNowTicks(); - const AZStd::sys_time_t deltaTime = endTime - startTime; - const float elapsedTimeSeconds = (float)(deltaTime) / (float)AZStd::GetTimeTicksPerSecond(); - - AZ_TracePrintf(ShaderAssetBuilderName, "Finished processing %s in %.2f seconds\n", request.m_sourceFile.c_str(), elapsedTimeSeconds); + + AZ_TracePrintf(ShaderAssetBuilderName, "Finished processing %s in %.2f seconds\n", request.m_sourceFile.c_str(), timer.GetDeltaTimeInSeconds()); ShaderBuilderUtility::LogProfilingData(ShaderAssetBuilderName, shaderFileName); } diff --git a/Gems/Atom/Asset/Shader/Code/Source/Editor/ShaderVariantAssetBuilder.cpp b/Gems/Atom/Asset/Shader/Code/Source/Editor/ShaderVariantAssetBuilder.cpp index 0e995992b9..8fcc22808b 100644 --- a/Gems/Atom/Asset/Shader/Code/Source/Editor/ShaderVariantAssetBuilder.cpp +++ b/Gems/Atom/Asset/Shader/Code/Source/Editor/ShaderVariantAssetBuilder.cpp @@ -743,7 +743,6 @@ namespace AZ void ShaderVariantAssetBuilder::ProcessShaderVariantJob(const AssetBuilderSDK::ProcessJobRequest& request, AssetBuilderSDK::ProcessJobResponse& response) const { - const AZStd::sys_time_t startTime = AZStd::GetTimeNowTicks(); AssetBuilderSDK::JobCancelListener jobCancelListener(request.m_jobId); AZStd::string fullPath; @@ -777,6 +776,9 @@ namespace AZ response.m_resultCode = AssetBuilderSDK::ProcessJobResult_Success; return; } + + const AZStd::sys_time_t shaderVariantAssetBuildTimestamp = AZStd::GetTimeNowMicroSecond(); + AZ_TracePrintf(ShaderVariantAssetBuilderName, "Build Timestamp %zu", shaderVariantAssetBuildTimestamp); auto supervariantList = ShaderBuilderUtility::GetSupervariantListFromShaderSourceData(shaderSourceDescriptor); @@ -911,7 +913,7 @@ namespace AZ ShaderVariantCreationContext shaderVariantCreationContext = { *shaderPlatformInterface, request.m_platformInfo, buildOptions.m_compilerArguments, request.m_tempDirPath, - startTime, + shaderVariantAssetBuildTimestamp, shaderSourceDescriptor, *shaderOptionGroupLayout.get(), shaderEntryPoints, From d5ee6fb36fc5ee817340df095a6a40592d8f3f75 Mon Sep 17 00:00:00 2001 From: hultonha <82228511+hultonha@users.noreply.github.com> Date: Thu, 26 Aug 2021 10:01:22 +0100 Subject: [PATCH 108/131] Expose camera settings to the Editor UI (#3442) * expose camera settings to the ui Signed-off-by: hultonha * improve naming of visibility functions, remove duplication Signed-off-by: hultonha --- .../EditorPreferencesPageViewportMovement.cpp | 136 +++++++++++++----- .../EditorPreferencesPageViewportMovement.h | 58 ++++++-- 2 files changed, 146 insertions(+), 48 deletions(-) diff --git a/Code/Editor/EditorPreferencesPageViewportMovement.cpp b/Code/Editor/EditorPreferencesPageViewportMovement.cpp index 988b4954d1..06bcd13c60 100644 --- a/Code/Editor/EditorPreferencesPageViewportMovement.cpp +++ b/Code/Editor/EditorPreferencesPageViewportMovement.cpp @@ -5,6 +5,7 @@ * SPDX-License-Identifier: Apache-2.0 OR MIT * */ + #include "EditorDefs.h" #include "EditorPreferencesPageViewportMovement.h" @@ -12,44 +13,96 @@ #include // Editor -#include "Settings.h" #include "EditorViewportSettings.h" +#include "Settings.h" void CEditorPreferencesPage_ViewportMovement::Reflect(AZ::SerializeContext& serialize) { serialize.Class() - ->Version(1) - ->Field("MoveSpeed", &CameraMovementSettings::m_moveSpeed) + ->Version(2) + ->Field("TranslateSpeed", &CameraMovementSettings::m_translateSpeed) ->Field("RotateSpeed", &CameraMovementSettings::m_rotateSpeed) - ->Field("FastMoveSpeed", &CameraMovementSettings::m_fastMoveSpeed) - ->Field("WheelZoomSpeed", &CameraMovementSettings::m_wheelZoomSpeed) - ->Field("InvertYAxis", &CameraMovementSettings::m_invertYRotation) - ->Field("InvertPan", &CameraMovementSettings::m_invertPan); + ->Field("BoostMultiplier", &CameraMovementSettings::m_boostMultiplier) + ->Field("ScrollSpeed", &CameraMovementSettings::m_scrollSpeed) + ->Field("DollySpeed", &CameraMovementSettings::m_dollySpeed) + ->Field("PanSpeed", &CameraMovementSettings::m_panSpeed) + ->Field("RotateSmoothing", &CameraMovementSettings::m_rotateSmoothing) + ->Field("RotateSmoothness", &CameraMovementSettings::m_rotateSmoothness) + ->Field("TranslateSmoothing", &CameraMovementSettings::m_translateSmoothing) + ->Field("TranslateSmoothness", &CameraMovementSettings::m_translateSmoothness) + ->Field("CaptureCursorLook", &CameraMovementSettings::m_captureCursorLook) + ->Field("OrbitYawRotationInverted", &CameraMovementSettings::m_orbitYawRotationInverted) + ->Field("PanInvertedX", &CameraMovementSettings::m_panInvertedX) + ->Field("PanInvertedY", &CameraMovementSettings::m_panInvertedY); - serialize.Class() - ->Version(1) - ->Field("CameraMovementSettings", &CEditorPreferencesPage_ViewportMovement::m_cameraMovementSettings); + serialize.Class()->Version(1)->Field( + "CameraMovementSettings", &CEditorPreferencesPage_ViewportMovement::m_cameraMovementSettings); - - AZ::EditContext* editContext = serialize.GetEditContext(); - if (editContext) + if (AZ::EditContext* editContext = serialize.GetEditContext()) { - editContext->Class("Camera Movement Settings", "") - ->DataElement(AZ::Edit::UIHandlers::SpinBox, &CameraMovementSettings::m_moveSpeed, "Camera Movement Speed", "Camera Movement Speed") - ->DataElement(AZ::Edit::UIHandlers::SpinBox, &CameraMovementSettings::m_rotateSpeed, "Camera Rotation Speed", "Camera Rotation Speed") - ->DataElement(AZ::Edit::UIHandlers::SpinBox, &CameraMovementSettings::m_fastMoveSpeed, "Fast Movement Scale", "Fast Movement Scale (holding shift") - ->DataElement(AZ::Edit::UIHandlers::SpinBox, &CameraMovementSettings::m_wheelZoomSpeed, "Wheel Zoom Speed", "Wheel Zoom Speed") - ->DataElement(AZ::Edit::UIHandlers::CheckBox, &CameraMovementSettings::m_invertYRotation, "Invert Y Axis", "Invert Y Rotation (holding RMB)") - ->DataElement(AZ::Edit::UIHandlers::CheckBox, &CameraMovementSettings::m_invertPan, "Invert Pan", "Invert Pan (holding MMB)"); + editContext->Class("Camera Settings", "") + ->DataElement( + AZ::Edit::UIHandlers::SpinBox, &CameraMovementSettings::m_translateSpeed, "Camera Movement Speed", "Camera movement speed") + ->Attribute(AZ::Edit::Attributes::Min, 0.01f) + ->DataElement( + AZ::Edit::UIHandlers::SpinBox, &CameraMovementSettings::m_rotateSpeed, "Camera Rotation Speed", "Camera rotation speed") + ->Attribute(AZ::Edit::Attributes::Min, 0.01f) + ->DataElement( + AZ::Edit::UIHandlers::SpinBox, &CameraMovementSettings::m_boostMultiplier, "Camera Boost Multiplier", + "Camera boost multiplier to apply to movement speed") + ->Attribute(AZ::Edit::Attributes::Min, 0.01f) + ->DataElement( + AZ::Edit::UIHandlers::SpinBox, &CameraMovementSettings::m_scrollSpeed, "Camera Scroll Speed", + "Camera movement speed while using scroll/wheel input") + ->Attribute(AZ::Edit::Attributes::Min, 0.01f) + ->DataElement( + AZ::Edit::UIHandlers::SpinBox, &CameraMovementSettings::m_dollySpeed, "Camera Dolly Speed", + "Camera movement speed while using mouse motion to move in and out") + ->Attribute(AZ::Edit::Attributes::Min, 0.01f) + ->DataElement( + AZ::Edit::UIHandlers::SpinBox, &CameraMovementSettings::m_panSpeed, "Camera Pan Speed", + "Camera movement speed while panning using the mouse") + ->Attribute(AZ::Edit::Attributes::Min, 0.01f) + ->DataElement( + AZ::Edit::UIHandlers::CheckBox, &CameraMovementSettings::m_rotateSmoothing, "Camera Rotate Smoothing", + "Is camera rotation smoothing enabled or disabled") + ->Attribute(AZ::Edit::Attributes::ChangeNotify, AZ::Edit::PropertyRefreshLevels::EntireTree) + ->DataElement( + AZ::Edit::UIHandlers::SpinBox, &CameraMovementSettings::m_rotateSmoothness, "Camera Rotate Smoothness", + "Amount of camera smoothing to apply while rotating the camera") + ->Attribute(AZ::Edit::Attributes::Min, 0.01f) + ->Attribute(AZ::Edit::Attributes::Visibility, &CameraMovementSettings::RotateSmoothingVisibility) + ->DataElement( + AZ::Edit::UIHandlers::CheckBox, &CameraMovementSettings::m_translateSmoothing, "Camera Translate Smoothing", + "Is camera translation smoothing enabled or disabled") + ->Attribute(AZ::Edit::Attributes::ChangeNotify, AZ::Edit::PropertyRefreshLevels::EntireTree) + ->DataElement( + AZ::Edit::UIHandlers::SpinBox, &CameraMovementSettings::m_translateSmoothness, "Camera Translate Smoothness", + "Amount of camera smoothing to apply while translating the camera") + ->Attribute(AZ::Edit::Attributes::Min, 0.01f) + ->Attribute(AZ::Edit::Attributes::Visibility, &CameraMovementSettings::TranslateSmoothingVisibility) + ->DataElement( + AZ::Edit::UIHandlers::CheckBox, &CameraMovementSettings::m_orbitYawRotationInverted, "Camera Orbit Yaw Inverted", + "Inverted yaw rotation while orbiting") + ->DataElement( + AZ::Edit::UIHandlers::CheckBox, &CameraMovementSettings::m_panInvertedX, "Invert Pan X", + "Invert direction of pan in local X axis") + ->DataElement( + AZ::Edit::UIHandlers::CheckBox, &CameraMovementSettings::m_panInvertedY, "Invert Pan Y", + "Invert direction of pan in local Y axis") + ->DataElement( + AZ::Edit::UIHandlers::CheckBox, &CameraMovementSettings::m_captureCursorLook, "Camera Capture Look Cursor", + "Should the cursor be captured (hidden) while performing free look"); - editContext->Class("Gizmo Movement Preferences", "Gizmo Movement Preferences") + editContext->Class("Viewport Preferences", "Viewport Preferences") ->ClassElement(AZ::Edit::ClassElements::EditorData, "") ->Attribute(AZ::Edit::Attributes::Visibility, AZ_CRC("PropertyVisibility_ShowChildrenOnly", 0xef428f20)) - ->DataElement(AZ::Edit::UIHandlers::Default, &CEditorPreferencesPage_ViewportMovement::m_cameraMovementSettings, "Camera Movement Settings", "Camera Movement Settings"); + ->DataElement( + AZ::Edit::UIHandlers::Default, &CEditorPreferencesPage_ViewportMovement::m_cameraMovementSettings, + "Camera Movement Settings", "Camera Movement Settings"); } } - CEditorPreferencesPage_ViewportMovement::CEditorPreferencesPage_ViewportMovement() { InitializeSettings(); @@ -68,21 +121,36 @@ QIcon& CEditorPreferencesPage_ViewportMovement::GetIcon() void CEditorPreferencesPage_ViewportMovement::OnApply() { - SandboxEditor::SetCameraTranslateSpeed(m_cameraMovementSettings.m_moveSpeed); + SandboxEditor::SetCameraTranslateSpeed(m_cameraMovementSettings.m_translateSpeed); SandboxEditor::SetCameraRotateSpeed(m_cameraMovementSettings.m_rotateSpeed); - SandboxEditor::SetCameraBoostMultiplier(m_cameraMovementSettings.m_fastMoveSpeed); - SandboxEditor::SetCameraScrollSpeed(m_cameraMovementSettings.m_wheelZoomSpeed); - SandboxEditor::SetCameraOrbitYawRotationInverted(m_cameraMovementSettings.m_invertYRotation); - SandboxEditor::SetCameraPanInvertedX(m_cameraMovementSettings.m_invertPan); - SandboxEditor::SetCameraPanInvertedY(m_cameraMovementSettings.m_invertPan); + SandboxEditor::SetCameraBoostMultiplier(m_cameraMovementSettings.m_boostMultiplier); + SandboxEditor::SetCameraScrollSpeed(m_cameraMovementSettings.m_scrollSpeed); + SandboxEditor::SetCameraDollyMotionSpeed(m_cameraMovementSettings.m_dollySpeed); + SandboxEditor::SetCameraPanSpeed(m_cameraMovementSettings.m_panSpeed); + SandboxEditor::SetCameraRotateSmoothness(m_cameraMovementSettings.m_rotateSmoothness); + SandboxEditor::SetCameraRotateSmoothingEnabled(m_cameraMovementSettings.m_rotateSmoothing); + SandboxEditor::SetCameraTranslateSmoothness(m_cameraMovementSettings.m_translateSmoothness); + SandboxEditor::SetCameraTranslateSmoothingEnabled(m_cameraMovementSettings.m_translateSmoothing); + SandboxEditor::SetCameraCaptureCursorForLook(m_cameraMovementSettings.m_captureCursorLook); + SandboxEditor::SetCameraOrbitYawRotationInverted(m_cameraMovementSettings.m_orbitYawRotationInverted); + SandboxEditor::SetCameraPanInvertedX(m_cameraMovementSettings.m_panInvertedX); + SandboxEditor::SetCameraPanInvertedY(m_cameraMovementSettings.m_panInvertedY); } void CEditorPreferencesPage_ViewportMovement::InitializeSettings() { - m_cameraMovementSettings.m_moveSpeed = SandboxEditor::CameraTranslateSpeed(); + m_cameraMovementSettings.m_translateSpeed = SandboxEditor::CameraTranslateSpeed(); m_cameraMovementSettings.m_rotateSpeed = SandboxEditor::CameraRotateSpeed(); - m_cameraMovementSettings.m_fastMoveSpeed = SandboxEditor::CameraBoostMultiplier(); - m_cameraMovementSettings.m_wheelZoomSpeed = SandboxEditor::CameraScrollSpeed(); - m_cameraMovementSettings.m_invertYRotation = SandboxEditor::CameraOrbitYawRotationInverted(); - m_cameraMovementSettings.m_invertPan = SandboxEditor::CameraPanInvertedX() && SandboxEditor::CameraPanInvertedY(); + m_cameraMovementSettings.m_boostMultiplier = SandboxEditor::CameraBoostMultiplier(); + m_cameraMovementSettings.m_scrollSpeed = SandboxEditor::CameraScrollSpeed(); + m_cameraMovementSettings.m_dollySpeed = SandboxEditor::CameraDollyMotionSpeed(); + m_cameraMovementSettings.m_panSpeed = SandboxEditor::CameraPanSpeed(); + m_cameraMovementSettings.m_rotateSmoothness = SandboxEditor::CameraRotateSmoothness(); + m_cameraMovementSettings.m_rotateSmoothing = SandboxEditor::CameraRotateSmoothingEnabled(); + m_cameraMovementSettings.m_translateSmoothness = SandboxEditor::CameraTranslateSmoothness(); + m_cameraMovementSettings.m_translateSmoothing = SandboxEditor::CameraTranslateSmoothingEnabled(); + m_cameraMovementSettings.m_captureCursorLook = SandboxEditor::CameraCaptureCursorForLook(); + m_cameraMovementSettings.m_orbitYawRotationInverted = SandboxEditor::CameraOrbitYawRotationInverted(); + m_cameraMovementSettings.m_panInvertedX = SandboxEditor::CameraPanInvertedX(); + m_cameraMovementSettings.m_panInvertedY = SandboxEditor::CameraPanInvertedY(); } diff --git a/Code/Editor/EditorPreferencesPageViewportMovement.h b/Code/Editor/EditorPreferencesPageViewportMovement.h index 1373260e62..a973c34f1a 100644 --- a/Code/Editor/EditorPreferencesPageViewportMovement.h +++ b/Code/Editor/EditorPreferencesPageViewportMovement.h @@ -5,17 +5,21 @@ * SPDX-License-Identifier: Apache-2.0 OR MIT * */ + #pragma once #include "Include/IPreferencesPage.h" -#include -#include #include +#include +#include #include +inline AZ::Crc32 EditorPropertyVisibility(const bool enabled) +{ + return enabled ? AZ::Edit::PropertyVisibility::Show : AZ::Edit::PropertyVisibility::Hide; +} -class CEditorPreferencesPage_ViewportMovement - : public IPreferencesPage +class CEditorPreferencesPage_ViewportMovement : public IPreferencesPage { public: AZ_RTTI(CEditorPreferencesPage_ViewportMovement, "{BC593332-7EAF-4171-8A35-1C5DE5B40909}", IPreferencesPage) @@ -25,12 +29,22 @@ public: CEditorPreferencesPage_ViewportMovement(); virtual ~CEditorPreferencesPage_ViewportMovement() = default; - virtual const char* GetCategory() override { return "Viewports"; } + virtual const char* GetCategory() override + { + return "Viewports"; + } + virtual const char* GetTitle(); virtual QIcon& GetIcon() override; virtual void OnApply() override; - virtual void OnCancel() override {} - virtual bool OnQueryCancel() override { return true; } + virtual void OnCancel() override + { + } + + virtual bool OnQueryCancel() override + { + return true; + } private: void InitializeSettings(); @@ -39,16 +53,32 @@ private: { AZ_TYPE_INFO(CameraMovementSettings, "{60B8C07E-5F48-4171-A50B-F45558B5CCA1}") - float m_moveSpeed; + float m_translateSpeed; float m_rotateSpeed; - float m_fastMoveSpeed; - float m_wheelZoomSpeed; - bool m_invertYRotation; - bool m_invertPan; + float m_scrollSpeed; + float m_dollySpeed; + float m_panSpeed; + float m_boostMultiplier; + float m_rotateSmoothness; + bool m_rotateSmoothing; + float m_translateSmoothness; + bool m_translateSmoothing; + bool m_captureCursorLook; + bool m_orbitYawRotationInverted; + bool m_panInvertedX; + bool m_panInvertedY; + + AZ::Crc32 RotateSmoothingVisibility() const + { + return EditorPropertyVisibility(m_rotateSmoothing); + } + + AZ::Crc32 TranslateSmoothingVisibility() const + { + return EditorPropertyVisibility(m_translateSmoothing); + } }; CameraMovementSettings m_cameraMovementSettings; QIcon m_icon; }; - - From 865d877d8e8e6037084fb0fe07dfe39ee6bd02c9 Mon Sep 17 00:00:00 2001 From: pereslav Date: Thu, 26 Aug 2021 13:05:45 +0100 Subject: [PATCH 109/131] LYN-5558 Fixed Blast assets loading in the Launcher Signed-off-by: pereslav --- Gems/Blast/Code/Source/Asset/BlastAsset.cpp | 12 ++++++++++++ Gems/Blast/Code/Source/Asset/BlastAsset.h | 2 ++ .../Code/Source/Components/BlastFamilyComponent.cpp | 1 + 3 files changed, 15 insertions(+) diff --git a/Gems/Blast/Code/Source/Asset/BlastAsset.cpp b/Gems/Blast/Code/Source/Asset/BlastAsset.cpp index bfd27448c0..9046ae62d5 100644 --- a/Gems/Blast/Code/Source/Asset/BlastAsset.cpp +++ b/Gems/Blast/Code/Source/Asset/BlastAsset.cpp @@ -7,6 +7,7 @@ */ #include +#include #include #include #include @@ -27,6 +28,17 @@ namespace Blast { } + void BlastAsset::Reflect(AZ::ReflectContext* context) + { + if (auto* serializeContext = azrtti_cast(context)) + { + serializeContext->Class() + ->Version(0) + ; + } + } + + bool BlastAsset::LoadFromBuffer(void* buffer, size_t bytesSize) { Nv::Blast::ExtSerialization* serialization = nullptr; diff --git a/Gems/Blast/Code/Source/Asset/BlastAsset.h b/Gems/Blast/Code/Source/Asset/BlastAsset.h index 8c7fd1db4b..22754aa535 100644 --- a/Gems/Blast/Code/Source/Asset/BlastAsset.h +++ b/Gems/Blast/Code/Source/Asset/BlastAsset.h @@ -25,6 +25,8 @@ namespace Blast BlastAsset(Nv::Blast::ExtPxAsset* pxAsset = nullptr, NvBlastExtDamageAccelerator* damageAccelerator = nullptr); + static void Reflect(AZ::ReflectContext* context); + bool LoadFromBuffer(void* buffer, size_t bytesSize); const Nv::Blast::ExtPxAsset* GetPxAsset() const diff --git a/Gems/Blast/Code/Source/Components/BlastFamilyComponent.cpp b/Gems/Blast/Code/Source/Components/BlastFamilyComponent.cpp index ec6e7bbbb9..62dc592312 100644 --- a/Gems/Blast/Code/Source/Components/BlastFamilyComponent.cpp +++ b/Gems/Blast/Code/Source/Components/BlastFamilyComponent.cpp @@ -48,6 +48,7 @@ namespace Blast BlastFamilyComponentNotificationBusHandler::Reflect(context); BlastActorConfiguration::Reflect(context); BlastActorData::Reflect(context); + BlastAsset::Reflect(context); if (AZ::SerializeContext* serialize = azrtti_cast(context)) { From 040b75c02cabe3f861cd73a9a177cc90664a3860 Mon Sep 17 00:00:00 2001 From: bosnichd Date: Thu, 26 Aug 2021 07:31:30 -0600 Subject: [PATCH 110/131] Fix PAL.cmake logic, thanks to lumberyard-employee-dm! (#3516) * Fix PAL.cmake logic, thanks to lumberyard-employee-dm! Signed-off-by: bosnichd * Lowercase the platform name to address review feedback. Signed-off-by: bosnichd --- cmake/PAL.cmake | 43 ++++++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/cmake/PAL.cmake b/cmake/PAL.cmake index 341df79f1a..67ed17b6d4 100644 --- a/cmake/PAL.cmake +++ b/cmake/PAL.cmake @@ -112,7 +112,8 @@ function(read_engine_restricted_path output_restricted_path) # Set manifest path to path in the user home directory set(manifest_path ${LY_ROOT_FOLDER}/engine.json) if(EXISTS ${manifest_path}) - o3de_restricted_path(${manifest_path} output_restricted_path) + o3de_restricted_path(${manifest_path} read_restricted_path) + set(${output_restricted_path} ${read_restricted_path} PARENT_SCOPE) endif() endfunction() @@ -133,16 +134,17 @@ ly_set(PAL_HOST_PLATFORM_NAME_LOWERCASE ${PAL_HOST_PLATFORM_NAME_LOWERCASE}) set(PAL_RESTRICTED_PLATFORMS) -string(LENGTH "${O3DE_ENGINE_RESTRICTED_PATH}" engine_restricted_length) file(GLOB pal_restricted_files ${O3DE_ENGINE_RESTRICTED_PATH}/*/cmake/PAL_*.cmake) foreach(pal_restricted_file ${pal_restricted_files}) - string(FIND ${pal_restricted_file} "/cmake/PAL" end) - if(${end} GREATER -1) - math(EXPR platform_length "${end} - ${engine_restricted_length} - 1") - math(EXPR platform_start "${engine_restricted_length} + 1") - string(SUBSTRING ${pal_restricted_file} ${platform_start} ${platform_length} platform) - list(APPEND PAL_RESTRICTED_PLATFORMS "${platform}") - endif() + # Get relative path from restricted root directory + cmake_path(RELATIVE_PATH pal_restricted_file BASE_DIRECTORY ${O3DE_ENGINE_RESTRICTED_PATH} OUTPUT_VARIABLE relative_pal_restricted_file) + # Split relative restricted path into path segments + string(REPLACE "/" ";" pal_restricted_segments ${relative_pal_restricted_file}) + # Retrieve the first path segment which should be the restricted platform + list(GET pal_restricted_segments 0 platform) + # Append the new restricted platform + string(TOLOWER ${platform} platform_lower) + list(APPEND PAL_RESTRICTED_PLATFORMS ${platform_lower}) endforeach() ly_set(PAL_RESTRICTED_PLATFORMS ${PAL_RESTRICTED_PLATFORMS}) @@ -186,11 +188,17 @@ function(ly_get_absolute_pal_filename out_name in_name) # Remove one path segment from the end of the current_object_path and prepend it to the list path_segments cmake_path(GET current_object_path PARENT_PATH parent_path) cmake_path(GET current_object_path FILENAME path_segment) - list(PREPEND path_segments_visited path_segment) + list(PREPEND path_segments_visited ${path_segment}) cmake_path(COMPARE current_object_path NOT_EQUAL parent_path is_prev_path_segment) cmake_path(SET current_object_path "${parent_path}") + set(is_prev_path_segment TRUE) while(is_prev_path_segment) + # Remove one path segment from the end of the current_object_path and prepend it to the list path_segments + cmake_path(GET current_object_path PARENT_PATH parent_path) + cmake_path(GET current_object_path FILENAME path_segment) + cmake_path(COMPARE current_object_path NOT_EQUAL parent_path is_prev_path_segment) + cmake_path(SET current_object_path "${parent_path}") # The Path is in a PAL structure # Decompose the path into sections before "Platform" and after "Platform" if(path_segment STREQUAL "Platform") @@ -205,21 +213,17 @@ function(ly_get_absolute_pal_filename out_name in_name) break() endif() - # Remove one path segment from the end of the current_object_path and prepend it to the list path_segments - cmake_path(GET current_object_path PARENT_PATH parent_path) - cmake_path(GET current_object_path FILENAME path_segment) - list(PREPEND path_segments_visited path_segment) - cmake_path(COMPARE current_object_path NOT_EQUAL parent_path is_prev_path_segment) - cmake_path(SET current_object_path "${parent_path}") + list(PREPEND path_segments_visited ${path_segment}) endwhile() # Compose a candidate restricted path and examine if it exists - cmake_path(APPEND object_restricted_path ${pre_platform_paths} "Platform" ${post_platform_paths} + cmake_path(APPEND ${pre_platform_paths} "Platform" ${post_platform_paths} OUTPUT_VARIABLE candidate_PAL_path) if(NOT EXISTS ${candidate_PAL_path}) - if("${candidate_platform_name}" IN_LIST PAL_RESTRICTED_PLATFORMS) + string(TOLOWER ${candidate_platform_name} candidate_platform_name_lower) + if("${candidate_platform_name_lower}" IN_LIST PAL_RESTRICTED_PLATFORMS) cmake_path(APPEND object_restricted_path ${candidate_platform_name} ${object_name} - ${pre_platform_paths} ${post_platform_paths} OUTPUT_VARIABLE candidate_PAL_path) + ${pre_platform_paths} OUTPUT_VARIABLE candidate_PAL_path) endif() endif() if(EXISTS ${candidate_PAL_path}) @@ -227,6 +231,7 @@ function(ly_get_absolute_pal_filename out_name in_name) endif() endif() endif() + cmake_path(ABSOLUTE_PATH full_name BASE_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}) set(${out_name} ${full_name} PARENT_SCOPE) endfunction() From ccd648c60000f7c54f2af891e37760919fbc840e Mon Sep 17 00:00:00 2001 From: santorac <55155825+santorac@users.noreply.github.com> Date: Thu, 26 Aug 2021 08:51:28 -0700 Subject: [PATCH 111/131] Removed unnecessary print statements Signed-off-by: santorac <55155825+santorac@users.noreply.github.com> --- .../Asset/Shader/Code/Source/Editor/ShaderAssetBuilder.cpp | 4 +--- .../Shader/Code/Source/Editor/ShaderVariantAssetBuilder.cpp | 1 - 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/Gems/Atom/Asset/Shader/Code/Source/Editor/ShaderAssetBuilder.cpp b/Gems/Atom/Asset/Shader/Code/Source/Editor/ShaderAssetBuilder.cpp index 2ebcb981fa..8ec7733d07 100644 --- a/Gems/Atom/Asset/Shader/Code/Source/Editor/ShaderAssetBuilder.cpp +++ b/Gems/Atom/Asset/Shader/Code/Source/Editor/ShaderAssetBuilder.cpp @@ -286,8 +286,6 @@ namespace AZ } } - AZ_TracePrintf(ShaderAssetBuilderName, "Build Timestamp %zu", shaderAssetBuildTimestamp); - auto supervariantList = ShaderBuilderUtility::GetSupervariantListFromShaderSourceData(shaderSourceData); RPI::ShaderAssetCreator shaderAssetCreator; @@ -666,7 +664,7 @@ namespace AZ response.m_resultCode = AssetBuilderSDK::ProcessJobResult_Success; - AZ_TracePrintf(ShaderAssetBuilderName, "Finished processing %s in %.2f seconds\n", request.m_sourceFile.c_str(), timer.GetDeltaTimeInSeconds()); + AZ_TracePrintf(ShaderAssetBuilderName, "Finished processing %s in %.3f seconds\n", request.m_sourceFile.c_str(), timer.GetDeltaTimeInSeconds()); ShaderBuilderUtility::LogProfilingData(ShaderAssetBuilderName, shaderFileName); } diff --git a/Gems/Atom/Asset/Shader/Code/Source/Editor/ShaderVariantAssetBuilder.cpp b/Gems/Atom/Asset/Shader/Code/Source/Editor/ShaderVariantAssetBuilder.cpp index 8fcc22808b..5dc1267dbb 100644 --- a/Gems/Atom/Asset/Shader/Code/Source/Editor/ShaderVariantAssetBuilder.cpp +++ b/Gems/Atom/Asset/Shader/Code/Source/Editor/ShaderVariantAssetBuilder.cpp @@ -778,7 +778,6 @@ namespace AZ } const AZStd::sys_time_t shaderVariantAssetBuildTimestamp = AZStd::GetTimeNowMicroSecond(); - AZ_TracePrintf(ShaderVariantAssetBuilderName, "Build Timestamp %zu", shaderVariantAssetBuildTimestamp); auto supervariantList = ShaderBuilderUtility::GetSupervariantListFromShaderSourceData(shaderSourceDescriptor); From aab06f687f64ca84b10403e7390e20433fc9a737 Mon Sep 17 00:00:00 2001 From: puvvadar Date: Thu, 26 Aug 2021 10:01:47 -0700 Subject: [PATCH 112/131] Change PacketDispatchResult Pending to Skipped Signed-off-by: puvvadar --- .../AzNetworking/AutoGen/AutoPacketDispatcher_Inline.jinja | 2 +- .../AzNetworking/AzNetworking/PacketLayer/IPacketHeader.h | 2 +- .../AzNetworking/UdpTransport/UdpNetworkInterface.cpp | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Code/Framework/AzNetworking/AzNetworking/AutoGen/AutoPacketDispatcher_Inline.jinja b/Code/Framework/AzNetworking/AzNetworking/AutoGen/AutoPacketDispatcher_Inline.jinja index 9767828f3a..c6f1a23402 100644 --- a/Code/Framework/AzNetworking/AzNetworking/AutoGen/AutoPacketDispatcher_Inline.jinja +++ b/Code/Framework/AzNetworking/AzNetworking/AutoGen/AutoPacketDispatcher_Inline.jinja @@ -13,7 +13,7 @@ namespace {{ xml.attrib['Name'] }} {% if ('HandshakePacket' not in Packet.attrib) or (Packet.attrib['HandshakePacket'] == 'false') %} if (!handler.IsHandshakeComplete()) { - return AzNetworking::PacketDispatchResult::Pending; + return AzNetworking::PacketDispatchResult::Skipped; } {% endif %} diff --git a/Code/Framework/AzNetworking/AzNetworking/PacketLayer/IPacketHeader.h b/Code/Framework/AzNetworking/AzNetworking/PacketLayer/IPacketHeader.h index 0d097429c0..4a441f5ed2 100644 --- a/Code/Framework/AzNetworking/AzNetworking/PacketLayer/IPacketHeader.h +++ b/Code/Framework/AzNetworking/AzNetworking/PacketLayer/IPacketHeader.h @@ -17,7 +17,7 @@ namespace AzNetworking { AZ_ENUM_CLASS(PacketDispatchResult , Failure - , Pending + , Skipped , Success ); diff --git a/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpNetworkInterface.cpp b/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpNetworkInterface.cpp index 70fa9258df..bf01ece458 100644 --- a/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpNetworkInterface.cpp +++ b/Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpNetworkInterface.cpp @@ -304,9 +304,9 @@ namespace AzNetworking // If it's not an expected unencrypted type then skip it for now continue; } - else if (handledPacket == PacketDispatchResult::Pending) + else if (handledPacket == PacketDispatchResult::Skipped) { - // If we did not handle due to a handshake pending completion, skip it + // If the result is marked as skipped then do so (i.e. if a handshake is not yet complete) continue; } else if (connection->GetConnectionState() != ConnectionState::Disconnecting) From bec568c8bd12f764bb60d49cfbd1e518cfa0e054 Mon Sep 17 00:00:00 2001 From: Chris Galvan Date: Thu, 26 Aug 2021 13:14:30 -0500 Subject: [PATCH 113/131] Added context menu on game folder status bar item to open project path in file explorer. Signed-off-by: Chris Galvan --- Code/Editor/MainStatusBar.cpp | 32 ++++++++++++++++++++++++++------ Code/Editor/MainStatusBarItems.h | 14 ++++++++++++++ 2 files changed, 40 insertions(+), 6 deletions(-) diff --git a/Code/Editor/MainStatusBar.cpp b/Code/Editor/MainStatusBar.cpp index a1e51ec553..f955035bd8 100644 --- a/Code/Editor/MainStatusBar.cpp +++ b/Code/Editor/MainStatusBar.cpp @@ -15,6 +15,7 @@ // AzQtComponents #include #include +#include // Qt #include @@ -209,7 +210,7 @@ MainStatusBar::MainStatusBar(QWidget* parent) addPermanentWidget(new StatusBarItem(QStringLiteral("connection"), true, this, true), 1); - addPermanentWidget(new StatusBarItem(QStringLiteral("game_info"), this, true), 1); + addPermanentWidget(new GameInfoItem(QStringLiteral("game_info"), this), 1); addPermanentWidget(new MemoryStatusItem(QStringLiteral("memory"), this), 1); } @@ -221,11 +222,6 @@ void MainStatusBar::Init() 500 }; //in ms, so 2 FPS - AZ::IO::FixedMaxPathString projectPath = AZ::Utils::GetProjectPath(); - QString strGameInfo; - strGameInfo = tr("GameFolder: '%1'").arg(projectPath.c_str()); - SetItem(QStringLiteral("game_info"), strGameInfo, tr("Game Info"), QPixmap()); - //ask for updates for items regularly. This is basically what MFC does auto timer = new QTimer(this); timer->setInterval(statusbarTimerUpdateInterval); @@ -436,5 +432,29 @@ QString GeneralStatusItem::CurrentText() const return StatusBarItem::CurrentText(); } +GameInfoItem::GameInfoItem(QString name, MainStatusBar* parent) + : StatusBarItem(name, parent, true) +{ + m_projectPath = QString::fromUtf8(AZ::Utils::GetProjectPath().c_str()); + + SetText(QObject::tr("GameFolder: '%1'").arg(m_projectPath)); + SetToolTip(QObject::tr("Game Info")); + + setContextMenuPolicy(Qt::CustomContextMenu); + QObject::connect(this, &QWidget::customContextMenuRequested, this, &GameInfoItem::OnShowContextMenu); +} + +void GameInfoItem::OnShowContextMenu(const QPoint& pos) +{ + QMenu contextMenu(this); + + // Context menu action to open the project folder in file browser + contextMenu.addAction(AzQtComponents::fileBrowserActionName(), this, [this]() { + AzQtComponents::ShowFileOnDesktop(m_projectPath); + }); + + contextMenu.exec(mapToGlobal(pos)); +} + #include #include diff --git a/Code/Editor/MainStatusBarItems.h b/Code/Editor/MainStatusBarItems.h index 2a3a21e72a..5f8d618dca 100644 --- a/Code/Editor/MainStatusBarItems.h +++ b/Code/Editor/MainStatusBarItems.h @@ -71,3 +71,17 @@ public: private: void updateStatus(); }; + +class GameInfoItem + : public StatusBarItem +{ + Q_OBJECT +public: + GameInfoItem(QString name, MainStatusBar* parent); + +private Q_SLOTS: + void OnShowContextMenu(const QPoint& pos); + +private: + QString m_projectPath; +}; From 0ab59e939f6f9f7b7cdc4d12aa7599b556c67144 Mon Sep 17 00:00:00 2001 From: puvvadar Date: Thu, 26 Aug 2021 12:08:14 -0700 Subject: [PATCH 114/131] Update transport tests for PacketDispatchResult change Signed-off-by: puvvadar --- .../AzNetworking/Tests/TcpTransport/TcpTransportTests.cpp | 4 ++-- .../AzNetworking/Tests/UdpTransport/UdpTransportTests.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Code/Framework/AzNetworking/Tests/TcpTransport/TcpTransportTests.cpp b/Code/Framework/AzNetworking/Tests/TcpTransport/TcpTransportTests.cpp index ff2360b674..d06aac1a14 100644 --- a/Code/Framework/AzNetworking/Tests/TcpTransport/TcpTransportTests.cpp +++ b/Code/Framework/AzNetworking/Tests/TcpTransport/TcpTransportTests.cpp @@ -33,11 +33,11 @@ namespace UnitTest ; } - bool OnPacketReceived([[maybe_unused]] IConnection* connection, const IPacketHeader& packetHeader, [[maybe_unused]] ISerializer& serializer) + PacketDispatchResult OnPacketReceived([[maybe_unused]] IConnection* connection, const IPacketHeader& packetHeader, [[maybe_unused]] ISerializer& serializer) { EXPECT_TRUE((packetHeader.GetPacketType() == static_cast(CorePackets::PacketType::InitiateConnectionPacket)) || (packetHeader.GetPacketType() == static_cast(CorePackets::PacketType::HeartbeatPacket))); - return false; + return PacketDispatchResult::Failure; } void OnPacketLost([[maybe_unused]] IConnection* connection, [[maybe_unused]] PacketId packetId) diff --git a/Code/Framework/AzNetworking/Tests/UdpTransport/UdpTransportTests.cpp b/Code/Framework/AzNetworking/Tests/UdpTransport/UdpTransportTests.cpp index ca8de30db9..9cc3fd4b09 100644 --- a/Code/Framework/AzNetworking/Tests/UdpTransport/UdpTransportTests.cpp +++ b/Code/Framework/AzNetworking/Tests/UdpTransport/UdpTransportTests.cpp @@ -36,11 +36,11 @@ namespace UnitTest ; } - bool OnPacketReceived([[maybe_unused]] IConnection* connection, const IPacketHeader& packetHeader, [[maybe_unused]] ISerializer& serializer) + PacketDispatchResult OnPacketReceived([[maybe_unused]] IConnection* connection, const IPacketHeader& packetHeader, [[maybe_unused]] ISerializer& serializer) { EXPECT_TRUE((packetHeader.GetPacketType() == static_cast(CorePackets::PacketType::InitiateConnectionPacket)) || (packetHeader.GetPacketType() == static_cast(CorePackets::PacketType::HeartbeatPacket))); - return false; + return PacketDispatchResult::Failure; } void OnPacketLost([[maybe_unused]] IConnection* connection, [[maybe_unused]] PacketId packetId) From 0264a3e7a1494c7dc97ee9a4ecdbd06601be26be Mon Sep 17 00:00:00 2001 From: bosnichd Date: Thu, 26 Aug 2021 13:10:54 -0600 Subject: [PATCH 115/131] Various fixes and empty boilerplate files required for restricted platforms. (#3610) * Various fixes and empty boilerplate files required for restricted platforms. Signed-off-by: bosnichd * Add comments to address review feedback. Signed-off-by: bosnichd --- .../AzNetworking/Utilities/EncryptionCommon.cpp | 2 +- Code/Legacy/CryCommon/CMakeLists.txt | 6 ++++++ .../CryCommon/Platform/Android/crycommon_android.cmake | 7 +++++++ .../Platform/Android/crycommon_android_files.cmake | 7 +++++++ .../Legacy/CryCommon/Platform/Linux/crycommon_linux.cmake | 7 +++++++ .../CryCommon/Platform/Linux/crycommon_linux_files.cmake | 7 +++++++ Code/Legacy/CryCommon/Platform/Mac/crycommon_mac.cmake | 7 +++++++ .../CryCommon/Platform/Mac/crycommon_mac_files.cmake | 7 +++++++ .../CryCommon/Platform/Windows/crycommon_windows.cmake | 7 +++++++ .../Platform/Windows/crycommon_windows_files.cmake | 7 +++++++ Code/Legacy/CryCommon/Platform/iOS/crycommon_ios.cmake | 7 +++++++ .../CryCommon/Platform/iOS/crycommon_ios_files.cmake | 7 +++++++ Code/Legacy/CrySystem/CMakeLists.txt | 6 ++++++ .../CrySystem/Platform/Android/platform_android.cmake | 7 +++++++ .../Platform/Android/platform_android_files.cmake | 7 +++++++ Code/Legacy/CrySystem/Platform/Linux/platform_linux.cmake | 7 +++++++ .../CrySystem/Platform/Linux/platform_linux_files.cmake | 7 +++++++ Code/Legacy/CrySystem/Platform/Mac/platform_mac.cmake | 7 +++++++ .../CrySystem/Platform/Mac/platform_mac_files.cmake | 7 +++++++ .../CrySystem/Platform/Windows/platform_windows.cmake | 7 +++++++ .../Platform/Windows/platform_windows_files.cmake | 7 +++++++ Code/Legacy/CrySystem/Platform/iOS/platform_ios.cmake | 7 +++++++ .../CrySystem/Platform/iOS/platform_ios_files.cmake | 7 +++++++ Gems/LyShine/Code/Source/UiFaderComponent.cpp | 4 ++-- Gems/LyShine/Code/Source/UiImageComponent.cpp | 4 ++-- Gems/LyShine/Code/Source/UiImageSequenceComponent.cpp | 4 ++-- Gems/LyShine/Code/Source/UiMaskComponent.cpp | 6 +++--- Gems/LyShine/Code/Source/UiParticleEmitterComponent.cpp | 4 ++-- Gems/LyShine/Code/Source/UiTextComponent.cpp | 8 ++++---- 29 files changed, 168 insertions(+), 16 deletions(-) create mode 100644 Code/Legacy/CryCommon/Platform/Android/crycommon_android.cmake create mode 100644 Code/Legacy/CryCommon/Platform/Android/crycommon_android_files.cmake create mode 100644 Code/Legacy/CryCommon/Platform/Linux/crycommon_linux.cmake create mode 100644 Code/Legacy/CryCommon/Platform/Linux/crycommon_linux_files.cmake create mode 100644 Code/Legacy/CryCommon/Platform/Mac/crycommon_mac.cmake create mode 100644 Code/Legacy/CryCommon/Platform/Mac/crycommon_mac_files.cmake create mode 100644 Code/Legacy/CryCommon/Platform/Windows/crycommon_windows.cmake create mode 100644 Code/Legacy/CryCommon/Platform/Windows/crycommon_windows_files.cmake create mode 100644 Code/Legacy/CryCommon/Platform/iOS/crycommon_ios.cmake create mode 100644 Code/Legacy/CryCommon/Platform/iOS/crycommon_ios_files.cmake create mode 100644 Code/Legacy/CrySystem/Platform/Android/platform_android.cmake create mode 100644 Code/Legacy/CrySystem/Platform/Android/platform_android_files.cmake create mode 100644 Code/Legacy/CrySystem/Platform/Linux/platform_linux.cmake create mode 100644 Code/Legacy/CrySystem/Platform/Linux/platform_linux_files.cmake create mode 100644 Code/Legacy/CrySystem/Platform/Mac/platform_mac.cmake create mode 100644 Code/Legacy/CrySystem/Platform/Mac/platform_mac_files.cmake create mode 100644 Code/Legacy/CrySystem/Platform/Windows/platform_windows.cmake create mode 100644 Code/Legacy/CrySystem/Platform/Windows/platform_windows_files.cmake create mode 100644 Code/Legacy/CrySystem/Platform/iOS/platform_ios.cmake create mode 100644 Code/Legacy/CrySystem/Platform/iOS/platform_ios_files.cmake diff --git a/Code/Framework/AzNetworking/AzNetworking/Utilities/EncryptionCommon.cpp b/Code/Framework/AzNetworking/AzNetworking/Utilities/EncryptionCommon.cpp index 216342a6c5..57badcee4e 100644 --- a/Code/Framework/AzNetworking/AzNetworking/Utilities/EncryptionCommon.cpp +++ b/Code/Framework/AzNetworking/AzNetworking/Utilities/EncryptionCommon.cpp @@ -25,7 +25,7 @@ #if defined(OPENSSL_THREADS) // thread support enabled -#else +#elif AZ_TRAIT_USE_OPENSSL # error OpenSSL threading support is not enabled #endif diff --git a/Code/Legacy/CryCommon/CMakeLists.txt b/Code/Legacy/CryCommon/CMakeLists.txt index ce89757b5c..1556c6a099 100644 --- a/Code/Legacy/CryCommon/CMakeLists.txt +++ b/Code/Legacy/CryCommon/CMakeLists.txt @@ -6,15 +6,21 @@ # # +ly_get_list_relative_pal_filename(pal_dir ${CMAKE_CURRENT_LIST_DIR}/Platform/${PAL_PLATFORM_NAME}) + ly_add_target( NAME CryCommon STATIC NAMESPACE Legacy FILES_CMAKE crycommon_files.cmake + ${pal_dir}/crycommon_${PAL_PLATFORM_NAME_LOWERCASE}_files.cmake # Required for restricted platforms + PLATFORM_INCLUDE_FILES + ${pal_dir}/crycommon_${PAL_PLATFORM_NAME_LOWERCASE}.cmake # Required for restricted platforms INCLUDE_DIRECTORIES PUBLIC . # Lots of code without CryCommon/ .. # Dangerous since exports Legacy's path (client code can do CrySystem/ without depending on that target) + ${pal_dir} # Required for restricted platforms BUILD_DEPENDENCIES PUBLIC AZ::AzCore diff --git a/Code/Legacy/CryCommon/Platform/Android/crycommon_android.cmake b/Code/Legacy/CryCommon/Platform/Android/crycommon_android.cmake new file mode 100644 index 0000000000..7a325ca97e --- /dev/null +++ b/Code/Legacy/CryCommon/Platform/Android/crycommon_android.cmake @@ -0,0 +1,7 @@ +# +# Copyright (c) Contributors to the Open 3D Engine Project. +# For complete copyright and license terms please see the LICENSE at the root of this distribution. +# +# SPDX-License-Identifier: Apache-2.0 OR MIT +# +# diff --git a/Code/Legacy/CryCommon/Platform/Android/crycommon_android_files.cmake b/Code/Legacy/CryCommon/Platform/Android/crycommon_android_files.cmake new file mode 100644 index 0000000000..7a325ca97e --- /dev/null +++ b/Code/Legacy/CryCommon/Platform/Android/crycommon_android_files.cmake @@ -0,0 +1,7 @@ +# +# Copyright (c) Contributors to the Open 3D Engine Project. +# For complete copyright and license terms please see the LICENSE at the root of this distribution. +# +# SPDX-License-Identifier: Apache-2.0 OR MIT +# +# diff --git a/Code/Legacy/CryCommon/Platform/Linux/crycommon_linux.cmake b/Code/Legacy/CryCommon/Platform/Linux/crycommon_linux.cmake new file mode 100644 index 0000000000..7a325ca97e --- /dev/null +++ b/Code/Legacy/CryCommon/Platform/Linux/crycommon_linux.cmake @@ -0,0 +1,7 @@ +# +# Copyright (c) Contributors to the Open 3D Engine Project. +# For complete copyright and license terms please see the LICENSE at the root of this distribution. +# +# SPDX-License-Identifier: Apache-2.0 OR MIT +# +# diff --git a/Code/Legacy/CryCommon/Platform/Linux/crycommon_linux_files.cmake b/Code/Legacy/CryCommon/Platform/Linux/crycommon_linux_files.cmake new file mode 100644 index 0000000000..7a325ca97e --- /dev/null +++ b/Code/Legacy/CryCommon/Platform/Linux/crycommon_linux_files.cmake @@ -0,0 +1,7 @@ +# +# Copyright (c) Contributors to the Open 3D Engine Project. +# For complete copyright and license terms please see the LICENSE at the root of this distribution. +# +# SPDX-License-Identifier: Apache-2.0 OR MIT +# +# diff --git a/Code/Legacy/CryCommon/Platform/Mac/crycommon_mac.cmake b/Code/Legacy/CryCommon/Platform/Mac/crycommon_mac.cmake new file mode 100644 index 0000000000..7a325ca97e --- /dev/null +++ b/Code/Legacy/CryCommon/Platform/Mac/crycommon_mac.cmake @@ -0,0 +1,7 @@ +# +# Copyright (c) Contributors to the Open 3D Engine Project. +# For complete copyright and license terms please see the LICENSE at the root of this distribution. +# +# SPDX-License-Identifier: Apache-2.0 OR MIT +# +# diff --git a/Code/Legacy/CryCommon/Platform/Mac/crycommon_mac_files.cmake b/Code/Legacy/CryCommon/Platform/Mac/crycommon_mac_files.cmake new file mode 100644 index 0000000000..7a325ca97e --- /dev/null +++ b/Code/Legacy/CryCommon/Platform/Mac/crycommon_mac_files.cmake @@ -0,0 +1,7 @@ +# +# Copyright (c) Contributors to the Open 3D Engine Project. +# For complete copyright and license terms please see the LICENSE at the root of this distribution. +# +# SPDX-License-Identifier: Apache-2.0 OR MIT +# +# diff --git a/Code/Legacy/CryCommon/Platform/Windows/crycommon_windows.cmake b/Code/Legacy/CryCommon/Platform/Windows/crycommon_windows.cmake new file mode 100644 index 0000000000..7a325ca97e --- /dev/null +++ b/Code/Legacy/CryCommon/Platform/Windows/crycommon_windows.cmake @@ -0,0 +1,7 @@ +# +# Copyright (c) Contributors to the Open 3D Engine Project. +# For complete copyright and license terms please see the LICENSE at the root of this distribution. +# +# SPDX-License-Identifier: Apache-2.0 OR MIT +# +# diff --git a/Code/Legacy/CryCommon/Platform/Windows/crycommon_windows_files.cmake b/Code/Legacy/CryCommon/Platform/Windows/crycommon_windows_files.cmake new file mode 100644 index 0000000000..7a325ca97e --- /dev/null +++ b/Code/Legacy/CryCommon/Platform/Windows/crycommon_windows_files.cmake @@ -0,0 +1,7 @@ +# +# Copyright (c) Contributors to the Open 3D Engine Project. +# For complete copyright and license terms please see the LICENSE at the root of this distribution. +# +# SPDX-License-Identifier: Apache-2.0 OR MIT +# +# diff --git a/Code/Legacy/CryCommon/Platform/iOS/crycommon_ios.cmake b/Code/Legacy/CryCommon/Platform/iOS/crycommon_ios.cmake new file mode 100644 index 0000000000..7a325ca97e --- /dev/null +++ b/Code/Legacy/CryCommon/Platform/iOS/crycommon_ios.cmake @@ -0,0 +1,7 @@ +# +# Copyright (c) Contributors to the Open 3D Engine Project. +# For complete copyright and license terms please see the LICENSE at the root of this distribution. +# +# SPDX-License-Identifier: Apache-2.0 OR MIT +# +# diff --git a/Code/Legacy/CryCommon/Platform/iOS/crycommon_ios_files.cmake b/Code/Legacy/CryCommon/Platform/iOS/crycommon_ios_files.cmake new file mode 100644 index 0000000000..7a325ca97e --- /dev/null +++ b/Code/Legacy/CryCommon/Platform/iOS/crycommon_ios_files.cmake @@ -0,0 +1,7 @@ +# +# Copyright (c) Contributors to the Open 3D Engine Project. +# For complete copyright and license terms please see the LICENSE at the root of this distribution. +# +# SPDX-License-Identifier: Apache-2.0 OR MIT +# +# diff --git a/Code/Legacy/CrySystem/CMakeLists.txt b/Code/Legacy/CrySystem/CMakeLists.txt index 57e33c4cc0..9e1cf92267 100644 --- a/Code/Legacy/CrySystem/CMakeLists.txt +++ b/Code/Legacy/CrySystem/CMakeLists.txt @@ -6,6 +6,8 @@ # # +ly_get_list_relative_pal_filename(pal_dir ${CMAKE_CURRENT_LIST_DIR}/Platform/${PAL_PLATFORM_NAME}) + add_subdirectory(XML) ly_add_target( @@ -13,9 +15,13 @@ ly_add_target( NAMESPACE Legacy FILES_CMAKE crysystem_files.cmake + ${pal_dir}/platform_${PAL_PLATFORM_NAME_LOWERCASE}_files.cmake # Required for restricted platforms + PLATFORM_INCLUDE_FILES + ${pal_dir}/platform_${PAL_PLATFORM_NAME_LOWERCASE}.cmake # Required for restricted platforms INCLUDE_DIRECTORIES PUBLIC . + ${pal_dir} # Required for restricted platforms BUILD_DEPENDENCIES PRIVATE 3rdParty::expat diff --git a/Code/Legacy/CrySystem/Platform/Android/platform_android.cmake b/Code/Legacy/CrySystem/Platform/Android/platform_android.cmake new file mode 100644 index 0000000000..7a325ca97e --- /dev/null +++ b/Code/Legacy/CrySystem/Platform/Android/platform_android.cmake @@ -0,0 +1,7 @@ +# +# Copyright (c) Contributors to the Open 3D Engine Project. +# For complete copyright and license terms please see the LICENSE at the root of this distribution. +# +# SPDX-License-Identifier: Apache-2.0 OR MIT +# +# diff --git a/Code/Legacy/CrySystem/Platform/Android/platform_android_files.cmake b/Code/Legacy/CrySystem/Platform/Android/platform_android_files.cmake new file mode 100644 index 0000000000..7a325ca97e --- /dev/null +++ b/Code/Legacy/CrySystem/Platform/Android/platform_android_files.cmake @@ -0,0 +1,7 @@ +# +# Copyright (c) Contributors to the Open 3D Engine Project. +# For complete copyright and license terms please see the LICENSE at the root of this distribution. +# +# SPDX-License-Identifier: Apache-2.0 OR MIT +# +# diff --git a/Code/Legacy/CrySystem/Platform/Linux/platform_linux.cmake b/Code/Legacy/CrySystem/Platform/Linux/platform_linux.cmake new file mode 100644 index 0000000000..7a325ca97e --- /dev/null +++ b/Code/Legacy/CrySystem/Platform/Linux/platform_linux.cmake @@ -0,0 +1,7 @@ +# +# Copyright (c) Contributors to the Open 3D Engine Project. +# For complete copyright and license terms please see the LICENSE at the root of this distribution. +# +# SPDX-License-Identifier: Apache-2.0 OR MIT +# +# diff --git a/Code/Legacy/CrySystem/Platform/Linux/platform_linux_files.cmake b/Code/Legacy/CrySystem/Platform/Linux/platform_linux_files.cmake new file mode 100644 index 0000000000..7a325ca97e --- /dev/null +++ b/Code/Legacy/CrySystem/Platform/Linux/platform_linux_files.cmake @@ -0,0 +1,7 @@ +# +# Copyright (c) Contributors to the Open 3D Engine Project. +# For complete copyright and license terms please see the LICENSE at the root of this distribution. +# +# SPDX-License-Identifier: Apache-2.0 OR MIT +# +# diff --git a/Code/Legacy/CrySystem/Platform/Mac/platform_mac.cmake b/Code/Legacy/CrySystem/Platform/Mac/platform_mac.cmake new file mode 100644 index 0000000000..7a325ca97e --- /dev/null +++ b/Code/Legacy/CrySystem/Platform/Mac/platform_mac.cmake @@ -0,0 +1,7 @@ +# +# Copyright (c) Contributors to the Open 3D Engine Project. +# For complete copyright and license terms please see the LICENSE at the root of this distribution. +# +# SPDX-License-Identifier: Apache-2.0 OR MIT +# +# diff --git a/Code/Legacy/CrySystem/Platform/Mac/platform_mac_files.cmake b/Code/Legacy/CrySystem/Platform/Mac/platform_mac_files.cmake new file mode 100644 index 0000000000..7a325ca97e --- /dev/null +++ b/Code/Legacy/CrySystem/Platform/Mac/platform_mac_files.cmake @@ -0,0 +1,7 @@ +# +# Copyright (c) Contributors to the Open 3D Engine Project. +# For complete copyright and license terms please see the LICENSE at the root of this distribution. +# +# SPDX-License-Identifier: Apache-2.0 OR MIT +# +# diff --git a/Code/Legacy/CrySystem/Platform/Windows/platform_windows.cmake b/Code/Legacy/CrySystem/Platform/Windows/platform_windows.cmake new file mode 100644 index 0000000000..7a325ca97e --- /dev/null +++ b/Code/Legacy/CrySystem/Platform/Windows/platform_windows.cmake @@ -0,0 +1,7 @@ +# +# Copyright (c) Contributors to the Open 3D Engine Project. +# For complete copyright and license terms please see the LICENSE at the root of this distribution. +# +# SPDX-License-Identifier: Apache-2.0 OR MIT +# +# diff --git a/Code/Legacy/CrySystem/Platform/Windows/platform_windows_files.cmake b/Code/Legacy/CrySystem/Platform/Windows/platform_windows_files.cmake new file mode 100644 index 0000000000..7a325ca97e --- /dev/null +++ b/Code/Legacy/CrySystem/Platform/Windows/platform_windows_files.cmake @@ -0,0 +1,7 @@ +# +# Copyright (c) Contributors to the Open 3D Engine Project. +# For complete copyright and license terms please see the LICENSE at the root of this distribution. +# +# SPDX-License-Identifier: Apache-2.0 OR MIT +# +# diff --git a/Code/Legacy/CrySystem/Platform/iOS/platform_ios.cmake b/Code/Legacy/CrySystem/Platform/iOS/platform_ios.cmake new file mode 100644 index 0000000000..7a325ca97e --- /dev/null +++ b/Code/Legacy/CrySystem/Platform/iOS/platform_ios.cmake @@ -0,0 +1,7 @@ +# +# Copyright (c) Contributors to the Open 3D Engine Project. +# For complete copyright and license terms please see the LICENSE at the root of this distribution. +# +# SPDX-License-Identifier: Apache-2.0 OR MIT +# +# diff --git a/Code/Legacy/CrySystem/Platform/iOS/platform_ios_files.cmake b/Code/Legacy/CrySystem/Platform/iOS/platform_ios_files.cmake new file mode 100644 index 0000000000..7a325ca97e --- /dev/null +++ b/Code/Legacy/CrySystem/Platform/iOS/platform_ios_files.cmake @@ -0,0 +1,7 @@ +# +# Copyright (c) Contributors to the Open 3D Engine Project. +# For complete copyright and license terms please see the LICENSE at the root of this distribution. +# +# SPDX-License-Identifier: Apache-2.0 OR MIT +# +# diff --git a/Gems/LyShine/Code/Source/UiFaderComponent.cpp b/Gems/LyShine/Code/Source/UiFaderComponent.cpp index e7eca04c59..d9309a7505 100644 --- a/Gems/LyShine/Code/Source/UiFaderComponent.cpp +++ b/Gems/LyShine/Code/Source/UiFaderComponent.cpp @@ -575,7 +575,7 @@ void UiFaderComponent::RenderRttFader(LyShine::IRenderGraph* renderGraph, UiElem AZ::Color clearColor(0.0f, 0.0f, 0.0f, 0.0f); // Start building the render to texture node in the render graph - LyShine::RenderGraph* lyRenderGraph = dynamic_cast(renderGraph); + LyShine::RenderGraph* lyRenderGraph = static_cast(renderGraph); // LYSHINE_ATOM_TODO - find a different solution from downcasting - GHI #3570 lyRenderGraph->BeginRenderToTexture(attachmentImage, m_viewportTopLeft, m_viewportSize, clearColor); // We don't want this fader or parent faders to affect what is rendered to the render target since we will @@ -615,7 +615,7 @@ void UiFaderComponent::RenderRttFader(LyShine::IRenderGraph* renderGraph, UiElem // Add a primitive to render a quad using the render target we have created { - LyShine::RenderGraph* lyRenderGraph = dynamic_cast(renderGraph); + LyShine::RenderGraph* lyRenderGraph = static_cast(renderGraph); // LYSHINE_ATOM_TODO - find a different solution from downcasting - GHI #3570 if (lyRenderGraph) { // Set the texture and other render state required diff --git a/Gems/LyShine/Code/Source/UiImageComponent.cpp b/Gems/LyShine/Code/Source/UiImageComponent.cpp index e01e87aadd..fac8a83c71 100644 --- a/Gems/LyShine/Code/Source/UiImageComponent.cpp +++ b/Gems/LyShine/Code/Source/UiImageComponent.cpp @@ -280,7 +280,7 @@ namespace AZ::Data::Instance image; if (sprite) { - CSprite* cSprite = dynamic_cast(sprite); // LYSHINE_ATOM_TODO - find a different solution from downcasting + CSprite* cSprite = static_cast(sprite); // LYSHINE_ATOM_TODO - find a different solution from downcasting - GHI #3570 if (cSprite) { image = cSprite->GetImage(); @@ -484,7 +484,7 @@ void UiImageComponent::Render(LyShine::IRenderGraph* renderGraph) bool isTextureSRGB = IsSpriteTypeRenderTarget() && m_isRenderTargetSRGB; bool isTexturePremultipliedAlpha = false; // we are not rendering from a render target with alpha in it - LyShine::RenderGraph* lyRenderGraph = dynamic_cast(renderGraph); // LYSHINE_ATOM_TODO - find a different solution from downcasting + LyShine::RenderGraph* lyRenderGraph = static_cast(renderGraph); // LYSHINE_ATOM_TODO - find a different solution from downcasting - GHI #3570 if (lyRenderGraph) { lyRenderGraph->AddPrimitiveAtom(&m_cachedPrimitive, image, isClampTextureMode, isTextureSRGB, isTexturePremultipliedAlpha, m_blendMode); diff --git a/Gems/LyShine/Code/Source/UiImageSequenceComponent.cpp b/Gems/LyShine/Code/Source/UiImageSequenceComponent.cpp index d16242fa05..d954cf2747 100644 --- a/Gems/LyShine/Code/Source/UiImageSequenceComponent.cpp +++ b/Gems/LyShine/Code/Source/UiImageSequenceComponent.cpp @@ -97,7 +97,7 @@ void UiImageSequenceComponent::Render(LyShine::IRenderGraph* renderGraph) return; } - CSprite* sprite = dynamic_cast(m_spriteList[m_sequenceIndex]); + CSprite* sprite = static_cast(m_spriteList[m_sequenceIndex]); // LYSHINE_ATOM_TODO - find a different solution from downcasting - GHI #3570 // get fade value (tracked by UiRenderer) and compute the desired alpha for the image float fade = renderGraph->GetAlphaFade(); @@ -165,7 +165,7 @@ void UiImageSequenceComponent::Render(LyShine::IRenderGraph* renderGraph) LyShine::BlendMode blendMode = LyShine::BlendMode::Normal; // Add the quad to the render graph - LyShine::RenderGraph* lyRenderGraph = dynamic_cast(renderGraph); + LyShine::RenderGraph* lyRenderGraph = static_cast(renderGraph); // LYSHINE_ATOM_TODO - find a different solution from downcasting - GHI #3570 if (lyRenderGraph) { lyRenderGraph->AddPrimitiveAtom(&m_cachedPrimitive, image, diff --git a/Gems/LyShine/Code/Source/UiMaskComponent.cpp b/Gems/LyShine/Code/Source/UiMaskComponent.cpp index d6ed468deb..b6ffc2ae89 100644 --- a/Gems/LyShine/Code/Source/UiMaskComponent.cpp +++ b/Gems/LyShine/Code/Source/UiMaskComponent.cpp @@ -722,7 +722,7 @@ void UiMaskComponent::RenderUsingGradientMask(LyShine::IRenderGraph* renderGraph // mask render target { // Start building the render to texture node in the render graph - LyShine::RenderGraph* lyRenderGraph = dynamic_cast(renderGraph); + LyShine::RenderGraph* lyRenderGraph = static_cast(renderGraph); // LYSHINE_ATOM_TODO - find a different solution from downcasting - GHI #3570 lyRenderGraph->BeginRenderToTexture(maskAttachmentImage, m_viewportTopLeft, m_viewportSize, clearColor); // Render the visual component for this element (if there is one) plus the child mask element (if there is one) @@ -735,7 +735,7 @@ void UiMaskComponent::RenderUsingGradientMask(LyShine::IRenderGraph* renderGraph // content render target { // Start building the render to texture node for the content render target in the render graph - LyShine::RenderGraph* lyRenderGraph = dynamic_cast(renderGraph); + LyShine::RenderGraph* lyRenderGraph = static_cast(renderGraph); // LYSHINE_ATOM_TODO - find a different solution from downcasting - GHI #3570 lyRenderGraph->BeginRenderToTexture(contentAttachmentImage, m_viewportTopLeft, m_viewportSize, clearColor); // Render the "content" - the child elements excluding the child mask element (if any) @@ -772,7 +772,7 @@ void UiMaskComponent::RenderUsingGradientMask(LyShine::IRenderGraph* renderGraph // Add a primitive to do the alpha mask { - LyShine::RenderGraph* lyRenderGraph = dynamic_cast(renderGraph); + LyShine::RenderGraph* lyRenderGraph = static_cast(renderGraph); // LYSHINE_ATOM_TODO - find a different solution from downcasting - GHI #3570 if (lyRenderGraph) { // Set the texture and other render state required diff --git a/Gems/LyShine/Code/Source/UiParticleEmitterComponent.cpp b/Gems/LyShine/Code/Source/UiParticleEmitterComponent.cpp index 0adf2fb2de..c6fd144d3a 100644 --- a/Gems/LyShine/Code/Source/UiParticleEmitterComponent.cpp +++ b/Gems/LyShine/Code/Source/UiParticleEmitterComponent.cpp @@ -785,7 +785,7 @@ void UiParticleEmitterComponent::Render(LyShine::IRenderGraph* renderGraph) AZ::Data::Instance image; if (m_sprite) { - CSprite* sprite = dynamic_cast(m_sprite); + CSprite* sprite = static_cast(m_sprite); // LYSHINE_ATOM_TODO - find a different solution from downcasting - GHI #3570 if (sprite) { image = sprite->GetImage(); @@ -843,7 +843,7 @@ void UiParticleEmitterComponent::Render(LyShine::IRenderGraph* renderGraph) m_cachedPrimitive.m_numVertices = totalVerticesInserted; m_cachedPrimitive.m_numIndices = totalParticlesInserted * indicesPerParticle; - LyShine::RenderGraph* lyRenderGraph = dynamic_cast(renderGraph); + LyShine::RenderGraph* lyRenderGraph = static_cast(renderGraph); // LYSHINE_ATOM_TODO - find a different solution from downcasting - GHI #3570 if (lyRenderGraph) { lyRenderGraph->AddPrimitiveAtom(&m_cachedPrimitive, image, isClampTextureMode, isTextureSRGB, isTexturePremultipliedAlpha, m_blendMode); diff --git a/Gems/LyShine/Code/Source/UiTextComponent.cpp b/Gems/LyShine/Code/Source/UiTextComponent.cpp index 60213878c9..1c8189fa2a 100644 --- a/Gems/LyShine/Code/Source/UiTextComponent.cpp +++ b/Gems/LyShine/Code/Source/UiTextComponent.cpp @@ -1830,7 +1830,7 @@ void UiTextComponent::Render(LyShine::IRenderGraph* renderGraph) DynUiPrimitive* primitive = renderGraph->GetDynamicQuadPrimitive(rect.pt, packedColor); primitive->m_next = nullptr; - LyShine::RenderGraph* lyRenderGraph = dynamic_cast(renderGraph); + LyShine::RenderGraph* lyRenderGraph = static_cast(renderGraph); // LYSHINE_ATOM_TODO - find a different solution from downcasting - GHI #3570 if (lyRenderGraph) { lyRenderGraph->AddPrimitiveAtom(primitive, systemImage, isClampTextureMode, isTextureSRGB, isTexturePremultipliedAlpha, blendMode); @@ -1856,7 +1856,7 @@ void UiTextComponent::Render(LyShine::IRenderGraph* renderGraph) } bool isClampTextureMode = true; - LyShine::RenderGraph* lyRenderGraph = dynamic_cast(renderGraph); + LyShine::RenderGraph* lyRenderGraph = static_cast(renderGraph); // LYSHINE_ATOM_TODO - find a different solution from downcasting - GHI #3570 if (lyRenderGraph) { lyRenderGraph->AddPrimitiveAtom(&batch->m_cachedPrimitive, texture, @@ -1871,7 +1871,7 @@ void UiTextComponent::Render(LyShine::IRenderGraph* renderGraph) for (RenderCacheBatch* batch : m_renderCache.m_batches) { - AZ::FFont* font = static_cast(batch->m_font); // LYSHINE_ATOM_TODO - find a different solution from downcasting FFont to IFont + AZ::FFont* font = static_cast(batch->m_font); // LYSHINE_ATOM_TODO - find a different solution from downcasting - GHI #3570 AZ::Data::Instance fontImage = font->GetFontImage(); if (fontImage) { @@ -1894,7 +1894,7 @@ void UiTextComponent::Render(LyShine::IRenderGraph* renderGraph) // because there is no padding on the left of the glyphs. bool isClampTextureMode = false; - LyShine::RenderGraph* lyRenderGraph = static_cast(renderGraph); // LYSHINE_ATOM_TODO - find a different solution from downcasting + LyShine::RenderGraph* lyRenderGraph = static_cast(renderGraph); // LYSHINE_ATOM_TODO - find a different solution from downcasting - GHI #3570 if (lyRenderGraph) { lyRenderGraph->AddPrimitiveAtom(&batch->m_cachedPrimitive, fontImage, From ec0278b89954d4406d881127df01a16650fddb08 Mon Sep 17 00:00:00 2001 From: Chris Burel Date: Thu, 26 Aug 2021 12:57:45 -0700 Subject: [PATCH 116/131] Configure default Atom assets to be enabled on the linux platform (#3611) Signed-off-by: Chris Burel --- .../Code/Source/Editor/EditorCommon.cpp | 4 ++++ .../Source/Platform/Linux/ImageProcessing_Traits_Linux.h | 2 +- .../Code/Tests/ImageProcessing_Test.cpp | 2 +- .../ImageProcessingAtom/Config/ImageBuilder.settings | 6 ++++++ .../DiffuseProbeGridBlendDistance.precompiledshader | 2 +- .../DiffuseProbeGridBlendIrradiance.precompiledshader | 2 +- .../DiffuseProbeGridBorderUpdateColumn.precompiledshader | 2 +- .../DiffuseProbeGridBorderUpdateRow.precompiledshader | 2 +- .../DiffuseProbeGridClassification.precompiledshader | 2 +- .../DiffuseProbeGridRayTracing.precompiledshader | 2 +- ...DiffuseProbeGridRayTracingClosestHit.precompiledshader | 2 +- .../DiffuseProbeGridRayTracingMiss.precompiledshader | 2 +- .../DiffuseProbeGridRelocation.precompiledshader | 2 +- .../DiffuseProbeGridRender.precompiledshader | 2 +- .../Assets/Textures/PostProcessing/AreaTex.dds.assetinfo | 8 ++++++++ .../Textures/PostProcessing/SearchTex.dds.assetinfo | 8 ++++++++ .../Textures/Foliage_Leaves_0_BaseColor.dds.assetinfo | 8 ++++++++ 17 files changed, 46 insertions(+), 12 deletions(-) diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Editor/EditorCommon.cpp b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Editor/EditorCommon.cpp index 8ce8b2d487..c6f1398703 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Editor/EditorCommon.cpp +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Editor/EditorCommon.cpp @@ -103,6 +103,10 @@ namespace ImageProcessingAtomEditor { readableString = "PC"; } + else if (platformStrLowerCase == "linux") + { + readableString = "Linux"; + } else if (platformStrLowerCase == "android") { readableString = "Android"; diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Platform/Linux/ImageProcessing_Traits_Linux.h b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Platform/Linux/ImageProcessing_Traits_Linux.h index b4efe031fd..19b7621f8a 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Platform/Linux/ImageProcessing_Traits_Linux.h +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Platform/Linux/ImageProcessing_Traits_Linux.h @@ -8,7 +8,7 @@ #pragma once #define AZ_TRAIT_IMAGEPROCESSING_BESSEL_FUNCTION_FIRST_ORDER j1 -#define AZ_TRAIT_IMAGEPROCESSING_DEFAULT_PLATFORM "pc" +#define AZ_TRAIT_IMAGEPROCESSING_DEFAULT_PLATFORM "linux" #define AZ_TRAIT_IMAGEPROCESSING_DEFINE_DIRECT3D_CONSTANTS 0 #define AZ_TRAIT_IMAGEPROCESSING_PVRTEXLIB_USE_WINDLL_IMPORT 0 #define AZ_TRAIT_IMAGEPROCESSING_SQUISH_DO_NOT_USE_FASTCALL 1 diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/ImageProcessing_Test.cpp b/Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/ImageProcessing_Test.cpp index 6395913f7a..20aa1e927d 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/ImageProcessing_Test.cpp +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/ImageProcessing_Test.cpp @@ -928,7 +928,7 @@ namespace UnitTest PlatformNameList platforms = BuilderSettingManager::Instance()->GetPlatformList(); #ifndef AZ_TOOLS_EXPAND_FOR_RESTRICTED_PLATFORMS - ASSERT_TRUE(platforms.size() == 4); + EXPECT_THAT(platforms, testing::UnorderedPointwise(testing::Eq(), {"pc", "linux", "mac", "ios", "android"})); #endif //AZ_TOOLS_EXPAND_FOR_RESTRICTED_PLATFORMS } diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Config/ImageBuilder.settings b/Gems/Atom/Asset/ImageProcessingAtom/Config/ImageBuilder.settings index 82a57dd614..c513e05a97 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Config/ImageBuilder.settings +++ b/Gems/Atom/Asset/ImageProcessingAtom/Config/ImageBuilder.settings @@ -29,6 +29,12 @@ "Streaming": false, "Enable": true }, + "linux": { + "GlossScale": 16.0, + "GlossBias": 0.0, + "Streaming": false, + "Enable": true + }, "provo": { "GlossScale": 16.0, "GlossBias": 0.0, diff --git a/Gems/Atom/Feature/Common/Assets/Shaders/DiffuseGlobalIllumination/DiffuseProbeGridBlendDistance.precompiledshader b/Gems/Atom/Feature/Common/Assets/Shaders/DiffuseGlobalIllumination/DiffuseProbeGridBlendDistance.precompiledshader index 0322f750a4..be1d87ff3e 100644 --- a/Gems/Atom/Feature/Common/Assets/Shaders/DiffuseGlobalIllumination/DiffuseProbeGridBlendDistance.precompiledshader +++ b/Gems/Atom/Feature/Common/Assets/Shaders/DiffuseGlobalIllumination/DiffuseProbeGridBlendDistance.precompiledshader @@ -7,7 +7,7 @@ "ShaderAssetFileName": "diffuseprobegridblenddistance.azshader", "PlatformIdentifiers": [ - "pc" + "pc", "linux" ], "RootShaderVariantAssets": [ diff --git a/Gems/Atom/Feature/Common/Assets/Shaders/DiffuseGlobalIllumination/DiffuseProbeGridBlendIrradiance.precompiledshader b/Gems/Atom/Feature/Common/Assets/Shaders/DiffuseGlobalIllumination/DiffuseProbeGridBlendIrradiance.precompiledshader index f6b19e6f5b..92fb12d5cc 100644 --- a/Gems/Atom/Feature/Common/Assets/Shaders/DiffuseGlobalIllumination/DiffuseProbeGridBlendIrradiance.precompiledshader +++ b/Gems/Atom/Feature/Common/Assets/Shaders/DiffuseGlobalIllumination/DiffuseProbeGridBlendIrradiance.precompiledshader @@ -7,7 +7,7 @@ "ShaderAssetFileName": "diffuseprobegridblendirradiance.azshader", "PlatformIdentifiers": [ - "pc" + "pc", "linux" ], "RootShaderVariantAssets": [ diff --git a/Gems/Atom/Feature/Common/Assets/Shaders/DiffuseGlobalIllumination/DiffuseProbeGridBorderUpdateColumn.precompiledshader b/Gems/Atom/Feature/Common/Assets/Shaders/DiffuseGlobalIllumination/DiffuseProbeGridBorderUpdateColumn.precompiledshader index e9ab96b088..8de77320f0 100644 --- a/Gems/Atom/Feature/Common/Assets/Shaders/DiffuseGlobalIllumination/DiffuseProbeGridBorderUpdateColumn.precompiledshader +++ b/Gems/Atom/Feature/Common/Assets/Shaders/DiffuseGlobalIllumination/DiffuseProbeGridBorderUpdateColumn.precompiledshader @@ -7,7 +7,7 @@ "ShaderAssetFileName": "diffuseprobegridborderupdatecolumn.azshader", "PlatformIdentifiers": [ - "pc" + "pc", "linux" ], "RootShaderVariantAssets": [ diff --git a/Gems/Atom/Feature/Common/Assets/Shaders/DiffuseGlobalIllumination/DiffuseProbeGridBorderUpdateRow.precompiledshader b/Gems/Atom/Feature/Common/Assets/Shaders/DiffuseGlobalIllumination/DiffuseProbeGridBorderUpdateRow.precompiledshader index bbfd19ce48..274dae91af 100644 --- a/Gems/Atom/Feature/Common/Assets/Shaders/DiffuseGlobalIllumination/DiffuseProbeGridBorderUpdateRow.precompiledshader +++ b/Gems/Atom/Feature/Common/Assets/Shaders/DiffuseGlobalIllumination/DiffuseProbeGridBorderUpdateRow.precompiledshader @@ -7,7 +7,7 @@ "ShaderAssetFileName": "diffuseprobegridborderupdaterow.azshader", "PlatformIdentifiers": [ - "pc" + "pc", "linux" ], "RootShaderVariantAssets": [ diff --git a/Gems/Atom/Feature/Common/Assets/Shaders/DiffuseGlobalIllumination/DiffuseProbeGridClassification.precompiledshader b/Gems/Atom/Feature/Common/Assets/Shaders/DiffuseGlobalIllumination/DiffuseProbeGridClassification.precompiledshader index 75fbd1d7a3..85f75e6364 100644 --- a/Gems/Atom/Feature/Common/Assets/Shaders/DiffuseGlobalIllumination/DiffuseProbeGridClassification.precompiledshader +++ b/Gems/Atom/Feature/Common/Assets/Shaders/DiffuseGlobalIllumination/DiffuseProbeGridClassification.precompiledshader @@ -7,7 +7,7 @@ "ShaderAssetFileName": "diffuseprobegridclassification.azshader", "PlatformIdentifiers": [ - "pc" + "pc", "linux" ], "RootShaderVariantAssets": [ diff --git a/Gems/Atom/Feature/Common/Assets/Shaders/DiffuseGlobalIllumination/DiffuseProbeGridRayTracing.precompiledshader b/Gems/Atom/Feature/Common/Assets/Shaders/DiffuseGlobalIllumination/DiffuseProbeGridRayTracing.precompiledshader index a9f75bff7d..88aa115b63 100644 --- a/Gems/Atom/Feature/Common/Assets/Shaders/DiffuseGlobalIllumination/DiffuseProbeGridRayTracing.precompiledshader +++ b/Gems/Atom/Feature/Common/Assets/Shaders/DiffuseGlobalIllumination/DiffuseProbeGridRayTracing.precompiledshader @@ -7,7 +7,7 @@ "ShaderAssetFileName": "diffuseprobegridraytracing.azshader", "PlatformIdentifiers": [ - "pc" + "pc", "linux" ], "RootShaderVariantAssets": [ diff --git a/Gems/Atom/Feature/Common/Assets/Shaders/DiffuseGlobalIllumination/DiffuseProbeGridRayTracingClosestHit.precompiledshader b/Gems/Atom/Feature/Common/Assets/Shaders/DiffuseGlobalIllumination/DiffuseProbeGridRayTracingClosestHit.precompiledshader index 15fb9ecf52..948fc793ab 100644 --- a/Gems/Atom/Feature/Common/Assets/Shaders/DiffuseGlobalIllumination/DiffuseProbeGridRayTracingClosestHit.precompiledshader +++ b/Gems/Atom/Feature/Common/Assets/Shaders/DiffuseGlobalIllumination/DiffuseProbeGridRayTracingClosestHit.precompiledshader @@ -7,7 +7,7 @@ "ShaderAssetFileName": "diffuseprobegridraytracingclosesthit.azshader", "PlatformIdentifiers": [ - "pc" + "pc", "linux" ], "RootShaderVariantAssets": [ diff --git a/Gems/Atom/Feature/Common/Assets/Shaders/DiffuseGlobalIllumination/DiffuseProbeGridRayTracingMiss.precompiledshader b/Gems/Atom/Feature/Common/Assets/Shaders/DiffuseGlobalIllumination/DiffuseProbeGridRayTracingMiss.precompiledshader index 38bb7e3de0..dec0e244b1 100644 --- a/Gems/Atom/Feature/Common/Assets/Shaders/DiffuseGlobalIllumination/DiffuseProbeGridRayTracingMiss.precompiledshader +++ b/Gems/Atom/Feature/Common/Assets/Shaders/DiffuseGlobalIllumination/DiffuseProbeGridRayTracingMiss.precompiledshader @@ -7,7 +7,7 @@ "ShaderAssetFileName": "diffuseprobegridraytracingmiss.azshader", "PlatformIdentifiers": [ - "pc" + "pc", "linux" ], "RootShaderVariantAssets": [ diff --git a/Gems/Atom/Feature/Common/Assets/Shaders/DiffuseGlobalIllumination/DiffuseProbeGridRelocation.precompiledshader b/Gems/Atom/Feature/Common/Assets/Shaders/DiffuseGlobalIllumination/DiffuseProbeGridRelocation.precompiledshader index 3517cd7955..e09a29a7e8 100644 --- a/Gems/Atom/Feature/Common/Assets/Shaders/DiffuseGlobalIllumination/DiffuseProbeGridRelocation.precompiledshader +++ b/Gems/Atom/Feature/Common/Assets/Shaders/DiffuseGlobalIllumination/DiffuseProbeGridRelocation.precompiledshader @@ -7,7 +7,7 @@ "ShaderAssetFileName": "diffuseprobegridrelocation.azshader", "PlatformIdentifiers": [ - "pc" + "pc", "linux" ], "RootShaderVariantAssets": [ diff --git a/Gems/Atom/Feature/Common/Assets/Shaders/DiffuseGlobalIllumination/DiffuseProbeGridRender.precompiledshader b/Gems/Atom/Feature/Common/Assets/Shaders/DiffuseGlobalIllumination/DiffuseProbeGridRender.precompiledshader index 29f9476ceb..279deaaa29 100644 --- a/Gems/Atom/Feature/Common/Assets/Shaders/DiffuseGlobalIllumination/DiffuseProbeGridRender.precompiledshader +++ b/Gems/Atom/Feature/Common/Assets/Shaders/DiffuseGlobalIllumination/DiffuseProbeGridRender.precompiledshader @@ -7,7 +7,7 @@ "ShaderAssetFileName": "diffuseprobegridrender.azshader", "PlatformIdentifiers": [ - "pc" + "pc", "linux" ], "RootShaderVariantAssets": [ diff --git a/Gems/Atom/Feature/Common/Assets/Textures/PostProcessing/AreaTex.dds.assetinfo b/Gems/Atom/Feature/Common/Assets/Textures/PostProcessing/AreaTex.dds.assetinfo index 72a7948174..4462730464 100644 --- a/Gems/Atom/Feature/Common/Assets/Textures/PostProcessing/AreaTex.dds.assetinfo +++ b/Gems/Atom/Feature/Common/Assets/Textures/PostProcessing/AreaTex.dds.assetinfo @@ -62,6 +62,14 @@ + + + + + + + + diff --git a/Gems/Atom/Feature/Common/Assets/Textures/PostProcessing/SearchTex.dds.assetinfo b/Gems/Atom/Feature/Common/Assets/Textures/PostProcessing/SearchTex.dds.assetinfo index 86d698d24e..0f6348f410 100644 --- a/Gems/Atom/Feature/Common/Assets/Textures/PostProcessing/SearchTex.dds.assetinfo +++ b/Gems/Atom/Feature/Common/Assets/Textures/PostProcessing/SearchTex.dds.assetinfo @@ -62,6 +62,14 @@ + + + + + + + + diff --git a/Gems/Atom/TestData/TestData/Textures/Foliage_Leaves_0_BaseColor.dds.assetinfo b/Gems/Atom/TestData/TestData/Textures/Foliage_Leaves_0_BaseColor.dds.assetinfo index 1aa896a8d7..8a189b3b98 100644 --- a/Gems/Atom/TestData/TestData/Textures/Foliage_Leaves_0_BaseColor.dds.assetinfo +++ b/Gems/Atom/TestData/TestData/Textures/Foliage_Leaves_0_BaseColor.dds.assetinfo @@ -62,6 +62,14 @@ + + + + + + + + From 34939dcb1027f1ad323bbfed985b3510f4b46405 Mon Sep 17 00:00:00 2001 From: chcurran <82187351+carlitosan@users.noreply.github.com> Date: Thu, 26 Aug 2021 13:14:21 -0700 Subject: [PATCH 117/131] add missing [[maybe_unused]] tags to Store() calls of serializers Signed-off-by: chcurran <82187351+carlitosan@users.noreply.github.com> --- .../Code/Source/ElementInformationSerializer.inl | 3 ++- .../Code/Source/ExpressionPrimitivesSerializers.inl | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Gems/ExpressionEvaluation/Code/Source/ElementInformationSerializer.inl b/Gems/ExpressionEvaluation/Code/Source/ElementInformationSerializer.inl index 9796bbb39b..c2cd377039 100644 --- a/Gems/ExpressionEvaluation/Code/Source/ElementInformationSerializer.inl +++ b/Gems/ExpressionEvaluation/Code/Source/ElementInformationSerializer.inl @@ -107,7 +107,8 @@ namespace AZ ( rapidjson::Value& outputValue , const void* inputValue , const void* defaultValue - , const Uuid& valueTypeId, JsonSerializerContext& context) override + , [[maybe_unused]] const Uuid& valueTypeId + , JsonSerializerContext& context) override { namespace JSR = JsonSerializationResult; diff --git a/Gems/ExpressionEvaluation/Code/Source/ExpressionPrimitivesSerializers.inl b/Gems/ExpressionEvaluation/Code/Source/ExpressionPrimitivesSerializers.inl index 1eaee38702..be9ddb4f20 100644 --- a/Gems/ExpressionEvaluation/Code/Source/ExpressionPrimitivesSerializers.inl +++ b/Gems/ExpressionEvaluation/Code/Source/ExpressionPrimitivesSerializers.inl @@ -89,7 +89,8 @@ namespace AZ ( rapidjson::Value& outputValue , const void* inputValue , const void* defaultValue - , const Uuid& valueTypeId, JsonSerializerContext& context) override + , [[maybe_unused]] const Uuid& valueTypeId + , JsonSerializerContext& context) override { namespace JSR = JsonSerializationResult; From 9f55212a199b77d6c25247fda090db162d0f2a17 Mon Sep 17 00:00:00 2001 From: jromnoa <80134229+jromnoa@users.noreply.github.com> Date: Thu, 26 Aug 2021 14:25:24 -0700 Subject: [PATCH 118/131] Adds MaterialEditor RHI launch tests (#3558) * adds MaterialEditor RHI launch tests * add explicit editor_script parameter to the launch_and_validate_results() call Signed-off-by: jromnoa --- .../atom_renderer/test_Atom_GPUTests.py | 36 +++++++++++++++++++ .../atom_renderer/test_Atom_MainSuite.py | 1 + 2 files changed, 37 insertions(+) diff --git a/AutomatedTesting/Gem/PythonTests/atom_renderer/test_Atom_GPUTests.py b/AutomatedTesting/Gem/PythonTests/atom_renderer/test_Atom_GPUTests.py index 7be1ed1b12..047f46a40f 100644 --- a/AutomatedTesting/Gem/PythonTests/atom_renderer/test_Atom_GPUTests.py +++ b/AutomatedTesting/Gem/PythonTests/atom_renderer/test_Atom_GPUTests.py @@ -181,3 +181,39 @@ class TestPerformanceBenchmarkSuite(object): aggregator = BenchmarkDataAggregator(workspace, logger, 'periodic') aggregator.upload_metrics(rhi) + + +@pytest.mark.parametrize("project", ["AutomatedTesting"]) +@pytest.mark.parametrize("launcher_platform", ['windows_generic']) +@pytest.mark.system +class TestMaterialEditor(object): + + @pytest.mark.parametrize("cfg_args", ["-rhi=dx12", "-rhi=Vulkan"]) + @pytest.mark.parametrize("exe_file_name", ["MaterialEditor"]) + def test_MaterialEditorLaunch_AllRHIOptionsSucceed( + self, request, workspace, project, launcher_platform, generic_launcher, exe_file_name, cfg_args): + """ + Tests each valid RHI option (Null RHI excluded) can be launched with the MaterialEditor. + Checks for the "Finished loading viewport configurtions." success message post lounch. + """ + expected_lines = ["Finished loading viewport configurtions."] + unexpected_lines = [ + # "Trace::Assert", + # "Trace::Error", + "Traceback (most recent call last):", + ] + + hydra.launch_and_validate_results( + request, + TEST_DIRECTORY, + generic_launcher, + editor_script="", + run_python="--runpython", + timeout=30, + expected_lines=expected_lines, + unexpected_lines=unexpected_lines, + halt_on_unexpected=False, + null_renderer=False, + cfg_args=[cfg_args], + log_file_name="MaterialEditor.log" + ) diff --git a/AutomatedTesting/Gem/PythonTests/atom_renderer/test_Atom_MainSuite.py b/AutomatedTesting/Gem/PythonTests/atom_renderer/test_Atom_MainSuite.py index 55c049b929..bb7a16ad6b 100644 --- a/AutomatedTesting/Gem/PythonTests/atom_renderer/test_Atom_MainSuite.py +++ b/AutomatedTesting/Gem/PythonTests/atom_renderer/test_Atom_MainSuite.py @@ -303,5 +303,6 @@ class TestMaterialEditorBasicTests(object): expected_lines=expected_lines, unexpected_lines=unexpected_lines, halt_on_unexpected=True, + null_renderer=True, log_file_name="MaterialEditor.log", ) From 1be95a1e761cba6327cd80ae65ba10084b06fb49 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Thu, 26 Aug 2021 15:59:40 -0700 Subject: [PATCH 119/131] Potential Memory Corruption in Release Build (#3559) * Potential Memory Corruption in Release Build Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> * @lumberyard-employee-dm suggested code Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> * warnings as errors found in VS2022 Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> * simplifying some strucutres used and fixing a bug Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> * some unused fixes for VS2022 Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> * fix for other platforms Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> * fixes check used in unit tests to be case-insensitive fixes memory leaks/invalid memory operations in AWSCore tests Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Code/Editor/Core/QtEditorApplication.cpp | 2 +- .../AzFramework/Archive/ZipDirStructures.cpp | 4 +- .../AzFramework/IO/LocalFileIO.cpp | 131 +++++++++--------- .../AzFramework/AzFramework/IO/LocalFileIO.h | 20 +-- .../AzFramework/IO/LocalFileIO_Android.cpp | 8 +- .../AzFramework/IO/LocalFileIO_UnixLike.cpp | 6 +- .../AzFramework/IO/LocalFileIO_WinAPI.cpp | 2 +- .../Windowing/NativeWindow_Windows.cpp | 2 +- Code/Framework/AzFramework/Tests/FileIO.cpp | 2 + Code/Legacy/CrySystem/System.cpp | 4 +- Code/Legacy/CrySystem/XML/xml.cpp | 2 +- .../Scheduler/TestImpactProcessScheduler.cpp | 1 - .../Run/TestImpactTestRunSerializer.cpp | 2 - .../AWSCoreAttributionManagerTest.cpp | 1 - .../Code/Tests/TestFramework/AWSCoreFixture.h | 5 +- .../RHI/DX12/Code/Source/RHI/AliasedHeap.cpp | 2 - .../DX12/Code/Source/RHI/AsyncUploadQueue.cpp | 1 - .../Code/Source/RHI/FrameGraphCompiler.cpp | 1 - .../Code/Source/Actor/BlastActorFactory.cpp | 4 - Gems/WhiteBox/Code/Tests/WhiteBoxTest.cpp | 1 - 20 files changed, 93 insertions(+), 108 deletions(-) diff --git a/Code/Editor/Core/QtEditorApplication.cpp b/Code/Editor/Core/QtEditorApplication.cpp index dd784ce10d..a4aab24be4 100644 --- a/Code/Editor/Core/QtEditorApplication.cpp +++ b/Code/Editor/Core/QtEditorApplication.cpp @@ -425,7 +425,7 @@ namespace Editor AZStd::array rawInputBytesArray; LPBYTE rawInputBytes = rawInputBytesArray.data(); - const UINT bytesCopied = GetRawInputData((HRAWINPUT)msg->lParam, RID_INPUT, rawInputBytes, &rawInputSize, rawInputHeaderSize); + [[maybe_unused]] const UINT bytesCopied = GetRawInputData((HRAWINPUT)msg->lParam, RID_INPUT, rawInputBytes, &rawInputSize, rawInputHeaderSize); CRY_ASSERT(bytesCopied == rawInputSize); RAWINPUT* rawInput = (RAWINPUT*)rawInputBytes; diff --git a/Code/Framework/AzFramework/AzFramework/Archive/ZipDirStructures.cpp b/Code/Framework/AzFramework/AzFramework/Archive/ZipDirStructures.cpp index 5f0d58a4cb..1d09705900 100644 --- a/Code/Framework/AzFramework/AzFramework/Archive/ZipDirStructures.cpp +++ b/Code/Framework/AzFramework/AzFramework/Archive/ZipDirStructures.cpp @@ -419,9 +419,9 @@ namespace AZ::IO::ZipDir } // defining file attributes for opening files using constants to avoid the need to include windows headers - constexpr int FileFlagNoBufferinf = 0x20000000; + constexpr int FileFlagNoBuffering = 0x20000000; constexpr int FileAttributeNormal = 0x00000080; - if (m_unbufferedFile.Open(filename, AZ::IO::SystemFile::OpenMode::SF_OPEN_READ_ONLY, FileAttributeNormal | FileAttributeNormal)) + if (m_unbufferedFile.Open(filename, AZ::IO::SystemFile::OpenMode::SF_OPEN_READ_ONLY, FileFlagNoBuffering | FileAttributeNormal)) { m_nSize = aznumeric_cast(m_unbufferedFile.Length()); return true; diff --git a/Code/Framework/AzFramework/AzFramework/IO/LocalFileIO.cpp b/Code/Framework/AzFramework/AzFramework/IO/LocalFileIO.cpp index d779ac8b49..076cce4965 100644 --- a/Code/Framework/AzFramework/AzFramework/IO/LocalFileIO.cpp +++ b/Code/Framework/AzFramework/AzFramework/IO/LocalFileIO.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -283,11 +284,18 @@ namespace AZ void LocalFileIO::CheckInvalidWrite([[maybe_unused]] const char* path) { #if defined(AZ_ENABLE_TRACING) - const char* assetsAlias = GetAlias("@assets@"); - if (path && assetsAlias && AZ::IO::PathView(path).IsRelativeTo(assetsAlias)) + const char* assetAliasPath = GetAlias("@assets@"); + if (path && assetAliasPath) { - AZ_Error("FileIO", false, "You may not alter data inside the asset cache. Please check the call stack and consider writing into the source asset folder instead.\n" - "Attempted write location: %s", path); + AZStd::string assetsAlias(assetAliasPath); + AZStd::string pathString = path; + AZStd::to_lower(assetsAlias.begin(), assetsAlias.end()); + AZStd::to_lower(pathString.begin(), pathString.end()); + if (AZ::IO::PathView(pathString.c_str()).IsRelativeTo(assetsAlias.c_str())) + { + AZ_Error("FileIO", false, "You may not alter data inside the asset cache. Please check the call stack and consider writing into the source asset folder instead.\n" + "Attempted write location: %s", path); + } } #endif } @@ -543,28 +551,12 @@ namespace AZ char fullPath[AZ_MAX_PATH_LEN]; ConvertToAbsolutePath(path, fullPath, AZ_MAX_PATH_LEN); - const auto it = AZStd::find_if(m_aliases.begin(), m_aliases.end(), [key](const AliasType& alias) - { - return alias.first.compare(key) == 0; - }); - - if (it != m_aliases.end()) - { - it->second = fullPath; - } - else - { - m_aliases.emplace_back(key, fullPath); - } + m_aliases[key] = fullPath; } const char* LocalFileIO::GetAlias(const char* key) const { - const auto it = AZStd::find_if(m_aliases.begin(), m_aliases.end(), [key](const AliasType& alias) - { - return alias.first.compare(key) == 0; - }); - + const auto it = m_aliases.find(key); if (it != m_aliases.end()) { return it->second.c_str(); @@ -574,10 +566,7 @@ namespace AZ void LocalFileIO::ClearAlias(const char* key) { - m_aliases.erase(AZStd::remove_if(m_aliases.begin(), m_aliases.end(), [key](const AliasType& alias) - { - return alias.first.compare(key) == 0; - }), m_aliases.end()); + m_aliases.erase(key); } AZStd::optional LocalFileIO::ConvertToAliasBuffer(char* outBuffer, AZ::u64 outBufferLength, AZStd::string_view inBuffer) const @@ -682,55 +671,67 @@ namespace AZ bool LocalFileIO::ResolveAliases(const char* path, char* resolvedPath, AZ::u64 resolvedPathSize) const { - AZ_Assert(path != resolvedPath && resolvedPathSize > strlen(path), "Resolved path is incorrect"); AZ_Assert(path && path[0] != '%', "%% is deprecated, @ is the only valid alias token"); - + AZStd::string_view pathView(path); + AZStd::string_view aliasKey; + AZStd::string_view aliasValue; + for (const auto& alias : m_aliases) + { + AZStd::string_view key{ alias.first }; + if (AZ::StringFunc::StartsWith(pathView, key)) // we only support aliases at the front of the path + { + aliasKey = key; + aliasValue = alias.second; + break; + } + } + size_t requiredResolvedPathSize = pathView.size() - aliasKey.size() + aliasValue.size() + 1; + AZ_Assert(path != resolvedPath && resolvedPathSize >= requiredResolvedPathSize, "Resolved path is incorrect"); // we assert above, but we also need to properly handle the case when the resolvedPath buffer size // is too small to copy the source into. - size_t pathLen = strlen(path) + 1; // account for null - if (path == resolvedPath || (resolvedPathSize < pathLen)) + if (path == resolvedPath || (resolvedPathSize < requiredResolvedPathSize)) { return false; } - azstrncpy(resolvedPath, resolvedPathSize, path, pathLen); - for (const auto& alias : m_aliases) + // Skip past the alias key in the pathView + // must ensure that we are replacing the entire folder name, not a partial (e.g. @GAME01@/ vs @GAME0@/) + if (AZStd::string_view postAliasView = pathView.substr(aliasKey.size()); + !aliasKey.empty() && (postAliasView.empty() || postAliasView.starts_with('/') || postAliasView.starts_with('\\'))) { - const char* key = alias.first.c_str(); - size_t keyLen = alias.first.length(); - if (azstrnicmp(resolvedPath, key, keyLen) == 0) // we only support aliases at the front of the path + // Copy over resolved alias path first + size_t resolvedPathLen = 0; + aliasValue.copy(resolvedPath, aliasValue.size()); + resolvedPathLen += aliasValue.size(); + // Append the post alias path next + postAliasView.copy(resolvedPath + resolvedPathLen, postAliasView.size()); + resolvedPathLen += postAliasView.size(); + // Null-Terminated the resolved path + resolvedPath[resolvedPathLen] = '\0'; + // If the path started with one of the "asset cache" path aliases, lowercase the path + const char* assetAliasPath = GetAlias("@assets@"); + const char* rootAliasPath = GetAlias("@root@"); + const char* projectPlatformCacheAliasPath = GetAlias("@projectplatformcache@"); + const bool lowercasePath = (assetAliasPath != nullptr && AZ::StringFunc::StartsWith(resolvedPath, assetAliasPath)) || + (rootAliasPath != nullptr && AZ::StringFunc::StartsWith(resolvedPath, rootAliasPath)) || + (projectPlatformCacheAliasPath != nullptr && AZ::StringFunc::StartsWith(resolvedPath, projectPlatformCacheAliasPath)); + if (lowercasePath) { - [[maybe_unused]] bool lowercasePath = LowerIfBeginsWith(resolvedPath, resolvedPathSize, "@assets@") - || LowerIfBeginsWith(resolvedPath, resolvedPathSize, "@root@") - || LowerIfBeginsWith(resolvedPath, resolvedPathSize, "@projectplatformcache@"); - - const char* dest = alias.second.c_str(); - size_t destLen = alias.second.length(); - char* afterKey = resolvedPath + keyLen; - size_t afterKeyLen = pathLen - keyLen; - // must ensure that we are replacing the entire folder name, not a partial (e.g. @GAME01@/ vs @GAME0@/) - if (*afterKey == '/' || *afterKey == '\\' || *afterKey == 0) - { - if (afterKeyLen + destLen + 1 < resolvedPathSize)//if after replacing the alias the length is greater than the max path size than skip - { - // scoot the right hand side of the replacement over to make room - memmove(resolvedPath + destLen, afterKey, afterKeyLen + 1); // make sure null is copied - memcpy(resolvedPath, dest, destLen); // insert replacement - pathLen -= keyLen; - pathLen += destLen; - - AZStd::replace(resolvedPath, resolvedPath + resolvedPathSize, '\\', '/'); - return true; - } - } + AZStd::to_lower(resolvedPath, resolvedPath + resolvedPathLen); } + // Replace any backslashes with posix slashes + AZStd::replace(resolvedPath, resolvedPath + resolvedPathLen, AZ::IO::WindowsPathSeparator, AZ::IO::PosixPathSeparator); + return true; + } + else + { + // The input path doesn't start with an available, copy it directly to the resolved path + pathView.copy(resolvedPath, pathView.size()); + // Null-Terminated the resolved path + resolvedPath[pathView.size()] = '\0'; } - // warn on failing to resolve an alias - AZ_Warning( - "LocalFileIO::ResolveAlias", path && path[0] != '@', - "Failed to resolve an alias: %s", path ? path : "(null)"); - + AZ_Warning("LocalFileIO::ResolveAlias", path && path[0] != '@', "Failed to resolve an alias: %s", path ? path : "(null)"); return false; } @@ -803,7 +804,7 @@ namespace AZ return false; } - AZ::OSString LocalFileIO::RemoveTrailingSlash(const AZ::OSString& pathStr) + AZStd::string LocalFileIO::RemoveTrailingSlash(const AZStd::string& pathStr) { if (pathStr.empty() || (pathStr[pathStr.length() - 1] != '/' && pathStr[pathStr.length() - 1] != '\\')) { @@ -813,7 +814,7 @@ namespace AZ return pathStr.substr(0, pathStr.length() - 1); } - AZ::OSString LocalFileIO::CheckForTrailingSlash(const AZ::OSString& pathStr) + AZStd::string LocalFileIO::CheckForTrailingSlash(const AZStd::string& pathStr) { if (pathStr.empty() || pathStr[pathStr.length() - 1] == '/') { diff --git a/Code/Framework/AzFramework/AzFramework/IO/LocalFileIO.h b/Code/Framework/AzFramework/AzFramework/IO/LocalFileIO.h index b02372d8c3..a9db55b320 100644 --- a/Code/Framework/AzFramework/AzFramework/IO/LocalFileIO.h +++ b/Code/Framework/AzFramework/AzFramework/IO/LocalFileIO.h @@ -8,16 +8,12 @@ #pragma once #include -#include -#include -#include -#include +#include #include #include -#include #include -#include #include +#include // This header file and CPP handles the platform specific implementation of code as defined by the FileIOBase interface class. // In order to make your code portable and functional with both this and the RemoteFileIO class, use the interface to access @@ -33,7 +29,7 @@ namespace AZ { public: AZ_RTTI(LocalFileIO, "{87A8D32B-F695-4105-9A4D-D99BE15DFD50}", FileIOBase); - AZ_CLASS_ALLOCATOR(LocalFileIO, OSAllocator, 0); + AZ_CLASS_ALLOCATOR(LocalFileIO, SystemAllocator, 0); LocalFileIO(); ~LocalFileIO(); @@ -77,8 +73,6 @@ namespace AZ bool ConvertToAbsolutePath(const char* path, char* absolutePath, AZ::u64 maxLength) const; private: - typedef AZStd::pair AliasType; - SystemFile* GetFilePointerFromHandle(HandleType fileHandle); HandleType GetNextHandle(); @@ -90,13 +84,13 @@ namespace AZ bool LowerIfBeginsWith(char* inOutBuffer, AZ::u64 bufferLen, const char* alias) const; private: - static AZ::OSString RemoveTrailingSlash(const AZ::OSString& pathStr); - static AZ::OSString CheckForTrailingSlash(const AZ::OSString& pathStr); + static AZStd::string RemoveTrailingSlash(const AZStd::string& pathStr); + static AZStd::string CheckForTrailingSlash(const AZStd::string& pathStr); mutable AZStd::recursive_mutex m_openFileGuard; AZStd::atomic m_nextHandle; - AZStd::map, AZ::OSStdAllocator> m_openFiles; - AZStd::vector m_aliases; + AZStd::unordered_map m_openFiles; + AZStd::unordered_map m_aliases; void CheckInvalidWrite(const char* path); }; diff --git a/Code/Framework/AzFramework/Platform/Android/AzFramework/IO/LocalFileIO_Android.cpp b/Code/Framework/AzFramework/Platform/Android/AzFramework/IO/LocalFileIO_Android.cpp index f6908142b4..b88c7cf25b 100644 --- a/Code/Framework/AzFramework/Platform/Android/AzFramework/IO/LocalFileIO_Android.cpp +++ b/Code/Framework/AzFramework/Platform/Android/AzFramework/IO/LocalFileIO_Android.cpp @@ -100,7 +100,7 @@ namespace AZ char resolvedPath[AZ_MAX_PATH_LEN]; ResolvePath(filePath, resolvedPath, AZ_MAX_PATH_LEN); - AZ::OSString pathWithoutSlash = RemoveTrailingSlash(resolvedPath); + AZStd::string pathWithoutSlash = RemoveTrailingSlash(resolvedPath); bool isInAPK = AZ::Android::Utils::IsApkPath(pathWithoutSlash.c_str()); if (isInAPK) @@ -115,7 +115,7 @@ namespace AZ // Skip over the current and parent directory paths if (filenameView != "." && filenameView != ".." && NameMatchesFilter(name, filter)) { - AZ::OSString foundFilePath = CheckForTrailingSlash(resolvedPath); + AZStd::string foundFilePath = CheckForTrailingSlash(resolvedPath); foundFilePath += name; // if aliased, de-alias! azstrcpy(tempBuffer, AZ_MAX_PATH_LEN, foundFilePath.c_str()); @@ -150,7 +150,7 @@ namespace AZ // Skip over the current and parent directory paths if (filenameView != "." && filenameView != ".." && NameMatchesFilter(entry->d_name, filter)) { - AZ::OSString foundFilePath = CheckForTrailingSlash(resolvedPath); + AZStd::string foundFilePath = CheckForTrailingSlash(resolvedPath); foundFilePath += entry->d_name; // if aliased, de-alias! azstrcpy(tempBuffer, AZ_MAX_PATH_LEN, foundFilePath.c_str()); @@ -199,7 +199,7 @@ namespace AZ } // make directories from bottom to top. - AZ::OSString pathBuffer; + AZStd::string pathBuffer; size_t pathLength = strlen(resolvedPath); pathBuffer.reserve(pathLength); for (size_t pathPos = 0; pathPos < pathLength; ++pathPos) diff --git a/Code/Framework/AzFramework/Platform/Common/UnixLike/AzFramework/IO/LocalFileIO_UnixLike.cpp b/Code/Framework/AzFramework/Platform/Common/UnixLike/AzFramework/IO/LocalFileIO_UnixLike.cpp index bf913e1818..c9cbdfbe7d 100644 --- a/Code/Framework/AzFramework/Platform/Common/UnixLike/AzFramework/IO/LocalFileIO_UnixLike.cpp +++ b/Code/Framework/AzFramework/Platform/Common/UnixLike/AzFramework/IO/LocalFileIO_UnixLike.cpp @@ -61,7 +61,7 @@ namespace AZ char resolvedPath[AZ_MAX_PATH_LEN] = {0}; ResolvePath(filePath, resolvedPath, AZ_MAX_PATH_LEN); - AZ::OSString withoutSlash = RemoveTrailingSlash(resolvedPath); + AZStd::string withoutSlash = RemoveTrailingSlash(resolvedPath); DIR* dir = opendir(withoutSlash.c_str()); if (dir != nullptr) @@ -80,7 +80,7 @@ namespace AZ // Skip over the current and parent directory paths if (filenameView != "." && filenameView != ".." && NameMatchesFilter(entry->d_name, filter)) { - AZ::OSString foundFilePath = CheckForTrailingSlash(resolvedPath); + AZStd::string foundFilePath = CheckForTrailingSlash(resolvedPath); foundFilePath += entry->d_name; // if aliased, dealias! azstrcpy(tempBuffer, AZ_MAX_PATH_LEN, foundFilePath.c_str()); @@ -116,7 +116,7 @@ namespace AZ } // make directories from bottom to top. - AZ::OSString buf; + AZStd::string buf; size_t pathLength = strlen(resolvedPath); buf.reserve(pathLength); for (size_t pos = 0; pos < pathLength; ++pos) diff --git a/Code/Framework/AzFramework/Platform/Common/WinAPI/AzFramework/IO/LocalFileIO_WinAPI.cpp b/Code/Framework/AzFramework/Platform/Common/WinAPI/AzFramework/IO/LocalFileIO_WinAPI.cpp index 61957fced0..5a56a360a8 100644 --- a/Code/Framework/AzFramework/Platform/Common/WinAPI/AzFramework/IO/LocalFileIO_WinAPI.cpp +++ b/Code/Framework/AzFramework/Platform/Common/WinAPI/AzFramework/IO/LocalFileIO_WinAPI.cpp @@ -128,7 +128,7 @@ namespace AZ } // make directories from bottom to top. - AZ::OSString buf; + AZStd::string buf; size_t pathLength = strlen(resolvedPath); buf.reserve(pathLength); for (size_t pos = 0; pos < pathLength; ++pos) diff --git a/Code/Framework/AzFramework/Platform/Windows/AzFramework/Windowing/NativeWindow_Windows.cpp b/Code/Framework/AzFramework/Platform/Windows/AzFramework/Windowing/NativeWindow_Windows.cpp index 8312f9fa63..3f2b29a7bb 100644 --- a/Code/Framework/AzFramework/Platform/Windows/AzFramework/Windowing/NativeWindow_Windows.cpp +++ b/Code/Framework/AzFramework/Platform/Windows/AzFramework/Windowing/NativeWindow_Windows.cpp @@ -234,7 +234,7 @@ namespace AzFramework GetRawInputData((HRAWINPUT)lParam, RID_INPUT, NULL, &rawInputSize, rawInputHeaderSize); LPBYTE rawInputBytes = new BYTE[rawInputSize]; - const UINT bytesCopied = GetRawInputData((HRAWINPUT)lParam, RID_INPUT, rawInputBytes, &rawInputSize, rawInputHeaderSize); + GetRawInputData((HRAWINPUT)lParam, RID_INPUT, rawInputBytes, &rawInputSize, rawInputHeaderSize); RAWINPUT* rawInput = (RAWINPUT*)rawInputBytes; AzFramework::RawInputNotificationBusWindows::Broadcast( diff --git a/Code/Framework/AzFramework/Tests/FileIO.cpp b/Code/Framework/AzFramework/Tests/FileIO.cpp index 7be14bbbb7..7a01ba991b 100644 --- a/Code/Framework/AzFramework/Tests/FileIO.cpp +++ b/Code/Framework/AzFramework/Tests/FileIO.cpp @@ -752,7 +752,9 @@ namespace UnitTest // Test that sending in a too small output path fails, // if the output buffer is too small to hold the resolved path size_t SMALLER_THAN_FINAL_RESOLVED_PATH = expectedResolvedPath.length() - 1; + AZ_TEST_START_TRACE_SUPPRESSION; resolveDidWork = local.ResolvePath(aliasTestPath, aliasResolvedPath, SMALLER_THAN_FINAL_RESOLVED_PATH); + AZ_TEST_STOP_TRACE_SUPPRESSION(1); AZ_TEST_ASSERT(!resolveDidWork); // test clearing an alias diff --git a/Code/Legacy/CrySystem/System.cpp b/Code/Legacy/CrySystem/System.cpp index 38a9a7ee1e..2d756d1352 100644 --- a/Code/Legacy/CrySystem/System.cpp +++ b/Code/Legacy/CrySystem/System.cpp @@ -1650,10 +1650,10 @@ bool CSystem::HandleMessage([[maybe_unused]] HWND hWnd, UINT uMsg, WPARAM wParam AZStd::array rawInputBytesArray; LPBYTE rawInputBytes = rawInputBytesArray.data(); - const UINT bytesCopied = GetRawInputData((HRAWINPUT)lParam, RID_INPUT, rawInputBytes, &rawInputSize, rawInputHeaderSize); + [[maybe_unused]] const UINT bytesCopied = GetRawInputData((HRAWINPUT)lParam, RID_INPUT, rawInputBytes, &rawInputSize, rawInputHeaderSize); CRY_ASSERT(bytesCopied == rawInputSize); - RAWINPUT* rawInput = (RAWINPUT*)rawInputBytes; + [[maybe_unused]] RAWINPUT* rawInput = (RAWINPUT*)rawInputBytes; CRY_ASSERT(rawInput); AzFramework::RawInputNotificationBusWindows::Broadcast(&AzFramework::RawInputNotificationsWindows::OnRawInputEvent, *rawInput); diff --git a/Code/Legacy/CrySystem/XML/xml.cpp b/Code/Legacy/CrySystem/XML/xml.cpp index a6f3d5b564..cc3ea7f820 100644 --- a/Code/Legacy/CrySystem/XML/xml.cpp +++ b/Code/Legacy/CrySystem/XML/xml.cpp @@ -1293,7 +1293,6 @@ XmlString CXmlNode::getXMLUnsafe(int level, char* tmpBuffer, uint32 sizeOfTmpBuf // TODO: those 2 saving functions are a bit messy. should probably make a separate one for the use of PlatformAPI bool CXmlNode::saveToFile(const char* fileName) { - const size_t chunkSizeBytes = (15 * 1024); if (!fileName) { return false; @@ -1310,6 +1309,7 @@ bool CXmlNode::saveToFile(const char* fileName) gEnv->pCryPak->FClose(fileHandle); return true; #else + constexpr size_t chunkSizeBytes = (15 * 1024); bool ret = saveToFile(fileName, chunkSizeBytes, fileHandle); gEnv->pCryPak->FClose(fileHandle); return ret; diff --git a/Code/Tools/TestImpactFramework/Runtime/Code/Source/Process/Scheduler/TestImpactProcessScheduler.cpp b/Code/Tools/TestImpactFramework/Runtime/Code/Source/Process/Scheduler/TestImpactProcessScheduler.cpp index 94df662a1d..683e2bfb23 100644 --- a/Code/Tools/TestImpactFramework/Runtime/Code/Source/Process/Scheduler/TestImpactProcessScheduler.cpp +++ b/Code/Tools/TestImpactFramework/Runtime/Code/Source/Process/Scheduler/TestImpactProcessScheduler.cpp @@ -270,7 +270,6 @@ namespace TestImpact { processInFlight.m_process->Terminate(ProcessTerminateErrorCode); AccumulateProcessStdContent(processInFlight); - const ProcessId processId = processInFlight.m_process->GetProcessInfo().GetId(); if (isCallingBackToClient) { diff --git a/Code/Tools/TestImpactFramework/Runtime/Code/Source/TestEngine/Run/TestImpactTestRunSerializer.cpp b/Code/Tools/TestImpactFramework/Runtime/Code/Source/TestEngine/Run/TestImpactTestRunSerializer.cpp index c0ca2caeae..5e385c9c12 100644 --- a/Code/Tools/TestImpactFramework/Runtime/Code/Source/TestEngine/Run/TestImpactTestRunSerializer.cpp +++ b/Code/Tools/TestImpactFramework/Runtime/Code/Source/TestEngine/Run/TestImpactTestRunSerializer.cpp @@ -154,8 +154,6 @@ namespace TestImpact const AZStd::chrono::milliseconds suiteDuration = AZStd::chrono::milliseconds{suite[TestRunFields::Keys[TestRunFields::DurationKey]].GetUint()}; // Suite enabled - const bool enabled = suite[TestRunFields::Keys[TestRunFields::EnabledKey]].GetBool(); - testSuites.emplace_back(TestRunSuite{ suite[TestRunFields::Keys[TestRunFields::NameKey]].GetString(), suite[TestRunFields::Keys[TestRunFields::EnabledKey]].GetBool(), diff --git a/Gems/AWSCore/Code/Tests/Editor/Attribution/AWSCoreAttributionManagerTest.cpp b/Gems/AWSCore/Code/Tests/Editor/Attribution/AWSCoreAttributionManagerTest.cpp index b8f7688ac6..37a8c0f6d4 100644 --- a/Gems/AWSCore/Code/Tests/Editor/Attribution/AWSCoreAttributionManagerTest.cpp +++ b/Gems/AWSCore/Code/Tests/Editor/Attribution/AWSCoreAttributionManagerTest.cpp @@ -211,7 +211,6 @@ namespace AWSAttributionUnitTest m_localFileIO->ResolvePath("@user@/Registry/", m_resolvedSettingsPath.data(), m_resolvedSettingsPath.size()); AZ::IO::SystemFile::DeleteDir(m_resolvedSettingsPath.data()); - delete AZ::IO::FileIOBase::GetInstance(); AZ::IO::FileIOBase::SetInstance(nullptr); AWSCoreFixture::TearDown(); diff --git a/Gems/AWSCore/Code/Tests/TestFramework/AWSCoreFixture.h b/Gems/AWSCore/Code/Tests/TestFramework/AWSCoreFixture.h index 0595353b6e..9d33d96215 100644 --- a/Gems/AWSCore/Code/Tests/TestFramework/AWSCoreFixture.h +++ b/Gems/AWSCore/Code/Tests/TestFramework/AWSCoreFixture.h @@ -130,10 +130,11 @@ public: m_settingsRegistry.reset(); AZ::IO::FileIOBase::SetInstance(nullptr); - + + delete m_localFileIO; + if (m_otherFileIO) { - delete m_localFileIO; AZ::IO::FileIOBase::SetInstance(m_otherFileIO); } diff --git a/Gems/Atom/RHI/DX12/Code/Source/RHI/AliasedHeap.cpp b/Gems/Atom/RHI/DX12/Code/Source/RHI/AliasedHeap.cpp index 8c1ce4b3b2..d45c58e24c 100644 --- a/Gems/Atom/RHI/DX12/Code/Source/RHI/AliasedHeap.cpp +++ b/Gems/Atom/RHI/DX12/Code/Source/RHI/AliasedHeap.cpp @@ -104,8 +104,6 @@ namespace AZ { const RHI::BufferDescriptor& descriptor = request.m_descriptor; Buffer* buffer = static_cast(request.m_buffer); - const size_t alignmentInBytes = D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT; - const size_t sizeInBytes = RHI::AlignUp(descriptor.m_byteCount, alignmentInBytes); MemoryView memoryView = GetDX12RHIDevice().CreateBufferPlaced( diff --git a/Gems/Atom/RHI/DX12/Code/Source/RHI/AsyncUploadQueue.cpp b/Gems/Atom/RHI/DX12/Code/Source/RHI/AsyncUploadQueue.cpp index e9beb55314..29b210e17e 100644 --- a/Gems/Atom/RHI/DX12/Code/Source/RHI/AsyncUploadQueue.cpp +++ b/Gems/Atom/RHI/DX12/Code/Source/RHI/AsyncUploadQueue.cpp @@ -378,7 +378,6 @@ namespace AZ } const uint32_t endRow = AZStd::GetMin(startRow + rowsPerSplit, subresourceLayout.m_rowCount); - const uint32_t numRowsToCopy = endRow - startRow; // Calculate the blocksize for BC formatted images; the copy command works in texels. uint32_t heightToCopy = (endRow - startRow) * compressedTexelBlockSizeHeight; diff --git a/Gems/Atom/RHI/DX12/Code/Source/RHI/FrameGraphCompiler.cpp b/Gems/Atom/RHI/DX12/Code/Source/RHI/FrameGraphCompiler.cpp index ba4aa76a60..7eaafc3705 100644 --- a/Gems/Atom/RHI/DX12/Code/Source/RHI/FrameGraphCompiler.cpp +++ b/Gems/Atom/RHI/DX12/Code/Source/RHI/FrameGraphCompiler.cpp @@ -530,7 +530,6 @@ namespace AZ transition.StateAfter = GetResourceState(*scopeAttachment); logger.SetStateAfter(transition.StateAfter); - const bool isCopyQueueAfter = scopeAfter.GetHardwareQueueClass() == RHI::HardwareQueueClass::Copy; RHI::ImageSubresourceRange viewRange = RHI::ImageSubresourceRange(scopeAttachment->GetImageView()->GetDescriptor()); for (const auto& subresourceState : image.GetAttachmentStateByIndex(&viewRange)) { diff --git a/Gems/Blast/Code/Source/Actor/BlastActorFactory.cpp b/Gems/Blast/Code/Source/Actor/BlastActorFactory.cpp index 704661c716..989ea1221a 100644 --- a/Gems/Blast/Code/Source/Actor/BlastActorFactory.cpp +++ b/Gems/Blast/Code/Source/Actor/BlastActorFactory.cpp @@ -43,8 +43,6 @@ namespace Blast const Nv::Blast::ExtPxChunk* pxChunks = blastFamily.GetPxAsset().getChunks(); const NvBlastChunk* chunks = tkAsset->getChunks(); const uint32_t pxChunkCount = blastFamily.GetPxAsset().getChunkCount(); - const uint32_t chunkCount = tkAsset->getChunkCount(); - const uint32_t nodeCount = tkActor.getGraphNodeCount(); AZ_Assert(pxChunks, "ExtPxAsset asset has a null chunk array."); AZ_Assert(chunks, "TkActor's asset has a null chunk array."); @@ -183,8 +181,6 @@ namespace Blast bool BlastActorFactoryImpl::VisibleChunksHasStaticActor( const BlastFamily& blastFamily, const AZStd::vector& chunkIndices) const { - const uint32_t chunkCount = blastFamily.GetPxAsset().getChunkCount(); - const Nv::Blast::ExtPxChunk* pxChunks = blastFamily.GetPxAsset().getChunks(); if (!pxChunks) { diff --git a/Gems/WhiteBox/Code/Tests/WhiteBoxTest.cpp b/Gems/WhiteBox/Code/Tests/WhiteBoxTest.cpp index 19258209dc..056c85512f 100644 --- a/Gems/WhiteBox/Code/Tests/WhiteBoxTest.cpp +++ b/Gems/WhiteBox/Code/Tests/WhiteBoxTest.cpp @@ -1821,7 +1821,6 @@ namespace UnitTest Api::InitializeAsUnitTriangle(*m_whiteBox); - const auto vertexCount = Api::MeshVertexCount(*m_whiteBox); const auto vertexHandles = Api::MeshVertexHandles(*m_whiteBox); const auto vertexPositions = Api::MeshVertexPositions(*m_whiteBox); From 48c959e3594f8a532842164b383ec1efc22ec294 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Thu, 26 Aug 2021 16:40:54 -0700 Subject: [PATCH 120/131] [Windows] Debug build error in OpenImageIO 3rdParty library (#3625) Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../Common/Code/Source/FrameCaptureSystemComponent.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Gems/Atom/Feature/Common/Code/Source/FrameCaptureSystemComponent.cpp b/Gems/Atom/Feature/Common/Code/Source/FrameCaptureSystemComponent.cpp index 6fbdf5b3f0..7374fdaf71 100644 --- a/Gems/Atom/Feature/Common/Code/Source/FrameCaptureSystemComponent.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/FrameCaptureSystemComponent.cpp @@ -33,7 +33,11 @@ #include #if defined(OPEN_IMAGE_IO_ENABLED) +// OpenImageIO/fmath.h(2271,5): error C4777: 'fprintf' : format string '%zd' requires an argument of type 'unsigned __int64', but variadic +// argument 5 has type 'OpenImageIO_v2_1::span_strided::index_type' +AZ_PUSH_DISABLE_WARNING(4777, "-Wunknown-warning-option") #include +AZ_POP_DISABLE_WARNING #endif namespace AZ From b0330ba26aaeddb800443d0e9723a27d9e889cd2 Mon Sep 17 00:00:00 2001 From: hultonha <82228511+hultonha@users.noreply.github.com> Date: Fri, 27 Aug 2021 09:29:08 +0100 Subject: [PATCH 121/131] Expose camera input channels to the UI and ensure the cached values are refreshed when updated (#3607) * expose camera input channels to the ui and ensure the cached values are refreshed when updated Signed-off-by: hultonha * small fixes for tests Signed-off-by: hultonha --- .../EditorModularViewportCameraComposer.cpp | 286 ++++++++++++++++++ .../EditorModularViewportCameraComposer.h | 48 +++ .../EditorModularViewportCameraComposerBus.h | 31 ++ .../EditorPreferencesPageViewportMovement.cpp | 155 +++++++++- .../EditorPreferencesPageViewportMovement.h | 21 ++ Code/Editor/EditorViewportSettings.cpp | 10 +- Code/Editor/EditorViewportSettings.h | 2 +- Code/Editor/EditorViewportWidget.cpp | 218 +------------ Code/Editor/EditorViewportWidget.h | 7 +- .../test_ModularViewportCameraController.cpp | 5 +- Code/Editor/editor_lib_files.cmake | 3 + .../AzFramework/Viewport/CameraInput.cpp | 53 +++- .../AzFramework/Viewport/CameraInput.h | 18 +- .../AzFramework/Tests/CameraInputTests.cpp | 28 +- 14 files changed, 624 insertions(+), 261 deletions(-) create mode 100644 Code/Editor/EditorModularViewportCameraComposer.cpp create mode 100644 Code/Editor/EditorModularViewportCameraComposer.h create mode 100644 Code/Editor/EditorModularViewportCameraComposerBus.h diff --git a/Code/Editor/EditorModularViewportCameraComposer.cpp b/Code/Editor/EditorModularViewportCameraComposer.cpp new file mode 100644 index 0000000000..2eab1c5611 --- /dev/null +++ b/Code/Editor/EditorModularViewportCameraComposer.cpp @@ -0,0 +1,286 @@ +/* + * Copyright (c) Contributors to the Open 3D Engine Project. + * For complete copyright and license terms please see the LICENSE at the root of this distribution. + * + * SPDX-License-Identifier: Apache-2.0 OR MIT + * + */ + +#include + +#include +#include +#include +#include +#include + +namespace SandboxEditor +{ + static AzFramework::TranslateCameraInputChannelIds BuildTranslateCameraInputChannelIds() + { + AzFramework::TranslateCameraInputChannelIds translateCameraInputChannelIds; + translateCameraInputChannelIds.m_leftChannelId = SandboxEditor::CameraTranslateLeftChannelId(); + translateCameraInputChannelIds.m_rightChannelId = SandboxEditor::CameraTranslateRightChannelId(); + translateCameraInputChannelIds.m_forwardChannelId = SandboxEditor::CameraTranslateForwardChannelId(); + translateCameraInputChannelIds.m_backwardChannelId = SandboxEditor::CameraTranslateBackwardChannelId(); + translateCameraInputChannelIds.m_upChannelId = SandboxEditor::CameraTranslateUpChannelId(); + translateCameraInputChannelIds.m_downChannelId = SandboxEditor::CameraTranslateDownChannelId(); + translateCameraInputChannelIds.m_boostChannelId = SandboxEditor::CameraTranslateBoostChannelId(); + + return translateCameraInputChannelIds; + } + + EditorModularViewportCameraComposer::EditorModularViewportCameraComposer(const AzFramework::ViewportId viewportId) + : m_viewportId(viewportId) + { + EditorModularViewportCameraComposerNotificationBus::Handler::BusConnect(viewportId); + } + + EditorModularViewportCameraComposer::~EditorModularViewportCameraComposer() + { + EditorModularViewportCameraComposerNotificationBus::Handler::BusDisconnect(); + } + + AZStd::shared_ptr EditorModularViewportCameraComposer:: + CreateModularViewportCameraController() + { + SetupCameras(); + + auto controller = AZStd::make_shared(); + + controller->SetCameraViewportContextBuilderCallback( + [viewportId = m_viewportId](AZStd::unique_ptr& cameraViewportContext) + { + cameraViewportContext = AZStd::make_unique(viewportId); + }); + + controller->SetCameraPriorityBuilderCallback( + [](AtomToolsFramework::CameraControllerPriorityFn& cameraControllerPriorityFn) + { + cameraControllerPriorityFn = AtomToolsFramework::DefaultCameraControllerPriority; + }); + + controller->SetCameraPropsBuilderCallback( + [](AzFramework::CameraProps& cameraProps) + { + cameraProps.m_rotateSmoothnessFn = [] + { + return SandboxEditor::CameraRotateSmoothness(); + }; + + cameraProps.m_translateSmoothnessFn = [] + { + return SandboxEditor::CameraTranslateSmoothness(); + }; + + cameraProps.m_rotateSmoothingEnabledFn = [] + { + return SandboxEditor::CameraRotateSmoothingEnabled(); + }; + + cameraProps.m_translateSmoothingEnabledFn = [] + { + return SandboxEditor::CameraTranslateSmoothingEnabled(); + }; + }); + + controller->SetCameraListBuilderCallback( + [viewportId = m_viewportId, this](AzFramework::Cameras& cameras) + { + cameras.AddCamera(m_firstPersonRotateCamera); + cameras.AddCamera(m_firstPersonPanCamera); + cameras.AddCamera(m_firstPersonTranslateCamera); + cameras.AddCamera(m_firstPersonScrollCamera); + cameras.AddCamera(m_orbitCamera); + }); + + return controller; + } + + void EditorModularViewportCameraComposer::SetupCameras() + { + const auto hideCursor = [viewportId = m_viewportId] + { + if (SandboxEditor::CameraCaptureCursorForLook()) + { + AzToolsFramework::ViewportInteraction::ViewportMouseCursorRequestBus::Event( + viewportId, &AzToolsFramework::ViewportInteraction::ViewportMouseCursorRequestBus::Events::BeginCursorCapture); + } + }; + const auto showCursor = [viewportId = m_viewportId] + { + if (SandboxEditor::CameraCaptureCursorForLook()) + { + AzToolsFramework::ViewportInteraction::ViewportMouseCursorRequestBus::Event( + viewportId, &AzToolsFramework::ViewportInteraction::ViewportMouseCursorRequestBus::Events::EndCursorCapture); + } + }; + + m_firstPersonRotateCamera = AZStd::make_shared(SandboxEditor::CameraFreeLookChannelId()); + + m_firstPersonRotateCamera->m_rotateSpeedFn = [] + { + return SandboxEditor::CameraRotateSpeed(); + }; + + // default behavior is to hide the cursor but this can be disabled (useful for remote desktop) + // note: See CaptureCursorLook in the Settings Registry + m_firstPersonRotateCamera->SetActivationBeganFn(hideCursor); + m_firstPersonRotateCamera->SetActivationEndedFn(showCursor); + + m_firstPersonPanCamera = + AZStd::make_shared(SandboxEditor::CameraFreePanChannelId(), AzFramework::LookPan); + + m_firstPersonPanCamera->m_panSpeedFn = [] + { + return SandboxEditor::CameraPanSpeed(); + }; + + m_firstPersonPanCamera->m_invertPanXFn = [] + { + return SandboxEditor::CameraPanInvertedX(); + }; + + m_firstPersonPanCamera->m_invertPanYFn = [] + { + return SandboxEditor::CameraPanInvertedY(); + }; + + const auto translateCameraInputChannelIds = BuildTranslateCameraInputChannelIds(); + + m_firstPersonTranslateCamera = + AZStd::make_shared(AzFramework::LookTranslation, translateCameraInputChannelIds); + + m_firstPersonTranslateCamera->m_translateSpeedFn = [] + { + return SandboxEditor::CameraTranslateSpeed(); + }; + + m_firstPersonTranslateCamera->m_boostMultiplierFn = [] + { + return SandboxEditor::CameraBoostMultiplier(); + }; + + m_firstPersonScrollCamera = AZStd::make_shared(); + + m_firstPersonScrollCamera->m_scrollSpeedFn = [] + { + return SandboxEditor::CameraScrollSpeed(); + }; + + m_orbitCamera = AZStd::make_shared(SandboxEditor::CameraOrbitChannelId()); + + m_orbitCamera->SetLookAtFn( + [viewportId = m_viewportId](const AZ::Vector3& position, const AZ::Vector3& direction) -> AZStd::optional + { + AZStd::optional lookAtAfterInterpolation; + AtomToolsFramework::ModularViewportCameraControllerRequestBus::EventResult( + lookAtAfterInterpolation, viewportId, + &AtomToolsFramework::ModularViewportCameraControllerRequestBus::Events::LookAtAfterInterpolation); + + // initially attempt to use the last set look at point after an interpolation has finished + if (lookAtAfterInterpolation.has_value()) + { + return *lookAtAfterInterpolation; + } + + const float RayDistance = 1000.0f; + AzFramework::RenderGeometry::RayRequest ray; + ray.m_startWorldPosition = position; + ray.m_endWorldPosition = position + direction * RayDistance; + ray.m_onlyVisible = true; + + AzFramework::RenderGeometry::RayResult renderGeometryIntersectionResult; + AzFramework::RenderGeometry::IntersectorBus::EventResult( + renderGeometryIntersectionResult, AzToolsFramework::GetEntityContextId(), + &AzFramework::RenderGeometry::IntersectorBus::Events::RayIntersect, ray); + + // attempt a ray intersection with any visible mesh and return the intersection position if successful + if (renderGeometryIntersectionResult) + { + return renderGeometryIntersectionResult.m_worldPosition; + } + + // if there is no selection or no intersection, fallback to default camera orbit behavior (ground plane + // intersection) + return {}; + }); + + m_orbitRotateCamera = AZStd::make_shared(SandboxEditor::CameraOrbitLookChannelId()); + + m_orbitRotateCamera->m_rotateSpeedFn = [] + { + return SandboxEditor::CameraRotateSpeed(); + }; + + m_orbitRotateCamera->m_invertYawFn = [] + { + return SandboxEditor::CameraOrbitYawRotationInverted(); + }; + + m_orbitTranslateCamera = + AZStd::make_shared(AzFramework::OrbitTranslation, translateCameraInputChannelIds); + + m_orbitTranslateCamera->m_translateSpeedFn = [] + { + return SandboxEditor::CameraTranslateSpeed(); + }; + + m_orbitTranslateCamera->m_boostMultiplierFn = [] + { + return SandboxEditor::CameraBoostMultiplier(); + }; + + m_orbitDollyScrollCamera = AZStd::make_shared(); + + m_orbitDollyScrollCamera->m_scrollSpeedFn = [] + { + return SandboxEditor::CameraScrollSpeed(); + }; + + m_orbitDollyMoveCamera = + AZStd::make_shared(SandboxEditor::CameraOrbitDollyChannelId()); + + m_orbitDollyMoveCamera->m_cursorSpeedFn = [] + { + return SandboxEditor::CameraDollyMotionSpeed(); + }; + + m_orbitPanCamera = AZStd::make_shared(SandboxEditor::CameraOrbitPanChannelId(), AzFramework::OrbitPan); + + m_orbitPanCamera->m_panSpeedFn = [] + { + return SandboxEditor::CameraPanSpeed(); + }; + + m_orbitPanCamera->m_invertPanXFn = [] + { + return SandboxEditor::CameraPanInvertedX(); + }; + + m_orbitPanCamera->m_invertPanYFn = [] + { + return SandboxEditor::CameraPanInvertedY(); + }; + + m_orbitCamera->m_orbitCameras.AddCamera(m_orbitRotateCamera); + m_orbitCamera->m_orbitCameras.AddCamera(m_orbitTranslateCamera); + m_orbitCamera->m_orbitCameras.AddCamera(m_orbitDollyScrollCamera); + m_orbitCamera->m_orbitCameras.AddCamera(m_orbitDollyMoveCamera); + m_orbitCamera->m_orbitCameras.AddCamera(m_orbitPanCamera); + } + + void EditorModularViewportCameraComposer::OnEditorModularViewportCameraComposerSettingsChanged() + { + const auto translateCameraInputChannelIds = BuildTranslateCameraInputChannelIds(); + m_firstPersonTranslateCamera->SetTranslateCameraInputChannelIds(translateCameraInputChannelIds); + m_orbitTranslateCamera->SetTranslateCameraInputChannelIds(translateCameraInputChannelIds); + + m_firstPersonPanCamera->SetPanInputChannelId(SandboxEditor::CameraFreePanChannelId()); + m_orbitPanCamera->SetPanInputChannelId(SandboxEditor::CameraOrbitPanChannelId()); + m_firstPersonRotateCamera->SetRotateInputChannelId(SandboxEditor::CameraFreeLookChannelId()); + m_orbitRotateCamera->SetRotateInputChannelId(SandboxEditor::CameraOrbitLookChannelId()); + m_orbitCamera->SetOrbitInputChannelId(SandboxEditor::CameraOrbitChannelId()); + m_orbitDollyMoveCamera->SetDollyInputChannelId(SandboxEditor::CameraOrbitDollyChannelId()); + } +} // namespace SandboxEditor diff --git a/Code/Editor/EditorModularViewportCameraComposer.h b/Code/Editor/EditorModularViewportCameraComposer.h new file mode 100644 index 0000000000..cb223d39e6 --- /dev/null +++ b/Code/Editor/EditorModularViewportCameraComposer.h @@ -0,0 +1,48 @@ +/* + * Copyright (c) Contributors to the Open 3D Engine Project. + * For complete copyright and license terms please see the LICENSE at the root of this distribution. + * + * SPDX-License-Identifier: Apache-2.0 OR MIT + * + */ + +#pragma once + +#include +#include +#include +#include + +namespace SandboxEditor +{ + //! Type responsible for building the editor's modular viewport camera controller. + class EditorModularViewportCameraComposer : private EditorModularViewportCameraComposerNotificationBus::Handler + { + public: + SANDBOX_API explicit EditorModularViewportCameraComposer(AzFramework::ViewportId viewportId); + SANDBOX_API ~EditorModularViewportCameraComposer(); + + //! Build a ModularViewportCameraController from the associated camera inputs. + SANDBOX_API AZStd::shared_ptr CreateModularViewportCameraController(); + + private: + //! Setup all internal camera inputs. + void SetupCameras(); + + // EditorModularViewportCameraComposerNotificationBus overrides ... + void OnEditorModularViewportCameraComposerSettingsChanged() override; + + AZStd::shared_ptr m_firstPersonRotateCamera; + AZStd::shared_ptr m_firstPersonPanCamera; + AZStd::shared_ptr m_firstPersonTranslateCamera; + AZStd::shared_ptr m_firstPersonScrollCamera; + AZStd::shared_ptr m_orbitCamera; + AZStd::shared_ptr m_orbitRotateCamera; + AZStd::shared_ptr m_orbitTranslateCamera; + AZStd::shared_ptr m_orbitDollyScrollCamera; + AZStd::shared_ptr m_orbitDollyMoveCamera; + AZStd::shared_ptr m_orbitPanCamera; + + AzFramework::ViewportId m_viewportId; + }; +} // namespace SandboxEditor diff --git a/Code/Editor/EditorModularViewportCameraComposerBus.h b/Code/Editor/EditorModularViewportCameraComposerBus.h new file mode 100644 index 0000000000..ac760b8a9a --- /dev/null +++ b/Code/Editor/EditorModularViewportCameraComposerBus.h @@ -0,0 +1,31 @@ +/* + * Copyright (c) Contributors to the Open 3D Engine Project. + * For complete copyright and license terms please see the LICENSE at the root of this distribution. + * + * SPDX-License-Identifier: Apache-2.0 OR MIT + * + */ + +#pragma once + +#include +#include +#include + +namespace SandboxEditor +{ + //! Notifications for changes to the editor modular viewport camera controller. + class EditorModularViewportCameraComposerNotifications + { + public: + //! Notify any listeners when changes have been made to the modular viewport camera settings. + //! @note This is used to update any cached input channels when controls are modified. + virtual void OnEditorModularViewportCameraComposerSettingsChanged() = 0; + + protected: + ~EditorModularViewportCameraComposerNotifications() = default; + }; + + using EditorModularViewportCameraComposerNotificationBus = + AZ::EBus; +} // namespace SandboxEditor diff --git a/Code/Editor/EditorPreferencesPageViewportMovement.cpp b/Code/Editor/EditorPreferencesPageViewportMovement.cpp index 06bcd13c60..74abb3f207 100644 --- a/Code/Editor/EditorPreferencesPageViewportMovement.cpp +++ b/Code/Editor/EditorPreferencesPageViewportMovement.cpp @@ -10,12 +10,54 @@ #include "EditorPreferencesPageViewportMovement.h" +#include +#include +#include +#include #include +#include // Editor #include "EditorViewportSettings.h" #include "Settings.h" +static AZStd::vector GetInputNamesByDevice(const AzFramework::InputDeviceId inputDeviceId) +{ + AzFramework::InputDeviceRequests::InputChannelIdSet availableInputChannelIds; + AzFramework::InputDeviceRequestBus::Event( + inputDeviceId, &AzFramework::InputDeviceRequests::GetInputChannelIds, availableInputChannelIds); + + AZStd::vector inputChannelNames; + for (const AzFramework::InputChannelId& inputChannelId : availableInputChannelIds) + { + inputChannelNames.push_back(inputChannelId.GetName()); + } + + AZStd::sort(inputChannelNames.begin(), inputChannelNames.end()); + + return inputChannelNames; +} + +static AZStd::vector GetEditorInputNames() +{ + // function static to defer having to call GetInputNamesByDevice for every CameraInputSettings member + static bool inputNamesGenerated = false; + static AZStd::vector inputNames; + + if (!inputNamesGenerated) + { + AZStd::vector keyboardInputNames = GetInputNamesByDevice(AzFramework::InputDeviceKeyboard::Id); + AZStd::vector mouseInputNames = GetInputNamesByDevice(AzFramework::InputDeviceMouse::Id); + + inputNames.insert(inputNames.end(), mouseInputNames.begin(), mouseInputNames.end()); + inputNames.insert(inputNames.end(), keyboardInputNames.begin(), keyboardInputNames.end()); + + inputNamesGenerated = true; + } + + return inputNames; +} + void CEditorPreferencesPage_ViewportMovement::Reflect(AZ::SerializeContext& serialize) { serialize.Class() @@ -35,12 +77,30 @@ void CEditorPreferencesPage_ViewportMovement::Reflect(AZ::SerializeContext& seri ->Field("PanInvertedX", &CameraMovementSettings::m_panInvertedX) ->Field("PanInvertedY", &CameraMovementSettings::m_panInvertedY); - serialize.Class()->Version(1)->Field( - "CameraMovementSettings", &CEditorPreferencesPage_ViewportMovement::m_cameraMovementSettings); + serialize.Class() + ->Version(1) + ->Field("TranslateForward", &CameraInputSettings::m_translateForwardChannelId) + ->Field("TranslateBackward", &CameraInputSettings::m_translateBackwardChannelId) + ->Field("TranslateLeft", &CameraInputSettings::m_translateLeftChannelId) + ->Field("TranslateRight", &CameraInputSettings::m_translateRightChannelId) + ->Field("TranslateUp", &CameraInputSettings::m_translateUpChannelId) + ->Field("TranslateDown", &CameraInputSettings::m_translateDownChannelId) + ->Field("Boost", &CameraInputSettings::m_boostChannelId) + ->Field("Orbit", &CameraInputSettings::m_orbitChannelId) + ->Field("FreeLook", &CameraInputSettings::m_freeLookChannelId) + ->Field("FreePan", &CameraInputSettings::m_freePanChannelId) + ->Field("OrbitLook", &CameraInputSettings::m_orbitLookChannelId) + ->Field("OrbitDolly", &CameraInputSettings::m_orbitDollyChannelId) + ->Field("OrbitPan", &CameraInputSettings::m_orbitPanChannelId); + + serialize.Class() + ->Version(1) + ->Field("CameraMovementSettings", &CEditorPreferencesPage_ViewportMovement::m_cameraMovementSettings) + ->Field("CameraInputSettings", &CEditorPreferencesPage_ViewportMovement::m_cameraInputSettings); if (AZ::EditContext* editContext = serialize.GetEditContext()) { - editContext->Class("Camera Settings", "") + editContext->Class("Camera Movement Settings", "") ->DataElement( AZ::Edit::UIHandlers::SpinBox, &CameraMovementSettings::m_translateSpeed, "Camera Movement Speed", "Camera movement speed") ->Attribute(AZ::Edit::Attributes::Min, 0.01f) @@ -94,12 +154,68 @@ void CEditorPreferencesPage_ViewportMovement::Reflect(AZ::SerializeContext& seri AZ::Edit::UIHandlers::CheckBox, &CameraMovementSettings::m_captureCursorLook, "Camera Capture Look Cursor", "Should the cursor be captured (hidden) while performing free look"); + editContext->Class("Camera Input Settings", "") + ->DataElement( + AZ::Edit::UIHandlers::ComboBox, &CameraInputSettings::m_translateForwardChannelId, "Translate Forward", + "Key/button to move the camera forward") + ->Attribute(AZ::Edit::Attributes::StringList, &GetEditorInputNames) + ->DataElement( + AZ::Edit::UIHandlers::ComboBox, &CameraInputSettings::m_translateBackwardChannelId, "Translate Backward", + "Key/button to move the camera backward") + ->Attribute(AZ::Edit::Attributes::StringList, &GetEditorInputNames) + ->DataElement( + AZ::Edit::UIHandlers::ComboBox, &CameraInputSettings::m_translateLeftChannelId, "Translate Left", + "Key/button to move the camera left") + ->Attribute(AZ::Edit::Attributes::StringList, &GetEditorInputNames) + ->DataElement( + AZ::Edit::UIHandlers::ComboBox, &CameraInputSettings::m_translateRightChannelId, "Translate Right", + "Key/button to move the camera right") + ->Attribute(AZ::Edit::Attributes::StringList, &GetEditorInputNames) + ->DataElement( + AZ::Edit::UIHandlers::ComboBox, &CameraInputSettings::m_translateUpChannelId, "Translate Up", + "Key/button to move the camera up") + ->Attribute(AZ::Edit::Attributes::StringList, &GetEditorInputNames) + ->DataElement( + AZ::Edit::UIHandlers::ComboBox, &CameraInputSettings::m_translateDownChannelId, "Translate Down", + "Key/button to move the camera down") + ->Attribute(AZ::Edit::Attributes::StringList, &GetEditorInputNames) + ->DataElement( + AZ::Edit::UIHandlers::ComboBox, &CameraInputSettings::m_boostChannelId, "Boost", + "Key/button to move the camera more quickly") + ->Attribute(AZ::Edit::Attributes::StringList, &GetEditorInputNames) + ->DataElement( + AZ::Edit::UIHandlers::ComboBox, &CameraInputSettings::m_orbitChannelId, "Orbit", + "Key/button to begin the camera orbit behavior") + ->Attribute(AZ::Edit::Attributes::StringList, &GetEditorInputNames) + ->DataElement( + AZ::Edit::UIHandlers::ComboBox, &CameraInputSettings::m_freeLookChannelId, "Free Look", + "Key/button to begin camera free look") + ->Attribute(AZ::Edit::Attributes::StringList, &GetEditorInputNames) + ->DataElement( + AZ::Edit::UIHandlers::ComboBox, &CameraInputSettings::m_freePanChannelId, "Free Pan", "Key/button to begin camera free pan") + ->Attribute(AZ::Edit::Attributes::StringList, &GetEditorInputNames) + ->DataElement( + AZ::Edit::UIHandlers::ComboBox, &CameraInputSettings::m_orbitLookChannelId, "Orbit Look", + "Key/button to begin camera orbit look") + ->Attribute(AZ::Edit::Attributes::StringList, &GetEditorInputNames) + ->DataElement( + AZ::Edit::UIHandlers::ComboBox, &CameraInputSettings::m_orbitDollyChannelId, "Orbit Dolly", + "Key/button to begin camera orbit dolly") + ->Attribute(AZ::Edit::Attributes::StringList, &GetEditorInputNames) + ->DataElement( + AZ::Edit::UIHandlers::ComboBox, &CameraInputSettings::m_orbitPanChannelId, "Orbit Pan", + "Key/button to begin camera orbit pan") + ->Attribute(AZ::Edit::Attributes::StringList, &GetEditorInputNames); + editContext->Class("Viewport Preferences", "Viewport Preferences") ->ClassElement(AZ::Edit::ClassElements::EditorData, "") ->Attribute(AZ::Edit::Attributes::Visibility, AZ_CRC("PropertyVisibility_ShowChildrenOnly", 0xef428f20)) ->DataElement( AZ::Edit::UIHandlers::Default, &CEditorPreferencesPage_ViewportMovement::m_cameraMovementSettings, - "Camera Movement Settings", "Camera Movement Settings"); + "Camera Movement Settings", "Camera Movement Settings") + ->DataElement( + AZ::Edit::UIHandlers::Default, &CEditorPreferencesPage_ViewportMovement::m_cameraInputSettings, "Camera Input Settings", + "Camera Input Settings"); } } @@ -135,6 +251,23 @@ void CEditorPreferencesPage_ViewportMovement::OnApply() SandboxEditor::SetCameraOrbitYawRotationInverted(m_cameraMovementSettings.m_orbitYawRotationInverted); SandboxEditor::SetCameraPanInvertedX(m_cameraMovementSettings.m_panInvertedX); SandboxEditor::SetCameraPanInvertedY(m_cameraMovementSettings.m_panInvertedY); + + SandboxEditor::SetCameraTranslateForwardChannelId(m_cameraInputSettings.m_translateForwardChannelId); + SandboxEditor::SetCameraTranslateBackwardChannelId(m_cameraInputSettings.m_translateBackwardChannelId); + SandboxEditor::SetCameraTranslateLeftChannelId(m_cameraInputSettings.m_translateLeftChannelId); + SandboxEditor::SetCameraTranslateRightChannelId(m_cameraInputSettings.m_translateRightChannelId); + SandboxEditor::SetCameraTranslateUpChannelId(m_cameraInputSettings.m_translateUpChannelId); + SandboxEditor::SetCameraTranslateDownChannelId(m_cameraInputSettings.m_translateDownChannelId); + SandboxEditor::SetCameraTranslateBoostChannelId(m_cameraInputSettings.m_boostChannelId); + SandboxEditor::SetCameraOrbitChannelId(m_cameraInputSettings.m_orbitChannelId); + SandboxEditor::SetCameraFreeLookChannelId(m_cameraInputSettings.m_freeLookChannelId); + SandboxEditor::SetCameraFreePanChannelId(m_cameraInputSettings.m_freePanChannelId); + SandboxEditor::SetCameraOrbitLookChannelId(m_cameraInputSettings.m_orbitLookChannelId); + SandboxEditor::SetCameraOrbitDollyChannelId(m_cameraInputSettings.m_orbitDollyChannelId); + SandboxEditor::SetCameraOrbitPanChannelId(m_cameraInputSettings.m_orbitPanChannelId); + + SandboxEditor::EditorModularViewportCameraComposerNotificationBus::Broadcast( + &SandboxEditor::EditorModularViewportCameraComposerNotificationBus::Events::OnEditorModularViewportCameraComposerSettingsChanged); } void CEditorPreferencesPage_ViewportMovement::InitializeSettings() @@ -153,4 +286,18 @@ void CEditorPreferencesPage_ViewportMovement::InitializeSettings() m_cameraMovementSettings.m_orbitYawRotationInverted = SandboxEditor::CameraOrbitYawRotationInverted(); m_cameraMovementSettings.m_panInvertedX = SandboxEditor::CameraPanInvertedX(); m_cameraMovementSettings.m_panInvertedY = SandboxEditor::CameraPanInvertedY(); + + m_cameraInputSettings.m_translateForwardChannelId = SandboxEditor::CameraTranslateForwardChannelId().GetName(); + m_cameraInputSettings.m_translateBackwardChannelId = SandboxEditor::CameraTranslateBackwardChannelId().GetName(); + m_cameraInputSettings.m_translateLeftChannelId = SandboxEditor::CameraTranslateLeftChannelId().GetName(); + m_cameraInputSettings.m_translateRightChannelId = SandboxEditor::CameraTranslateRightChannelId().GetName(); + m_cameraInputSettings.m_translateUpChannelId = SandboxEditor::CameraTranslateUpChannelId().GetName(); + m_cameraInputSettings.m_translateDownChannelId = SandboxEditor::CameraTranslateDownChannelId().GetName(); + m_cameraInputSettings.m_boostChannelId = SandboxEditor::CameraTranslateBoostChannelId().GetName(); + m_cameraInputSettings.m_orbitChannelId = SandboxEditor::CameraOrbitChannelId().GetName(); + m_cameraInputSettings.m_freeLookChannelId = SandboxEditor::CameraFreeLookChannelId().GetName(); + m_cameraInputSettings.m_freePanChannelId = SandboxEditor::CameraFreePanChannelId().GetName(); + m_cameraInputSettings.m_orbitLookChannelId = SandboxEditor::CameraOrbitLookChannelId().GetName(); + m_cameraInputSettings.m_orbitDollyChannelId = SandboxEditor::CameraOrbitDollyChannelId().GetName(); + m_cameraInputSettings.m_orbitPanChannelId = SandboxEditor::CameraOrbitPanChannelId().GetName(); } diff --git a/Code/Editor/EditorPreferencesPageViewportMovement.h b/Code/Editor/EditorPreferencesPageViewportMovement.h index a973c34f1a..b7482fb048 100644 --- a/Code/Editor/EditorPreferencesPageViewportMovement.h +++ b/Code/Editor/EditorPreferencesPageViewportMovement.h @@ -79,6 +79,27 @@ private: } }; + struct CameraInputSettings + { + AZ_TYPE_INFO(struct CameraInputSettings, "{A250FAD4-662E-4896-B030-D4ED03679377}") + + AZStd::string m_translateForwardChannelId; + AZStd::string m_translateBackwardChannelId; + AZStd::string m_translateLeftChannelId; + AZStd::string m_translateRightChannelId; + AZStd::string m_translateUpChannelId; + AZStd::string m_translateDownChannelId; + AZStd::string m_boostChannelId; + AZStd::string m_orbitChannelId; + AZStd::string m_freeLookChannelId; + AZStd::string m_freePanChannelId; + AZStd::string m_orbitLookChannelId; + AZStd::string m_orbitDollyChannelId; + AZStd::string m_orbitPanChannelId; + }; + CameraMovementSettings m_cameraMovementSettings; + CameraInputSettings m_cameraInputSettings; + QIcon m_icon; }; diff --git a/Code/Editor/EditorViewportSettings.cpp b/Code/Editor/EditorViewportSettings.cpp index 38831a1de4..872454412d 100644 --- a/Code/Editor/EditorViewportSettings.cpp +++ b/Code/Editor/EditorViewportSettings.cpp @@ -63,7 +63,11 @@ namespace SandboxEditor AZStd::remove_cvref_t value = AZStd::forward(defaultValue); if (const auto* registry = AZ::SettingsRegistry::Get()) { - registry->Get(value, setting); + T potentialValue; + if (registry->Get(potentialValue, setting)) + { + value = AZStd::move(potentialValue); + } } return value; @@ -363,7 +367,7 @@ namespace SandboxEditor void SetCameraTranslateBoostChannelId(AZStd::string_view cameraTranslateBoostId) { - SetRegistry(CameraTranslateDownIdSetting, cameraTranslateBoostId); + SetRegistry(CameraTranslateBoostIdSetting, cameraTranslateBoostId); } AzFramework::InputChannelId CameraOrbitChannelId() @@ -371,7 +375,7 @@ namespace SandboxEditor return AzFramework::InputChannelId(GetRegistry(CameraOrbitIdSetting, AZStd::string("keyboard_key_modifier_alt_l")).c_str()); } - void SetCameraOrbitChannelChannelId(AZStd::string_view cameraOrbitId) + void SetCameraOrbitChannelId(AZStd::string_view cameraOrbitId) { SetRegistry(CameraOrbitIdSetting, cameraOrbitId); } diff --git a/Code/Editor/EditorViewportSettings.h b/Code/Editor/EditorViewportSettings.h index 83004d52af..3da8c465fb 100644 --- a/Code/Editor/EditorViewportSettings.h +++ b/Code/Editor/EditorViewportSettings.h @@ -111,7 +111,7 @@ namespace SandboxEditor SANDBOX_API void SetCameraTranslateBoostChannelId(AZStd::string_view cameraTranslateBoostId); SANDBOX_API AzFramework::InputChannelId CameraOrbitChannelId(); - SANDBOX_API void SetCameraOrbitChannelChannelId(AZStd::string_view cameraOrbitId); + SANDBOX_API void SetCameraOrbitChannelId(AZStd::string_view cameraOrbitId); SANDBOX_API AzFramework::InputChannelId CameraFreeLookChannelId(); SANDBOX_API void SetCameraFreeLookChannelId(AZStd::string_view cameraFreeLookId); diff --git a/Code/Editor/EditorViewportWidget.cpp b/Code/Editor/EditorViewportWidget.cpp index c6750550e8..44ac159c87 100644 --- a/Code/Editor/EditorViewportWidget.cpp +++ b/Code/Editor/EditorViewportWidget.cpp @@ -50,7 +50,6 @@ // AtomToolsFramework #include -#include // CryCommon #include @@ -1030,220 +1029,6 @@ bool EditorViewportWidget::ShowingWorldSpace() return BuildKeyboardModifiers(QGuiApplication::queryKeyboardModifiers()).Shift(); } -AZStd::shared_ptr CreateModularViewportCameraController( - const AzFramework::ViewportId viewportId) -{ - auto controller = AZStd::make_shared(); - - controller->SetCameraViewportContextBuilderCallback( - [viewportId](AZStd::unique_ptr& cameraViewportContext) - { - cameraViewportContext = AZStd::make_unique(viewportId); - }); - - controller->SetCameraPriorityBuilderCallback( - [](AtomToolsFramework::CameraControllerPriorityFn& cameraControllerPriorityFn) - { - cameraControllerPriorityFn = AtomToolsFramework::DefaultCameraControllerPriority; - }); - - controller->SetCameraPropsBuilderCallback( - [](AzFramework::CameraProps& cameraProps) - { - cameraProps.m_rotateSmoothnessFn = [] - { - return SandboxEditor::CameraRotateSmoothness(); - }; - - cameraProps.m_translateSmoothnessFn = [] - { - return SandboxEditor::CameraTranslateSmoothness(); - }; - - cameraProps.m_rotateSmoothingEnabledFn = [] - { - return SandboxEditor::CameraRotateSmoothingEnabled(); - }; - - cameraProps.m_translateSmoothingEnabledFn = [] - { - return SandboxEditor::CameraTranslateSmoothingEnabled(); - }; - }); - - controller->SetCameraListBuilderCallback( - [viewportId](AzFramework::Cameras& cameras) - { - const auto hideCursor = [viewportId] - { - if (SandboxEditor::CameraCaptureCursorForLook()) - { - AzToolsFramework::ViewportInteraction::ViewportMouseCursorRequestBus::Event( - viewportId, &AzToolsFramework::ViewportInteraction::ViewportMouseCursorRequestBus::Events::BeginCursorCapture); - } - }; - const auto showCursor = [viewportId] - { - if (SandboxEditor::CameraCaptureCursorForLook()) - { - AzToolsFramework::ViewportInteraction::ViewportMouseCursorRequestBus::Event( - viewportId, &AzToolsFramework::ViewportInteraction::ViewportMouseCursorRequestBus::Events::EndCursorCapture); - } - }; - - auto firstPersonRotateCamera = AZStd::make_shared(SandboxEditor::CameraFreeLookChannelId()); - firstPersonRotateCamera->m_rotateSpeedFn = [] - { - return SandboxEditor::CameraRotateSpeed(); - }; - - // default behavior is to hide the cursor but this can be disabled (useful for remote desktop) - // note: See CaptureCursorLook in the Settings Registry - firstPersonRotateCamera->SetActivationBeganFn(hideCursor); - firstPersonRotateCamera->SetActivationEndedFn(showCursor); - - auto firstPersonPanCamera = - AZStd::make_shared(SandboxEditor::CameraFreePanChannelId(), AzFramework::LookPan); - firstPersonPanCamera->m_panSpeedFn = [] - { - return SandboxEditor::CameraPanSpeed(); - }; - firstPersonPanCamera->m_invertPanXFn = [] - { - return SandboxEditor::CameraPanInvertedX(); - }; - firstPersonPanCamera->m_invertPanYFn = [] - { - return SandboxEditor::CameraPanInvertedY(); - }; - - AzFramework::TranslateCameraInputChannels translateCameraInputChannels; - translateCameraInputChannels.m_leftChannelId = SandboxEditor::CameraTranslateLeftChannelId(); - translateCameraInputChannels.m_rightChannelId = SandboxEditor::CameraTranslateRightChannelId(); - translateCameraInputChannels.m_forwardChannelId = SandboxEditor::CameraTranslateForwardChannelId(); - translateCameraInputChannels.m_backwardChannelId = SandboxEditor::CameraTranslateBackwardChannelId(); - translateCameraInputChannels.m_upChannelId = SandboxEditor::CameraTranslateUpChannelId(); - translateCameraInputChannels.m_downChannelId = SandboxEditor::CameraTranslateDownChannelId(); - translateCameraInputChannels.m_boostChannelId = SandboxEditor::CameraTranslateBoostChannelId(); - - auto firstPersonTranslateCamera = - AZStd::make_shared(AzFramework::LookTranslation, translateCameraInputChannels); - firstPersonTranslateCamera->m_translateSpeedFn = [] - { - return SandboxEditor::CameraTranslateSpeed(); - }; - firstPersonTranslateCamera->m_boostMultiplierFn = [] - { - return SandboxEditor::CameraBoostMultiplier(); - }; - - auto firstPersonWheelCamera = AZStd::make_shared(); - firstPersonWheelCamera->m_scrollSpeedFn = [] - { - return SandboxEditor::CameraScrollSpeed(); - }; - - auto orbitCamera = AZStd::make_shared(SandboxEditor::CameraOrbitChannelId()); - orbitCamera->SetLookAtFn( - [viewportId](const AZ::Vector3& position, const AZ::Vector3& direction) -> AZStd::optional - { - AZStd::optional lookAtAfterInterpolation; - AtomToolsFramework::ModularViewportCameraControllerRequestBus::EventResult( - lookAtAfterInterpolation, viewportId, - &AtomToolsFramework::ModularViewportCameraControllerRequestBus::Events::LookAtAfterInterpolation); - - // initially attempt to use the last set look at point after an interpolation has finished - if (lookAtAfterInterpolation.has_value()) - { - return *lookAtAfterInterpolation; - } - - const float RayDistance = 1000.0f; - AzFramework::RenderGeometry::RayRequest ray; - ray.m_startWorldPosition = position; - ray.m_endWorldPosition = position + direction * RayDistance; - ray.m_onlyVisible = true; - - AzFramework::RenderGeometry::RayResult renderGeometryIntersectionResult; - AzFramework::RenderGeometry::IntersectorBus::EventResult( - renderGeometryIntersectionResult, AzToolsFramework::GetEntityContextId(), - &AzFramework::RenderGeometry::IntersectorBus::Events::RayIntersect, ray); - - // attempt a ray intersection with any visible mesh and return the intersection position if successful - if (renderGeometryIntersectionResult) - { - return renderGeometryIntersectionResult.m_worldPosition; - } - - // if there is no selection or no intersection, fallback to default camera orbit behavior (ground plane - // intersection) - return {}; - }); - - auto orbitRotateCamera = AZStd::make_shared(SandboxEditor::CameraOrbitLookChannelId()); - orbitRotateCamera->m_rotateSpeedFn = [] - { - return SandboxEditor::CameraRotateSpeed(); - }; - orbitRotateCamera->m_invertYawFn = [] - { - return SandboxEditor::CameraOrbitYawRotationInverted(); - }; - - auto orbitTranslateCamera = - AZStd::make_shared(AzFramework::OrbitTranslation, translateCameraInputChannels); - orbitTranslateCamera->m_translateSpeedFn = [] - { - return SandboxEditor::CameraTranslateSpeed(); - }; - orbitTranslateCamera->m_boostMultiplierFn = [] - { - return SandboxEditor::CameraBoostMultiplier(); - }; - - auto orbitDollyWheelCamera = AZStd::make_shared(); - orbitDollyWheelCamera->m_scrollSpeedFn = [] - { - return SandboxEditor::CameraScrollSpeed(); - }; - - auto orbitDollyMoveCamera = - AZStd::make_shared(SandboxEditor::CameraOrbitDollyChannelId()); - orbitDollyMoveCamera->m_cursorSpeedFn = [] - { - return SandboxEditor::CameraDollyMotionSpeed(); - }; - - auto orbitPanCamera = AZStd::make_shared(SandboxEditor::CameraOrbitPanChannelId(), AzFramework::OrbitPan); - orbitPanCamera->m_panSpeedFn = [] - { - return SandboxEditor::CameraPanSpeed(); - }; - orbitPanCamera->m_invertPanXFn = [] - { - return SandboxEditor::CameraPanInvertedX(); - }; - orbitPanCamera->m_invertPanYFn = [] - { - return SandboxEditor::CameraPanInvertedY(); - }; - - orbitCamera->m_orbitCameras.AddCamera(orbitRotateCamera); - orbitCamera->m_orbitCameras.AddCamera(orbitTranslateCamera); - orbitCamera->m_orbitCameras.AddCamera(orbitDollyWheelCamera); - orbitCamera->m_orbitCameras.AddCamera(orbitDollyMoveCamera); - orbitCamera->m_orbitCameras.AddCamera(orbitPanCamera); - - cameras.AddCamera(firstPersonRotateCamera); - cameras.AddCamera(firstPersonPanCamera); - cameras.AddCamera(firstPersonTranslateCamera); - cameras.AddCamera(firstPersonWheelCamera); - cameras.AddCamera(orbitCamera); - }); - - return controller; -} - void EditorViewportWidget::SetViewportId(int id) { CViewport::SetViewportId(id); @@ -1288,7 +1073,8 @@ void EditorViewportWidget::SetViewportId(int id) m_renderViewport->GetControllerList()->Add(AZStd::make_shared()); - m_renderViewport->GetControllerList()->Add(CreateModularViewportCameraController(AzFramework::ViewportId(id))); + m_editorModularViewportCameraComposer = AZStd::make_unique(AzFramework::ViewportId(id)); + m_renderViewport->GetControllerList()->Add(m_editorModularViewportCameraComposer->CreateModularViewportCameraController()); m_renderViewport->SetViewportSettings(&g_EditorViewportSettings); diff --git a/Code/Editor/EditorViewportWidget.h b/Code/Editor/EditorViewportWidget.h index d4bb14ad3b..9da5e3f9a1 100644 --- a/Code/Editor/EditorViewportWidget.h +++ b/Code/Editor/EditorViewportWidget.h @@ -19,6 +19,7 @@ #include "Undo/Undo.h" #include "Util/PredefinedAspectRatios.h" #include "EditorViewportSettings.h" +#include "EditorModularViewportCameraComposer.h" #include #include @@ -369,6 +370,8 @@ private: // This widget holds a reference to the manipulator manage because its responsible for drawing manipulators AZStd::shared_ptr m_manipulatorManager; + AZStd::unique_ptr m_editorModularViewportCameraComposer; + // Helper for getting EditorEntityNotificationBus events AZStd::unique_ptr m_editorEntityNotifications; @@ -389,7 +392,3 @@ private: AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING }; - -//! Creates a modular camera controller in the configuration used by the editor viewport. -SANDBOX_API AZStd::shared_ptr CreateModularViewportCameraController( - const AzFramework::ViewportId viewportId); diff --git a/Code/Editor/Lib/Tests/test_ModularViewportCameraController.cpp b/Code/Editor/Lib/Tests/test_ModularViewportCameraController.cpp index 7309110c4d..ce5564c7f6 100644 --- a/Code/Editor/Lib/Tests/test_ModularViewportCameraController.cpp +++ b/Code/Editor/Lib/Tests/test_ModularViewportCameraController.cpp @@ -139,7 +139,8 @@ namespace UnitTest m_viewportMouseCursorRequests.Connect(TestViewportId, m_inputChannelMapper.get()); // create editor modular camera - auto controller = CreateModularViewportCameraController(TestViewportId); + m_editorModularViewportCameraComposer = AZStd::make_unique(TestViewportId); + auto controller = m_editorModularViewportCameraComposer->CreateModularViewportCameraController(); // set some overrides for the test controller->SetCameraViewportContextBuilderCallback( @@ -169,6 +170,7 @@ namespace UnitTest void HaltCollaborators() { + m_editorModularViewportCameraComposer.reset(); m_mockWindowRequests.Disconnect(); m_viewportMouseCursorRequests.Disconnect(); m_cameraViewportContextView = nullptr; @@ -212,6 +214,7 @@ namespace UnitTest ViewportMouseCursorRequestImpl m_viewportMouseCursorRequests; AtomToolsFramework::ModularCameraViewportContext* m_cameraViewportContextView = nullptr; AZStd::unique_ptr m_settingsRegistry; + AZStd::unique_ptr m_editorModularViewportCameraComposer; }; const AzFramework::ViewportId ModularViewportCameraControllerFixture::TestViewportId = AzFramework::ViewportId(0); diff --git a/Code/Editor/editor_lib_files.cmake b/Code/Editor/editor_lib_files.cmake index bc8f835fc7..24634b245d 100644 --- a/Code/Editor/editor_lib_files.cmake +++ b/Code/Editor/editor_lib_files.cmake @@ -787,6 +787,9 @@ set(FILES EditorViewportSettings.h EditorViewportCamera.cpp EditorViewportCamera.h + EditorModularViewportCameraComposer.cpp + EditorModularViewportCameraComposer.h + EditorModularViewportCameraComposerBus.h ViewportManipulatorController.cpp ViewportManipulatorController.h TopRendererWnd.cpp diff --git a/Code/Framework/AzFramework/AzFramework/Viewport/CameraInput.cpp b/Code/Framework/AzFramework/AzFramework/Viewport/CameraInput.cpp index fac1e45920..89338a355f 100644 --- a/Code/Framework/AzFramework/AzFramework/Viewport/CameraInput.cpp +++ b/Code/Framework/AzFramework/AzFramework/Viewport/CameraInput.cpp @@ -332,6 +332,11 @@ namespace AzFramework return nextCamera; } + void RotateCameraInput::SetRotateInputChannelId(const InputChannelId& rotateChannelId) + { + m_rotateChannelId = rotateChannelId; + } + PanCameraInput::PanCameraInput(const InputChannelId& panChannelId, PanAxesFn panAxesFn) : m_panAxesFn(AZStd::move(panAxesFn)) , m_panChannelId(panChannelId) @@ -379,35 +384,40 @@ namespace AzFramework return nextCamera; } - TranslateCameraInput::TranslationType TranslateCameraInput::TranslationFromKey( - const InputChannelId& channelId, const TranslateCameraInputChannels& translateCameraInputChannels) + void PanCameraInput::SetPanInputChannelId(const InputChannelId& panChannelId) { - if (channelId == translateCameraInputChannels.m_forwardChannelId) + m_panChannelId = panChannelId; + } + + TranslateCameraInput::TranslationType TranslateCameraInput::TranslationFromKey( + const InputChannelId& channelId, const TranslateCameraInputChannelIds& translateCameraInputChannelIds) + { + if (channelId == translateCameraInputChannelIds.m_forwardChannelId) { return TranslationType::Forward; } - if (channelId == translateCameraInputChannels.m_backwardChannelId) + if (channelId == translateCameraInputChannelIds.m_backwardChannelId) { return TranslationType::Backward; } - if (channelId == translateCameraInputChannels.m_leftChannelId) + if (channelId == translateCameraInputChannelIds.m_leftChannelId) { return TranslationType::Left; } - if (channelId == translateCameraInputChannels.m_rightChannelId) + if (channelId == translateCameraInputChannelIds.m_rightChannelId) { return TranslationType::Right; } - if (channelId == translateCameraInputChannels.m_downChannelId) + if (channelId == translateCameraInputChannelIds.m_downChannelId) { return TranslationType::Down; } - if (channelId == translateCameraInputChannels.m_upChannelId) + if (channelId == translateCameraInputChannelIds.m_upChannelId) { return TranslationType::Up; } @@ -416,9 +426,9 @@ namespace AzFramework } TranslateCameraInput::TranslateCameraInput( - TranslationAxesFn translationAxesFn, const TranslateCameraInputChannels& translateCameraInputChannels) + TranslationAxesFn translationAxesFn, const TranslateCameraInputChannelIds& translateCameraInputChannelIds) : m_translationAxesFn(AZStd::move(translationAxesFn)) - , m_translateCameraInputChannels(translateCameraInputChannels) + , m_translateCameraInputChannelIds(translateCameraInputChannelIds) { m_translateSpeedFn = []() constexpr { @@ -438,13 +448,13 @@ namespace AzFramework { if (input->m_state == InputChannel::State::Began) { - m_translation |= TranslationFromKey(input->m_channelId, m_translateCameraInputChannels); + m_translation |= TranslationFromKey(input->m_channelId, m_translateCameraInputChannelIds); if (m_translation != TranslationType::Nil) { BeginActivation(); } - if (input->m_channelId == m_translateCameraInputChannels.m_boostChannelId) + if (input->m_channelId == m_translateCameraInputChannelIds.m_boostChannelId) { m_boost = true; } @@ -452,12 +462,12 @@ namespace AzFramework // ensure we don't process end events in the idle state else if (input->m_state == InputChannel::State::Ended && !Idle()) { - m_translation &= ~(TranslationFromKey(input->m_channelId, m_translateCameraInputChannels)); + m_translation &= ~(TranslationFromKey(input->m_channelId, m_translateCameraInputChannelIds)); if (m_translation == TranslationType::Nil) { EndActivation(); } - if (input->m_channelId == m_translateCameraInputChannels.m_boostChannelId) + if (input->m_channelId == m_translateCameraInputChannelIds.m_boostChannelId) { m_boost = false; } @@ -529,6 +539,11 @@ namespace AzFramework m_boost = false; } + void TranslateCameraInput::SetTranslateCameraInputChannelIds(const TranslateCameraInputChannelIds& translateCameraInputChannelIds) + { + m_translateCameraInputChannelIds = translateCameraInputChannelIds; + } + OrbitCameraInput::OrbitCameraInput(const InputChannelId& orbitChannelId) : m_orbitChannelId(orbitChannelId) { @@ -620,6 +635,11 @@ namespace AzFramework return nextCamera; } + void OrbitCameraInput::SetOrbitInputChannelId(const InputChannelId& orbitChanneId) + { + m_orbitChannelId = orbitChanneId; + } + OrbitDollyScrollCameraInput::OrbitDollyScrollCameraInput() { m_scrollSpeedFn = []() constexpr @@ -678,6 +698,11 @@ namespace AzFramework return nextCamera; } + void OrbitDollyCursorMoveCameraInput::SetDollyInputChannelId(const InputChannelId& dollyChannelId) + { + m_dollyChannelId = dollyChannelId; + } + ScrollTranslationCameraInput::ScrollTranslationCameraInput() { m_scrollSpeedFn = []() constexpr diff --git a/Code/Framework/AzFramework/AzFramework/Viewport/CameraInput.h b/Code/Framework/AzFramework/AzFramework/Viewport/CameraInput.h index ec383fa8ef..69e8b66434 100644 --- a/Code/Framework/AzFramework/AzFramework/Viewport/CameraInput.h +++ b/Code/Framework/AzFramework/AzFramework/Viewport/CameraInput.h @@ -303,6 +303,8 @@ namespace AzFramework bool HandleEvents(const InputEvent& event, const ScreenVector& cursorDelta, float scrollDelta) override; Camera StepCamera(const Camera& targetCamera, const ScreenVector& cursorDelta, float scrollDelta, float deltaTime) override; + void SetRotateInputChannelId(const InputChannelId& rotateChannelId); + AZStd::function m_rotateSpeedFn; AZStd::function m_invertPitchFn; AZStd::function m_invertYawFn; @@ -355,6 +357,8 @@ namespace AzFramework bool HandleEvents(const InputEvent& event, const ScreenVector& cursorDelta, float scrollDelta) override; Camera StepCamera(const Camera& targetCamera, const ScreenVector& cursorDelta, float scrollDelta, float deltaTime) override; + void SetPanInputChannelId(const InputChannelId& panChannelId); + AZStd::function m_panSpeedFn; AZStd::function m_invertPanXFn; AZStd::function m_invertPanYFn; @@ -398,7 +402,7 @@ namespace AzFramework } //! Groups all camera translation inputs. - struct TranslateCameraInputChannels + struct TranslateCameraInputChannelIds { InputChannelId m_forwardChannelId; InputChannelId m_backwardChannelId; @@ -414,13 +418,15 @@ namespace AzFramework { public: explicit TranslateCameraInput( - TranslationAxesFn translationAxesFn, const TranslateCameraInputChannels& translateCameraInputChannels); + TranslationAxesFn translationAxesFn, const TranslateCameraInputChannelIds& translateCameraInputChannelIds); // CameraInput overrides ... bool 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; + void SetTranslateCameraInputChannelIds(const TranslateCameraInputChannelIds& translateCameraInputChannelIds); + AZStd::function m_translateSpeedFn; AZStd::function m_boostMultiplierFn; @@ -482,11 +488,11 @@ namespace AzFramework //! Converts from a generic input channel id to a concrete translation type (based on the user's key mappings). TranslationType TranslationFromKey( - const InputChannelId& channelId, const TranslateCameraInputChannels& translateCameraInputChannels); + const InputChannelId& channelId, const TranslateCameraInputChannelIds& translateCameraInputChannelIds); TranslationType m_translation = TranslationType::Nil; //!< Types of translation the camera input is under. TranslationAxesFn m_translationAxesFn; //!< Builder for translation axes. - TranslateCameraInputChannels m_translateCameraInputChannels; //!< Input channel ids that map to internal translation types. + TranslateCameraInputChannelIds m_translateCameraInputChannelIds; //!< Input channel ids that map to internal translation types. bool m_boost = false; //!< Is the translation speed currently being multiplied/scaled upwards. }; @@ -513,6 +519,8 @@ namespace AzFramework bool HandleEvents(const InputEvent& event, const ScreenVector& cursorDelta, float scrollDelta) override; Camera StepCamera(const Camera& targetCamera, const ScreenVector& cursorDelta, float scrollDelta, float deltaTime) override; + void SetDollyInputChannelId(const InputChannelId& dollyChannelId); + AZStd::function m_cursorSpeedFn; private: @@ -548,6 +556,8 @@ namespace AzFramework Camera StepCamera(const Camera& targetCamera, const ScreenVector& cursorDelta, float scrollDelta, float deltaTime) override; bool Exclusive() const override; + void SetOrbitInputChannelId(const InputChannelId& orbitChanneId); + Cameras m_orbitCameras; //!< The camera inputs to run when this camera input is active (only these will run as it is exclusive). //! Override the default behavior for how a look-at point is calculated. diff --git a/Code/Framework/AzFramework/Tests/CameraInputTests.cpp b/Code/Framework/AzFramework/Tests/CameraInputTests.cpp index ef340a41a5..486cca2af0 100644 --- a/Code/Framework/AzFramework/Tests/CameraInputTests.cpp +++ b/Code/Framework/AzFramework/Tests/CameraInputTests.cpp @@ -35,23 +35,23 @@ namespace UnitTest m_cameraSystem = AZStd::make_shared(); - m_translateCameraInputChannels.m_leftChannelId = AzFramework::InputChannelId("keyboard_key_alphanumeric_A"); - m_translateCameraInputChannels.m_rightChannelId = AzFramework::InputChannelId("keyboard_key_alphanumeric_D"); - m_translateCameraInputChannels.m_forwardChannelId = AzFramework::InputChannelId("keyboard_key_alphanumeric_W"); - m_translateCameraInputChannels.m_backwardChannelId = AzFramework::InputChannelId("keyboard_key_alphanumeric_S"); - m_translateCameraInputChannels.m_upChannelId = AzFramework::InputChannelId("keyboard_key_alphanumeric_E"); - m_translateCameraInputChannels.m_downChannelId = AzFramework::InputChannelId("keyboard_key_alphanumeric_Q"); - m_translateCameraInputChannels.m_boostChannelId = AzFramework::InputChannelId("keyboard_key_modifier_shift_l"); + m_translateCameraInputChannelIds.m_leftChannelId = AzFramework::InputChannelId("keyboard_key_alphanumeric_A"); + m_translateCameraInputChannelIds.m_rightChannelId = AzFramework::InputChannelId("keyboard_key_alphanumeric_D"); + m_translateCameraInputChannelIds.m_forwardChannelId = AzFramework::InputChannelId("keyboard_key_alphanumeric_W"); + m_translateCameraInputChannelIds.m_backwardChannelId = AzFramework::InputChannelId("keyboard_key_alphanumeric_S"); + m_translateCameraInputChannelIds.m_upChannelId = AzFramework::InputChannelId("keyboard_key_alphanumeric_E"); + m_translateCameraInputChannelIds.m_downChannelId = AzFramework::InputChannelId("keyboard_key_alphanumeric_Q"); + m_translateCameraInputChannelIds.m_boostChannelId = AzFramework::InputChannelId("keyboard_key_modifier_shift_l"); m_firstPersonRotateCamera = AZStd::make_shared(AzFramework::InputDeviceMouse::Button::Right); m_firstPersonTranslateCamera = - AZStd::make_shared(AzFramework::LookTranslation, m_translateCameraInputChannels); + AZStd::make_shared(AzFramework::LookTranslation, m_translateCameraInputChannelIds); auto orbitCamera = AZStd::make_shared(AzFramework::InputChannelId("keyboard_key_modifier_alt_l")); auto orbitRotateCamera = AZStd::make_shared(AzFramework::InputDeviceMouse::Button::Left); auto orbitTranslateCamera = - AZStd::make_shared(AzFramework::OrbitTranslation, m_translateCameraInputChannels); + AZStd::make_shared(AzFramework::OrbitTranslation, m_translateCameraInputChannelIds); orbitCamera->m_orbitCameras.AddCamera(orbitRotateCamera); orbitCamera->m_orbitCameras.AddCamera(orbitTranslateCamera); @@ -77,7 +77,7 @@ namespace UnitTest AllocatorsTestFixture::TearDown(); } - AzFramework::TranslateCameraInputChannels m_translateCameraInputChannels; + AzFramework::TranslateCameraInputChannelIds m_translateCameraInputChannelIds; AZStd::shared_ptr m_firstPersonRotateCamera; AZStd::shared_ptr m_firstPersonTranslateCamera; }; @@ -112,7 +112,7 @@ namespace UnitTest }); HandleEventAndUpdate( - AzFramework::DiscreteInputEvent{ m_translateCameraInputChannels.m_forwardChannelId, AzFramework::InputChannel::State::Began }); + AzFramework::DiscreteInputEvent{ m_translateCameraInputChannelIds.m_forwardChannelId, AzFramework::InputChannel::State::Began }); EXPECT_TRUE(activationBegan); } @@ -208,9 +208,9 @@ namespace UnitTest }); HandleEventAndUpdate( - AzFramework::DiscreteInputEvent{ m_translateCameraInputChannels.m_forwardChannelId, AzFramework::InputChannel::State::Began }); + AzFramework::DiscreteInputEvent{ m_translateCameraInputChannelIds.m_forwardChannelId, AzFramework::InputChannel::State::Began }); HandleEventAndUpdate( - AzFramework::DiscreteInputEvent{ m_translateCameraInputChannels.m_forwardChannelId, AzFramework::InputChannel::State::Ended }); + AzFramework::DiscreteInputEvent{ m_translateCameraInputChannelIds.m_forwardChannelId, AzFramework::InputChannel::State::Ended }); EXPECT_TRUE(activationBegan); EXPECT_TRUE(activationEnded); @@ -226,7 +226,7 @@ namespace UnitTest }); HandleEventAndUpdate( - AzFramework::DiscreteInputEvent{ m_translateCameraInputChannels.m_forwardChannelId, AzFramework::InputChannel::State::Began }); + AzFramework::DiscreteInputEvent{ m_translateCameraInputChannelIds.m_forwardChannelId, AzFramework::InputChannel::State::Began }); m_cameraSystem->m_cameras.Clear(); From 9e5ef08229d36ac9a4a624d0af13f91c43a8e8e5 Mon Sep 17 00:00:00 2001 From: hultonha <82228511+hultonha@users.noreply.github.com> Date: Fri, 27 Aug 2021 13:06:56 +0100 Subject: [PATCH 122/131] Remove unused lambda capture variable (#3634) Signed-off-by: hultonha --- Code/Editor/EditorModularViewportCameraComposer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Code/Editor/EditorModularViewportCameraComposer.cpp b/Code/Editor/EditorModularViewportCameraComposer.cpp index 2eab1c5611..498d6f3353 100644 --- a/Code/Editor/EditorModularViewportCameraComposer.cpp +++ b/Code/Editor/EditorModularViewportCameraComposer.cpp @@ -85,7 +85,7 @@ namespace SandboxEditor }); controller->SetCameraListBuilderCallback( - [viewportId = m_viewportId, this](AzFramework::Cameras& cameras) + [this](AzFramework::Cameras& cameras) { cameras.AddCamera(m_firstPersonRotateCamera); cameras.AddCamera(m_firstPersonPanCamera); From d590a91fe791a85ab81baf5dd1f4b262ba008c73 Mon Sep 17 00:00:00 2001 From: Chris Galvan Date: Fri, 27 Aug 2021 11:24:05 -0500 Subject: [PATCH 123/131] Implemented helper method of QFileDialog::getSaveFileName to prevent user from saving files with invalid names. Signed-off-by: Chris Galvan --- Code/Editor/TrackView/TrackViewDialog.cpp | 3 +- Code/Editor/TrackView/TrackViewNodes.cpp | 3 +- .../Components/Widgets/FileDialog.cpp | 53 +++++++++++++++++++ .../Components/Widgets/FileDialog.h | 29 ++++++++++ .../AzQtComponents/azqtcomponents_files.cmake | 2 + .../AssetEditor/AssetEditorWidget.cpp | 13 ++--- .../Source/ImageProcessingSystemComponent.cpp | 4 +- .../Code/Source/Util/Util.cpp | 6 +-- .../CreateMaterialDialog.cpp | 6 +-- .../EditorMaterialComponentExporter.cpp | 4 +- .../EMStudioSDK/Source/FileManager.cpp | 39 +++++--------- Gems/LyShine/Code/Editor/EditorWindow.cpp | 4 +- .../Code/Editor/View/Windows/MainWindow.cpp | 4 +- .../Code/Source/EditorWhiteBoxComponent.cpp | 6 +-- 14 files changed, 127 insertions(+), 49 deletions(-) create mode 100644 Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/FileDialog.cpp create mode 100644 Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/FileDialog.h diff --git a/Code/Editor/TrackView/TrackViewDialog.cpp b/Code/Editor/TrackView/TrackViewDialog.cpp index cfaa82fdb4..d70cbad29e 100644 --- a/Code/Editor/TrackView/TrackViewDialog.cpp +++ b/Code/Editor/TrackView/TrackViewDialog.cpp @@ -34,6 +34,7 @@ // AzQtComponents #include +#include // CryCommon #include @@ -2324,7 +2325,7 @@ void CTrackViewDialog::SaveCurrentSequenceToFBX() } } - QString filename = QFileDialog::getSaveFileName(this, tr("Export Selected Nodes To FBX File"), selectedSequenceFBXStr, szFilters); + QString filename = AzQtComponents::FileDialog::GetSaveFileName(this, tr("Export Selected Nodes To FBX File"), selectedSequenceFBXStr, szFilters); if (!filename.isEmpty()) { pExportManager->SetBakedKeysSequenceExport(true); diff --git a/Code/Editor/TrackView/TrackViewNodes.cpp b/Code/Editor/TrackView/TrackViewNodes.cpp index e3b994c488..2a2d584e46 100644 --- a/Code/Editor/TrackView/TrackViewNodes.cpp +++ b/Code/Editor/TrackView/TrackViewNodes.cpp @@ -30,6 +30,7 @@ // AzQtComponents #include +#include // CryCommon #include @@ -1044,7 +1045,7 @@ void CTrackViewNodesCtrl::OnNMRclick(QPoint point) file = QString::fromUtf8(selectedNodes.GetNode(0)->GetName().c_str()) + QString(".fbx"); } - QString path = QFileDialog::getSaveFileName(this, tr("Export Selected Nodes To FBX File"), QString(), tr("FBX Files (*.fbx)")); + QString path = AzQtComponents::FileDialog::GetSaveFileName(this, tr("Export Selected Nodes To FBX File"), QString(), tr("FBX Files (*.fbx)")); if (!path.isEmpty()) { diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/FileDialog.cpp b/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/FileDialog.cpp new file mode 100644 index 0000000000..cdd6a77094 --- /dev/null +++ b/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/FileDialog.cpp @@ -0,0 +1,53 @@ +/* + * Copyright (c) Contributors to the Open 3D Engine Project. + * For complete copyright and license terms please see the LICENSE at the root of this distribution. + * + * SPDX-License-Identifier: Apache-2.0 OR MIT + * + */ + +#include + +#include +#include + +namespace AzQtComponents +{ + QString FileDialog::GetSaveFileName(QWidget* parent, const QString& caption, const QString& dir, + const QString& filter, QString* selectedFilter, QFileDialog::Options options) + { + bool shouldPromptAgain = false; + QString filePath; + + do + { + // Trigger Qt's save filename dialog + // If filePath isn't empty, it means we are prompting again because the filename was invalid, + // so pass it instead of the directory so the filename is pre-filled in for the user + filePath = QFileDialog::getSaveFileName(parent, caption, (filePath.isEmpty()) ? dir : filePath, filter, selectedFilter, options); + + if (!filePath.isEmpty()) + { + QFileInfo fileInfo(filePath); + QString fileName = fileInfo.fileName(); + + // Check if the filename has any invalid characters + QRegExp validFileNameRegex("^[a-zA-Z0-9_\\-./]*$"); + shouldPromptAgain = !validFileNameRegex.exactMatch(fileName); + + // If the filename had invalid characters, then show a warning message and then we will re-prompt the save filename dialog + if (shouldPromptAgain) + { + QMessageBox::warning(parent, QObject::tr("Invalid filename"), QObject::tr("The filename contains invalid characters\n\n%1").arg(fileName)); + } + } + else + { + // If the filePath is empty, then the user cancelled the dialog so we don't need to prompt again + shouldPromptAgain = false; + } + } while (shouldPromptAgain); + + return filePath; + } +} // namespace AzQtComponents diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/FileDialog.h b/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/FileDialog.h new file mode 100644 index 0000000000..6b63404949 --- /dev/null +++ b/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/FileDialog.h @@ -0,0 +1,29 @@ +/* + * Copyright (c) Contributors to the Open 3D Engine Project. + * For complete copyright and license terms please see the LICENSE at the root of this distribution. + * + * SPDX-License-Identifier: Apache-2.0 OR MIT + * + */ + +#pragma once + +#include + +#if !defined(Q_MOC_RUN) +#include +#endif + +namespace AzQtComponents +{ + class AZ_QT_COMPONENTS_API FileDialog + { + public: + //! Helper method that extends QFileDialog::getSaveFileName to prevent the user from + //! saving a filename with invalid characters (e.g. AP doesn't allow @ characters because they are used for aliases) + static QString GetSaveFileName(QWidget* parent = nullptr, const QString& caption = QString(), + const QString& dir = QString(), const QString& filter = QString(), + QString* selectedFilter = nullptr, QFileDialog::Options options = QFileDialog::Options()); + }; + +} // namespace AzQtComponents diff --git a/Code/Framework/AzQtComponents/AzQtComponents/azqtcomponents_files.cmake b/Code/Framework/AzQtComponents/AzQtComponents/azqtcomponents_files.cmake index af1a3a9f56..c214b81405 100644 --- a/Code/Framework/AzQtComponents/AzQtComponents/azqtcomponents_files.cmake +++ b/Code/Framework/AzQtComponents/AzQtComponents/azqtcomponents_files.cmake @@ -146,6 +146,8 @@ set(FILES Components/Widgets/Eyedropper.h Components/Widgets/Eyedropper.cpp Components/Widgets/EyedropperConfig.ini + Components/Widgets/FileDialog.cpp + Components/Widgets/FileDialog.h Components/Widgets/FilteredSearchWidget.qss Components/Widgets/FilteredSearchWidgetConfig.ini Components/Widgets/GradientSlider.cpp diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/AssetEditor/AssetEditorWidget.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/AssetEditor/AssetEditorWidget.cpp index 7198ed1be8..e155189a99 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/AssetEditor/AssetEditorWidget.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/AssetEditor/AssetEditorWidget.cpp @@ -37,6 +37,10 @@ AZ_POP_DISABLE_WARNING #include #include +#include + +#include + #include #include @@ -46,9 +50,6 @@ AZ_POP_DISABLE_WARNING #include #include #include -AZ_PUSH_DISABLE_WARNING(4251, "-Wunknown-warning-option") // 'QFileInfo::d_ptr': class 'QSharedDataPointer' needs to have dll-interface to be used by clients of class 'QFileInfo' -#include -AZ_POP_DISABLE_WARNING #include namespace AzToolsFramework @@ -414,7 +415,7 @@ namespace AzToolsFramework filter.append(")"); } - const QString saveAs = QFileDialog::getSaveFileName(nullptr, tr("Save As..."), m_userSettings->m_lastSavePath.c_str(), filter); + const QString saveAs = AzQtComponents::FileDialog::GetSaveFileName(AzToolsFramework::GetActiveWindow(), tr("Save As..."), m_userSettings->m_lastSavePath.c_str(), filter); return SaveImpl(asset, saveAs); } @@ -902,7 +903,7 @@ namespace AzToolsFramework statusString = QString("%1"); } - statusString = statusString.arg(m_currentAsset).arg(m_queuedAssetStatus); + statusString = statusString.arg(m_currentAsset); if (!m_queuedAssetStatus.isEmpty()) { @@ -920,7 +921,7 @@ namespace AzToolsFramework void AssetEditorWidget::SetupHeader() { - QString nameString = QString("%1").arg(m_currentAsset).arg(m_queuedAssetStatus); + QString nameString = QString("%1").arg(m_currentAsset); m_header->setName(nameString); diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/ImageProcessingSystemComponent.cpp b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/ImageProcessingSystemComponent.cpp index 0436ef0215..665d08b3ae 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/ImageProcessingSystemComponent.cpp +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/ImageProcessingSystemComponent.cpp @@ -17,6 +17,8 @@ #include #include +#include + #include #include #include @@ -202,7 +204,7 @@ namespace ImageProcessingAtom AZ::Data::AssetId assetId = product->GetAssetId(); menu->addAction("Save as DDS...", [assetId, this]() { - QString filePath = QFileDialog::getSaveFileName(nullptr, QString("Save to file"), m_lastSavedPath, QString("DDS file (*.dds)")); + QString filePath = AzQtComponents::FileDialog::GetSaveFileName(nullptr, QString("Save to file"), m_lastSavedPath, QString("DDS file (*.dds)")); if (filePath.isEmpty()) { return; diff --git a/Gems/Atom/Tools/AtomToolsFramework/Code/Source/Util/Util.cpp b/Gems/Atom/Tools/AtomToolsFramework/Code/Source/Util/Util.cpp index ba913e317b..be112345a9 100644 --- a/Gems/Atom/Tools/AtomToolsFramework/Code/Source/Util/Util.cpp +++ b/Gems/Atom/Tools/AtomToolsFramework/Code/Source/Util/Util.cpp @@ -11,13 +11,13 @@ #include #include #include +#include #include #include #include AZ_PUSH_DISABLE_WARNING(4251 4800, "-Wunknown-warning-option") // disable warnings spawned by QT #include -#include #include #include AZ_POP_DISABLE_WARNING @@ -29,7 +29,7 @@ namespace AtomToolsFramework const QFileInfo initialFileInfo(initialPath); const QString initialExt(initialFileInfo.completeSuffix()); - const QFileInfo selectedFileInfo(QFileDialog::getSaveFileName( + const QFileInfo selectedFileInfo(AzQtComponents::FileDialog::GetSaveFileName( QApplication::activeWindow(), "Save File", initialFileInfo.absolutePath() + @@ -104,7 +104,7 @@ namespace AtomToolsFramework const QFileInfo initialFileInfo(initialPath); const QString initialExt(initialFileInfo.completeSuffix()); - const QFileInfo duplicateFileInfo(QFileDialog::getSaveFileName( + const QFileInfo duplicateFileInfo(AzQtComponents::FileDialog::GetSaveFileName( QApplication::activeWindow(), "Duplicate File", GetUniqueFileInfo(initialPath).absoluteFilePath(), diff --git a/Gems/Atom/Tools/MaterialEditor/Code/Source/Window/CreateMaterialDialog/CreateMaterialDialog.cpp b/Gems/Atom/Tools/MaterialEditor/Code/Source/Window/CreateMaterialDialog/CreateMaterialDialog.cpp index 608122b77a..f27a08b08d 100644 --- a/Gems/Atom/Tools/MaterialEditor/Code/Source/Window/CreateMaterialDialog/CreateMaterialDialog.cpp +++ b/Gems/Atom/Tools/MaterialEditor/Code/Source/Window/CreateMaterialDialog/CreateMaterialDialog.cpp @@ -11,6 +11,8 @@ #include #include +#include + #include #include @@ -19,8 +21,6 @@ #include -#include - namespace MaterialEditor { CreateMaterialDialog::CreateMaterialDialog(QWidget* parent) @@ -95,7 +95,7 @@ namespace MaterialEditor //When the file selection button is pressed, open a file dialog to select where the material will be saved QObject::connect(m_ui->m_materialFilePicker, &AzQtComponents::BrowseEdit::attachedButtonTriggered, m_ui->m_materialFilePicker, [this]() { - QFileInfo fileInfo = QFileDialog::getSaveFileName(this, + QFileInfo fileInfo = AzQtComponents::FileDialog::GetSaveFileName(this, QString("Select Material Filename"), m_materialFileInfo.absoluteFilePath(), QString("Material (*.material)")); diff --git a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Material/EditorMaterialComponentExporter.cpp b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Material/EditorMaterialComponentExporter.cpp index 32a36392a4..f55da28fa6 100644 --- a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Material/EditorMaterialComponentExporter.cpp +++ b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/Material/EditorMaterialComponentExporter.cpp @@ -11,6 +11,7 @@ #include #include +#include #include #include #include @@ -22,7 +23,6 @@ AZ_PUSH_DISABLE_WARNING(4251 4800, "-Wunknown-warning-option") // disable warnin #include #include #include -#include #include #include #include @@ -145,7 +145,7 @@ namespace AZ // Whenever the browse button is clicked, open a save file dialog in the same location as the current export file setting QObject::connect(materialFileWidget, &AzQtComponents::BrowseEdit::attachedButtonTriggered, materialFileWidget, [&dialog, &exportItem, materialFileWidget, overwriteCheckBox]() { - QFileInfo fileInfo = QFileDialog::getSaveFileName(&dialog, + QFileInfo fileInfo = AzQtComponents::FileDialog::GetSaveFileName(&dialog, QString("Select Material Filename"), exportItem.GetExportPath().c_str(), QString("Material (*.material)"), diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/FileManager.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/FileManager.cpp index 5a89729e49..129d005f80 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/FileManager.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/FileManager.cpp @@ -9,7 +9,6 @@ #include "FileManager.h" #include #include -#include #include #include #include @@ -36,6 +35,8 @@ #include #include +#include + #include #include #include @@ -412,14 +413,12 @@ namespace EMStudio { GetManager()->SetAvoidRendering(true); - QFileDialog::Options options; QString selectedFilter; - const AZStd::string filename = QFileDialog::getSaveFileName(parent, // parent + const AZStd::string filename = AzQtComponents::FileDialog::GetSaveFileName(parent, // parent "Save", // caption GetLastUsedFolder(m_lastActorFolder), // directory "EMotion FX Actor Files (*.actor)", - &selectedFilter, - options).toUtf8().data(); + &selectedFilter).toUtf8().data(); GetManager()->SetAvoidRendering(false); @@ -471,14 +470,12 @@ namespace EMStudio { GetManager()->SetAvoidRendering(true); - QFileDialog::Options options; QString selectedFilter; - AZStd::string filename = QFileDialog::getSaveFileName(parent, // parent + AZStd::string filename = AzQtComponents::FileDialog::GetSaveFileName(parent, // parent "Save", // caption GetLastUsedFolder(m_lastWorkspaceFolder), // directory "EMotionFX Editor Workspace Files (*.emfxworkspace)", - &selectedFilter, - options).toUtf8().data(); + &selectedFilter).toUtf8().data(); GetManager()->SetAvoidRendering(false); @@ -553,14 +550,12 @@ namespace EMStudio { GetManager()->SetAvoidRendering(true); - QFileDialog::Options options; QString selectedFilter; - AZStd::string filename = QFileDialog::getSaveFileName(parent, // parent + AZStd::string filename = AzQtComponents::FileDialog::GetSaveFileName(parent, // parent "Save", // caption GetLastUsedFolder(m_lastMotionSetFolder), // directory "EMotion FX Motion Set Files (*.motionset)", - &selectedFilter, - options).toUtf8().data(); + &selectedFilter).toUtf8().data(); GetManager()->SetAvoidRendering(false); @@ -632,14 +627,12 @@ namespace EMStudio { GetManager()->SetAvoidRendering(true); - QFileDialog::Options options; QString selectedFilter; - AZStd::string filename = QFileDialog::getSaveFileName(parent, // parent + AZStd::string filename = AzQtComponents::FileDialog::GetSaveFileName(parent, // parent "Save", // caption GetLastUsedFolder(m_lastAnimGraphFolder), // directory "EMotion FX Anim Graph Files (*.animgraph);;All Files (*)", - &selectedFilter, - options).toUtf8().data(); + &selectedFilter).toUtf8().data(); GetManager()->SetAvoidRendering(false); @@ -675,14 +668,12 @@ namespace EMStudio { GetManager()->SetAvoidRendering(true); - QFileDialog::Options options; QString selectedFilter; - const AZStd::string filename = QFileDialog::getSaveFileName(parent, // parent + const AZStd::string filename = AzQtComponents::FileDialog::GetSaveFileName(parent, // parent "Save", // caption GetLastUsedFolder(m_lastNodeMapFolder), // directory "Node Map Files (*.nodeMap);;All Files (*)", - &selectedFilter, - options).toUtf8().data(); + &selectedFilter).toUtf8().data(); GetManager()->SetAvoidRendering(false); @@ -737,14 +728,12 @@ namespace EMStudio GetManager()->SetAvoidRendering(true); - QFileDialog::Options options; QString selectedFilter; - QString filename = QFileDialog::getSaveFileName(parent, // parent + QString filename = AzQtComponents::FileDialog::GetSaveFileName(parent, // parent "Save", // caption dir.c_str(), // directory "EMotion FX Blend Config Files (*.cfg);;All Files (*)", - &selectedFilter, - options); + &selectedFilter); GetManager()->SetAvoidRendering(false); diff --git a/Gems/LyShine/Code/Editor/EditorWindow.cpp b/Gems/LyShine/Code/Editor/EditorWindow.cpp index 5ae1eb44b9..663570bbf0 100644 --- a/Gems/LyShine/Code/Editor/EditorWindow.cpp +++ b/Gems/LyShine/Code/Editor/EditorWindow.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -32,7 +33,6 @@ #include #include #include -#include #define UICANVASEDITOR_SETTINGS_EDIT_MODE_STATE_KEY (QString("Edit Mode State") + " " + FileHelpers::GetAbsoluteGameDir()) #define UICANVASEDITOR_SETTINGS_EDIT_MODE_GEOM_KEY (QString("Edit Mode Geometry") + " " + FileHelpers::GetAbsoluteGameDir()) @@ -706,7 +706,7 @@ bool EditorWindow::SaveCanvasToXml(UiCanvasMetadata& canvasMetadata, bool forceA dir.append(canvasMetadata.m_canvasDisplayName.c_str()); } - QString filename = QFileDialog::getSaveFileName(nullptr, + QString filename = AzQtComponents::FileDialog::GetSaveFileName(nullptr, QString(), dir, "*." UICANVASEDITOR_CANVAS_EXTENSION, diff --git a/Gems/ScriptCanvas/Code/Editor/View/Windows/MainWindow.cpp b/Gems/ScriptCanvas/Code/Editor/View/Windows/MainWindow.cpp index f4241e3545..fbe03ffc0a 100644 --- a/Gems/ScriptCanvas/Code/Editor/View/Windows/MainWindow.cpp +++ b/Gems/ScriptCanvas/Code/Editor/View/Windows/MainWindow.cpp @@ -15,7 +15,6 @@ #include #include -#include #include #include #include @@ -91,6 +90,7 @@ #include #include +#include #include #include @@ -1868,7 +1868,7 @@ namespace ScriptCanvasEditor while (!isValidFileName) { - selectedFile = QFileDialog::getSaveFileName(this, tr("Save As..."), suggestedFilename.data(), filter); + selectedFile = AzQtComponents::FileDialog::GetSaveFileName(this, tr("Save As..."), suggestedFilename.data(), filter); // If the selected file is empty that means we just cancelled. // So we want to break out. diff --git a/Gems/WhiteBox/Code/Source/EditorWhiteBoxComponent.cpp b/Gems/WhiteBox/Code/Source/EditorWhiteBoxComponent.cpp index 61796bde58..f18b69393c 100644 --- a/Gems/WhiteBox/Code/Source/EditorWhiteBoxComponent.cpp +++ b/Gems/WhiteBox/Code/Source/EditorWhiteBoxComponent.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -31,7 +32,6 @@ #include #include #include -#include #include #include #include @@ -513,7 +513,7 @@ namespace WhiteBox WhiteBoxPathAtProjectRoot(GetEntity()->GetName(), ObjExtension); const QString fileFilter = AZStd::string::format("*.%s", ObjExtension).c_str(); - const QString absoluteSaveFilePath = QFileDialog::getSaveFileName( + const QString absoluteSaveFilePath = AzQtComponents::FileDialog::GetSaveFileName( nullptr, "Save As...", QString(initialAbsolutePathToExport.c_str()), fileFilter); const auto absoluteSaveFilePathUtf8 = absoluteSaveFilePath.toUtf8(); @@ -577,7 +577,7 @@ namespace WhiteBox { const QString fileFilter = AZStd::string::format("*.%s", Pipeline::WhiteBoxMeshAssetHandler::AssetFileExtension).c_str(); - const QString absolutePath = QFileDialog::getSaveFileName( + const QString absolutePath = AzQtComponents::FileDialog::GetSaveFileName( nullptr, "Save As Asset...", QString(initialAbsolutePath.c_str()), fileFilter); return AZStd::string(absolutePath.toUtf8()); From 9fac26e6a643139f3e83ba3f7af4f94a2b1fcb8d Mon Sep 17 00:00:00 2001 From: Qing Tao <55564570+VickyAtAZ@users.noreply.github.com> Date: Fri, 27 Aug 2021 10:09:58 -0700 Subject: [PATCH 124/131] Update o3de to use new packages of ISPCTexComp and squish-ccr (#3556) Update package name and hash Add compressor names. Update ImageProcessingAtom unit tests. Removed some unused test assets under ImageProcessingAtom Enalbe ISPC to all the platforms. Better error message with compression/decompression Add temp folder to git ignore added ispccompressor for all platform. valid it with linux Update windows package hashes. Removed AZ_TRAIT_IMAGEPROCESSING_USE_ISPC_TEXTURE_COMPRESSOR Minor refactor with image processing unit tests. Signed-off-by: qingtao --- .../AzCore/std/function/function_base.h | 1 + .../ImageProcessingAtom/Code/CMakeLists.txt | 1 + .../Atom/ImageProcessing/ImageObject.h | 1 - .../Code/Source/Compressors/CTSquisher.cpp | 5 + .../Code/Source/Compressors/CTSquisher.h | 1 + .../Code/Source/Compressors/Compressor.cpp | 10 +- .../Code/Source/Compressors/Compressor.h | 1 + .../Code/Source/Compressors/ETC2.cpp | 5 + .../Code/Source/Compressors/ETC2.h | 3 +- .../Compressors/ISPCTextureCompressor.cpp | 5 + .../Compressors/ISPCTextureCompressor.h | 4 +- .../Code/Source/Compressors/PVRTC.cpp | 5 + .../Code/Source/Compressors/PVRTC.h | 1 + .../Source/Converters/ConvertPixelFormat.cpp | 22 +- .../Code/Source/ImageBuilderComponent.cpp | 2 +- .../Code/Source/ImageLoader/QtImageLoader.cpp | 1 + .../Android/ImageProcessing_Traits_Android.h | 1 - .../Linux/ImageProcessing_Traits_Linux.h | 1 - .../Platform/Mac/ImageProcessing_Traits_Mac.h | 1 - .../Windows/ImageProcessing_Traits_Windows.h | 1 - .../Platform/Windows/platform_windows.cmake | 8 - .../Windows/platform_windows_files.cmake | 2 - .../Platform/iOS/ImageProcessing_Traits_iOS.h | 1 - .../Code/Source/Processing/ImageConvert.cpp | 2 +- .../Code/Source/Processing/ImageConvert.h | 2 +- .../Code/Source/Processing/ImageObjectImpl.h | 4 - .../Code/Tests/ImageProcessing_Test.cpp | 255 ++++++++---------- .../Code/Tests/TestAssets/.gitignore | 1 + .../Code/Tests/TestAssets/BlackWhite.png | 3 - .../Code/Tests/TestAssets/LatLong_cm.png | 3 - .../TestAssets/Lenstexture_dirtyglass.tif | 3 - .../abandoned_sanatorium_staircase_cm.exr | 3 - .../Code/Tests/TestAssets/red.png | 3 - .../road_in_tenerife_mountain_cm.exr | 3 - .../Code/Tests/TestAssets/sunset_cm.exr | 3 - .../temp/128x128_RGBA8.tga.streamingimage | Bin 28861 -> 0 bytes .../Tests/TestAssets/workshop_iblskyboxcm.exr | 3 + .../Code/imageprocessing_files.cmake | 2 + .../Linux/BuiltInPackages_linux.cmake | 3 +- .../Platform/Linux/squish-ccr_linux.cmake | 9 - .../Platform/Mac/BuiltInPackages_mac.cmake | 4 +- .../Platform/Mac/squish-ccr_mac.cmake | 9 - .../Windows/BuiltInPackages_windows.cmake | 3 +- .../Platform/Windows/squish-ccr_windows.cmake | 9 - 44 files changed, 173 insertions(+), 237 deletions(-) create mode 100644 Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/TestAssets/.gitignore delete mode 100644 Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/TestAssets/BlackWhite.png delete mode 100644 Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/TestAssets/LatLong_cm.png delete mode 100644 Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/TestAssets/Lenstexture_dirtyglass.tif delete mode 100644 Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/TestAssets/abandoned_sanatorium_staircase_cm.exr delete mode 100644 Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/TestAssets/red.png delete mode 100644 Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/TestAssets/road_in_tenerife_mountain_cm.exr delete mode 100644 Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/TestAssets/sunset_cm.exr delete mode 100644 Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/TestAssets/temp/128x128_RGBA8.tga.streamingimage create mode 100644 Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/TestAssets/workshop_iblskyboxcm.exr delete mode 100644 cmake/3rdParty/Platform/Linux/squish-ccr_linux.cmake delete mode 100644 cmake/3rdParty/Platform/Mac/squish-ccr_mac.cmake delete mode 100644 cmake/3rdParty/Platform/Windows/squish-ccr_windows.cmake diff --git a/Code/Framework/AzCore/AzCore/std/function/function_base.h b/Code/Framework/AzCore/AzCore/std/function/function_base.h index 32892a4c03..b39a5cf81b 100644 --- a/Code/Framework/AzCore/AzCore/std/function/function_base.h +++ b/Code/Framework/AzCore/AzCore/std/function/function_base.h @@ -10,6 +10,7 @@ #ifndef AZSTD_FUNCTION_BASE_HEADER #define AZSTD_FUNCTION_BASE_HEADER +#include #include #include #include diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/CMakeLists.txt b/Gems/Atom/Asset/ImageProcessingAtom/Code/CMakeLists.txt index 233ead9dea..6227d74d7e 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/CMakeLists.txt +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/CMakeLists.txt @@ -66,6 +66,7 @@ ly_add_target( 3rdParty::PVRTexTool 3rdParty::squish-ccr 3rdParty::tiff + 3rdParty::ISPCTexComp 3rdParty::ilmbase Legacy::CryCommon AZ::AzFramework diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Include/Atom/ImageProcessing/ImageObject.h b/Gems/Atom/Asset/ImageProcessingAtom/Code/Include/Atom/ImageProcessing/ImageObject.h index 561dee5880..5796a0c84d 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Include/Atom/ImageProcessing/ImageObject.h +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Include/Atom/ImageProcessing/ImageObject.h @@ -70,7 +70,6 @@ namespace ImageProcessingAtom virtual AZ::u32 GetPixelCount(AZ::u32 mip) const = 0; virtual AZ::u32 GetWidth(AZ::u32 mip) const = 0; virtual AZ::u32 GetHeight(AZ::u32 mip) const = 0; - virtual bool IsCubemap() const = 0; virtual AZ::u32 GetMipCount() const = 0; //get pixel data buffer diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Compressors/CTSquisher.cpp b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Compressors/CTSquisher.cpp index bfe5e283b5..709bce4c54 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Compressors/CTSquisher.cpp +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Compressors/CTSquisher.cpp @@ -141,6 +141,11 @@ namespace ImageProcessingAtom ColorSpace CTSquisher::GetSupportedColorSpace([[maybe_unused]] EPixelFormat compressFormat) const { return ColorSpace::autoSelect; + } + + const char* CTSquisher::GetName() const + { + return "CTSquisher"; } EPixelFormat CTSquisher::GetSuggestedUncompressedFormat(EPixelFormat compressedfmt, EPixelFormat uncompressedfmt) const diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Compressors/CTSquisher.h b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Compressors/CTSquisher.h index 77865a596e..1e4aaf3f31 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Compressors/CTSquisher.h +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Compressors/CTSquisher.h @@ -27,6 +27,7 @@ namespace ImageProcessingAtom EPixelFormat GetSuggestedUncompressedFormat(EPixelFormat compressedfmt, EPixelFormat uncompressedfmt) const override; ColorSpace GetSupportedColorSpace(EPixelFormat compressFormat) const final; + const char* GetName() const final; private: static CryTextureSquisher::ECodingPreset GetCompressPreset(EPixelFormat compressFmt, EPixelFormat uncompressFmt); diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Compressors/Compressor.cpp b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Compressors/Compressor.cpp index 99205edb01..2cd7ff0e9b 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Compressors/Compressor.cpp +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Compressors/Compressor.cpp @@ -10,22 +10,15 @@ #include #include #include - -// this is required for the AZ_TRAIT_IMAGEPROCESSING_USE_ISPC_TEXTURE_COMPRESSOR define -#include - -#if AZ_TRAIT_IMAGEPROCESSING_USE_ISPC_TEXTURE_COMPRESSOR #include -#endif namespace ImageProcessingAtom { - ICompressorPtr ICompressor::FindCompressor(EPixelFormat fmt, ColorSpace colorSpace, bool isCompressing) + ICompressorPtr ICompressor::FindCompressor(EPixelFormat fmt, [[maybe_unused]] ColorSpace colorSpace, bool isCompressing) { // The ISPC texture compressor is able to compress BC1, BC3, BC6H and BC7 formats, and all of the ASTC formats. // Note: The ISPC texture compressor is only able to compress images that are a multiple of the compressed format's blocksize. // Another limitation is that the compressor requires LDR source images to be in sRGB colorspace. -#if AZ_TRAIT_IMAGEPROCESSING_USE_ISPC_TEXTURE_COMPRESSOR if (ISPCCompressor::IsCompressedPixelFormatSupported(fmt)) { if ((isCompressing && ISPCCompressor::IsSourceColorSpaceSupported(colorSpace, fmt)) || (!isCompressing && ISPCCompressor::DoesSupportDecompress(fmt))) @@ -33,7 +26,6 @@ namespace ImageProcessingAtom return ICompressorPtr(new ISPCCompressor()); } } -#endif if (CTSquisher::IsCompressedPixelFormatSupported(fmt)) { diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Compressors/Compressor.h b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Compressors/Compressor.h index 4eb04590a5..dff71e59db 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Compressors/Compressor.h +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Compressors/Compressor.h @@ -48,6 +48,7 @@ namespace ImageProcessingAtom virtual IImageObjectPtr DecompressImage(IImageObjectPtr srcImage, EPixelFormat fmtDst) const = 0; virtual EPixelFormat GetSuggestedUncompressedFormat(EPixelFormat compressedfmt, EPixelFormat uncompressedfmt) const = 0; virtual ColorSpace GetSupportedColorSpace(EPixelFormat compressFormat) const = 0; + virtual const char* GetName() const = 0; //find compressor for specified compressed pixel format. isCompressing to indicate if it's for compressing or decompressing static ICompressorPtr FindCompressor(EPixelFormat fmt, ColorSpace colorSpace, bool isCompressing); diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Compressors/ETC2.cpp b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Compressors/ETC2.cpp index 0c3d6dca3d..73108d5502 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Compressors/ETC2.cpp +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Compressors/ETC2.cpp @@ -111,6 +111,11 @@ namespace ImageProcessingAtom { return ColorSpace::autoSelect; } + + const char* ETC2Compressor::GetName() const + { + return "ETC2Compressor"; + } IImageObjectPtr ETC2Compressor::CompressImage(IImageObjectPtr srcImage, EPixelFormat fmtDst, const CompressOption* compressOption) const diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Compressors/ETC2.h b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Compressors/ETC2.h index 7e5354a185..9ab5a164a5 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Compressors/ETC2.h +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Compressors/ETC2.h @@ -24,7 +24,8 @@ namespace ImageProcessingAtom IImageObjectPtr DecompressImage(IImageObjectPtr srcImage, EPixelFormat fmtDst) const override; EPixelFormat GetSuggestedUncompressedFormat(EPixelFormat compressedfmt, EPixelFormat uncompressedfmt) const override; - virtual ColorSpace GetSupportedColorSpace(EPixelFormat compressFormat) const final; + ColorSpace GetSupportedColorSpace(EPixelFormat compressFormat) const final; + const char* GetName() const final; }; } // namespace ImageProcessingAtom diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Compressors/ISPCTextureCompressor.cpp b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Compressors/ISPCTextureCompressor.cpp index be6eb9511d..5e96c7274d 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Compressors/ISPCTextureCompressor.cpp +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Compressors/ISPCTextureCompressor.cpp @@ -111,6 +111,11 @@ namespace ImageProcessingAtom return ColorSpace::autoSelect; } + const char* ISPCCompressor::GetName() const + { + return "ISPCCompressor"; + } + IImageObjectPtr ISPCCompressor::CompressImage(IImageObjectPtr sourceImage, EPixelFormat destinationFormat, const CompressOption* compressOption) const { // Used to find the profile setters, depending on the image quality diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Compressors/ISPCTextureCompressor.h b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Compressors/ISPCTextureCompressor.h index 8652b60b68..2ab0dfc833 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Compressors/ISPCTextureCompressor.h +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Compressors/ISPCTextureCompressor.h @@ -28,7 +28,9 @@ namespace ImageProcessingAtom ColorSpace GetSupportedColorSpace(EPixelFormat compressFormat) const final; IImageObjectPtr CompressImage(IImageObjectPtr sourceImage, EPixelFormat destinationFormat, const CompressOption* compressOption) const final; - IImageObjectPtr DecompressImage(IImageObjectPtr sourceImage, EPixelFormat destinationFormat) const final; + IImageObjectPtr DecompressImage(IImageObjectPtr sourceImage, EPixelFormat destinationFormat) const final; + const char* GetName() const final; + EPixelFormat GetSuggestedUncompressedFormat(EPixelFormat compressedfmt, EPixelFormat uncompressedfmt) const final; }; diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Compressors/PVRTC.cpp b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Compressors/PVRTC.cpp index 7e11a83cae..0002ff4678 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Compressors/PVRTC.cpp +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Compressors/PVRTC.cpp @@ -107,6 +107,11 @@ namespace ImageProcessingAtom return ColorSpace::autoSelect; } + const char* PVRTCCompressor::GetName() const + { + return "PVRTCCompressor"; + } + bool PVRTCCompressor::DoesSupportDecompress([[maybe_unused]] EPixelFormat fmtDst) { return true; diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Compressors/PVRTC.h b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Compressors/PVRTC.h index 86e31286b6..cedd6d6643 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Compressors/PVRTC.h +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Compressors/PVRTC.h @@ -25,5 +25,6 @@ namespace ImageProcessingAtom EPixelFormat GetSuggestedUncompressedFormat(EPixelFormat compressedfmt, EPixelFormat uncompressedfmt) const override; ColorSpace GetSupportedColorSpace(EPixelFormat compressFormat) const final; + const char* GetName() const final; }; } // namespace ImageProcessingAtom diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Converters/ConvertPixelFormat.cpp b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Converters/ConvertPixelFormat.cpp index 004f17c33d..8f851b46d1 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Converters/ConvertPixelFormat.cpp +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Converters/ConvertPixelFormat.cpp @@ -6,6 +6,7 @@ * */ +#include #include #include @@ -97,9 +98,18 @@ namespace ImageProcessingAtom else { IImageObjectPtr dstImage = nullptr; + const PixelFormatInfo* compressedInfo = CPixelFormats::GetInstance().GetPixelFormatInfo(compressedFmt); if (isSrcUncompressed) { + AZ::u64 startTime = AZStd::GetTimeUTCMilliSecond(); dstImage = compressor->CompressImage(Get(), fmtDst, &m_compressOption); + AZ::u64 endTime = AZStd::GetTimeUTCMilliSecond(); + [[maybe_unused]] double processTime = static_cast(endTime - startTime) / 1000.0; + if (dstImage) + { + AZ_TracePrintf("Image Processing", "Image [%dx%d] was compressed to [%s] format by [%s] in %.3f seconds\n", + Get()->GetWidth(0), Get()->GetHeight(0), compressedInfo->szName, compressor->GetName(), processTime); + } } else { @@ -107,11 +117,13 @@ namespace ImageProcessingAtom } Set(dstImage); - } - - if (Get() == nullptr) - { - AZ_Error("Image Processing", false, "The selected compressor failed to compress this image"); + + if (dstImage == nullptr) + { + AZ_Error("Image Processing", false, "Failed to use [%s] to %s [%s] format", compressor->GetName(), + isSrcUncompressed ? "compress" : "decompress", + compressedInfo->szName); + } } } } diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/ImageBuilderComponent.cpp b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/ImageBuilderComponent.cpp index 40d1429f4b..c688b0b20c 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/ImageBuilderComponent.cpp +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/ImageBuilderComponent.cpp @@ -74,7 +74,7 @@ namespace ImageProcessingAtom builderDescriptor.m_busId = azrtti_typeid(); builderDescriptor.m_createJobFunction = AZStd::bind(&ImageBuilderWorker::CreateJobs, &m_imageBuilder, AZStd::placeholders::_1, AZStd::placeholders::_2); builderDescriptor.m_processJobFunction = AZStd::bind(&ImageBuilderWorker::ProcessJob, &m_imageBuilder, AZStd::placeholders::_1, AZStd::placeholders::_2); - builderDescriptor.m_version = 23; // [ATOM-14022] + builderDescriptor.m_version = 24; // [SPEC-7821] builderDescriptor.m_analysisFingerprint = ImageProcessingAtom::BuilderSettingManager::Instance()->GetAnalysisFingerprint(); m_imageBuilder.BusConnect(builderDescriptor.m_busId); AssetBuilderSDK::AssetBuilderBus::Broadcast(&AssetBuilderSDK::AssetBuilderBusTraits::RegisterBuilderInformation, builderDescriptor); diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/ImageLoader/QtImageLoader.cpp b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/ImageLoader/QtImageLoader.cpp index 3ac36b8b17..4124eebcd4 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/ImageLoader/QtImageLoader.cpp +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/ImageLoader/QtImageLoader.cpp @@ -28,6 +28,7 @@ namespace ImageProcessingAtom QImage qimage(filename.c_str()); if (qimage.isNull()) { + AZ_Error("ImageProcessing", false, "Failed to load [%s] via QImage", filename.c_str()); return NULL; } diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Platform/Android/ImageProcessing_Traits_Android.h b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Platform/Android/ImageProcessing_Traits_Android.h index 22d0061573..0bd7ba3732 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Platform/Android/ImageProcessing_Traits_Android.h +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Platform/Android/ImageProcessing_Traits_Android.h @@ -13,4 +13,3 @@ #define AZ_TRAIT_IMAGEPROCESSING_PVRTEXLIB_USE_WINDLL_IMPORT 0 #define AZ_TRAIT_IMAGEPROCESSING_SQUISH_DO_NOT_USE_FASTCALL 0 #define AZ_TRAIT_IMAGEPROCESSING_USE_BASE10_BYTE_PREFIX 0 -#define AZ_TRAIT_IMAGEPROCESSING_USE_ISPC_TEXTURE_COMPRESSOR 0 diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Platform/Linux/ImageProcessing_Traits_Linux.h b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Platform/Linux/ImageProcessing_Traits_Linux.h index 19b7621f8a..43e8a2b3f9 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Platform/Linux/ImageProcessing_Traits_Linux.h +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Platform/Linux/ImageProcessing_Traits_Linux.h @@ -13,4 +13,3 @@ #define AZ_TRAIT_IMAGEPROCESSING_PVRTEXLIB_USE_WINDLL_IMPORT 0 #define AZ_TRAIT_IMAGEPROCESSING_SQUISH_DO_NOT_USE_FASTCALL 1 #define AZ_TRAIT_IMAGEPROCESSING_USE_BASE10_BYTE_PREFIX 0 -#define AZ_TRAIT_IMAGEPROCESSING_USE_ISPC_TEXTURE_COMPRESSOR 0 diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Platform/Mac/ImageProcessing_Traits_Mac.h b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Platform/Mac/ImageProcessing_Traits_Mac.h index a494f7ace7..2704fb0185 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Platform/Mac/ImageProcessing_Traits_Mac.h +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Platform/Mac/ImageProcessing_Traits_Mac.h @@ -13,4 +13,3 @@ #define AZ_TRAIT_IMAGEPROCESSING_PVRTEXLIB_USE_WINDLL_IMPORT 0 #define AZ_TRAIT_IMAGEPROCESSING_SQUISH_DO_NOT_USE_FASTCALL 1 #define AZ_TRAIT_IMAGEPROCESSING_USE_BASE10_BYTE_PREFIX 1 -#define AZ_TRAIT_IMAGEPROCESSING_USE_ISPC_TEXTURE_COMPRESSOR 0 diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Platform/Windows/ImageProcessing_Traits_Windows.h b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Platform/Windows/ImageProcessing_Traits_Windows.h index 3fdd1ddf66..e8d25c2dad 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Platform/Windows/ImageProcessing_Traits_Windows.h +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Platform/Windows/ImageProcessing_Traits_Windows.h @@ -13,4 +13,3 @@ #define AZ_TRAIT_IMAGEPROCESSING_PVRTEXLIB_USE_WINDLL_IMPORT 1 #define AZ_TRAIT_IMAGEPROCESSING_SQUISH_DO_NOT_USE_FASTCALL 0 #define AZ_TRAIT_IMAGEPROCESSING_USE_BASE10_BYTE_PREFIX 0 -#define AZ_TRAIT_IMAGEPROCESSING_USE_ISPC_TEXTURE_COMPRESSOR 1 diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Platform/Windows/platform_windows.cmake b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Platform/Windows/platform_windows.cmake index ca8dad1013..5cd1fb5a22 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Platform/Windows/platform_windows.cmake +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Platform/Windows/platform_windows.cmake @@ -6,11 +6,3 @@ # # -# windows requires the 3rd Party ISPCTexComp library. - -ly_associate_package(PACKAGE_NAME ISPCTexComp-2021.3-rev1-windows TARGETS ISPCTexComp PACKAGE_HASH 324fb051a549bc96571530e63c01e18a4c860db45317734d86276fe27a45f6dd) - -set(LY_BUILD_DEPENDENCIES - PUBLIC - 3rdParty::ISPCTexComp - ) diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Platform/Windows/platform_windows_files.cmake b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Platform/Windows/platform_windows_files.cmake index bb3cd74557..f404a9ef60 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Platform/Windows/platform_windows_files.cmake +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Platform/Windows/platform_windows_files.cmake @@ -9,6 +9,4 @@ set(FILES ImageProcessing_Traits_Platform.h ImageProcessing_Traits_Windows.h - ../../Compressors/ISPCTextureCompressor.cpp - ../../Compressors/ISPCTextureCompressor.h ) diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Platform/iOS/ImageProcessing_Traits_iOS.h b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Platform/iOS/ImageProcessing_Traits_iOS.h index a494f7ace7..2704fb0185 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Platform/iOS/ImageProcessing_Traits_iOS.h +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Platform/iOS/ImageProcessing_Traits_iOS.h @@ -13,4 +13,3 @@ #define AZ_TRAIT_IMAGEPROCESSING_PVRTEXLIB_USE_WINDLL_IMPORT 0 #define AZ_TRAIT_IMAGEPROCESSING_SQUISH_DO_NOT_USE_FASTCALL 1 #define AZ_TRAIT_IMAGEPROCESSING_USE_BASE10_BYTE_PREFIX 1 -#define AZ_TRAIT_IMAGEPROCESSING_USE_ISPC_TEXTURE_COMPRESSOR 0 diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Processing/ImageConvert.cpp b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Processing/ImageConvert.cpp index 3f28e89334..a1093ffc37 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Processing/ImageConvert.cpp +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Processing/ImageConvert.cpp @@ -869,7 +869,7 @@ namespace ImageProcessingAtom return process; } - void ImageConvertProcess::CreateIBLCubemap(AZ::Uuid presetUUID, const char* fileNameSuffix, IImageObjectPtr cubemapImage) + void ImageConvertProcess::CreateIBLCubemap(AZ::Uuid presetUUID, const char* fileNameSuffix, IImageObjectPtr& cubemapImage) { const AZStd::string& platformId = m_input->m_platform; AZStd::string_view filePath; diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Processing/ImageConvert.h b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Processing/ImageConvert.h index db34c46e2a..190e68ca31 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Processing/ImageConvert.h +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Processing/ImageConvert.h @@ -161,7 +161,7 @@ namespace ImageProcessingAtom bool FillCubemapMipmaps(); //IBL cubemap generation, this creates a separate ImageConvertProcess - void CreateIBLCubemap(AZ::Uuid presetUUID, const char* fileNameSuffix, IImageObjectPtr cubemapImage); + void CreateIBLCubemap(AZ::Uuid presetUUID, const char* fileNameSuffix, IImageObjectPtr& cubemapImage); //convert color space to linear with pixel format rgba32f bool ConvertToLinear(); diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Processing/ImageObjectImpl.h b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Processing/ImageObjectImpl.h index c4cbd13fea..c8b8ced496 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Processing/ImageObjectImpl.h +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Processing/ImageObjectImpl.h @@ -36,10 +36,6 @@ namespace ImageProcessingAtom AZ::u32 GetWidth(AZ::u32 mip) const override; AZ::u32 GetHeight(AZ::u32 mip) const override; AZ::u32 GetMipCount() const override; - bool IsCubemap() const override - { - return false; - }; void GetImagePointer(AZ::u32 mip, AZ::u8*& pMem, AZ::u32& pitch) const override; AZ::u32 GetMipBufSize(AZ::u32 mip) const override; diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/ImageProcessing_Test.cpp b/Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/ImageProcessing_Test.cpp index 20aa1e927d..fa1b092e6b 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/ImageProcessing_Test.cpp +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/ImageProcessing_Test.cpp @@ -71,11 +71,6 @@ using namespace ImageProcessingAtom; namespace UnitTest { - namespace - { - static const char* s_gemFolder; - } - // Expose AZ::AssetManagerComponent::Reflect function for testing class MyAssetManagerComponent : public AZ::AssetManagerComponent @@ -125,6 +120,8 @@ namespace UnitTest AZStd::unique_ptr m_jsonSystemComponent; AZStd::vector> m_assetHandlers; AZStd::string m_gemFolder; + AZStd::string m_outputRootFolder; + AZStd::string m_outputFolder; void SetUp() override { @@ -172,7 +169,7 @@ namespace UnitTest AzQtComponents::PrepareQtPaths(); m_gemFolder = AZ::Test::GetEngineRootPath() + "/Gems/Atom/Asset/ImageProcessingAtom/"; - s_gemFolder = m_gemFolder.c_str(); + m_outputFolder = m_gemFolder + AZStd::string("Code/Tests/TestAssets/temp/"); m_defaultSettingFolder = m_gemFolder + AZStd::string("Config/"); m_testFileFolder = m_gemFolder + AZStd::string("Code/Tests/TestAssets/"); @@ -185,7 +182,7 @@ namespace UnitTest void TearDown() override { m_gemFolder = AZStd::string(); - s_gemFolder = ""; + m_outputFolder = AZStd::string(); m_defaultSettingFolder = AZStd::string(); m_testFileFolder = AZStd::string(); @@ -226,16 +223,16 @@ namespace UnitTest Image_512X288_RGB8_Tga, Image_1024X1024_RGB8_Tif, Image_UpperCase_Tga, - Image_512x512_Normal_Tga, + Image_512x512_Normal_Tga, // QImage doesn't support loading this file. Image_128x128_Transparent_Tga, Image_237x177_RGB_Jpg, Image_GreyScale_Png, - Image_BlackWhite_Png, Image_Alpha8_64x64_Mip7_Dds, Image_BGRA_64x64_Mip7_Dds, Image_Luminance8bpp_66x33_dds, Image_BGR_64x64_dds, - Image_Sunset_4096x2048_R16G16B16A16F_exr + Image_defaultprobe_cm_1536x256_64bits_tif, + Image_workshop_iblskyboxcm_exr }; //image file names for testing @@ -258,17 +255,29 @@ namespace UnitTest m_imagFileNameMap[Image_128x128_Transparent_Tga] = m_testFileFolder + "128x128_RGBA8.tga"; m_imagFileNameMap[Image_237x177_RGB_Jpg] = m_testFileFolder + "237x177_RGB.jpg"; m_imagFileNameMap[Image_GreyScale_Png] = m_testFileFolder + "greyscale.png"; - m_imagFileNameMap[Image_BlackWhite_Png] = m_testFileFolder + "BlackWhite.png"; m_imagFileNameMap[Image_Alpha8_64x64_Mip7_Dds] = m_testFileFolder + "Alpha8_64x64_Mip7.dds"; m_imagFileNameMap[Image_BGRA_64x64_Mip7_Dds] = m_testFileFolder + "BGRA_64x64_MIP7.dds"; m_imagFileNameMap[Image_Luminance8bpp_66x33_dds] = m_testFileFolder + "Luminance8bpp_66x33.dds"; m_imagFileNameMap[Image_BGR_64x64_dds] = m_testFileFolder + "RGBA_64x64.dds"; - m_imagFileNameMap[Image_Sunset_4096x2048_R16G16B16A16F_exr] = m_testFileFolder + "sunset_cm.exr"; + m_imagFileNameMap[Image_defaultprobe_cm_1536x256_64bits_tif] = m_testFileFolder + "defaultProbe_cm.tif"; + m_imagFileNameMap[Image_workshop_iblskyboxcm_exr] = m_testFileFolder + "workshop_iblskyboxcm.exr"; } public: + void SetOutputSubFolder(const char* subFolderName) + { + if (subFolderName) + { + m_outputFolder = m_outputRootFolder + "/" + subFolderName; + } + else + { + m_outputFolder = m_outputRootFolder; + } + } + //helper function to save an image object to a file through QtImage - static void SaveImageToFile([[maybe_unused]] const IImageObjectPtr imageObject, [[maybe_unused]] const AZStd::string imageName, [[maybe_unused]] AZ::u32 maxMipCnt = 100) + void SaveImageToFile([[maybe_unused]] const IImageObjectPtr imageObject, [[maybe_unused]] const AZStd::string imageName, [[maybe_unused]] AZ::u32 maxMipCnt = 100) { #ifndef DEBUG_OUTPUT_IMAGES return; @@ -278,12 +287,12 @@ namespace UnitTest return; } - //create the directory if it's not exist - AZStd::string outputDir = s_gemFolder + AZStd::string("Code/Tests/TestAssets/Output/"); - QDir dir(outputDir.data()); - if (!dir.exists()) + // create dir if it doesn't exist + QDir dir; + QDir outputDir(m_outputFolder.c_str()); + if (!outputDir.exists()) { - dir.mkpath("."); + dir.mkpath(m_outputFolder.c_str()); } //save origin file pixel format so we could use it to generate name later @@ -303,12 +312,13 @@ namespace UnitTest finalImage->GetImagePointer(mip, imageBuf, pitch); uint32 width = finalImage->GetWidth(mip); uint32 height = finalImage->GetHeight(mip); + uint32 originalSize = imageObject->GetMipBufSize(mip); //generate file name char filePath[2048]; - azsprintf(filePath, "%s%s_%s_mip%d_%dx%d.png", outputDir.data(), imageName.c_str() + azsprintf(filePath, "%s%s_%s_mip%d_%dx%d_%d.png", m_outputFolder.data(), imageName.c_str() , CPixelFormats::GetInstance().GetPixelFormatInfo(originPixelFormat)->szName - , mip, width, height); + , mip, width, height, originalSize); QImage qimage(imageBuf, width, height, pitch, QImage::Format_RGBA8888); qimage.save(filePath); @@ -385,7 +395,7 @@ namespace UnitTest } - static bool CompareDDSImage(const QString& imagePath1, const QString& imagePath2, QString& output) + bool CompareDDSImage(const QString& imagePath1, const QString& imagePath2, QString& output) { IImageObjectPtr image1, alphaImage1, image2, alphaImage2; @@ -530,15 +540,7 @@ namespace UnitTest TEST_F(ImageProcessingTest, TestCubemapLayouts) { { - IImageObjectPtr srcImage(LoadImageFromFile(m_imagFileNameMap[Image_Sunset_4096x2048_R16G16B16A16F_exr])); - ImageToProcess imageToProcess(srcImage); - imageToProcess.ConvertCubemapLayout(CubemapLayoutHorizontalCross); - ASSERT_TRUE(imageToProcess.Get()->GetWidth(0) * 3 == imageToProcess.Get()->GetHeight(0) * 4); - SaveImageToFile(imageToProcess.Get(), "LatLong", 1); - } - - { - IImageObjectPtr srcImage(LoadImageFromFile(m_testFileFolder + "defaultProbe_cm.tif")); + IImageObjectPtr srcImage(LoadImageFromFile(m_imagFileNameMap[Image_defaultprobe_cm_1536x256_64bits_tif])); ImageToProcess imageToProcess(srcImage); imageToProcess.ConvertCubemapLayout(CubemapLayoutVertical); @@ -635,12 +637,8 @@ namespace UnitTest ASSERT_TRUE(img != nullptr); ASSERT_TRUE(img->GetPixelFormat() == ePixelFormat_B8G8R8); - // Exr files - img = IImageObjectPtr(LoadImageFromFile(m_imagFileNameMap[Image_Sunset_4096x2048_R16G16B16A16F_exr])); - ASSERT_TRUE(img != nullptr); - img = IImageObjectPtr(LoadImageFromFile(m_testFileFolder + "abandoned_sanatorium_staircase_cm.exr")); - ASSERT_TRUE(img != nullptr); - img = IImageObjectPtr(LoadImageFromFile(m_testFileFolder + "road_in_tenerife_mountain_cm.exr")); + // Exr file + img = IImageObjectPtr(LoadImageFromFile(m_imagFileNameMap[Image_workshop_iblskyboxcm_exr])); ASSERT_TRUE(img != nullptr); } @@ -783,39 +781,36 @@ namespace UnitTest ASSERT_TRUE(dstImage3->CompareImage(dstImage1)); } - TEST_F(ImageProcessingTest, DISABLED_TestConvertPVRTC) + TEST_F(ImageProcessingTest, TestConvertFormatCompressed) { - //source image - AZStd::string inputFile; - inputFile = "../AutomatedTesting/Objects/ParticleAssets/ShowRoom/showroom_pipe_blue_001_ddna.tif"; - - IImageObjectPtr srcImage(LoadImageFromFile(inputFile)); - ImageToProcess imageToProcess(srcImage); - - for (EPixelFormat pixelFormat = ePixelFormat_PVRTC2; pixelFormat <= ePixelFormat_ETC2a;) - { - imageToProcess.Set(srcImage); - imageToProcess.ConvertFormat(pixelFormat); - SaveImageToFile(imageToProcess.Get(), "Compressor", 1); - - //next format - pixelFormat = EPixelFormat(pixelFormat + 1); - } - } - - TEST_F(ImageProcessingTest, DISABLED_TestConvertFormat) - { - EPixelFormat pixelFormat; IImageObjectPtr srcImage; //images to be tested - static const int imageCount = 5; + static const int imageCount = 4; ImageFeature images[imageCount] = { Image_20X16_RGBA8_Png, - Image_32X32_16bit_F_Tif, - Image_32X32_32bit_F_Tif, - Image_512x512_Normal_Tga, - Image_128x128_Transparent_Tga }; + Image_237x177_RGB_Jpg, + Image_128x128_Transparent_Tga, + Image_defaultprobe_cm_1536x256_64bits_tif}; + + // collect all compressed pixel formats + AZStd::vector compressedFormats; + for (uint32 i = 0; i < ePixelFormat_Count; i++) + { + EPixelFormat pixelFormat = (EPixelFormat)i; + auto formatInfo = CPixelFormats::GetInstance().GetPixelFormatInfo(pixelFormat); + if (formatInfo->bCompressed) + { + // exclude astc formats until we add astc compressor to all platforms + // exclude pvrtc formats (deprecating) + if (!IsASTCFormat(pixelFormat) + && pixelFormat != ePixelFormat_PVRTC2 && pixelFormat != ePixelFormat_PVRTC4 + && !IsETCFormat(pixelFormat)) // skip ETC since it's very slow + { + compressedFormats.push_back(pixelFormat); + } + } + } for (int imageIdx = 0; imageIdx < imageCount; imageIdx++) { @@ -827,42 +822,37 @@ namespace UnitTest ImageToProcess imageToProcess(srcImage); //test ConvertFormat functions against all the pixel formats - for (pixelFormat = ePixelFormat_R8G8B8A8; pixelFormat < ePixelFormat_Unknown;) + for (EPixelFormat pixelFormat : compressedFormats) { + // + if (!CPixelFormats::GetInstance().IsImageSizeValid(pixelFormat, srcImage->GetWidth(0), srcImage->GetHeight(0), false)) + { + continue; + } + + auto formatInfo = CPixelFormats::GetInstance().GetPixelFormatInfo(pixelFormat); imageToProcess.Set(srcImage); imageToProcess.ConvertFormat(pixelFormat); + if (!imageToProcess.Get()) + { + AZ_Warning("test", false, "unsupported format: %s", formatInfo->szName); + continue; + } ASSERT_TRUE(imageToProcess.Get()); + ASSERT_TRUE(imageToProcess.Get()->GetPixelFormat() == pixelFormat); - //if the format is compressed and there is no compressor for it, it won't be converted to the expected format - if (ICompressor::FindCompressor(pixelFormat, ImageProcessingAtom::ColorSpace::autoSelect, true) == nullptr - && !CPixelFormats::GetInstance().IsPixelFormatUncompressed(pixelFormat)) - { - ASSERT_TRUE(imageToProcess.Get()->GetPixelFormat() != pixelFormat); - } - else - { - //validate the size and it may not working for some uncompressed format - if (!CPixelFormats::GetInstance().IsImageSizeValid( - pixelFormat, srcImage->GetWidth(0), srcImage->GetHeight(0), false)) - { - ASSERT_TRUE(imageToProcess.Get()->GetPixelFormat() != pixelFormat); - } - else - { - ASSERT_TRUE(imageToProcess.Get()->GetPixelFormat() == pixelFormat); + // Get compressor name + ColorSpace sourceColorSpace = srcImage->HasImageFlags(EIF_SRGBRead) ? ColorSpace::sRGB : ColorSpace::linear; + ICompressorPtr compressor = ICompressor::FindCompressor(pixelFormat, sourceColorSpace, true); - //save the image to a file so we can check the visual result - SaveImageToFile(imageToProcess.Get(), imageName, 1); + //save the image to a file so we can check the visual result + AZStd::string outputName = AZStd::string::format("%s_%s", imageName.c_str(), compressor->GetName()); + SaveImageToFile(imageToProcess.Get(), outputName, 1); - //convert back to an uncompressed format and expect it will be successful - imageToProcess.ConvertFormat(ePixelFormat_R8G8B8A8); - ASSERT_TRUE(imageToProcess.Get()->GetPixelFormat() == ePixelFormat_R8G8B8A8); - } - } - - //next pixel format - pixelFormat = EPixelFormat(pixelFormat + 1); + //convert back to an uncompressed format and expect it will be successful + imageToProcess.ConvertFormat(ePixelFormat_R8G8B8A8); + ASSERT_TRUE(imageToProcess.Get()->GetPixelFormat() == ePixelFormat_R8G8B8A8); } } } @@ -932,42 +922,6 @@ namespace UnitTest #endif //AZ_TOOLS_EXPAND_FOR_RESTRICTED_PLATFORMS } - TEST_F(ImageProcessingTest, DISABLED_TestCubemap) - { - //load builder presets - auto outcome = BuilderSettingManager::Instance()->LoadConfigFromFolder(m_defaultSettingFolder); - ASSERT_TRUE(outcome.IsSuccess()); - - const AZStd::string outputFolder = m_gemFolder + AZStd::string("Code/Tests/TestAssets/temp/"); - AZStd::string inputFile; - AZStd::vector outProducts; - - inputFile = m_testFileFolder + "defaultProbe_cm.tif"; - - ImageConvertProcess* process = CreateImageConvertProcess(inputFile, outputFolder, "pc", outProducts); - - if (process != nullptr) - { - int step = 0; - while (!process->IsFinished()) - { - process->UpdateProcess(); - step++; - } - - //get process result - ASSERT_TRUE(process->IsSucceed()); - - SaveImageToFile(process->GetOutputImage(), "cubemap", 100); - SaveImageToFile(process->GetOutputIBLSpecularCubemap(), "iblspecularcubemap", 100); - SaveImageToFile(process->GetOutputIBLDiffuseCubemap(), "ibldiffusecubemap", 100); - SaveImageToFile(process->GetOutputAlphaImage(), "alpha", 1); - process->GetAppendOutputProducts(outProducts); - - delete process; - } - } - //test image conversion for builder TEST_F(ImageProcessingTest, TestBuilderImageConvertor) { @@ -975,12 +929,11 @@ namespace UnitTest auto outcome = BuilderSettingManager::Instance()->LoadConfigFromFolder(m_defaultSettingFolder); ASSERT_TRUE(outcome.IsSuccess()); - const AZStd::string outputFolder = m_gemFolder + AZStd::string("Code/Tests/TestAssets/temp/"); AZStd::string inputFile; AZStd::vector outProducts; inputFile = m_imagFileNameMap[Image_128x128_Transparent_Tga]; - ImageConvertProcess* process = CreateImageConvertProcess(inputFile, outputFolder, "pc", outProducts, m_context.get()); + ImageConvertProcess* process = CreateImageConvertProcess(inputFile, m_outputFolder, "pc", outProducts, m_context.get()); if (process != nullptr) { @@ -1004,30 +957,38 @@ namespace UnitTest } } - - //test image loading function for output dds files - TEST_F(ImageProcessingTest, DISABLED_TestLoadDdsImage) + TEST_F(ImageProcessingTest, TestIblSkyboxPreset) { - IImageObjectPtr originImage, alphaImage; - AZStd::string inputFolder = "../AutomatedTesting/Cache/pc/engineassets/texturemsg/"; + //load builder presets + auto outcome = BuilderSettingManager::Instance()->LoadConfigFromFolder(m_defaultSettingFolder); + ASSERT_TRUE(outcome.IsSuccess()); + AZStd::string inputFile; + AZStd::vector outProducts; - inputFile = "E:/Javelin_NWLYDev/dev/Cache/Assets/pc/assets/textures/blend_maps/moss/jav_moss_ddn.dds"; + inputFile = m_imagFileNameMap[Image_workshop_iblskyboxcm_exr]; + ImageConvertProcess* process = CreateImageConvertProcess(inputFile, m_outputFolder, "pc", outProducts, m_context.get()); - IImageObjectPtr newImage = IImageObjectPtr(DdsLoader::LoadImageFromFileLegacy(inputFile)); - if (newImage->HasImageFlags(EIF_AttachedAlpha)) + if (process != nullptr) { - if (newImage->HasImageFlags(EIF_Splitted)) - { - alphaImage = IImageObjectPtr(DdsLoader::LoadImageFromFileLegacy(inputFile + ".a")); - } - else - { - alphaImage = IImageObjectPtr(DdsLoader::LoadAttachedImageFromDdsFileLegacy(inputFile, newImage)); - } - } + process->ProcessAll(); - SaveImageToFile(newImage, "jav_moss_ddn", 10); + //get process result + ASSERT_TRUE(process->IsSucceed()); + + auto specularImage = process->GetOutputIBLSpecularCubemap(); + auto diffuseImage = process->GetOutputIBLDiffuseCubemap(); + ASSERT_TRUE(process->GetOutputImage()); + ASSERT_TRUE(specularImage); + ASSERT_TRUE(diffuseImage); + + // output converted result if save image is enabled + SaveImageToFile(process->GetOutputImage(), "ibl_skybox", 10); + SaveImageToFile(specularImage, "ibl_specular", 10); + SaveImageToFile(diffuseImage, "ibl_diffuse", 10); + + delete process; + } } TEST_F(ImageProcessingTest, DISABLED_CompareOutputImage) diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/TestAssets/.gitignore b/Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/TestAssets/.gitignore new file mode 100644 index 0000000000..de16d18e9c --- /dev/null +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/TestAssets/.gitignore @@ -0,0 +1 @@ +[Tt]emp/** diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/TestAssets/BlackWhite.png b/Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/TestAssets/BlackWhite.png deleted file mode 100644 index dfe856790a..0000000000 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/TestAssets/BlackWhite.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:969c6597a6346c5ff8ae24b4ae143bacbeed2944dd139ddef9b440483dbe4c02 -size 8866921 diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/TestAssets/LatLong_cm.png b/Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/TestAssets/LatLong_cm.png deleted file mode 100644 index 729868e8c0..0000000000 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/TestAssets/LatLong_cm.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:ef6c54d5fa8dd3906d07eb4d3a4d664e82d957103e4bfbcaa951e3722348300d -size 749794 diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/TestAssets/Lenstexture_dirtyglass.tif b/Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/TestAssets/Lenstexture_dirtyglass.tif deleted file mode 100644 index 090991ec7a..0000000000 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/TestAssets/Lenstexture_dirtyglass.tif +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:265ae231486dc6d5d61aa2416b0010ea743722f7238660faeed9edacd46e8a6b -size 6303186 diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/TestAssets/abandoned_sanatorium_staircase_cm.exr b/Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/TestAssets/abandoned_sanatorium_staircase_cm.exr deleted file mode 100644 index f4612e45dc..0000000000 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/TestAssets/abandoned_sanatorium_staircase_cm.exr +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:a559d4b21606d663bc9c7f9d8086646770f5e383c2214e6d3be0b192abbc6888 -size 7736382 diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/TestAssets/red.png b/Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/TestAssets/red.png deleted file mode 100644 index 800faddee4..0000000000 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/TestAssets/red.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:37d146db3de179add861ee86d2316ef1dd413cdb0b02448b3b95bf0023f44bae -size 613 diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/TestAssets/road_in_tenerife_mountain_cm.exr b/Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/TestAssets/road_in_tenerife_mountain_cm.exr deleted file mode 100644 index 358f4a3fcb..0000000000 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/TestAssets/road_in_tenerife_mountain_cm.exr +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:95ec8e752ba10edb8242a9bb8cc78e5b85fe2861268cf95e06942e2a10ef243c -size 7484335 diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/TestAssets/sunset_cm.exr b/Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/TestAssets/sunset_cm.exr deleted file mode 100644 index d1179b96de..0000000000 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/TestAssets/sunset_cm.exr +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:da49114be7305fad10121f92cdf6f153ebb3bc302edc662f2ed75cd45306ab7f -size 50364729 diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/TestAssets/temp/128x128_RGBA8.tga.streamingimage b/Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/TestAssets/temp/128x128_RGBA8.tga.streamingimage deleted file mode 100644 index 6826f2a76e90456d281de0067934c304f03e7704..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 28861 zcmeHQ3tW^{`u=7>gqhS)F|TcyC?QT0t9U^I)HJX_6Q@DM85C0xF|Pp{Fp65bqKFqn z&_+md(Gf2VhJTiH`xB$RzipQpT2}qph=4Is zKB-p+%XF^>2llUseGU&3aiO1O9LSt$vwHB2{sDtG>5oU$n0~m67BP3UX20_k(ZFQ= z_@$OtcYadae%+fF{xL6fS*M|jAs17k;;UZUl9sY)klmSkNjP82g_;Adwt8}lCA&-H z6Iw(Z7xHENtd-yCKC(Gf`|9E~b@L;VZKwI-wL*r8E`>gJ+>Q$^+dK1e>gV(Bk8m4$ z@9(dFbmNn=i$2EV2XaUMetX3P(c7~wTsT-dtmh`>$*)iMZkra;F;x}w*nM#ScXml- zj~(YYzh{zPiB(+4YY{nXY{1%e8;hrPn(lRUkgs}xXxZ_1d-gi$w{Gjk1Krzid-mfo z%Pu{gG_$~WeS9ZB_soX6-IlNV^x(KL_e*=Ud;Bo>=S?2#sz3YWPd)ixv>h%qbU>8L z6C5HOS!mm5s<)q4#YAXc9`yXG5577YdN*SRjyLB*-x#FW@Z^h*UjCa?KT-VtrPD&5 zdF92O7SCy|3unZJnC|3cJ;BF?T)LNj|Iy<-&xJe_`M0u1kK@rHT_=9@?xV+XerS12 zbl?+wF@%ulw> z3w>*~Xx`s(R7jGiyS~UqAZ7B*>q~5nO+}e&GDd@6`LYj;cS|J0qosj*7VWPdBcZxTFKA1=`*=LBBbo*DfyEqi5VYN{n&9k?p|Q<)&Am` zO&fgQbr0}L8Ps`*?W{>348Y6($dj0)q*Fn) zEf?A)-O~4oEe~?8Unjk9lgU0>nojncl3v!7^f22dq?i4H(mORNJz9Rb^!80jPh+Yl zb8q_xN)NJ{80ewpmrD;_eX{0rzD-F_TJc9|KFDf9dbIp<>BUV-@6?p^)GvRO^dPGV z>Cy7brN`_;6Wl|Uo~-#CTK*{M@w!b&kCtC9J+!z9>Cw`J^k`{9db~mtJ|E`tTSUA+ zrGN7D)}P!rIl0$Vy#G`4pP1{>80Am9e?r#!r`LOOp8u!MfAT2je?H=Ierv8fEiaGl zvZK6>ddlkL)cO$>i7n!27UA5OxZbaPG2&=J>+tGtcBFgSTc=34pK8Wn^QW3e{&e%` zpKezEOtbG#K3j>0&%KtNK2u*mCTd2EvSZq)PX?{H;u=m3|JffA=b!5ApNi2O``8e6 zaCNZa=D>At4{XG(IRD%H+sFN_?QKQC(F6URa6qY4@@+Z(tdy~v{GjW-$pE) z?-psrEw~XAN+(JqaJlfY$Nhb#wrIq*^gaR7NNYQL-v!QA{O9*i_rL>w8&5+2rXHFx zMq)kiH0R$?`t~sgCmc{JjrGqp1D5x5=xR^6p6?|&_ST*&eH{i7HuGEm+U8hQ{-quw z!bUz%GO(jR_#NO+nCEl3m!9#TQ0na3B<}nQ=j2~HEY*5`AIA}=FLrkDBdp;owY{W? zr!SV;3s{-R=Q`W_f8!J0BC;zzU&S|c;P`NUYKvs{z8YS_`JZ;#)=F=cM@;(SFLt%! z|Fv(yUJGutvC7>+?7#7H%ovFi4k$t3^UaUNr(NwM@CUk!`#BbTzxE2l^~GDogP*(i z{n|^;q6so54s?qHUN{z=cBO}Cfozby((J~K?gxDU|JfaY`CM_ZkNZsQ0In&7dtul zEx>FW-;k>t(EjehbDbO_1pR5)!nsKjKDBg`3RtP(EuFcBp!?wu^h1@{;J}Ue#${X5 zPHTVsxBCyK->I+$_G!uaZ@dt5y`>W%{I9V`bN`Kn{mwJ{1-}E@6x>L?dPuO}`eHYU zUyp(tYr((JpLw~GH$2dOsgH>I-(0*^GT~+Lf5lm3+jW6VS)V7FGD6S?Zm8?Q4oYLO zWOlH?KldhK@Exo1pSA~lFLwV{!1E_C`_FN=?Mm&B;y5*b=A3Z;6(?$s88hPaIoSUs z;rdE#^vH&Tqz}ULG#1^&VFKTN^gb&1hu{HshY8G?bZU`I{zC=*5VaM1i837nS%0ZCLcE(Oc4xi$pZ8zJ_v%KzMQ!qJBTBY- zu=h8b-I^E7n{|!xYc$sv5BW>MyfpAF*l&HF+Z*nTf9fwI@Z?v>{tr1&e;SM2Br$Ik z0QYquKF!5$;zi;2q6wD|aPCU{Cr@Mkz<%&hS95VsZtXnq4SSCqp5spZWoU(Xz~zoQ zGJx>L`ON;0hm;FAdlAzIE6&uy-b?L$t>>?s2mcR$KV=lV--_wr`=Y&{|M11`O7OXO za>AzT`fkIF5c4#461o#a2@9%{*7@Y_}xh5l4&5|MA5c8*%$@keRG1HK#cF_EJk@$GKq zTVY=i_aom$c_W?!-!G^F7m&X$%5w|%WSHa!6weG~`at$%G~`JaO znFTjy!v3khp%3D$Mez6V4>v;W2P^BhinpyO5aK~}ROE2N`Rgek=pi~e?|2B|Pd2f9 zplaSz;mZ14ZeJGT|HXyC(1(4SiElg3iVL#@{yEvg?f+H@~|PxmAK#Fw#XtK{&lS0z+v z4QmCQO!}b#{$PO_`G7Q;{EG(sr@Up}P5eI(e+8_YuVQ>td;mQxF$ZGf_hE%4jwh z4gO0U_#Z71{CSaHG0qF^z=C}%;J*W7uFnL&jBmZ$+Nq3x|Kaf0;9tLx;itmw2LnqB zGk||McASogn?-e^~N;>XknJ`)cl&8S^9@ zZ@%}{ObqaOeq5EZI9I~g`j_p>=m8vGrL0=Y@wMPT!_JSehOqf=@BGttzI48d&(+pd z8FsHsvE%4|no2Eq|C*5RMbh(N{#^B?c*^gS@0Xn~BKt4@%-s7fFzF-s*L{`G_#}Ts z{2$%K@Qh_og%kg~-($EJ;)i-}ttoYyz^~qQ_?xbv+Y}ST_@;P4?PL3G>wOpelYQZG zlXpkfPJCEuO{Twy?(Fu?T45%>RL}>+hfkel_Fb3?wyFzKhENba^MY{tEruz!l*2E9V6O8|y`kUs}@+q<6m3$kyV zFFmbi{(=0dLGLF0{utw*`p*np{Z-ucQ5#+qdBJ{xC3WA=hz!hh68JFarDDD|E^^u` zXA$vda1(QU-6m(uZDOpyuSSnq1ipa~!zdKNaRK6+{p)9O{V1`oaNWKdix$`4`ydYfjJ?s#60+hH#Z%%x zbRhI0q{S)n2XkvHOkSP9e{c&S9@N4gbP?a_?UQR`AwJ;`C_l)0*dM?@tb5sE4Xl}c zoNVIKg8JQR*_GM5*|)2^xh41%@;SX+F<}Vwp(?DUVDBI_X@WcXhn7b$9s`tbS~x@C zpY+#&1I1aS4-+Mnufg6G7mH@Z1pP2kLirf!!>um`{~@`E_-c?Vr1jr{@6G!i$es*x zsRVqF6e0Rh|H>U;@4q#FzxDkd(ue6L=)=wIY-5QendFHz>9luB!58ei^X2nJ#9!Hd zhHHvaSF3U0AKBRo^6xX21w=s~YIELWeA4&=^w%zp*edW(@f7FBM*3w7Snvlp{}q?4 zY;$lc_ydXu6&0>_H@bNu9+3Yg{_VKe2D{8!(C82BIRCWKGg`N`^6%o{-mca4>4LqR zk>3sP<-UgaC;wvbkjtY2+|9(lbJy$+fb!%S;P=+emd_7<(-nNm^(%?*n=Jz{9wU4t z5BJ0MyH;J4k-DL=lkdM z$Fkn$i~aWRQM`bAH(4sckF140zAF7hY^=$2{S^2CUlboeXGO_Q@C|zw`~mphord<1 z73S^m2hfMub+fm^-{+ahzd|2krw3&v5#KC7h>acjSHjF6sNw$=El3|$2>u`;At6@6 z-N^RdV$+x(%D5%z8FA?`R{q^vyRR8_{bozjm!hH~`KZ3`?Sg=Xe7;DppZx~f!7n{e z4}RCiqP^-)%SgNrp!{P5k05t*;PzR$qX?Je-@4QCT9}0LAJT`av*bUn1g<|fM-SMF z|Bm9x#6YqSx!hIC*R}Q)*)n^VO2z;A_WpDHH~5O3uv3iumrhImASC+~_%EyJQcnEe zxsVP2pJ$}}k@z(3%S!SHZgp!8#+!h(1sfT^Rr79y0LNw|W!}O|A4ivMFRhxP9R)`PfJnUn)U;JwEsSBK_>Vm{^f}G zZw!R}Kj2@E194*%=0LR5^T3~cUE(cStLrx<^ge_ObY$;0ThjXyKEIFR$8^Ep6TWrH zz1;}3le~oM?`)bb>0uJ>tMMv#aF9xouL-e;`b#Xtd8V2Fa=!L+eEh-f4K*We&|{xd zz6!b`%qGD;%{2Zb{=Pay{I4+6d<5a*oUEh)z%;)=`2B_Jgm#)wAe<0R=O>wIKAZ5k z!Aw7BzU3WYpJ##bM|{Hln4T6_lKnIO5f9pn3ex7`kMzNaPv57BJjOrhSB&$4edCYT zLx``rp{#we`xPg`Gc&_`_r)L0mlFO&$J%9x_k=GVbYI!>dP+;0Pa#}ma)*Ct7ewQ0 z!VNXoQzU<%4nH4XMfkto-~XI`-3zukRr1sqByR=yxO+7?$z!CA$GEC7hzGH;mk)z% z{82tk_|qJQUq?Pb_`@ZPPs*gqa5#OL+ zBXTT}=<(OcfBS#tKX@R+R{lrMWqe!t-;~7k!^;1G4;XIb{{Xw*%767`VCVzo_l*A! zWs*%P|2zC!O2l%RjXUuVIx6m71^G~cM*fchtVwAjUW4gKB(U`WgOZ z@c*i~HM5}(!lyUcKlmYiA^U%0U{y-X>oVB?AbW*EE{_`{@Hxur|JNt7cB}v2`#!bH zf~@}kVsX`-K&S-e`^5L1(yE(*igrO(|KD&YC#+?8O3TZ9Xt{$c?7x9tLng#a{Nukr z{y*vuYGC{_8xP_?A|f`{{7vu*kM-R=X?#fb`qd%gubZdU|L@;SSm9~)|GGu2z0vNGxwmc`x3V$+Q?zD$ z3h^Ha;OqT>Z!!M$`l6!QZ-8I$N%4xu& zz|g0?=hjj>=uuylGd=LSV-V$kQU~x~hjhtNhWwx6Kk|V``|rOE*K^p7VCzKka9XXl z{?>lU7qVmz%6Cj*VX?O^%970?-8{)2K!3=&B4F@M_5vJQr~`i!x_Mgjzf5iLiUDu| z73|^9!2`GGA zCEy$U()mROv-#Ct;0yLj<3G8)yT??2*lX3DQ8fN*0sfMwp&k6wcvK2Px2+()9fN56 zM|>aKM&~;Q(R{dEUSzoPIq~l}tN&rg&D36dWkZ+*?eU0zQdha2uU%c@08I8FkxKvj z^MQL>yZ5kOM*N$?VuSBjlt@m6C_Lk<)}J$(Xuv1?+o=#A&-LdeSgxKgiw)&kUmT6`o{|m>p7&=p#$M1^*%B{|O1| zzsg|zS-pk)FBStpDaHTF-Y! zt}hxtm|>d#AwCy`=a`@$vuOT@_}sKWz(JIsU^c*TKzGd)*spyIC)pdafAy5tf)%76#0Tyd8`v{MVaeX@P4hn$6}6UL z%^4deWkON|8}B&D^&$)A3NcI*=SVuZ3Dhwk90lKfuhiU zKinDBFD;Gq%T1v#ih1MOP2!j4BLNMoV_@IVADW*aes`|iO!^T+>$ikI({CXDXVLtx zR3SH9Jxu(!Ppc_9lPPtR8)_~SPD`Wlkkn0YXt>!H`rtUL4E|Cql^ggvlx{l8h70{G zmg@iT_)v$A(%QNT@5AXL_-d`)k~S}S()_Qk!jf?Bo02U%!%xEA$DA8c ze$t!#AMt;37xV%A(|ix%kJric#_W^cG~Z*Yh)qb3gMUCf)f1pSAwHx7+KV5=d$oGp zK&C$w@6oLG?#%Rq_(Hg^?IK>M@VqfZ@b_xOdoec>^S?jxZROqiZO;u@Irdn_AuE2~ z4t(}o6GQhafFJh=*-)W?OWWS3iY=*t3rIA07!arBR)LHxH*8;W=Yb2TrI67(TM$Pd7G-a^JF z$w&Hd=zWG?Uv?wJEw9LY@gs(<`f&9q^h1$WNbA4E|IIJk`Ubv`R!I30u+egD)&77N z(hF(+SS-mi*Hv*ZI$V9ako+wt-fFJD3x9ES?Ip@5#JRkZzbDp3cTWeO(g%=Cl!(81oF#K8*7jUb<{z#5fG zX#;=n{94oY-jp6#kK1$ZD`!9C54zjr+zgCK%b@#{KY00BX77|A5P##mn0?dxNnqd! zO2#L}2RGRFx@ioPd}QxC7BNivAOZd)6MV;{6_S4-zE24LA-$0DN8 zV?GJyZ!G^D`Y%b@MpVoJE6%Cq?mi)*!^g*>@Cc~7^kv=2@ zG5#r^C%z*Gv3ByWPzRM?cg8o1@0NyM&1HHs`~~r!kf>2T#p#N@&1e2)d$;o3)c2$L zfs9kMj#-j%$q5%AJy5>TT;Mx{o)7wsBb^zaqz_Uk#AI)V>HR^k@nLL#S6j(sh7?o9+c90DDl646WM=yA&rN{z@P6B_`gi~1o$?eDHId`m#AJ# zytQ6g`YHH-JEM-~pNQ|T4h#G{pT~Nefd9exKacq~!j}$mA0_MST}ZzOpD)sWv=W%^ zNBE0fqz}=I-^xVgq0K2dJAo-*(^V#_K3dE4f#SCoeCI4={8K(m{$SPgk}ap84^-bl zc;OhvFY!%y>X0A#CV!!HWtjPQwQ8W0Ve0SNh6K&i;Jd;6tq|WeDy0&?)I$4Z8uPiP zc>Vt#7jsKeUViBQ;&z>ElC_h3NgvG62X`CdFGh$DilX{PeIR|6xaAd38p!m4@)huJ zoIR5GPcNi+0sA+;8xH(-dLh+IO5BRgYv#1Y{n84_KE%M;?*hl9UlRO9UcGV0>Qy7B z#bne8`jKZ==4S}}U#9vJ;%i@a8^Qi*{6To#e*e??&IQq=KZN&xNc`8kSnAmQMoRb@lW|0(gW3!$tBQ_ zaXzHqI*UdXGn(lG`E%ks()UNcE9PocqaWe>rItVPjr2j&SrlAkF@Nhq{S9-6e@8y| zEBrfd^Q%5$ZYA=C)s6brPV~d{w1SK)PPi-SgQ9t681lhFtABXeiTF+{6#N71Ke!L$ zTZk9HlZLe|2>{>ZFNp7$F^q4DACj%b=7p2n2>jE0H`g=IykZ9P_cY!>_*bUC)5dq& z+Zk7AK9cNz!+hrdb4QgAAiiUCjQ`^y6@v(W@LuZ6sreh6t$5=CZU^{xA^$_|>*KYg z4=!{+u98=#%|1PBmw|Vo=Mn!)Ca2`@-1fbdUuAqqN#9-Ds(k2u$^IjUGktJ|JcP&g zC;rFzki5tT6aAclw`zRIK6I59zK<<1@_+4rwf23$=3 z;bH$H6aA2qc5DOF2W$Z8VVh}!{a)@$@uJ?W9OwxC5zk3p@Llik!u&h=JE`8R3?9h% zr~VReEv}z9tPREc%YuF&-cKLhcI3=G8CS@Eh{1nM2;-mpsdy`|oU0N1eO(ULtBB8} ziHvWWFMSw)Ncx2Kcg73+J6qf1#tQ!5neIpJZ;j%Fe1M)u{7>=|{DBX>k9JFgDs*59 z{6Vz9uXc+iF~AM{!~RJgZLLP>-I4K6@@jP!-p#(`W8=0e7s8-h*-jMvg{7g|ne2!B zxeX`l*5e_6`)m36cVGW#{$S5-pPq5-{YHP$S-g3AOaapm-mFyibYOf_f8^o7zz%|c zza;2K&tiU<^D5YP`eh-Wn-S4DO#w_FpIHOD=B?_ThE}ApaxG<>v9@ zhcNyr{t%y`L!ck}4bE1q9)xzo2Iqr9d!kb5NqpA}eByk~2zSPR7V%lhD~I)?8lxR8MRZ{Kdr*DyZ+ zUE}w^oByAC9>tG`^9cuT^K|%&M*Zl(Wt!F&Z{VG9Bhn9NyHz7+7H3@PivBF-jY@av zs+VViZ|dKze7&;I)6D(}W4vd6svq^T^)RKJu zeZimdh(GPf!1iol7zf0iq6?!_Z81qeHKj_WqgZ?P;qzr8?V;*?zR4uGoKEpC^8MAlq*=$$h+x z_Mara%=RBna>xE-;OYI?ev_fD!hU0|`Wfsu!+uiXej1Bzhz;9+Lh(k44F}KR_Xu3> zB$?U!sMKtK-v599&!h4_kNrQF3SwF@K8%Jj9IMyQ!t-fAS7JZfuY1TL#~u4|&3V%F zFxDTrSRo|&^|RT2tmvp5ciNA)XCd}uVZY7Ec@=|5-jB7cKdK(!?Q_`v+T~bLqWxBz z#x>CXy2#@pxL=}0m*j^5;)Sy*lKNj#}&vEIGZF_Otd8Rc9U#q5UZ3 zyV-uExD&#DH1X|2Y(LulvR%Udvztf!h5d(Cd}D9oY3vt`NI${$n_b!fzPm}2=jfjb zr~QN<&tdW}pS9SX_LnRl$o3CZ49b$x{(>oO9`29Y3TF=eQElUG)sIK*Mfm*+|FyQ( z<1cZno_{>-(`a}}9^aqs_gM^n%~-MD^;R7AbDS0AH9-C!vRJ+TIYU4c^+)~Zv_Iz% z_T%)~jQtwo>-8o5`vz=8`QF}h=B=oMtS$J0ew>5mSIs@~U3<41{dfjp%@*XqmD{={ z3-$D+Y`@JZbMJGfB@yvebMzY8Pw^p>ucl}@_E*)K_D*5)FQ1j;u110F!k5^73F1eC zdTRe>*dKv)S4MWy)yBO?vU0UCwx|rm-a94)th`pLfv9$xm@}i>`%B;((*l_KTt1d z(sGuPY}5}+m+h;WqsR6@lQBcs53;k*=BL6@KWf_eCaWht9)kLC90+rw`teq$$bYC& z5GZ~wDd5X?nFj_5{#T`va|LOr|7lCuXfzn2`(W`OB^=IO2id=b1zr7Ag_-Ji$$qI| zK%WU$)CG6D7ImVI_(l2d?_aO+-AJ1+w37FD{(f0(m}!6I$E@Cc{khkd zQT^=hScbR5e-NHc#g8a~ApcACkP1;{H*ZtY0FqawR)>mTL@^fr2pbF@9?#BZ^=)tB ze26E{Pek!6`s3uha-qJl>K{}epVG3lEOj-t^EDl(i=GY>>eU_a;eYS?lzUq7QLRLa z^{y(2zyJ1ess~N-=u&Q9Vj2HNW3&f^h5V%d#P7CQ zRL>#{BK-$6l7R5J z>|d!I+X?bveV+Uu%6kmyVZd0=r+5x=4W~9TT%CC%gx2#dC#imCbqsb>>S_I+ucq~R zs^`V}8W!w-ZGYTu;CY`!%WPUt#|YbW|IB`Ss+ZYNwbp?88TI*0wmwe&kJdlmpTyQb zZ@~Wns>gQ)Mm>!!_>2uzt8Jg_7Ujrv3ErZ+cKqCYYnu|AFUYOF`{ zwFq{rR^wOuvA)Pj>aqUFajEC9o=jMm$bX0b!OH2Qz*xW3R%$FITD#=%FT6L_tkGjV zSyR1*%?EclynGg|7Zto+l6wmE1ltk+XuT-Om#q&`{KI;&=4E@<9~A$ve5{djb5A>u zXnOvznbYA3Nqr}Fw(3KO2=jB8&!_wf^&RHF^=G&o_a}MxOlFw+gVt-#ti${b)@K|y z-=Ot7<8=d@pN&I4L-VoKN7#I9XRO#@xUIZ(l*ZfjE?vq`3%GI*n@=HsPV;NVEX%*KofZ2pS!RY_jGa>pDdKjpI| zf5BqNi}|RkdG>=z{=JxQru9cF-VsCd3*YF`eoVuBF6kGRZ@7w<{eh&uY$rG>P_jWKo+_f6#V|>^=sqN>e z51M&o0LJ4gb!>ZjUf=>3>-*S^?mOvkho`uce8_)2jt`^#=@TXNJR0xpsFAt#omy76 zujWPMyV!qv^SUsX$Mc;p>nYE_HP*%#Lh*c;^11lFzbo73l-53MU(F2UqbBXi0AW0G zYS(J#t{Nny5u*6PE;qV)Q~#(`>d^RRv|p}WPgg#z;O5rt=Iq{+z2sSj{?{TuC<$csbkzUI2Q*KO z-E`@|>X$B1|A(qosKE+O=y8@imWbce5v?^~K1x|Hy}+^ghk=R zkuPxCu!~~KXLozk^-v#`o%ZmQ@ci+m&Uk+hbl3&1txyk;kNZjCZ@&~_Jx0&F(D|lB z%-=3}#_Ph4=+dEh|4yvpHk3@scSuPhk%S*u$r0jsBn@!Yf1CGKgL z2s^YeDBFLVXqIj6bs@C8t9{sXwNhGrVaLQ*7q=koi$8cU9(Ub4B>2qZztAlF)aw5M D1ff2g diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/TestAssets/workshop_iblskyboxcm.exr b/Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/TestAssets/workshop_iblskyboxcm.exr new file mode 100644 index 0000000000..72937bd6d0 --- /dev/null +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Tests/TestAssets/workshop_iblskyboxcm.exr @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:010165af78bdafe61dad187b250598fa670325428271f5bcf9bd4d839f4cc1c0 +size 20114684 diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/imageprocessing_files.cmake b/Gems/Atom/Asset/ImageProcessingAtom/Code/imageprocessing_files.cmake index e8bc033f08..55ccdf1d89 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/imageprocessing_files.cmake +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/imageprocessing_files.cmake @@ -129,6 +129,8 @@ set(FILES Source/Compressors/CryTextureSquisher/ColorBlockRGBA4x4s.h Source/Compressors/CryTextureSquisher/ColorBlockRGBA4x4c.h Source/Compressors/CryTextureSquisher/ColorTypes.h + Source/Compressors/ISPCTextureCompressor.cpp + Source/Compressors/ISPCTextureCompressor.h Source/Thumbnail/ImageThumbnail.cpp Source/Thumbnail/ImageThumbnail.h Source/Thumbnail/ImageThumbnailSystemComponent.cpp diff --git a/cmake/3rdParty/Platform/Linux/BuiltInPackages_linux.cmake b/cmake/3rdParty/Platform/Linux/BuiltInPackages_linux.cmake index 7df364121b..ba63ef5d64 100644 --- a/cmake/3rdParty/Platform/Linux/BuiltInPackages_linux.cmake +++ b/cmake/3rdParty/Platform/Linux/BuiltInPackages_linux.cmake @@ -9,7 +9,6 @@ # shared by other platforms: ly_associate_package(PACKAGE_NAME ilmbase-2.3.0-rev4-multiplatform TARGETS ilmbase PACKAGE_HASH 97547fdf1fbc4d81b8ccf382261f8c25514ed3b3c4f8fd493f0a4fa873bba348) ly_associate_package(PACKAGE_NAME assimp-5.0.1-rev11-multiplatform TARGETS assimplib PACKAGE_HASH 1a9113788b893ef4a2ee63ac01eb71b981a92894a5a51175703fa225f5804dec) -ly_associate_package(PACKAGE_NAME squish-ccr-20150601-rev3-multiplatform TARGETS squish-ccr PACKAGE_HASH c878c6c0c705e78403c397d03f5aa7bc87e5978298710e14d09c9daf951a83b3) ly_associate_package(PACKAGE_NAME ASTCEncoder-2017_11_14-rev2-multiplatform TARGETS ASTCEncoder PACKAGE_HASH c240ffc12083ee39a5ce9dc241de44d116e513e1e3e4cc1d05305e7aa3bdc326) ly_associate_package(PACKAGE_NAME md5-2.0-multiplatform TARGETS md5 PACKAGE_HASH 29e52ad22c78051551f78a40c2709594f0378762ae03b417adca3f4b700affdf) ly_associate_package(PACKAGE_NAME RapidJSON-1.1.0-rev1-multiplatform TARGETS RapidJSON PACKAGE_HASH 2f5e26ecf86c3b7a262753e7da69ac59928e78e9534361f3d00c1ad5879e4023) @@ -45,5 +44,7 @@ ly_associate_package(PACKAGE_NAME DirectXShaderCompilerDxc-1.6.2104-o3de-rev3-li ly_associate_package(PACKAGE_NAME SPIRVCross-2021.04.29-rev1-linux TARGETS SPIRVCross PACKAGE_HASH 7889ee5460a688e9b910c0168b31445c0079d363affa07b25d4c8aeb608a0b80) ly_associate_package(PACKAGE_NAME azslc-1.7.23-rev2-linux TARGETS azslc PACKAGE_HASH 1ba84d8321a566d35a1e9aa7400211ba8e6d1c11c08e4be3c93e6e74b8f7aef1) ly_associate_package(PACKAGE_NAME zlib-1.2.11-rev1-linux TARGETS zlib PACKAGE_HASH 6418e93b9f4e6188f3b62cbd3a7822e1c4398a716e786d1522b809a727d08ba9) +ly_associate_package(PACKAGE_NAME squish-ccr-deb557d-rev1-linux TARGETS squish-ccr PACKAGE_HASH 85fecafbddc6a41a27c5f59ed4a5dfb123a94cb4666782cf26e63c0a4724c530) +ly_associate_package(PACKAGE_NAME ISPCTexComp-36b80aa-rev1-linux TARGETS ISPCTexComp PACKAGE_HASH 065fd12abe4247dde247330313763cf816c3375c221da030bdec35024947f259) diff --git a/cmake/3rdParty/Platform/Linux/squish-ccr_linux.cmake b/cmake/3rdParty/Platform/Linux/squish-ccr_linux.cmake deleted file mode 100644 index 80a0776765..0000000000 --- a/cmake/3rdParty/Platform/Linux/squish-ccr_linux.cmake +++ /dev/null @@ -1,9 +0,0 @@ -# -# Copyright (c) Contributors to the Open 3D Engine Project. -# For complete copyright and license terms please see the LICENSE at the root of this distribution. -# -# SPDX-License-Identifier: Apache-2.0 OR MIT -# -# - -set(SQUISH-CCR_LIBS ${BASE_PATH}/lib/Linux/Release/libsquish-ccr.a) \ No newline at end of file diff --git a/cmake/3rdParty/Platform/Mac/BuiltInPackages_mac.cmake b/cmake/3rdParty/Platform/Mac/BuiltInPackages_mac.cmake index 353956a495..be89612c1b 100644 --- a/cmake/3rdParty/Platform/Mac/BuiltInPackages_mac.cmake +++ b/cmake/3rdParty/Platform/Mac/BuiltInPackages_mac.cmake @@ -9,7 +9,6 @@ # shared by other platforms: ly_associate_package(PACKAGE_NAME ilmbase-2.3.0-rev4-multiplatform TARGETS ilmbase PACKAGE_HASH 97547fdf1fbc4d81b8ccf382261f8c25514ed3b3c4f8fd493f0a4fa873bba348) ly_associate_package(PACKAGE_NAME assimp-5.0.1-rev11-multiplatform TARGETS assimplib PACKAGE_HASH 1a9113788b893ef4a2ee63ac01eb71b981a92894a5a51175703fa225f5804dec) -ly_associate_package(PACKAGE_NAME squish-ccr-20150601-rev3-multiplatform TARGETS squish-ccr PACKAGE_HASH c878c6c0c705e78403c397d03f5aa7bc87e5978298710e14d09c9daf951a83b3) ly_associate_package(PACKAGE_NAME ASTCEncoder-2017_11_14-rev2-multiplatform TARGETS ASTCEncoder PACKAGE_HASH c240ffc12083ee39a5ce9dc241de44d116e513e1e3e4cc1d05305e7aa3bdc326) ly_associate_package(PACKAGE_NAME md5-2.0-multiplatform TARGETS md5 PACKAGE_HASH 29e52ad22c78051551f78a40c2709594f0378762ae03b417adca3f4b700affdf) ly_associate_package(PACKAGE_NAME RapidJSON-1.1.0-rev1-multiplatform TARGETS RapidJSON PACKAGE_HASH 2f5e26ecf86c3b7a262753e7da69ac59928e78e9534361f3d00c1ad5879e4023) @@ -43,3 +42,6 @@ ly_associate_package(PACKAGE_NAME OpenSSL-1.1.1b-rev1-mac ly_associate_package(PACKAGE_NAME qt-5.15.2-rev5-mac TARGETS Qt PACKAGE_HASH 9d25918351898b308ded3e9e571fff6f26311b2071aeafd00dd5b249fdf53f7e) ly_associate_package(PACKAGE_NAME libsamplerate-0.2.1-rev2-mac TARGETS libsamplerate PACKAGE_HASH b912af40c0ac197af9c43d85004395ba92a6a859a24b7eacd920fed5854a97fe) ly_associate_package(PACKAGE_NAME zlib-1.2.11-rev1-mac TARGETS zlib PACKAGE_HASH 7fd8a77b3598423d9d6be5f8c60d52aecf346ab4224f563a5282db283aa0da02) +ly_associate_package(PACKAGE_NAME squish-ccr-deb557d-rev1-mac TARGETS squish-ccr PACKAGE_HASH 155bfbfa17c19a9cd2ef025de14c5db598f4290045d5b0d83ab58cb345089a77) +ly_associate_package(PACKAGE_NAME ISPCTexComp-36b80aa-rev1-mac TARGETS ISPCTexComp PACKAGE_HASH 8a4e93277b8face6ea2fd57c6d017bdb55643ed3d6387110bc5f6b3b884dd169) + diff --git a/cmake/3rdParty/Platform/Mac/squish-ccr_mac.cmake b/cmake/3rdParty/Platform/Mac/squish-ccr_mac.cmake deleted file mode 100644 index 740e630570..0000000000 --- a/cmake/3rdParty/Platform/Mac/squish-ccr_mac.cmake +++ /dev/null @@ -1,9 +0,0 @@ -# -# Copyright (c) Contributors to the Open 3D Engine Project. -# For complete copyright and license terms please see the LICENSE at the root of this distribution. -# -# SPDX-License-Identifier: Apache-2.0 OR MIT -# -# - -set(SQUISH-CCR_LIBS ${BASE_PATH}/lib/Mac/Release/libsquish-ccr.a) \ No newline at end of file diff --git a/cmake/3rdParty/Platform/Windows/BuiltInPackages_windows.cmake b/cmake/3rdParty/Platform/Windows/BuiltInPackages_windows.cmake index 2aded62bcd..2655b7247f 100644 --- a/cmake/3rdParty/Platform/Windows/BuiltInPackages_windows.cmake +++ b/cmake/3rdParty/Platform/Windows/BuiltInPackages_windows.cmake @@ -9,7 +9,6 @@ # shared by other platforms: ly_associate_package(PACKAGE_NAME ilmbase-2.3.0-rev4-multiplatform TARGETS ilmbase PACKAGE_HASH 97547fdf1fbc4d81b8ccf382261f8c25514ed3b3c4f8fd493f0a4fa873bba348) ly_associate_package(PACKAGE_NAME assimp-5.0.1-rev11-multiplatform TARGETS assimplib PACKAGE_HASH 1a9113788b893ef4a2ee63ac01eb71b981a92894a5a51175703fa225f5804dec) -ly_associate_package(PACKAGE_NAME squish-ccr-20150601-rev3-multiplatform TARGETS squish-ccr PACKAGE_HASH c878c6c0c705e78403c397d03f5aa7bc87e5978298710e14d09c9daf951a83b3) ly_associate_package(PACKAGE_NAME ASTCEncoder-2017_11_14-rev2-multiplatform TARGETS ASTCEncoder PACKAGE_HASH c240ffc12083ee39a5ce9dc241de44d116e513e1e3e4cc1d05305e7aa3bdc326) ly_associate_package(PACKAGE_NAME md5-2.0-multiplatform TARGETS md5 PACKAGE_HASH 29e52ad22c78051551f78a40c2709594f0378762ae03b417adca3f4b700affdf) ly_associate_package(PACKAGE_NAME RapidJSON-1.1.0-rev1-multiplatform TARGETS RapidJSON PACKAGE_HASH 2f5e26ecf86c3b7a262753e7da69ac59928e78e9534361f3d00c1ad5879e4023) @@ -51,3 +50,5 @@ ly_associate_package(PACKAGE_NAME civetweb-1.8-rev1-windows ly_associate_package(PACKAGE_NAME OpenSSL-1.1.1b-rev2-windows TARGETS OpenSSL PACKAGE_HASH 9af1c50343f89146b4053101a7aeb20513319a3fe2f007e356d7ce25f9241040) ly_associate_package(PACKAGE_NAME Crashpad-0.8.0-rev1-windows TARGETS Crashpad PACKAGE_HASH d162aa3070147bc0130a44caab02c5fe58606910252caf7f90472bd48d4e31e2) ly_associate_package(PACKAGE_NAME zlib-1.2.11-rev1-windows TARGETS zlib PACKAGE_HASH 6fb46a0ef8c8614cde3517b50fca47f2a6d1fd059b21f3b8ff13e635ca7f2fa6) +ly_associate_package(PACKAGE_NAME squish-ccr-deb557d-rev1-windows TARGETS squish-ccr PACKAGE_HASH 5c3d9fa491e488ccaf802304ad23b932268a2b2846e383f088779962af2bfa84) +ly_associate_package(PACKAGE_NAME ISPCTexComp-36b80aa-rev1-windows TARGETS ISPCTexComp PACKAGE_HASH b6fa6ea28a2808a9a5524c72c37789c525925e435770f2d94eb2d387360fa2d0) diff --git a/cmake/3rdParty/Platform/Windows/squish-ccr_windows.cmake b/cmake/3rdParty/Platform/Windows/squish-ccr_windows.cmake deleted file mode 100644 index fb94cb6969..0000000000 --- a/cmake/3rdParty/Platform/Windows/squish-ccr_windows.cmake +++ /dev/null @@ -1,9 +0,0 @@ -# -# Copyright (c) Contributors to the Open 3D Engine Project. -# For complete copyright and license terms please see the LICENSE at the root of this distribution. -# -# SPDX-License-Identifier: Apache-2.0 OR MIT -# -# - -set(SQUISH-CCR_LIBS ${BASE_PATH}/lib/Windows/Release/squish-ccr.lib) \ No newline at end of file From 4a33f1187ab15a480975c9c1a0c62f2cc7e55e26 Mon Sep 17 00:00:00 2001 From: jckand-amzn Date: Fri, 27 Aug 2021 12:27:51 -0500 Subject: [PATCH 125/131] Re-saved instance_counter script canvas asset Signed-off-by: jckand-amzn --- .../instance_counter.scriptcanvas | 2027 +++++++---------- 1 file changed, 786 insertions(+), 1241 deletions(-) diff --git a/AutomatedTesting/ScriptCanvas/instance_counter.scriptcanvas b/AutomatedTesting/ScriptCanvas/instance_counter.scriptcanvas index 0ccd364da5..0e5524273c 100644 --- a/AutomatedTesting/ScriptCanvas/instance_counter.scriptcanvas +++ b/AutomatedTesting/ScriptCanvas/instance_counter.scriptcanvas @@ -1,1241 +1,786 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +{ + "Type": "JsonSerialization", + "Version": 1, + "ClassName": "ScriptCanvasData", + "ClassData": { + "m_scriptCanvas": { + "Id": { + "id": 3744110453276 + }, + "Name": "instance_counter", + "Components": { + "Component_[12097559167852379075]": { + "$type": "EditorGraphVariableManagerComponent", + "Id": 12097559167852379075 + }, + "Component_[2729072015511887582]": { + "$type": "{4D755CA9-AB92-462C-B24F-0B3376F19967} Graph", + "Id": 2729072015511887582, + "m_graphData": { + "m_nodes": [ + { + "Id": { + "id": 3752700387868 + }, + "Name": "SC-Node(Print)", + "Components": { + "Component_[10726023654468379779]": { + "$type": "Print", + "Id": 10726023654468379779, + "Slots": [ + { + "id": { + "m_id": "{14259C44-C324-4F72-93E7-FA49B061F2C7}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "In", + "toolTip": "Input signal", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{4DE18FB9-E6F3-47B2-B721-AE0A35FC9C5F}" + }, + "DynamicTypeOverride": 3, + "contracts": [ + { + "$type": "SlotTypeContract" + }, + null + ], + "slotName": "Value", + "toolTip": "Value which replaces instances of {Value} in the resulting string.", + "DisplayDataType": { + "m_type": 3 + }, + "DisplayGroup": { + "Value": 1015031923 + }, + "Descriptor": { + "ConnectionType": 1, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{BDE3D585-DDD2-4B5E-AB8E-738F07B89A00}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Out", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + } + ], + "Datums": [ + { + "isOverloadedStorage": false, + "scriptCanvasType": { + "m_type": 3 + }, + "isNullPointer": false, + "$type": "double", + "value": 0.0, + "label": "Value" + } + ], + "m_format": "Instances found in area = {Value}", + "m_numericPrecision": 0, + "m_arrayBindingMap": [ + { + "Key": 1, + "Value": { + "m_id": "{4DE18FB9-E6F3-47B2-B721-AE0A35FC9C5F}" + } + } + ], + "m_unresolvedString": [ + "Instances found in area = ", + {} + ], + "m_formatSlotMap": { + "Value": { + "m_id": "{4DE18FB9-E6F3-47B2-B721-AE0A35FC9C5F}" + } + } + } + } + }, + { + "Id": { + "id": 3756995355164 + }, + "Name": "SC-Node(Start)", + "Components": { + "Component_[1402832180862211598]": { + "$type": "Start", + "Id": 1402832180862211598, + "Slots": [ + { + "id": { + "m_id": "{66363B00-927B-4B9C-AF21-C9DDC4BA528D}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Out", + "toolTip": "Signaled when the entity that owns this graph is fully activated.", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + } + ] + } + } + }, + { + "Id": { + "id": 3765585289756 + }, + "Name": "SC-Node(GetAreaProductCount)", + "Components": { + "Component_[14710093371558461612]": { + "$type": "{E42861BD-1956-45AE-8DD7-CCFC1E3E5ACF} Method", + "Id": 14710093371558461612, + "Slots": [ + { + "id": { + "m_id": "{32D2E25A-834E-48FE-B868-7AB5D78D3A3B}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + }, + null + ], + "slotName": "EntityID: 0", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{9D282D11-1630-4247-BCA7-001953C7AAEA}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "In", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{DDBA739C-F8A3-4307-8BEF-494B499DA0DC}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Out", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{64B972F8-C880-4BB2-8482-E5F0FDBB692D}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Result: Number", + "DisplayDataType": { + "m_type": 3 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + } + ], + "Datums": [ + { + "isOverloadedStorage": false, + "scriptCanvasType": { + "m_type": 1 + }, + "isNullPointer": false, + "$type": "EntityId", + "value": { + "id": 2901262558 + }, + "label": "Source" + } + ], + "methodType": 0, + "methodName": "GetAreaProductCount", + "className": "VegetationSpawnerRequestBus", + "resultSlotIDs": [ + {} + ], + "prettyClassName": "VegetationSpawnerRequestBus" + } + } + }, + { + "Id": { + "id": 3748405420572 + }, + "Name": "SC-Node(TimeDelayNodeableNode)", + "Components": { + "Component_[4183258099933897606]": { + "$type": "TimeDelayNodeableNode", + "Id": 4183258099933897606, + "Slots": [ + { + "id": { + "m_id": "{5B850958-5026-4659-B6C7-0EB4E55205E6}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Start", + "DisplayGroup": { + "Value": 2675529103 + }, + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{DB2A2300-A20D-4DB7-A31B-F4F1B040BB62}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + }, + null + ], + "slotName": "Delay", + "toolTip": "The amount of time to delay before the Done is signalled.", + "DisplayGroup": { + "Value": 2675529103 + }, + "Descriptor": { + "ConnectionType": 1, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{27714BA0-DFD3-4813-94BF-12B0ADF2B89F}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "On Start", + "DisplayGroup": { + "Value": 2675529103 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{34BAE377-8B62-4E33-B9AB-0819643950A1}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Done", + "toolTip": "Signaled after waiting for the specified amount of times.", + "DisplayGroup": { + "Value": 271442091 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + } + ], + "Datums": [ + { + "isOverloadedStorage": false, + "scriptCanvasType": { + "m_type": 3 + }, + "isNullPointer": false, + "$type": "double", + "value": 5.0, + "label": "Delay" + } + ], + "nodeable": { + "m_timeUnits": 2 + }, + "slotExecutionMap": { + "ins": [ + { + "_slotId": { + "m_id": "{5B850958-5026-4659-B6C7-0EB4E55205E6}" + }, + "_inputs": [ + { + "_slotId": { + "m_id": "{DB2A2300-A20D-4DB7-A31B-F4F1B040BB62}" + } + } + ], + "_outs": [ + { + "_slotId": { + "m_id": "{27714BA0-DFD3-4813-94BF-12B0ADF2B89F}" + }, + "_name": "On Start", + "_interfaceSourceId": "{00E45DAC-D501-0000-A050-B80244000000}" + } + ], + "_interfaceSourceId": "{9CCBADAB-917D-0000-0400-000000000000}" + } + ], + "latents": [ + { + "_slotId": { + "m_id": "{34BAE377-8B62-4E33-B9AB-0819643950A1}" + }, + "_name": "Done", + "_interfaceSourceId": "{9CCBADAB-917D-0000-0400-000000000000}" + } + ] + } + } + } + }, + { + "Id": { + "id": 3761290322460 + }, + "Name": "SC-Node(Print)", + "Components": { + "Component_[6291714103869491290]": { + "$type": "Print", + "Id": 6291714103869491290, + "Slots": [ + { + "id": { + "m_id": "{69A4391E-F7BE-4E2E-8FED-474227D660F3}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "In", + "toolTip": "Input signal", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{5D263368-0096-424D-ACEE-1D658417E00D}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Out", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + } + ], + "m_format": "Delaying for 5 seconds", + "m_unresolvedString": [ + "Delaying for 5 seconds" + ] + } + } + } + ], + "m_connections": [ + { + "Id": { + "id": 3769880257052 + }, + "Name": "srcEndpoint=(On Graph Start: Out), destEndpoint=(TimeDelay: Start)", + "Components": { + "Component_[17168700535869642649]": { + "$type": "{64CA5016-E803-4AC4-9A36-BDA2C890C6EB} Connection", + "Id": 17168700535869642649, + "sourceEndpoint": { + "nodeId": { + "id": 3756995355164 + }, + "slotId": { + "m_id": "{66363B00-927B-4B9C-AF21-C9DDC4BA528D}" + } + }, + "targetEndpoint": { + "nodeId": { + "id": 3748405420572 + }, + "slotId": { + "m_id": "{5B850958-5026-4659-B6C7-0EB4E55205E6}" + } + } + } + } + }, + { + "Id": { + "id": 3774175224348 + }, + "Name": "srcEndpoint=(TimeDelay: On Start), destEndpoint=(Print: In)", + "Components": { + "Component_[447639101916656835]": { + "$type": "{64CA5016-E803-4AC4-9A36-BDA2C890C6EB} Connection", + "Id": 447639101916656835, + "sourceEndpoint": { + "nodeId": { + "id": 3748405420572 + }, + "slotId": { + "m_id": "{27714BA0-DFD3-4813-94BF-12B0ADF2B89F}" + } + }, + "targetEndpoint": { + "nodeId": { + "id": 3761290322460 + }, + "slotId": { + "m_id": "{69A4391E-F7BE-4E2E-8FED-474227D660F3}" + } + } + } + } + }, + { + "Id": { + "id": 3778470191644 + }, + "Name": "srcEndpoint=(TimeDelay: Done), destEndpoint=(GetAreaProductCount: In)", + "Components": { + "Component_[13322673526483611656]": { + "$type": "{64CA5016-E803-4AC4-9A36-BDA2C890C6EB} Connection", + "Id": 13322673526483611656, + "sourceEndpoint": { + "nodeId": { + "id": 3748405420572 + }, + "slotId": { + "m_id": "{34BAE377-8B62-4E33-B9AB-0819643950A1}" + } + }, + "targetEndpoint": { + "nodeId": { + "id": 3765585289756 + }, + "slotId": { + "m_id": "{9D282D11-1630-4247-BCA7-001953C7AAEA}" + } + } + } + } + }, + { + "Id": { + "id": 3782765158940 + }, + "Name": "srcEndpoint=(GetAreaProductCount: Result: Number), destEndpoint=(Print: Value)", + "Components": { + "Component_[17896973599438945144]": { + "$type": "{64CA5016-E803-4AC4-9A36-BDA2C890C6EB} Connection", + "Id": 17896973599438945144, + "sourceEndpoint": { + "nodeId": { + "id": 3765585289756 + }, + "slotId": { + "m_id": "{64B972F8-C880-4BB2-8482-E5F0FDBB692D}" + } + }, + "targetEndpoint": { + "nodeId": { + "id": 3752700387868 + }, + "slotId": { + "m_id": "{4DE18FB9-E6F3-47B2-B721-AE0A35FC9C5F}" + } + } + } + } + }, + { + "Id": { + "id": 3787060126236 + }, + "Name": "srcEndpoint=(GetAreaProductCount: Out), destEndpoint=(Print: In)", + "Components": { + "Component_[3309014461387913721]": { + "$type": "{64CA5016-E803-4AC4-9A36-BDA2C890C6EB} Connection", + "Id": 3309014461387913721, + "sourceEndpoint": { + "nodeId": { + "id": 3765585289756 + }, + "slotId": { + "m_id": "{DDBA739C-F8A3-4307-8BEF-494B499DA0DC}" + } + }, + "targetEndpoint": { + "nodeId": { + "id": 3752700387868 + }, + "slotId": { + "m_id": "{14259C44-C324-4F72-93E7-FA49B061F2C7}" + } + } + } + } + } + ] + }, + "m_assetType": "{3E2AC8CD-713F-453E-967F-29517F331784}", + "versionData": { + "_grammarVersion": 1, + "_runtimeVersion": 1 + }, + "GraphCanvasData": [ + { + "Key": { + "id": 3744110453276 + }, + "Value": { + "ComponentData": { + "{5F84B500-8C45-40D1-8EFC-A5306B241444}": { + "$type": "SceneComponentSaveData", + "ViewParams": { + "Scale": 0.9218543514249998, + "AnchorX": 50.98419189453125, + "AnchorY": -272.27728271484375 + } + } + } + } + }, + { + "Key": { + "id": 3748405420572 + }, + "Value": { + "ComponentData": { + "{24CB38BB-1705-4EC5-8F63-B574571B4DCD}": { + "$type": "NodeSaveData" + }, + "{328FF15C-C302-458F-A43D-E1794DE0904E}": { + "$type": "GeneralNodeTitleComponentSaveData", + "PaletteOverride": "TimeNodeTitlePalette" + }, + "{7CC444B1-F9B3-41B5-841B-0C4F2179F111}": { + "$type": "GeometrySaveData", + "Position": [ + 380.0, + 20.0 + ] + }, + "{B0B99C8A-03AF-4CF6-A926-F65C874C3D97}": { + "$type": "StylingComponentSaveData" + }, + "{B1F49A35-8408-40DA-B79E-F1E3B64322CE}": { + "$type": "PersistentIdComponentSaveData", + "PersistentId": "{DB8CFC70-AD18-45D5-8C6C-A39648059134}" + } + } + } + }, + { + "Key": { + "id": 3752700387868 + }, + "Value": { + "ComponentData": { + "{24CB38BB-1705-4EC5-8F63-B574571B4DCD}": { + "$type": "NodeSaveData" + }, + "{328FF15C-C302-458F-A43D-E1794DE0904E}": { + "$type": "GeneralNodeTitleComponentSaveData", + "PaletteOverride": "StringNodeTitlePalette" + }, + "{7CC444B1-F9B3-41B5-841B-0C4F2179F111}": { + "$type": "GeometrySaveData", + "Position": [ + 1220.0, + 180.0 + ] + }, + "{B0B99C8A-03AF-4CF6-A926-F65C874C3D97}": { + "$type": "StylingComponentSaveData" + }, + "{B1F49A35-8408-40DA-B79E-F1E3B64322CE}": { + "$type": "PersistentIdComponentSaveData", + "PersistentId": "{1811B851-23B5-43C8-B654-9822174090CC}" + } + } + } + }, + { + "Key": { + "id": 3756995355164 + }, + "Value": { + "ComponentData": { + "{24CB38BB-1705-4EC5-8F63-B574571B4DCD}": { + "$type": "NodeSaveData" + }, + "{328FF15C-C302-458F-A43D-E1794DE0904E}": { + "$type": "GeneralNodeTitleComponentSaveData", + "PaletteOverride": "TimeNodeTitlePalette" + }, + "{7CC444B1-F9B3-41B5-841B-0C4F2179F111}": { + "$type": "GeometrySaveData", + "Position": [ + 160.0, + 60.0 + ] + }, + "{B0B99C8A-03AF-4CF6-A926-F65C874C3D97}": { + "$type": "StylingComponentSaveData" + }, + "{B1F49A35-8408-40DA-B79E-F1E3B64322CE}": { + "$type": "PersistentIdComponentSaveData", + "PersistentId": "{483C126F-701F-492F-8375-15B40F8D0178}" + } + } + } + }, + { + "Key": { + "id": 3761290322460 + }, + "Value": { + "ComponentData": { + "{24CB38BB-1705-4EC5-8F63-B574571B4DCD}": { + "$type": "NodeSaveData" + }, + "{328FF15C-C302-458F-A43D-E1794DE0904E}": { + "$type": "GeneralNodeTitleComponentSaveData", + "PaletteOverride": "StringNodeTitlePalette" + }, + "{7CC444B1-F9B3-41B5-841B-0C4F2179F111}": { + "$type": "GeometrySaveData", + "Position": [ + 700.0, + -160.0 + ] + }, + "{B0B99C8A-03AF-4CF6-A926-F65C874C3D97}": { + "$type": "StylingComponentSaveData" + }, + "{B1F49A35-8408-40DA-B79E-F1E3B64322CE}": { + "$type": "PersistentIdComponentSaveData", + "PersistentId": "{DF1AB898-208E-4EA4-B3A9-202A4DB725EB}" + } + } + } + }, + { + "Key": { + "id": 3765585289756 + }, + "Value": { + "ComponentData": { + "{24CB38BB-1705-4EC5-8F63-B574571B4DCD}": { + "$type": "NodeSaveData" + }, + "{328FF15C-C302-458F-A43D-E1794DE0904E}": { + "$type": "GeneralNodeTitleComponentSaveData", + "PaletteOverride": "MethodNodeTitlePalette" + }, + "{7CC444B1-F9B3-41B5-841B-0C4F2179F111}": { + "$type": "GeometrySaveData", + "Position": [ + 700.0, + 200.0 + ] + }, + "{B0B99C8A-03AF-4CF6-A926-F65C874C3D97}": { + "$type": "StylingComponentSaveData", + "SubStyle": ".method" + }, + "{B1F49A35-8408-40DA-B79E-F1E3B64322CE}": { + "$type": "PersistentIdComponentSaveData", + "PersistentId": "{5724716B-5E80-4BB2-AA9C-3E4916A40BAE}" + } + } + } + } + ], + "StatisticsHelper": { + "InstanceCounter": [ + { + "Key": 4199610336680704683, + "Value": 1 + }, + { + "Key": 6462358712820489356, + "Value": 1 + }, + { + "Key": 10684225535275896474, + "Value": 2 + }, + { + "Key": 13774516461288748354, + "Value": 1 + } + ] + } + } + } + } + } +} \ No newline at end of file From 9876d86d5dcc50a2f8ccb1f09acb06d50d7857b9 Mon Sep 17 00:00:00 2001 From: bosnichd Date: Fri, 27 Aug 2021 11:33:28 -0600 Subject: [PATCH 126/131] Fix two compilation errors exposed when enabling tools support for any restricted platform. (#3633) * Various fixes and empty boilerplate files required for restricted platforms. Signed-off-by: bosnichd * Add comments to address review feedback. Signed-off-by: bosnichd * Fix two compilation errors exposed when enabling tools support for any restricted platform. - The simple one: remove menu commands that call OnChangeGameSpec (which has since been removed) from CryEdit.cpp - The "I almost threw my computer out the window" one: pull PVRTC.cpp out of unity builds, because it indirectly #includes winnt.h, which typedefs wchar_t WCHAR, which causes a complilation error (Error C2632 'wchar_t' followed by 'wchar_t' is illegal ImageProcessingAtom.Editor.Static C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\winnt.h 471) if something else in the unity file has also happened to define WCHAR as wchar_t. Enabling tools support for any restricted platform resulted in this happening due to different compile definitions being set for ImageConvert.cpp and BuilderSettingManager.cpp (see Gems/Atom/Asset/ImageProcessingAtom/Code/CMakeLists.txt), which resulted in those two files being pulled out of unity builds, which resulted in the entirely unrelated PVRTC.cpp file being moved from the first thing included by a unity file to the second last thing included by a different unity file, that just happened to include something else (prior to PVRTC.cpp) which was defining WCHAR as wchar_t. Signed-off-by: bosnichd --- Code/Editor/CryEdit.cpp | 7 ------- .../ImageProcessingAtom/Code/imageprocessing_files.cmake | 4 ++++ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/Code/Editor/CryEdit.cpp b/Code/Editor/CryEdit.cpp index f0cc5c6264..ca139cc506 100644 --- a/Code/Editor/CryEdit.cpp +++ b/Code/Editor/CryEdit.cpp @@ -447,13 +447,6 @@ void CCryEditApp::RegisterActionHandlers() ON_COMMAND(ID_OPEN_TRACKVIEW, OnOpenTrackView) ON_COMMAND(ID_OPEN_UICANVASEDITOR, OnOpenUICanvasEditor) -#if defined(AZ_TOOLS_EXPAND_FOR_RESTRICTED_PLATFORMS) -#define AZ_RESTRICTED_PLATFORM_EXPANSION(CodeName, CODENAME, codename, PrivateName, PRIVATENAME, privatename, PublicName, PUBLICNAME, publicname, PublicAuxName1, PublicAuxName2, PublicAuxName3)\ - ON_COMMAND_RANGE(ID_GAME_##CODENAME##_ENABLELOWSPEC, ID_GAME_##CODENAME##_ENABLEHIGHSPEC, OnChangeGameSpec) - AZ_TOOLS_EXPAND_FOR_RESTRICTED_PLATFORMS -#undef AZ_RESTRICTED_PLATFORM_EXPANSION -#endif - ON_COMMAND(ID_OPEN_QUICK_ACCESS_BAR, OnOpenQuickAccessBar) ON_COMMAND(ID_FILE_SAVE_LEVEL, OnFileSave) diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/imageprocessing_files.cmake b/Gems/Atom/Asset/ImageProcessingAtom/Code/imageprocessing_files.cmake index 55ccdf1d89..29f7a9ca57 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/imageprocessing_files.cmake +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/imageprocessing_files.cmake @@ -136,3 +136,7 @@ set(FILES Source/Thumbnail/ImageThumbnailSystemComponent.cpp Source/Thumbnail/ImageThumbnailSystemComponent.h ) + +set(SKIP_UNITY_BUILD_INCLUSION_FILES + Source/Compressors/PVRTC.cpp +) From 043b21816582ed76243113ff800b992a1f78c80f Mon Sep 17 00:00:00 2001 From: Chris Galvan Date: Fri, 27 Aug 2021 15:44:31 -0500 Subject: [PATCH 127/131] Updated invalid filename warning with more explicit message from PR feedback. Signed-off-by: Chris Galvan --- .../AzQtComponents/Components/Widgets/FileDialog.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/FileDialog.cpp b/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/FileDialog.cpp index cdd6a77094..d2d773ff93 100644 --- a/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/FileDialog.cpp +++ b/Code/Framework/AzQtComponents/AzQtComponents/Components/Widgets/FileDialog.cpp @@ -38,7 +38,8 @@ namespace AzQtComponents // If the filename had invalid characters, then show a warning message and then we will re-prompt the save filename dialog if (shouldPromptAgain) { - QMessageBox::warning(parent, QObject::tr("Invalid filename"), QObject::tr("The filename contains invalid characters\n\n%1").arg(fileName)); + QMessageBox::warning(parent, QObject::tr("Invalid filename"), + QObject::tr("O3DE assets are restricted to alphanumeric characters, hyphens (-), underscores (_), and dots (.)\n\n%1").arg(fileName)); } } else From d39a6a90858cdd7e8f0a4c4fd000022006fb1c8e Mon Sep 17 00:00:00 2001 From: Junbo Liang <68558268+junbo75@users.noreply.github.com> Date: Fri, 27 Aug 2021 15:17:41 -0700 Subject: [PATCH 128/131] Read project, region and assume role ARN from environment and update the script canvas graphs to fix automation test failures (#3654) Fix AWS periodic automation test.s --- .../Gem/PythonTests/AWS/common/constants.py | 8 +- .../ConitoAnonymousAuthorization.scriptcanvas | 3681 ++---- .../PasswordSignIn.scriptcanvas | 10248 ++++++---------- .../PasswordSignUp.scriptcanvas | 6842 ++++------- .../ScriptCanvas/dynamodbdemo.scriptcanvas | 5745 ++++----- .../ScriptCanvas/lambdademo.scriptcanvas | 4149 +++---- .../ScriptCanvas/s3demo.scriptcanvas | 8651 +++++-------- 7 files changed, 14763 insertions(+), 24561 deletions(-) diff --git a/AutomatedTesting/Gem/PythonTests/AWS/common/constants.py b/AutomatedTesting/Gem/PythonTests/AWS/common/constants.py index be143547a7..b12aca5f29 100644 --- a/AutomatedTesting/Gem/PythonTests/AWS/common/constants.py +++ b/AutomatedTesting/Gem/PythonTests/AWS/common/constants.py @@ -5,12 +5,14 @@ For complete copyright and license terms please see the LICENSE at the root of t SPDX-License-Identifier: Apache-2.0 OR MIT """ +import os + # ARN of the IAM role to assume for retrieving temporary AWS credentials -ASSUME_ROLE_ARN = 'arn:aws:iam::645075835648:role/o3de-automation-tests' +ASSUME_ROLE_ARN = os.environ.get('ASSUME_ROLE_ARN', 'arn:aws:iam::645075835648:role/o3de-automation-tests') # Name of the AWS project deployed by the CDK applications -AWS_PROJECT_NAME = 'AWSAUTO' +AWS_PROJECT_NAME = os.environ.get('O3DE_AWS_PROJECT_NAME', 'AWSAUTO') # Region for the existing CloudFormation stacks used by the automation tests -AWS_REGION = 'us-east-1' +AWS_REGION = os.environ.get('O3DE_AWS_DEPLOY_REGION', 'us-east-1') # Name of the default resource mapping config file used by the automation tests AWS_RESOURCE_MAPPING_FILE_NAME = 'default_aws_resource_mappings.json' # Name of the game launcher log diff --git a/AutomatedTesting/Levels/AWS/ClientAuth/ConitoAnonymousAuthorization.scriptcanvas b/AutomatedTesting/Levels/AWS/ClientAuth/ConitoAnonymousAuthorization.scriptcanvas index 6cbd951fae..c61953a7c1 100644 --- a/AutomatedTesting/Levels/AWS/ClientAuth/ConitoAnonymousAuthorization.scriptcanvas +++ b/AutomatedTesting/Levels/AWS/ClientAuth/ConitoAnonymousAuthorization.scriptcanvas @@ -1,2356 +1,1325 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +{ + "Type": "JsonSerialization", + "Version": 1, + "ClassName": "ScriptCanvasData", + "ClassData": { + "m_scriptCanvas": { + "Id": { + "id": 6706710049590 + }, + "Name": "ConitoAnonymousAuthorization", + "Components": { + "Component_[6686064357815538527]": { + "$type": "EditorGraphVariableManagerComponent", + "Id": 6686064357815538527, + "m_variableData": { + "m_nameVariableMap": [ + { + "Key": { + "m_id": "{FED50699-DBFE-442D-BB6C-5B0030818690}" + }, + "Value": { + "Datum": { + "isOverloadedStorage": false, + "scriptCanvasType": { + "m_type": 4, + "m_azType": "{02FB32C4-B94E-4084-9049-3DF32F87BD76}" + }, + "isNullPointer": false, + "$type": "ClientAuthAWSCredentials", + "label": "Creds" + }, + "VariableId": { + "m_id": "{FED50699-DBFE-442D-BB6C-5B0030818690}" + }, + "VariableName": "Creds" + } + } + ] + } + }, + "Component_[8229254966989441794]": { + "$type": "{4D755CA9-AB92-462C-B24F-0B3376F19967} Graph", + "Id": 8229254966989441794, + "m_graphData": { + "m_nodes": [ + { + "Id": { + "id": 6732479853366 + }, + "Name": "EBusEventHandler", + "Components": { + "Component_[10018029241448660845]": { + "$type": "EBusEventHandler", + "Id": 10018029241448660845, + "Slots": [ + { + "id": { + "m_id": "{CA49F2CC-6D8D-4B79-A2EC-FC892B3080E0}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Connect", + "toolTip": "Connect this event handler to the specified entity.", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{8B77E1C8-36A3-4DD7-8D8C-384CFA02F904}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Disconnect", + "toolTip": "Disconnect this event handler.", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{A3CF94A0-43D2-4E1A-B9D4-7D142E125868}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "OnConnected", + "toolTip": "Signaled when a connection has taken place.", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{FD5B4E69-23D5-45CE-94A4-5B8ADC51E068}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "OnDisconnected", + "toolTip": "Signaled when this event handler is disconnected.", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{FBF58831-798C-49AF-AFE4-B667AAAFB80F}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "OnFailure", + "toolTip": "Signaled when it is not possible to connect this handler.", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{4318D470-DC34-4453-884A-CA7321A49DDC}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Source", + "toolTip": "ID used to connect on a specific Event address (Type: EntityId)", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{A968DBCB-4507-4155-94FD-7D86AE794FAB}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "EntityID", + "DisplayDataType": { + "m_type": 1 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{154DF389-1BC0-440B-9D57-7C074EE8C94D}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnEntityActivated", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + }, + { + "id": { + "m_id": "{96563FB8-2C6D-44CA-B9AA-5F07863BDE93}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "EntityID", + "DisplayDataType": { + "m_type": 1 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{436B24D6-79C7-4DDF-A73B-71D5F1953C07}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnEntityDeactivated", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + } + ], + "Datums": [ + { + "isOverloadedStorage": false, + "scriptCanvasType": { + "m_type": 1 + }, + "isNullPointer": false, + "$type": "EntityId", + "value": { + "id": 2901262558 + }, + "label": "Source" + } + ], + "m_eventMap": [ + { + "Key": { + "Value": 245425936 + }, + "Value": { + "m_eventName": "OnEntityActivated", + "m_eventId": { + "Value": 245425936 + }, + "m_eventSlotId": { + "m_id": "{154DF389-1BC0-440B-9D57-7C074EE8C94D}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{A968DBCB-4507-4155-94FD-7D86AE794FAB}" + } + ], + "m_numExpectedArguments": 1 + } + }, + { + "Key": { + "Value": 4273369222 + }, + "Value": { + "m_eventName": "OnEntityDeactivated", + "m_eventId": { + "Value": 4273369222 + }, + "m_eventSlotId": { + "m_id": "{436B24D6-79C7-4DDF-A73B-71D5F1953C07}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{96563FB8-2C6D-44CA-B9AA-5F07863BDE93}" + } + ], + "m_numExpectedArguments": 1 + } + } + ], + "m_ebusName": "EntityBus", + "m_busId": { + "Value": 3358774020 + } + } + } + }, + { + "Id": { + "id": 6719594951478 + }, + "Name": "SC-Node(Initialize)", + "Components": { + "Component_[11437183238486970293]": { + "$type": "{E42861BD-1956-45AE-8DD7-CCFC1E3E5ACF} Method", + "Id": 11437183238486970293, + "Slots": [ + { + "id": { + "m_id": "{2C1E3EE7-262F-418C-9861-7D459C415D3F}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "In", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{CB95F6C6-6F1C-4E95-88FA-940EF78C1EC9}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Out", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{6520B85D-1E4C-4ECC-B9E4-E12B2A3FD071}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Result: Boolean", + "DisplayDataType": { + "m_type": 0 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + } + ], + "methodType": 0, + "methodName": "Initialize", + "className": "AWSCognitoAuthorizationRequestBus", + "resultSlotIDs": [ + {} + ], + "prettyClassName": "AWSCognitoAuthorizationRequestBus" + } + } + }, + { + "Id": { + "id": 6736774820662 + }, + "Name": "EBusEventHandler", + "Components": { + "Component_[17018320061093636088]": { + "$type": "EBusEventHandler", + "Id": 17018320061093636088, + "Slots": [ + { + "id": { + "m_id": "{785E4FD0-16C5-4DA7-997F-790EE825762E}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Connect", + "toolTip": "Connect this event handler to the specified entity.", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{EBC33745-F120-44A7-B00E-BB33CC4A4C70}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Disconnect", + "toolTip": "Disconnect this event handler.", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{B3F4FB70-C354-46BE-9807-9FC7BB2C622E}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "OnConnected", + "toolTip": "Signaled when a connection has taken place.", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{9AEA64C0-1654-45C1-9E34-C685BA5192A4}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "OnDisconnected", + "toolTip": "Signaled when this event handler is disconnected.", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{2006558F-6EB5-4FD8-AAEC-B3207647E03D}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "OnFailure", + "toolTip": "Signaled when it is not possible to connect this handler.", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{1F864171-3BF2-41B9-B798-30841004A63A}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ClientAuthAWSCredentials", + "DisplayDataType": { + "m_type": 4, + "m_azType": "{02FB32C4-B94E-4084-9049-3DF32F87BD76}" + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{42CC05C3-381B-422B-81E6-0A67DF343611}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnRequestAWSCredentialsSuccess", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + }, + { + "id": { + "m_id": "{3F8CDA89-2FD1-438B-8874-A8F55A22BF5A}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "String", + "DisplayDataType": { + "m_type": 5 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{D4EA6ED9-60A0-4161-BDAC-734B83A2C360}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnRequestAWSCredentialsFail", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + } + ], + "m_eventMap": [ + { + "Key": { + "Value": 3736070646 + }, + "Value": { + "m_eventName": "OnRequestAWSCredentialsSuccess", + "m_eventId": { + "Value": 3736070646 + }, + "m_eventSlotId": { + "m_id": "{42CC05C3-381B-422B-81E6-0A67DF343611}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{1F864171-3BF2-41B9-B798-30841004A63A}" + } + ], + "m_numExpectedArguments": 1 + } + }, + { + "Key": { + "Value": 4193877825 + }, + "Value": { + "m_eventName": "OnRequestAWSCredentialsFail", + "m_eventId": { + "Value": 4193877825 + }, + "m_eventSlotId": { + "m_id": "{D4EA6ED9-60A0-4161-BDAC-734B83A2C360}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{3F8CDA89-2FD1-438B-8874-A8F55A22BF5A}" + } + ], + "m_numExpectedArguments": 1 + } + } + ], + "m_ebusName": "AWSCognitoAuthorizationNotificationBus", + "m_busId": { + "Value": 1100345364 + } + } + } + }, + { + "Id": { + "id": 6715299984182 + }, + "Name": "SC-Node(Print)", + "Components": { + "Component_[285714280162783661]": { + "$type": "Print", + "Id": 285714280162783661, + "Slots": [ + { + "id": { + "m_id": "{C667893C-CB0F-455C-A49B-61C717DAC23E}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "In", + "toolTip": "Input signal", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{FEC13BF8-5A06-4962-953E-EB526BD14238}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Out", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + } + ], + "m_format": "Fail anonymous credentials", + "m_unresolvedString": [ + "Fail anonymous credentials" + ] + } + } + }, + { + "Id": { + "id": 6728184886070 + }, + "Name": "SC-Node(Print)", + "Components": { + "Component_[285714280162783661]": { + "$type": "Print", + "Id": 285714280162783661, + "Slots": [ + { + "id": { + "m_id": "{C667893C-CB0F-455C-A49B-61C717DAC23E}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "In", + "toolTip": "Input signal", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{FEC13BF8-5A06-4962-953E-EB526BD14238}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Out", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + } + ], + "m_format": "Success anonymous credentials", + "m_unresolvedString": [ + "Success anonymous credentials" + ] + } + } + }, + { + "Id": { + "id": 6711005016886 + }, + "Name": "SC-Node(RequestAWSCredentialsAsync)", + "Components": { + "Component_[3965816515223111262]": { + "$type": "{E42861BD-1956-45AE-8DD7-CCFC1E3E5ACF} Method", + "Id": 3965816515223111262, + "Slots": [ + { + "id": { + "m_id": "{0BB643D4-3989-499E-B997-E51370B8D72D}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "In", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{2533A5E2-7A0D-429D-A970-FBF28240D574}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Out", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + } + ], + "methodType": 0, + "methodName": "RequestAWSCredentialsAsync", + "className": "AWSCognitoAuthorizationRequestBus", + "resultSlotIDs": [ + {} + ], + "prettyClassName": "AWSCognitoAuthorizationRequestBus" + } + } + }, + { + "Id": { + "id": 6723889918774 + }, + "Name": "EBusEventHandler", + "Components": { + "Component_[7309023392789275534]": { + "$type": "EBusEventHandler", + "Id": 7309023392789275534, + "Slots": [ + { + "id": { + "m_id": "{5E6F6747-9B5E-4A7F-9278-161F310CD5AD}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Connect", + "toolTip": "Connect this event handler to the specified entity.", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{604545A7-C650-4BF6-BA05-EA468CDC7731}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Disconnect", + "toolTip": "Disconnect this event handler.", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{F0140D4D-2DF2-42D6-83A9-6CC51C8C1E52}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "OnConnected", + "toolTip": "Signaled when a connection has taken place.", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{A1A40AD6-9AA5-4C50-91C2-78B274BA6895}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "OnDisconnected", + "toolTip": "Signaled when this event handler is disconnected.", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{BC5D0C52-CBDB-4778-9577-3CAD3F88B03B}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "OnFailure", + "toolTip": "Signaled when it is not possible to connect this handler.", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{9EC2A72F-09F7-4DDE-8C5D-7EC489BA0401}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ClientAuthAWSCredentials", + "DisplayDataType": { + "m_type": 4, + "m_azType": "{02FB32C4-B94E-4084-9049-3DF32F87BD76}" + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{5E083227-4BC8-4DC0-A3D7-86F3C464FFCC}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnRequestAWSCredentialsSuccess", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + }, + { + "id": { + "m_id": "{60D8497E-6879-4379-BAC3-271D25816B72}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "String", + "DisplayDataType": { + "m_type": 5 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{F4AF6BF6-2BBE-4B11-A548-C17935A41E46}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnRequestAWSCredentialsFail", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + } + ], + "m_eventMap": [ + { + "Key": { + "Value": 3736070646 + }, + "Value": { + "m_eventName": "OnRequestAWSCredentialsSuccess", + "m_eventId": { + "Value": 3736070646 + }, + "m_eventSlotId": { + "m_id": "{5E083227-4BC8-4DC0-A3D7-86F3C464FFCC}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{9EC2A72F-09F7-4DDE-8C5D-7EC489BA0401}" + } + ], + "m_numExpectedArguments": 1 + } + }, + { + "Key": { + "Value": 4193877825 + }, + "Value": { + "m_eventName": "OnRequestAWSCredentialsFail", + "m_eventId": { + "Value": 4193877825 + }, + "m_eventSlotId": { + "m_id": "{F4AF6BF6-2BBE-4B11-A548-C17935A41E46}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{60D8497E-6879-4379-BAC3-271D25816B72}" + } + ], + "m_numExpectedArguments": 1 + } + } + ], + "m_ebusName": "AWSCognitoAuthorizationNotificationBus", + "m_busId": { + "Value": 1100345364 + } + } + } + } + ], + "m_connections": [ + { + "Id": { + "id": 6741069787958 + }, + "Name": "srcEndpoint=(Initialize: Out), destEndpoint=(RequestAWSCredentialsAsync: In)", + "Components": { + "Component_[9874477978239191526]": { + "$type": "{64CA5016-E803-4AC4-9A36-BDA2C890C6EB} Connection", + "Id": 9874477978239191526, + "sourceEndpoint": { + "nodeId": { + "id": 6719594951478 + }, + "slotId": { + "m_id": "{CB95F6C6-6F1C-4E95-88FA-940EF78C1EC9}" + } + }, + "targetEndpoint": { + "nodeId": { + "id": 6711005016886 + }, + "slotId": { + "m_id": "{0BB643D4-3989-499E-B997-E51370B8D72D}" + } + } + } + } + }, + { + "Id": { + "id": 6745364755254 + }, + "Name": "srcEndpoint=(AWSCognitoAuthorizationNotificationBus Handler: ExecutionSlot:OnRequestAWSCredentialsSuccess), destEndpoint=(Print: In)", + "Components": { + "Component_[7934553402512435877]": { + "$type": "{64CA5016-E803-4AC4-9A36-BDA2C890C6EB} Connection", + "Id": 7934553402512435877, + "sourceEndpoint": { + "nodeId": { + "id": 6723889918774 + }, + "slotId": { + "m_id": "{5E083227-4BC8-4DC0-A3D7-86F3C464FFCC}" + } + }, + "targetEndpoint": { + "nodeId": { + "id": 6728184886070 + }, + "slotId": { + "m_id": "{C667893C-CB0F-455C-A49B-61C717DAC23E}" + } + } + } + } + }, + { + "Id": { + "id": 6749659722550 + }, + "Name": "srcEndpoint=(AWSCognitoAuthorizationNotificationBus Handler: ExecutionSlot:OnRequestAWSCredentialsFail), destEndpoint=(Print: In)", + "Components": { + "Component_[2125665954450546710]": { + "$type": "{64CA5016-E803-4AC4-9A36-BDA2C890C6EB} Connection", + "Id": 2125665954450546710, + "sourceEndpoint": { + "nodeId": { + "id": 6736774820662 + }, + "slotId": { + "m_id": "{D4EA6ED9-60A0-4161-BDAC-734B83A2C360}" + } + }, + "targetEndpoint": { + "nodeId": { + "id": 6715299984182 + }, + "slotId": { + "m_id": "{C667893C-CB0F-455C-A49B-61C717DAC23E}" + } + } + } + } + }, + { + "Id": { + "id": 6753954689846 + }, + "Name": "srcEndpoint=(EntityBus Handler: ExecutionSlot:OnEntityActivated), destEndpoint=(Initialize: In)", + "Components": { + "Component_[4615127778717764315]": { + "$type": "{64CA5016-E803-4AC4-9A36-BDA2C890C6EB} Connection", + "Id": 4615127778717764315, + "sourceEndpoint": { + "nodeId": { + "id": 6732479853366 + }, + "slotId": { + "m_id": "{154DF389-1BC0-440B-9D57-7C074EE8C94D}" + } + }, + "targetEndpoint": { + "nodeId": { + "id": 6719594951478 + }, + "slotId": { + "m_id": "{2C1E3EE7-262F-418C-9861-7D459C415D3F}" + } + } + } + } + } + ] + }, + "m_assetType": "{3E2AC8CD-713F-453E-967F-29517F331784}", + "versionData": { + "_grammarVersion": 1, + "_runtimeVersion": 1 + }, + "m_variableCounter": 1, + "GraphCanvasData": [ + { + "Key": { + "id": 6706710049590 + }, + "Value": { + "ComponentData": { + "{5F84B500-8C45-40D1-8EFC-A5306B241444}": { + "$type": "SceneComponentSaveData", + "ViewParams": { + "Scale": 1.0784334878464947, + "AnchorX": -170.6178436279297, + "AnchorY": -28.745397567749023 + } + } + } + } + }, + { + "Key": { + "id": 6711005016886 + }, + "Value": { + "ComponentData": { + "{24CB38BB-1705-4EC5-8F63-B574571B4DCD}": { + "$type": "NodeSaveData" + }, + "{328FF15C-C302-458F-A43D-E1794DE0904E}": { + "$type": "GeneralNodeTitleComponentSaveData", + "PaletteOverride": "MethodNodeTitlePalette" + }, + "{7CC444B1-F9B3-41B5-841B-0C4F2179F111}": { + "$type": "GeometrySaveData", + "Position": [ + 820.0, + 180.0 + ] + }, + "{B0B99C8A-03AF-4CF6-A926-F65C874C3D97}": { + "$type": "StylingComponentSaveData", + "SubStyle": ".method" + }, + "{B1F49A35-8408-40DA-B79E-F1E3B64322CE}": { + "$type": "PersistentIdComponentSaveData", + "PersistentId": "{912ACE5E-70F5-43A7-A375-D763B26712FE}" + } + } + } + }, + { + "Key": { + "id": 6715299984182 + }, + "Value": { + "ComponentData": { + "{24CB38BB-1705-4EC5-8F63-B574571B4DCD}": { + "$type": "NodeSaveData" + }, + "{328FF15C-C302-458F-A43D-E1794DE0904E}": { + "$type": "GeneralNodeTitleComponentSaveData", + "PaletteOverride": "StringNodeTitlePalette" + }, + "{7CC444B1-F9B3-41B5-841B-0C4F2179F111}": { + "$type": "GeometrySaveData", + "Position": [ + 600.0, + 740.0 + ] + }, + "{B0B99C8A-03AF-4CF6-A926-F65C874C3D97}": { + "$type": "StylingComponentSaveData" + }, + "{B1F49A35-8408-40DA-B79E-F1E3B64322CE}": { + "$type": "PersistentIdComponentSaveData", + "PersistentId": "{D2FFD8D1-A1C1-4C64-A87E-6A2366DC602C}" + } + } + } + }, + { + "Key": { + "id": 6719594951478 + }, + "Value": { + "ComponentData": { + "{24CB38BB-1705-4EC5-8F63-B574571B4DCD}": { + "$type": "NodeSaveData" + }, + "{328FF15C-C302-458F-A43D-E1794DE0904E}": { + "$type": "GeneralNodeTitleComponentSaveData", + "PaletteOverride": "MethodNodeTitlePalette" + }, + "{7CC444B1-F9B3-41B5-841B-0C4F2179F111}": { + "$type": "GeometrySaveData", + "Position": [ + 420.0, + 180.0 + ] + }, + "{B0B99C8A-03AF-4CF6-A926-F65C874C3D97}": { + "$type": "StylingComponentSaveData", + "SubStyle": ".method" + }, + "{B1F49A35-8408-40DA-B79E-F1E3B64322CE}": { + "$type": "PersistentIdComponentSaveData", + "PersistentId": "{E8A1C3CF-FD12-4D8E-8FB9-F9B678487CF8}" + } + } + } + }, + { + "Key": { + "id": 6723889918774 + }, + "Value": { + "ComponentData": { + "{24CB38BB-1705-4EC5-8F63-B574571B4DCD}": { + "$type": "NodeSaveData" + }, + "{7CC444B1-F9B3-41B5-841B-0C4F2179F111}": { + "$type": "GeometrySaveData", + "Position": [ + 120.0, + 460.0 + ] + }, + "{9E81C95F-89C0-4476-8E82-63CCC4E52E04}": { + "$type": "EBusHandlerNodeDescriptorSaveData", + "EventIds": [ + { + "Value": 3736070646 + } + ] + }, + "{B0B99C8A-03AF-4CF6-A926-F65C874C3D97}": { + "$type": "StylingComponentSaveData" + }, + "{B1F49A35-8408-40DA-B79E-F1E3B64322CE}": { + "$type": "PersistentIdComponentSaveData", + "PersistentId": "{E6C8A974-2E4B-439F-94E2-FC9FB4A2ACD8}" + } + } + } + }, + { + "Key": { + "id": 6728184886070 + }, + "Value": { + "ComponentData": { + "{24CB38BB-1705-4EC5-8F63-B574571B4DCD}": { + "$type": "NodeSaveData" + }, + "{328FF15C-C302-458F-A43D-E1794DE0904E}": { + "$type": "GeneralNodeTitleComponentSaveData", + "PaletteOverride": "StringNodeTitlePalette" + }, + "{7CC444B1-F9B3-41B5-841B-0C4F2179F111}": { + "$type": "GeometrySaveData", + "Position": [ + 640.0, + 500.0 + ] + }, + "{B0B99C8A-03AF-4CF6-A926-F65C874C3D97}": { + "$type": "StylingComponentSaveData" + }, + "{B1F49A35-8408-40DA-B79E-F1E3B64322CE}": { + "$type": "PersistentIdComponentSaveData", + "PersistentId": "{47352093-20A0-4352-8BE4-20A995063E83}" + } + } + } + }, + { + "Key": { + "id": 6732479853366 + }, + "Value": { + "ComponentData": { + "{24CB38BB-1705-4EC5-8F63-B574571B4DCD}": { + "$type": "NodeSaveData" + }, + "{7CC444B1-F9B3-41B5-841B-0C4F2179F111}": { + "$type": "GeometrySaveData", + "Position": [ + 40.0, + 140.0 + ] + }, + "{9E81C95F-89C0-4476-8E82-63CCC4E52E04}": { + "$type": "EBusHandlerNodeDescriptorSaveData", + "EventIds": [ + { + "Value": 245425936 + } + ] + }, + "{B0B99C8A-03AF-4CF6-A926-F65C874C3D97}": { + "$type": "StylingComponentSaveData" + }, + "{B1F49A35-8408-40DA-B79E-F1E3B64322CE}": { + "$type": "PersistentIdComponentSaveData", + "PersistentId": "{24559DE7-5A79-40E8-BBAF-029A7D08F472}" + } + } + } + }, + { + "Key": { + "id": 6736774820662 + }, + "Value": { + "ComponentData": { + "{24CB38BB-1705-4EC5-8F63-B574571B4DCD}": { + "$type": "NodeSaveData" + }, + "{7CC444B1-F9B3-41B5-841B-0C4F2179F111}": { + "$type": "GeometrySaveData", + "Position": [ + 120.0, + 740.0 + ] + }, + "{9E81C95F-89C0-4476-8E82-63CCC4E52E04}": { + "$type": "EBusHandlerNodeDescriptorSaveData", + "EventIds": [ + { + "Value": 4193877825 + } + ] + }, + "{B0B99C8A-03AF-4CF6-A926-F65C874C3D97}": { + "$type": "StylingComponentSaveData" + }, + "{B1F49A35-8408-40DA-B79E-F1E3B64322CE}": { + "$type": "PersistentIdComponentSaveData", + "PersistentId": "{D1C91A31-0031-4FF8-8E93-B10F8586B366}" + } + } + } + } + ], + "StatisticsHelper": { + "InstanceCounter": [ + { + "Key": 5842116761103598202, + "Value": 1 + }, + { + "Key": 5842117453459104876, + "Value": 1 + }, + { + "Key": 5842117453819001655, + "Value": 1 + }, + { + "Key": 10684225535275896474, + "Value": 2 + }, + { + "Key": 13774516386968943251, + "Value": 1 + }, + { + "Key": 13774516392820282243, + "Value": 1 + } + ] + } + } + } + } + } +} \ No newline at end of file diff --git a/AutomatedTesting/Levels/AWS/ClientAuthPasswordSignIn/PasswordSignIn.scriptcanvas b/AutomatedTesting/Levels/AWS/ClientAuthPasswordSignIn/PasswordSignIn.scriptcanvas index 1847f1f0ec..3c7cd836a1 100644 --- a/AutomatedTesting/Levels/AWS/ClientAuthPasswordSignIn/PasswordSignIn.scriptcanvas +++ b/AutomatedTesting/Levels/AWS/ClientAuthPasswordSignIn/PasswordSignIn.scriptcanvas @@ -1,6573 +1,3675 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +{ + "Type": "JsonSerialization", + "Version": 1, + "ClassName": "ScriptCanvasData", + "ClassData": { + "m_scriptCanvas": { + "Id": { + "id": 22550844404534 + }, + "Name": "PasswordSignIn", + "Components": { + "Component_[6385465305444622263]": { + "$type": "EditorGraphVariableManagerComponent", + "Id": 6385465305444622263, + "m_variableData": { + "m_nameVariableMap": [ + { + "Key": { + "m_id": "{9E6C4595-2633-4312-B9AA-F49A0B90D7A0}" + }, + "Value": { + "Datum": { + "isOverloadedStorage": false, + "scriptCanvasType": { + "m_type": 4, + "m_azType": "{99DAD0BC-740E-5E82-826B-8FC7968CC02C}" + }, + "isNullPointer": false, + "$type": "{99DAD0BC-740E-5E82-826B-8FC7968CC02C} AZStd::vector", + "value": [ + "AWSCognitoIDP" + ], + "label": "Array" + }, + "VariableId": { + "m_id": "{9E6C4595-2633-4312-B9AA-F49A0B90D7A0}" + }, + "VariableName": "AuthenticationProviders" + } + } + ] + } + }, + "Component_[8710839917828649136]": { + "$type": "{4D755CA9-AB92-462C-B24F-0B3376F19967} Graph", + "Id": 8710839917828649136, + "m_graphData": { + "m_nodes": [ + { + "Id": { + "id": 22606678979382 + }, + "Name": "SC-Node(Print)", + "Components": { + "Component_[10817928006900121599]": { + "$type": "Print", + "Id": 10817928006900121599, + "Slots": [ + { + "id": { + "m_id": "{269D4FDC-1137-45A3-8442-2A2DF98D6F6E}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "In", + "toolTip": "Input signal", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{F5EE89C0-AB89-4D06-BD4C-72CA40AB075B}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Out", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + } + ], + "m_format": "SignIn Success", + "m_unresolvedString": [ + "SignIn Success" + ] + } + } + }, + { + "Id": { + "id": 22610973946678 + }, + "Name": "SC-Node(Initialize)", + "Components": { + "Component_[1153097947988754865]": { + "$type": "{E42861BD-1956-45AE-8DD7-CCFC1E3E5ACF} Method", + "Id": 1153097947988754865, + "Slots": [ + { + "id": { + "m_id": "{8C6FB06A-4A06-41E5-94E5-9D78671977C8}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Array: 0", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 2 + }, + "DataType": 1, + "IsReference": true, + "VariableReference": { + "m_id": "{9E6C4595-2633-4312-B9AA-F49A0B90D7A0}" + } + }, + { + "id": { + "m_id": "{F4ED50C1-0694-4E9F-A4E6-83565E517C1E}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "In", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{4BB45954-74C5-4023-AFBE-C82638076FDD}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Out", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{F6930458-3515-45B6-BB6D-1217547A7401}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Result: Boolean", + "DisplayDataType": { + "m_type": 0 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + } + ], + "Datums": [ + { + "isOverloadedStorage": false, + "scriptCanvasType": { + "m_type": 4, + "m_azType": "{99DAD0BC-740E-5E82-826B-8FC7968CC02C}" + }, + "isNullPointer": true, + "label": "Array: 0" + } + ], + "methodType": 0, + "methodName": "Initialize", + "className": "AuthenticationProviderRequestBus", + "resultSlotIDs": [ + {} + ], + "prettyClassName": "AuthenticationProviderRequestBus" + } + } + }, + { + "Id": { + "id": 22559434339126 + }, + "Name": "EBusEventHandler", + "Components": { + "Component_[15120484156765471501]": { + "$type": "EBusEventHandler", + "Id": 15120484156765471501, + "Slots": [ + { + "id": { + "m_id": "{55723136-4724-4749-8A1E-A0829EC4CB54}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Connect", + "toolTip": "Connect this event handler to the specified entity.", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{01F5AE9F-BF74-41B1-A1F9-7782B707C013}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Disconnect", + "toolTip": "Disconnect this event handler.", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{2D449731-3E45-489D-B7EA-586D3E87738C}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "OnConnected", + "toolTip": "Signaled when a connection has taken place.", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{7FE6C340-B7A9-4ABD-B30E-FB78707A8042}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "OnDisconnected", + "toolTip": "Signaled when this event handler is disconnected.", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{174FBA70-D39B-4FAD-8595-52A63CE855F4}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "OnFailure", + "toolTip": "Signaled when it is not possible to connect this handler.", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{B4E8FA2A-6833-43A2-BF8D-E021B7F24C6C}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Source", + "toolTip": "ID used to connect on a specific Event address (Type: EntityId)", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{808F793B-E283-4872-B0C9-3BDE44FB0372}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "EntityID", + "DisplayDataType": { + "m_type": 1 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{1E81F46E-80CF-4CF6-8499-04539BBF244E}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnEntityActivated", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + }, + { + "id": { + "m_id": "{7977990A-4416-494A-94F1-F2670A6E920B}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "EntityID", + "DisplayDataType": { + "m_type": 1 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{AB5A3F2D-D553-49A8-98A5-F99375431668}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnEntityDeactivated", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + } + ], + "Datums": [ + { + "isOverloadedStorage": false, + "scriptCanvasType": { + "m_type": 1 + }, + "isNullPointer": false, + "$type": "EntityId", + "value": { + "id": 2901262558 + }, + "label": "Source" + } + ], + "m_eventMap": [ + { + "Key": { + "Value": 245425936 + }, + "Value": { + "m_eventName": "OnEntityActivated", + "m_eventId": { + "Value": 245425936 + }, + "m_eventSlotId": { + "m_id": "{1E81F46E-80CF-4CF6-8499-04539BBF244E}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{808F793B-E283-4872-B0C9-3BDE44FB0372}" + } + ], + "m_numExpectedArguments": 1 + } + }, + { + "Key": { + "Value": 4273369222 + }, + "Value": { + "m_eventName": "OnEntityDeactivated", + "m_eventId": { + "Value": 4273369222 + }, + "m_eventSlotId": { + "m_id": "{AB5A3F2D-D553-49A8-98A5-F99375431668}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{7977990A-4416-494A-94F1-F2670A6E920B}" + } + ], + "m_numExpectedArguments": 1 + } + } + ], + "m_ebusName": "EntityBus", + "m_busId": { + "Value": 3358774020 + } + } + } + }, + { + "Id": { + "id": 22580909175606 + }, + "Name": "EBusEventHandler", + "Components": { + "Component_[16042865177069512848]": { + "$type": "EBusEventHandler", + "Id": 16042865177069512848, + "Slots": [ + { + "id": { + "m_id": "{8503C0C0-DFA8-43AF-AE40-E2A48C9F77C5}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Connect", + "toolTip": "Connect this event handler to the specified entity.", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{EE5F8D3F-CC56-400F-91F6-835A2A843D3E}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Disconnect", + "toolTip": "Disconnect this event handler.", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{35490A45-17F4-444E-B4EB-443B4AC61D07}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "OnConnected", + "toolTip": "Signaled when a connection has taken place.", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{FCCA77C5-AB2A-4BE7-BC46-99B74FDBEC7B}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "OnDisconnected", + "toolTip": "Signaled when this event handler is disconnected.", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{F52BDF60-64FD-488B-8D5D-D996B9400986}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "OnFailure", + "toolTip": "Signaled when it is not possible to connect this handler.", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{8C19381E-B495-4B42-880C-86399A055392}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ClientAuthAWSCredentials", + "DisplayDataType": { + "m_type": 4, + "m_azType": "{02FB32C4-B94E-4084-9049-3DF32F87BD76}" + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{BCA83F8F-E431-421D-8B01-A8B31C3C66B1}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnRequestAWSCredentialsSuccess", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + }, + { + "id": { + "m_id": "{2EEBA254-1346-4866-80CA-3608BAF5B767}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "String", + "DisplayDataType": { + "m_type": 5 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{BB27DD72-E82E-4C67-8493-E3DF0AFCC093}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnRequestAWSCredentialsFail", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + } + ], + "m_eventMap": [ + { + "Key": { + "Value": 3736070646 + }, + "Value": { + "m_eventName": "OnRequestAWSCredentialsSuccess", + "m_eventId": { + "Value": 3736070646 + }, + "m_eventSlotId": { + "m_id": "{BCA83F8F-E431-421D-8B01-A8B31C3C66B1}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{8C19381E-B495-4B42-880C-86399A055392}" + } + ], + "m_numExpectedArguments": 1 + } + }, + { + "Key": { + "Value": 4193877825 + }, + "Value": { + "m_eventName": "OnRequestAWSCredentialsFail", + "m_eventId": { + "Value": 4193877825 + }, + "m_eventSlotId": { + "m_id": "{BB27DD72-E82E-4C67-8493-E3DF0AFCC093}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{2EEBA254-1346-4866-80CA-3608BAF5B767}" + } + ], + "m_numExpectedArguments": 1 + } + } + ], + "m_ebusName": "AWSCognitoAuthorizationNotificationBus", + "m_busId": { + "Value": 1100345364 + } + } + } + }, + { + "Id": { + "id": 22585204142902 + }, + "Name": "EBusEventHandler", + "Components": { + "Component_[16607172582241819113]": { + "$type": "EBusEventHandler", + "Id": 16607172582241819113, + "Slots": [ + { + "id": { + "m_id": "{E55A09C6-5B87-4F4F-9EC4-7F602A5C02AC}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Connect", + "toolTip": "Connect this event handler to the specified entity.", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{AC007706-2035-4888-AD7C-3C9AF6650FEC}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Disconnect", + "toolTip": "Disconnect this event handler.", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{809A2C05-FB97-4C59-B1D8-C29A22F69097}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "OnConnected", + "toolTip": "Signaled when a connection has taken place.", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{E3E053B8-37B7-4094-8974-BF0E13919943}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "OnDisconnected", + "toolTip": "Signaled when this event handler is disconnected.", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{5BB6420D-1016-49B8-AC48-3C5C1EE647F5}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "OnFailure", + "toolTip": "Signaled when it is not possible to connect this handler.", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{D79F252C-3D2A-4CC1-9A51-18B7827EB4CA}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "AuthenticationTokens", + "DisplayDataType": { + "m_type": 4, + "m_azType": "{F965D1B2-9DE3-4900-B44B-E58D9F083ACB}" + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{F3E407C4-9D91-4077-A730-C2463570A9FC}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnPasswordGrantSingleFactorSignInSuccess", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + }, + { + "id": { + "m_id": "{5B6638B9-4F55-4CCB-A368-C83FED5C43F8}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "String", + "DisplayDataType": { + "m_type": 5 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{282E0463-9A13-4681-B69C-B6B30CA7CD01}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnPasswordGrantSingleFactorSignInFail", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + }, + { + "id": { + "m_id": "{B088E163-C71A-417E-8D35-F0A29273F5D9}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnPasswordGrantMultiFactorSignInSuccess", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + }, + { + "id": { + "m_id": "{C2EBAEB4-5ECA-441C-8202-0D2A80F1A776}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "String", + "DisplayDataType": { + "m_type": 5 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{79F39D7A-BFC2-4749-9631-575A6C63714D}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnPasswordGrantMultiFactorSignInFail", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + }, + { + "id": { + "m_id": "{0CC24B35-F3D6-4E7B-B9D1-98CEB36059AE}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "AuthenticationTokens", + "DisplayDataType": { + "m_type": 4, + "m_azType": "{F965D1B2-9DE3-4900-B44B-E58D9F083ACB}" + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{3C544F9A-0137-4735-8484-0458246E4D52}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnPasswordGrantMultiFactorConfirmSignInSuccess", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + }, + { + "id": { + "m_id": "{BEBDDB95-FBBA-4AE1-BA89-C3DAE042E9E1}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "String", + "DisplayDataType": { + "m_type": 5 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{FA8FE256-A70A-475E-A724-0E70C1099213}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnPasswordGrantMultiFactorConfirmSignInFail", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + }, + { + "id": { + "m_id": "{919E73F9-6A2B-437B-867D-6723FFF8D29E}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "String", + "DisplayDataType": { + "m_type": 5 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{B494FB65-9082-4826-84B4-E2E6DB1803D1}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "String", + "DisplayDataType": { + "m_type": 5 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{7F2FE508-FCDB-45E5-BBEB-8A25E9D09C41}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Number", + "DisplayDataType": { + "m_type": 3 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{E8BA420E-FF66-4B13-94B9-2D96448542B0}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnDeviceCodeGrantSignInSuccess", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + }, + { + "id": { + "m_id": "{4694A0AC-A400-47D0-A050-8B6AEDF65748}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "String", + "DisplayDataType": { + "m_type": 5 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{E03D10FB-C618-4260-870D-FA2B2B13FE0D}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnDeviceCodeGrantSignInFail", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + }, + { + "id": { + "m_id": "{031D9648-B03B-42E3-8E6B-BF5F6FEF1937}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "AuthenticationTokens", + "DisplayDataType": { + "m_type": 4, + "m_azType": "{F965D1B2-9DE3-4900-B44B-E58D9F083ACB}" + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{98B96DAE-EC45-4F36-B39A-F4C91C56FF95}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnDeviceCodeGrantConfirmSignInSuccess", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + }, + { + "id": { + "m_id": "{6958B465-4D41-4325-8A66-011E5BA281F2}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "String", + "DisplayDataType": { + "m_type": 5 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{526EE051-CABD-415C-99D1-D55ED0032E5E}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnDeviceCodeGrantConfirmSignInFail", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + }, + { + "id": { + "m_id": "{A921FE09-C86A-4DE3-9976-0BCC3359CAF3}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "AuthenticationTokens", + "DisplayDataType": { + "m_type": 4, + "m_azType": "{F965D1B2-9DE3-4900-B44B-E58D9F083ACB}" + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{981C81CF-AED4-4535-A226-4BC19C718D73}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnRefreshTokensSuccess", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + }, + { + "id": { + "m_id": "{1C060C05-4FE2-455A-BABA-4B86CE19F934}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "String", + "DisplayDataType": { + "m_type": 5 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{F20A8880-B22D-4FAA-8779-F51DE7DB2D21}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnRefreshTokensFail", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + } + ], + "m_eventMap": [ + { + "Key": { + "Value": 962116424 + }, + "Value": { + "m_eventName": "OnDeviceCodeGrantSignInSuccess", + "m_eventId": { + "Value": 962116424 + }, + "m_eventSlotId": { + "m_id": "{E8BA420E-FF66-4B13-94B9-2D96448542B0}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{919E73F9-6A2B-437B-867D-6723FFF8D29E}" + }, + { + "m_id": "{B494FB65-9082-4826-84B4-E2E6DB1803D1}" + }, + { + "m_id": "{7F2FE508-FCDB-45E5-BBEB-8A25E9D09C41}" + } + ], + "m_numExpectedArguments": 3 + } + }, + { + "Key": { + "Value": 1026494196 + }, + "Value": { + "m_eventName": "OnRefreshTokensFail", + "m_eventId": { + "Value": 1026494196 + }, + "m_eventSlotId": { + "m_id": "{F20A8880-B22D-4FAA-8779-F51DE7DB2D21}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{1C060C05-4FE2-455A-BABA-4B86CE19F934}" + } + ], + "m_numExpectedArguments": 1 + } + }, + { + "Key": { + "Value": 1152314015 + }, + "Value": { + "m_eventName": "OnRefreshTokensSuccess", + "m_eventId": { + "Value": 1152314015 + }, + "m_eventSlotId": { + "m_id": "{981C81CF-AED4-4535-A226-4BC19C718D73}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{A921FE09-C86A-4DE3-9976-0BCC3359CAF3}" + } + ], + "m_numExpectedArguments": 1 + } + }, + { + "Key": { + "Value": 1203288733 + }, + "Value": { + "m_eventName": "OnPasswordGrantMultiFactorConfirmSignInSuccess", + "m_eventId": { + "Value": 1203288733 + }, + "m_eventSlotId": { + "m_id": "{3C544F9A-0137-4735-8484-0458246E4D52}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{0CC24B35-F3D6-4E7B-B9D1-98CEB36059AE}" + } + ], + "m_numExpectedArguments": 1 + } + }, + { + "Key": { + "Value": 1293959492 + }, + "Value": { + "m_eventName": "OnPasswordGrantSingleFactorSignInFail", + "m_eventId": { + "Value": 1293959492 + }, + "m_eventSlotId": { + "m_id": "{282E0463-9A13-4681-B69C-B6B30CA7CD01}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{5B6638B9-4F55-4CCB-A368-C83FED5C43F8}" + } + ], + "m_numExpectedArguments": 1 + } + }, + { + "Key": { + "Value": 1722702500 + }, + "Value": { + "m_eventName": "OnPasswordGrantSingleFactorSignInSuccess", + "m_eventId": { + "Value": 1722702500 + }, + "m_eventSlotId": { + "m_id": "{F3E407C4-9D91-4077-A730-C2463570A9FC}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{D79F252C-3D2A-4CC1-9A51-18B7827EB4CA}" + } + ], + "m_numExpectedArguments": 1 + } + }, + { + "Key": { + "Value": 1819337155 + }, + "Value": { + "m_eventName": "OnPasswordGrantMultiFactorConfirmSignInFail", + "m_eventId": { + "Value": 1819337155 + }, + "m_eventSlotId": { + "m_id": "{FA8FE256-A70A-475E-A724-0E70C1099213}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{BEBDDB95-FBBA-4AE1-BA89-C3DAE042E9E1}" + } + ], + "m_numExpectedArguments": 1 + } + }, + { + "Key": { + "Value": 1908852787 + }, + "Value": { + "m_eventName": "OnPasswordGrantMultiFactorSignInFail", + "m_eventId": { + "Value": 1908852787 + }, + "m_eventSlotId": { + "m_id": "{79F39D7A-BFC2-4749-9631-575A6C63714D}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{C2EBAEB4-5ECA-441C-8202-0D2A80F1A776}" + } + ], + "m_numExpectedArguments": 1 + } + }, + { + "Key": { + "Value": 2486714370 + }, + "Value": { + "m_eventName": "OnPasswordGrantMultiFactorSignInSuccess", + "m_eventId": { + "Value": 2486714370 + }, + "m_eventSlotId": { + "m_id": "{B088E163-C71A-417E-8D35-F0A29273F5D9}" + } + } + }, + { + "Key": { + "Value": 3091702945 + }, + "Value": { + "m_eventName": "OnDeviceCodeGrantSignInFail", + "m_eventId": { + "Value": 3091702945 + }, + "m_eventSlotId": { + "m_id": "{E03D10FB-C618-4260-870D-FA2B2B13FE0D}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{4694A0AC-A400-47D0-A050-8B6AEDF65748}" + } + ], + "m_numExpectedArguments": 1 + } + }, + { + "Key": { + "Value": 3973214553 + }, + "Value": { + "m_eventName": "OnDeviceCodeGrantConfirmSignInFail", + "m_eventId": { + "Value": 3973214553 + }, + "m_eventSlotId": { + "m_id": "{526EE051-CABD-415C-99D1-D55ED0032E5E}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{6958B465-4D41-4325-8A66-011E5BA281F2}" + } + ], + "m_numExpectedArguments": 1 + } + }, + { + "Key": { + "Value": 4272279525 + }, + "Value": { + "m_eventName": "OnDeviceCodeGrantConfirmSignInSuccess", + "m_eventId": { + "Value": 4272279525 + }, + "m_eventSlotId": { + "m_id": "{98B96DAE-EC45-4F36-B39A-F4C91C56FF95}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{031D9648-B03B-42E3-8E6B-BF5F6FEF1937}" + } + ], + "m_numExpectedArguments": 1 + } + } + ], + "m_ebusName": "AuthenticationProviderNotificationBus", + "m_busId": { + "Value": 3734230664 + } + } + } + }, + { + "Id": { + "id": 22602384012086 + }, + "Name": "SC-Node(Print)", + "Components": { + "Component_[17989474089224348440]": { + "$type": "Print", + "Id": 17989474089224348440, + "Slots": [ + { + "id": { + "m_id": "{C0E7856E-AE8E-4151-9109-2E3B2A810054}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "In", + "toolTip": "Input signal", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{36A6967B-AD9E-41C2-9BCC-2AF62F62C774}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Out", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + } + ], + "m_format": "Fail credentials", + "m_unresolvedString": [ + "Fail credentials" + ] + } + } + }, + { + "Id": { + "id": 22593794077494 + }, + "Name": "SC-Node(RequestAWSCredentialsAsync)", + "Components": { + "Component_[3213338170673989286]": { + "$type": "{E42861BD-1956-45AE-8DD7-CCFC1E3E5ACF} Method", + "Id": 3213338170673989286, + "Slots": [ + { + "id": { + "m_id": "{EB37FB3D-48EB-4766-AD8C-7F03D100C7FA}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "In", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{E1160157-4FDD-4720-9EF1-995D0380C53D}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Out", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + } + ], + "methodType": 0, + "methodName": "RequestAWSCredentialsAsync", + "className": "AWSCognitoAuthorizationRequestBus", + "resultSlotIDs": [ + {} + ], + "prettyClassName": "AWSCognitoAuthorizationRequestBus" + } + } + }, + { + "Id": { + "id": 22563729306422 + }, + "Name": "EBusEventHandler", + "Components": { + "Component_[3639374038291845020]": { + "$type": "EBusEventHandler", + "Id": 3639374038291845020, + "Slots": [ + { + "id": { + "m_id": "{2A8157B6-1A5A-464C-B1A1-CC5067AC8872}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Connect", + "toolTip": "Connect this event handler to the specified entity.", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{8DBCEE08-2A7F-4D3E-BF59-7FB3A34AD3B7}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Disconnect", + "toolTip": "Disconnect this event handler.", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{D8FCBC44-E46B-4699-B1A2-AE2BFE61A132}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "OnConnected", + "toolTip": "Signaled when a connection has taken place.", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{9E6AE222-55CE-48F1-A844-7DB53C07AB50}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "OnDisconnected", + "toolTip": "Signaled when this event handler is disconnected.", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{0507AD01-1320-4210-9786-5F87063D301F}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "OnFailure", + "toolTip": "Signaled when it is not possible to connect this handler.", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{6772D7F9-08BE-4D59-B410-7E6EC0FFEF2B}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "AuthenticationTokens", + "DisplayDataType": { + "m_type": 4, + "m_azType": "{F965D1B2-9DE3-4900-B44B-E58D9F083ACB}" + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{ED8A0C7D-9D75-45A7-BAE1-FD8B980DADE2}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnPasswordGrantSingleFactorSignInSuccess", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + }, + { + "id": { + "m_id": "{64484918-D357-4B41-830D-CC9EEB6EC963}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "String", + "DisplayDataType": { + "m_type": 5 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{C042D8B9-D834-4A5A-85E7-F9C775EF9784}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnPasswordGrantSingleFactorSignInFail", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + }, + { + "id": { + "m_id": "{FBBC04A8-2368-4B67-A48F-D7D33EDBC71F}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnPasswordGrantMultiFactorSignInSuccess", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + }, + { + "id": { + "m_id": "{5873E80A-4E48-4B52-AB91-ACE8DC42EC86}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "String", + "DisplayDataType": { + "m_type": 5 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{DC0B9782-C4BB-49C0-8DE3-06933347FA20}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnPasswordGrantMultiFactorSignInFail", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + }, + { + "id": { + "m_id": "{4EB602D7-C5D7-427C-B7D3-838CC4FFBA0D}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "AuthenticationTokens", + "DisplayDataType": { + "m_type": 4, + "m_azType": "{F965D1B2-9DE3-4900-B44B-E58D9F083ACB}" + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{B0F0A8E6-251E-4009-ADE7-8FA70422B1A3}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnPasswordGrantMultiFactorConfirmSignInSuccess", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + }, + { + "id": { + "m_id": "{0E5E0F30-D4A3-4361-99DC-DFB03CDA26ED}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "String", + "DisplayDataType": { + "m_type": 5 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{DF4A4D97-D2A3-42C2-9F85-B79D0743B1DD}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnPasswordGrantMultiFactorConfirmSignInFail", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + }, + { + "id": { + "m_id": "{58B429CF-B818-4CCB-8E31-84B04B65B704}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "String", + "DisplayDataType": { + "m_type": 5 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{4564C0EF-B526-4AB6-9564-0AE22B473EE5}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "String", + "DisplayDataType": { + "m_type": 5 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{6CD7C063-7118-4E55-AA6D-9EDF5B72F7E7}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Number", + "DisplayDataType": { + "m_type": 3 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{3F5A128D-5F74-4D09-9C12-425DCDDD8A71}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnDeviceCodeGrantSignInSuccess", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + }, + { + "id": { + "m_id": "{D49C27E1-B1F7-4A70-8872-B4E6337F0334}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "String", + "DisplayDataType": { + "m_type": 5 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{E6EFD9E4-7CC8-4FBF-88DE-2FAAC4099AE2}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnDeviceCodeGrantSignInFail", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + }, + { + "id": { + "m_id": "{92E26492-6278-4B46-8CD4-0B271B1BB21B}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "AuthenticationTokens", + "DisplayDataType": { + "m_type": 4, + "m_azType": "{F965D1B2-9DE3-4900-B44B-E58D9F083ACB}" + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{D39D72BA-6EC1-445C-93B7-CAD87B1ADC7D}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnDeviceCodeGrantConfirmSignInSuccess", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + }, + { + "id": { + "m_id": "{7D66C081-777B-451E-B626-0DAEB39ECA5A}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "String", + "DisplayDataType": { + "m_type": 5 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{AE4AC27C-0EF0-4AFE-B8D2-80D6F1B35FAB}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnDeviceCodeGrantConfirmSignInFail", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + }, + { + "id": { + "m_id": "{A2BFBF6C-4E19-4294-BDB8-5A191048C9DB}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "AuthenticationTokens", + "DisplayDataType": { + "m_type": 4, + "m_azType": "{F965D1B2-9DE3-4900-B44B-E58D9F083ACB}" + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{C2C30AB7-DACE-49FA-B7B3-04B9FFA5763F}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnRefreshTokensSuccess", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + }, + { + "id": { + "m_id": "{9BD290CA-B00E-491D-855C-7BD084A0FF43}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "String", + "DisplayDataType": { + "m_type": 5 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{6660546E-CC9B-4951-AE9F-C1D45E6098DD}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnRefreshTokensFail", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + } + ], + "m_eventMap": [ + { + "Key": { + "Value": 962116424 + }, + "Value": { + "m_eventName": "OnDeviceCodeGrantSignInSuccess", + "m_eventId": { + "Value": 962116424 + }, + "m_eventSlotId": { + "m_id": "{3F5A128D-5F74-4D09-9C12-425DCDDD8A71}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{58B429CF-B818-4CCB-8E31-84B04B65B704}" + }, + { + "m_id": "{4564C0EF-B526-4AB6-9564-0AE22B473EE5}" + }, + { + "m_id": "{6CD7C063-7118-4E55-AA6D-9EDF5B72F7E7}" + } + ], + "m_numExpectedArguments": 3 + } + }, + { + "Key": { + "Value": 1026494196 + }, + "Value": { + "m_eventName": "OnRefreshTokensFail", + "m_eventId": { + "Value": 1026494196 + }, + "m_eventSlotId": { + "m_id": "{6660546E-CC9B-4951-AE9F-C1D45E6098DD}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{9BD290CA-B00E-491D-855C-7BD084A0FF43}" + } + ], + "m_numExpectedArguments": 1 + } + }, + { + "Key": { + "Value": 1152314015 + }, + "Value": { + "m_eventName": "OnRefreshTokensSuccess", + "m_eventId": { + "Value": 1152314015 + }, + "m_eventSlotId": { + "m_id": "{C2C30AB7-DACE-49FA-B7B3-04B9FFA5763F}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{A2BFBF6C-4E19-4294-BDB8-5A191048C9DB}" + } + ], + "m_numExpectedArguments": 1 + } + }, + { + "Key": { + "Value": 1203288733 + }, + "Value": { + "m_eventName": "OnPasswordGrantMultiFactorConfirmSignInSuccess", + "m_eventId": { + "Value": 1203288733 + }, + "m_eventSlotId": { + "m_id": "{B0F0A8E6-251E-4009-ADE7-8FA70422B1A3}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{4EB602D7-C5D7-427C-B7D3-838CC4FFBA0D}" + } + ], + "m_numExpectedArguments": 1 + } + }, + { + "Key": { + "Value": 1293959492 + }, + "Value": { + "m_eventName": "OnPasswordGrantSingleFactorSignInFail", + "m_eventId": { + "Value": 1293959492 + }, + "m_eventSlotId": { + "m_id": "{C042D8B9-D834-4A5A-85E7-F9C775EF9784}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{64484918-D357-4B41-830D-CC9EEB6EC963}" + } + ], + "m_numExpectedArguments": 1 + } + }, + { + "Key": { + "Value": 1722702500 + }, + "Value": { + "m_eventName": "OnPasswordGrantSingleFactorSignInSuccess", + "m_eventId": { + "Value": 1722702500 + }, + "m_eventSlotId": { + "m_id": "{ED8A0C7D-9D75-45A7-BAE1-FD8B980DADE2}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{6772D7F9-08BE-4D59-B410-7E6EC0FFEF2B}" + } + ], + "m_numExpectedArguments": 1 + } + }, + { + "Key": { + "Value": 1819337155 + }, + "Value": { + "m_eventName": "OnPasswordGrantMultiFactorConfirmSignInFail", + "m_eventId": { + "Value": 1819337155 + }, + "m_eventSlotId": { + "m_id": "{DF4A4D97-D2A3-42C2-9F85-B79D0743B1DD}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{0E5E0F30-D4A3-4361-99DC-DFB03CDA26ED}" + } + ], + "m_numExpectedArguments": 1 + } + }, + { + "Key": { + "Value": 1908852787 + }, + "Value": { + "m_eventName": "OnPasswordGrantMultiFactorSignInFail", + "m_eventId": { + "Value": 1908852787 + }, + "m_eventSlotId": { + "m_id": "{DC0B9782-C4BB-49C0-8DE3-06933347FA20}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{5873E80A-4E48-4B52-AB91-ACE8DC42EC86}" + } + ], + "m_numExpectedArguments": 1 + } + }, + { + "Key": { + "Value": 2486714370 + }, + "Value": { + "m_eventName": "OnPasswordGrantMultiFactorSignInSuccess", + "m_eventId": { + "Value": 2486714370 + }, + "m_eventSlotId": { + "m_id": "{FBBC04A8-2368-4B67-A48F-D7D33EDBC71F}" + } + } + }, + { + "Key": { + "Value": 3091702945 + }, + "Value": { + "m_eventName": "OnDeviceCodeGrantSignInFail", + "m_eventId": { + "Value": 3091702945 + }, + "m_eventSlotId": { + "m_id": "{E6EFD9E4-7CC8-4FBF-88DE-2FAAC4099AE2}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{D49C27E1-B1F7-4A70-8872-B4E6337F0334}" + } + ], + "m_numExpectedArguments": 1 + } + }, + { + "Key": { + "Value": 3973214553 + }, + "Value": { + "m_eventName": "OnDeviceCodeGrantConfirmSignInFail", + "m_eventId": { + "Value": 3973214553 + }, + "m_eventSlotId": { + "m_id": "{AE4AC27C-0EF0-4AFE-B8D2-80D6F1B35FAB}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{7D66C081-777B-451E-B626-0DAEB39ECA5A}" + } + ], + "m_numExpectedArguments": 1 + } + }, + { + "Key": { + "Value": 4272279525 + }, + "Value": { + "m_eventName": "OnDeviceCodeGrantConfirmSignInSuccess", + "m_eventId": { + "Value": 4272279525 + }, + "m_eventSlotId": { + "m_id": "{D39D72BA-6EC1-445C-93B7-CAD87B1ADC7D}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{92E26492-6278-4B46-8CD4-0B271B1BB21B}" + } + ], + "m_numExpectedArguments": 1 + } + } + ], + "m_ebusName": "AuthenticationProviderNotificationBus", + "m_busId": { + "Value": 3734230664 + } + } + } + }, + { + "Id": { + "id": 22572319241014 + }, + "Name": "SC-Node(Initialize)", + "Components": { + "Component_[7405312649373835200]": { + "$type": "{E42861BD-1956-45AE-8DD7-CCFC1E3E5ACF} Method", + "Id": 7405312649373835200, + "Slots": [ + { + "id": { + "m_id": "{FAF2B1D0-815D-476E-BE0A-3C5B0A7181E2}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "In", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{354BF6A8-150D-4A9A-A19F-1B92ADC44A43}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Out", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{1F13C9EB-941B-4AF1-B8DF-7549F7D6304E}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Result: Boolean", + "DisplayDataType": { + "m_type": 0 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + } + ], + "methodType": 0, + "methodName": "Initialize", + "className": "AWSCognitoAuthorizationRequestBus", + "resultSlotIDs": [ + {} + ], + "prettyClassName": "AWSCognitoAuthorizationRequestBus" + } + } + }, + { + "Id": { + "id": 22589499110198 + }, + "Name": "SC-Node(PasswordGrantSingleFactorSignInAsync)", + "Components": { + "Component_[7750292952156679363]": { + "$type": "{E42861BD-1956-45AE-8DD7-CCFC1E3E5ACF} Method", + "Id": 7750292952156679363, + "Slots": [ + { + "id": { + "m_id": "{A5E60763-81A7-4A8A-B8DB-AF4F3DD7D044}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "String: 0", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{CC3B7A6A-ABFF-4417-AB09-E010E9193CE0}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "String: 1", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{ABB9039F-307D-4A8B-A4DC-2BAFADDF238B}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "String: 2", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{F24D94B3-CD7D-4719-AEAB-58B6AA087480}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "In", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{E8DC5B43-1CB4-489C-AD04-D67C59BD9719}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Out", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + } + ], + "Datums": [ + { + "isOverloadedStorage": false, + "scriptCanvasType": { + "m_type": 5 + }, + "isNullPointer": false, + "$type": "{03AAAB3F-5C47-5A66-9EBC-D5FA4DB353C9} AZStd::string", + "value": "AWSCognitoIDP", + "label": "String: 0" + }, + { + "isOverloadedStorage": false, + "scriptCanvasType": { + "m_type": 5 + }, + "isNullPointer": false, + "$type": "{03AAAB3F-5C47-5A66-9EBC-D5FA4DB353C9} AZStd::string", + "value": "test1", + "label": "String: 1" + }, + { + "isOverloadedStorage": false, + "scriptCanvasType": { + "m_type": 5 + }, + "isNullPointer": false, + "$type": "{03AAAB3F-5C47-5A66-9EBC-D5FA4DB353C9} AZStd::string", + "value": "Test1test1!", + "label": "String: 2" + } + ], + "methodType": 0, + "methodName": "PasswordGrantSingleFactorSignInAsync", + "className": "AuthenticationProviderRequestBus", + "resultSlotIDs": [ + {} + ], + "prettyClassName": "AuthenticationProviderRequestBus" + } + } + }, + { + "Id": { + "id": 22598089044790 + }, + "Name": "SC-Node(Print)", + "Components": { + "Component_[8044817584554102751]": { + "$type": "Print", + "Id": 8044817584554102751, + "Slots": [ + { + "id": { + "m_id": "{D3247169-ACA4-42FF-9CD9-7FC5D2888197}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "In", + "toolTip": "Input signal", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{F520F3E3-70BF-43EE-B133-65093AA8CCA8}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Out", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + } + ], + "m_format": "Success credentials", + "m_unresolvedString": [ + "Success credentials" + ] + } + } + }, + { + "Id": { + "id": 22576614208310 + }, + "Name": "SC-Node(Initialize)", + "Components": { + "Component_[8692474017847050528]": { + "$type": "{E42861BD-1956-45AE-8DD7-CCFC1E3E5ACF} Method", + "Id": 8692474017847050528, + "Slots": [ + { + "id": { + "m_id": "{9EFCF33C-EFBB-44F8-BBD9-0E4AA96D45AF}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "In", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{04D08EB7-F20A-4CF7-8BB6-C79804F6EB59}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Out", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{2B827E49-A105-44B7-BF32-B0BB97AA0069}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Result: Boolean", + "DisplayDataType": { + "m_type": 0 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + } + ], + "methodType": 0, + "methodName": "Initialize", + "className": "AWSCognitoUserManagementRequestBus", + "resultSlotIDs": [ + {} + ], + "prettyClassName": "AWSCognitoUserManagementRequestBus" + } + } + }, + { + "Id": { + "id": 22555139371830 + }, + "Name": "SC-Node(Print)", + "Components": { + "Component_[8900676182846034623]": { + "$type": "Print", + "Id": 8900676182846034623, + "Slots": [ + { + "id": { + "m_id": "{9BB1F768-9D92-432C-9B8F-C99EB679CFB9}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "In", + "toolTip": "Input signal", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{880D8B51-8686-4D13-8AD3-0C9F43C9CC9F}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Out", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + } + ], + "m_format": "SignIn Fail", + "m_unresolvedString": [ + "SignIn Fail" + ] + } + } + }, + { + "Id": { + "id": 22568024273718 + }, + "Name": "EBusEventHandler", + "Components": { + "Component_[954102115830395541]": { + "$type": "EBusEventHandler", + "Id": 954102115830395541, + "Slots": [ + { + "id": { + "m_id": "{7CC34F95-FB5B-43EB-AD4D-72E916B326C3}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Connect", + "toolTip": "Connect this event handler to the specified entity.", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{CF183A1F-260C-4BD6-8A1D-D1F1F6DA4D77}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Disconnect", + "toolTip": "Disconnect this event handler.", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{B7010FF0-FFFF-401B-A97B-F64B6592D4AD}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "OnConnected", + "toolTip": "Signaled when a connection has taken place.", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{E4952C80-F90E-4B2D-894C-D42C88ECD33B}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "OnDisconnected", + "toolTip": "Signaled when this event handler is disconnected.", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{9F16F58B-1942-4841-9E7C-E797DFA9967D}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "OnFailure", + "toolTip": "Signaled when it is not possible to connect this handler.", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{29C614BD-C1B3-4EA3-B6E5-9147AED55BC8}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ClientAuthAWSCredentials", + "DisplayDataType": { + "m_type": 4, + "m_azType": "{02FB32C4-B94E-4084-9049-3DF32F87BD76}" + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{C8DD4D15-0C2D-43BC-9158-2D7DD1A33BBC}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnRequestAWSCredentialsSuccess", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + }, + { + "id": { + "m_id": "{F1BCDD2A-6F12-4E5F-A263-6237776FA727}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "String", + "DisplayDataType": { + "m_type": 5 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{5EEFCA6E-8B52-43A0-BFAF-512FDAB89E58}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnRequestAWSCredentialsFail", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + } + ], + "m_eventMap": [ + { + "Key": { + "Value": 3736070646 + }, + "Value": { + "m_eventName": "OnRequestAWSCredentialsSuccess", + "m_eventId": { + "Value": 3736070646 + }, + "m_eventSlotId": { + "m_id": "{C8DD4D15-0C2D-43BC-9158-2D7DD1A33BBC}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{29C614BD-C1B3-4EA3-B6E5-9147AED55BC8}" + } + ], + "m_numExpectedArguments": 1 + } + }, + { + "Key": { + "Value": 4193877825 + }, + "Value": { + "m_eventName": "OnRequestAWSCredentialsFail", + "m_eventId": { + "Value": 4193877825 + }, + "m_eventSlotId": { + "m_id": "{5EEFCA6E-8B52-43A0-BFAF-512FDAB89E58}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{F1BCDD2A-6F12-4E5F-A263-6237776FA727}" + } + ], + "m_numExpectedArguments": 1 + } + } + ], + "m_ebusName": "AWSCognitoAuthorizationNotificationBus", + "m_busId": { + "Value": 1100345364 + } + } + } + } + ], + "m_connections": [ + { + "Id": { + "id": 22615268913974 + }, + "Name": "srcEndpoint=(Initialize: Out), destEndpoint=(Initialize: In)", + "Components": { + "Component_[14399681979807032845]": { + "$type": "{64CA5016-E803-4AC4-9A36-BDA2C890C6EB} Connection", + "Id": 14399681979807032845, + "sourceEndpoint": { + "nodeId": { + "id": 22610973946678 + }, + "slotId": { + "m_id": "{4BB45954-74C5-4023-AFBE-C82638076FDD}" + } + }, + "targetEndpoint": { + "nodeId": { + "id": 22576614208310 + }, + "slotId": { + "m_id": "{9EFCF33C-EFBB-44F8-BBD9-0E4AA96D45AF}" + } + } + } + } + }, + { + "Id": { + "id": 22619563881270 + }, + "Name": "srcEndpoint=(Initialize: Out), destEndpoint=(Initialize: In)", + "Components": { + "Component_[17573298986849197839]": { + "$type": "{64CA5016-E803-4AC4-9A36-BDA2C890C6EB} Connection", + "Id": 17573298986849197839, + "sourceEndpoint": { + "nodeId": { + "id": 22576614208310 + }, + "slotId": { + "m_id": "{04D08EB7-F20A-4CF7-8BB6-C79804F6EB59}" + } + }, + "targetEndpoint": { + "nodeId": { + "id": 22572319241014 + }, + "slotId": { + "m_id": "{FAF2B1D0-815D-476E-BE0A-3C5B0A7181E2}" + } + } + } + } + }, + { + "Id": { + "id": 22623858848566 + }, + "Name": "srcEndpoint=(Initialize: Out), destEndpoint=(PasswordGrantSingleFactorSignInAsync: In)", + "Components": { + "Component_[9852640775697931695]": { + "$type": "{64CA5016-E803-4AC4-9A36-BDA2C890C6EB} Connection", + "Id": 9852640775697931695, + "sourceEndpoint": { + "nodeId": { + "id": 22572319241014 + }, + "slotId": { + "m_id": "{354BF6A8-150D-4A9A-A19F-1B92ADC44A43}" + } + }, + "targetEndpoint": { + "nodeId": { + "id": 22589499110198 + }, + "slotId": { + "m_id": "{F24D94B3-CD7D-4719-AEAB-58B6AA087480}" + } + } + } + } + }, + { + "Id": { + "id": 22628153815862 + }, + "Name": "srcEndpoint=(Print: Out), destEndpoint=(RequestAWSCredentialsAsync: In)", + "Components": { + "Component_[12044830313862012006]": { + "$type": "{64CA5016-E803-4AC4-9A36-BDA2C890C6EB} Connection", + "Id": 12044830313862012006, + "sourceEndpoint": { + "nodeId": { + "id": 22606678979382 + }, + "slotId": { + "m_id": "{F5EE89C0-AB89-4D06-BD4C-72CA40AB075B}" + } + }, + "targetEndpoint": { + "nodeId": { + "id": 22593794077494 + }, + "slotId": { + "m_id": "{EB37FB3D-48EB-4766-AD8C-7F03D100C7FA}" + } + } + } + } + }, + { + "Id": { + "id": 22632448783158 + }, + "Name": "srcEndpoint=(AuthenticationProviderNotificationBus Handler: ExecutionSlot:OnPasswordGrantSingleFactorSignInSuccess), destEndpoint=(Print: In)", + "Components": { + "Component_[11544107396556720999]": { + "$type": "{64CA5016-E803-4AC4-9A36-BDA2C890C6EB} Connection", + "Id": 11544107396556720999, + "sourceEndpoint": { + "nodeId": { + "id": 22585204142902 + }, + "slotId": { + "m_id": "{F3E407C4-9D91-4077-A730-C2463570A9FC}" + } + }, + "targetEndpoint": { + "nodeId": { + "id": 22606678979382 + }, + "slotId": { + "m_id": "{269D4FDC-1137-45A3-8442-2A2DF98D6F6E}" + } + } + } + } + }, + { + "Id": { + "id": 22636743750454 + }, + "Name": "srcEndpoint=(AWSCognitoAuthorizationNotificationBus Handler: ExecutionSlot:OnRequestAWSCredentialsSuccess), destEndpoint=(Print: In)", + "Components": { + "Component_[16101269355489066265]": { + "$type": "{64CA5016-E803-4AC4-9A36-BDA2C890C6EB} Connection", + "Id": 16101269355489066265, + "sourceEndpoint": { + "nodeId": { + "id": 22580909175606 + }, + "slotId": { + "m_id": "{BCA83F8F-E431-421D-8B01-A8B31C3C66B1}" + } + }, + "targetEndpoint": { + "nodeId": { + "id": 22598089044790 + }, + "slotId": { + "m_id": "{D3247169-ACA4-42FF-9CD9-7FC5D2888197}" + } + } + } + } + }, + { + "Id": { + "id": 22641038717750 + }, + "Name": "srcEndpoint=(AWSCognitoAuthorizationNotificationBus Handler: ExecutionSlot:OnRequestAWSCredentialsFail), destEndpoint=(Print: In)", + "Components": { + "Component_[6840692313652679972]": { + "$type": "{64CA5016-E803-4AC4-9A36-BDA2C890C6EB} Connection", + "Id": 6840692313652679972, + "sourceEndpoint": { + "nodeId": { + "id": 22568024273718 + }, + "slotId": { + "m_id": "{5EEFCA6E-8B52-43A0-BFAF-512FDAB89E58}" + } + }, + "targetEndpoint": { + "nodeId": { + "id": 22602384012086 + }, + "slotId": { + "m_id": "{C0E7856E-AE8E-4151-9109-2E3B2A810054}" + } + } + } + } + }, + { + "Id": { + "id": 22645333685046 + }, + "Name": "srcEndpoint=(AuthenticationProviderNotificationBus Handler: ExecutionSlot:OnPasswordGrantSingleFactorSignInFail), destEndpoint=(Print: In)", + "Components": { + "Component_[72000609721937697]": { + "$type": "{64CA5016-E803-4AC4-9A36-BDA2C890C6EB} Connection", + "Id": 72000609721937697, + "sourceEndpoint": { + "nodeId": { + "id": 22563729306422 + }, + "slotId": { + "m_id": "{C042D8B9-D834-4A5A-85E7-F9C775EF9784}" + } + }, + "targetEndpoint": { + "nodeId": { + "id": 22555139371830 + }, + "slotId": { + "m_id": "{9BB1F768-9D92-432C-9B8F-C99EB679CFB9}" + } + } + } + } + }, + { + "Id": { + "id": 22649628652342 + }, + "Name": "srcEndpoint=(EntityBus Handler: ExecutionSlot:OnEntityActivated), destEndpoint=(Initialize: In)", + "Components": { + "Component_[15648358861411868133]": { + "$type": "{64CA5016-E803-4AC4-9A36-BDA2C890C6EB} Connection", + "Id": 15648358861411868133, + "sourceEndpoint": { + "nodeId": { + "id": 22559434339126 + }, + "slotId": { + "m_id": "{1E81F46E-80CF-4CF6-8499-04539BBF244E}" + } + }, + "targetEndpoint": { + "nodeId": { + "id": 22610973946678 + }, + "slotId": { + "m_id": "{F4ED50C1-0694-4E9F-A4E6-83565E517C1E}" + } + } + } + } + } + ] + }, + "m_assetType": "{3E2AC8CD-713F-453E-967F-29517F331784}", + "versionData": { + "_grammarVersion": 1, + "_runtimeVersion": 1 + }, + "m_variableCounter": 1, + "GraphCanvasData": [ + { + "Key": { + "id": 22550844404534 + }, + "Value": { + "ComponentData": { + "{5F84B500-8C45-40D1-8EFC-A5306B241444}": { + "$type": "SceneComponentSaveData", + "ViewParams": { + "Scale": 1.4170998772559926, + "AnchorX": 224.40196228027344, + "AnchorY": 163.7146453857422 + } + } + } + } + }, + { + "Key": { + "id": 22555139371830 + }, + "Value": { + "ComponentData": { + "{24CB38BB-1705-4EC5-8F63-B574571B4DCD}": { + "$type": "NodeSaveData" + }, + "{328FF15C-C302-458F-A43D-E1794DE0904E}": { + "$type": "GeneralNodeTitleComponentSaveData", + "PaletteOverride": "StringNodeTitlePalette" + }, + "{7CC444B1-F9B3-41B5-841B-0C4F2179F111}": { + "$type": "GeometrySaveData", + "Position": [ + 1720.0, + 820.0 + ] + }, + "{B0B99C8A-03AF-4CF6-A926-F65C874C3D97}": { + "$type": "StylingComponentSaveData" + }, + "{B1F49A35-8408-40DA-B79E-F1E3B64322CE}": { + "$type": "PersistentIdComponentSaveData", + "PersistentId": "{2B3195F2-1430-43F8-9E98-821F79AE9168}" + } + } + } + }, + { + "Key": { + "id": 22559434339126 + }, + "Value": { + "ComponentData": { + "{24CB38BB-1705-4EC5-8F63-B574571B4DCD}": { + "$type": "NodeSaveData" + }, + "{7CC444B1-F9B3-41B5-841B-0C4F2179F111}": { + "$type": "GeometrySaveData", + "Position": [ + 340.0, + 240.0 + ] + }, + "{9E81C95F-89C0-4476-8E82-63CCC4E52E04}": { + "$type": "EBusHandlerNodeDescriptorSaveData", + "EventIds": [ + { + "Value": 245425936 + } + ] + }, + "{B0B99C8A-03AF-4CF6-A926-F65C874C3D97}": { + "$type": "StylingComponentSaveData" + }, + "{B1F49A35-8408-40DA-B79E-F1E3B64322CE}": { + "$type": "PersistentIdComponentSaveData", + "PersistentId": "{571D5EB6-761E-4961-A9A8-47CEC16F8549}" + } + } + } + }, + { + "Key": { + "id": 22563729306422 + }, + "Value": { + "ComponentData": { + "{24CB38BB-1705-4EC5-8F63-B574571B4DCD}": { + "$type": "NodeSaveData" + }, + "{7CC444B1-F9B3-41B5-841B-0C4F2179F111}": { + "$type": "GeometrySaveData", + "Position": [ + 1200.0, + 820.0 + ] + }, + "{9E81C95F-89C0-4476-8E82-63CCC4E52E04}": { + "$type": "EBusHandlerNodeDescriptorSaveData", + "EventIds": [ + { + "Value": 1293959492 + } + ] + }, + "{B0B99C8A-03AF-4CF6-A926-F65C874C3D97}": { + "$type": "StylingComponentSaveData" + }, + "{B1F49A35-8408-40DA-B79E-F1E3B64322CE}": { + "$type": "PersistentIdComponentSaveData", + "PersistentId": "{D64CFD59-5EB3-46F7-B778-B8C1B1BCE0F6}" + } + } + } + }, + { + "Key": { + "id": 22568024273718 + }, + "Value": { + "ComponentData": { + "{24CB38BB-1705-4EC5-8F63-B574571B4DCD}": { + "$type": "NodeSaveData" + }, + "{7CC444B1-F9B3-41B5-841B-0C4F2179F111}": { + "$type": "GeometrySaveData", + "Position": [ + 1200.0, + 1360.0 + ] + }, + "{9E81C95F-89C0-4476-8E82-63CCC4E52E04}": { + "$type": "EBusHandlerNodeDescriptorSaveData", + "EventIds": [ + { + "Value": 4193877825 + } + ] + }, + "{B0B99C8A-03AF-4CF6-A926-F65C874C3D97}": { + "$type": "StylingComponentSaveData" + }, + "{B1F49A35-8408-40DA-B79E-F1E3B64322CE}": { + "$type": "PersistentIdComponentSaveData", + "PersistentId": "{897D9E34-AB55-4C02-B7CF-707DF3026F7A}" + } + } + } + }, + { + "Key": { + "id": 22572319241014 + }, + "Value": { + "ComponentData": { + "{24CB38BB-1705-4EC5-8F63-B574571B4DCD}": { + "$type": "NodeSaveData" + }, + "{328FF15C-C302-458F-A43D-E1794DE0904E}": { + "$type": "GeneralNodeTitleComponentSaveData", + "PaletteOverride": "MethodNodeTitlePalette" + }, + "{7CC444B1-F9B3-41B5-841B-0C4F2179F111}": { + "$type": "GeometrySaveData", + "Position": [ + 300.0, + 620.0 + ] + }, + "{B0B99C8A-03AF-4CF6-A926-F65C874C3D97}": { + "$type": "StylingComponentSaveData", + "SubStyle": ".method" + }, + "{B1F49A35-8408-40DA-B79E-F1E3B64322CE}": { + "$type": "PersistentIdComponentSaveData", + "PersistentId": "{86D69109-1347-4874-B913-DD03618254AA}" + } + } + } + }, + { + "Key": { + "id": 22576614208310 + }, + "Value": { + "ComponentData": { + "{24CB38BB-1705-4EC5-8F63-B574571B4DCD}": { + "$type": "NodeSaveData" + }, + "{328FF15C-C302-458F-A43D-E1794DE0904E}": { + "$type": "GeneralNodeTitleComponentSaveData", + "PaletteOverride": "MethodNodeTitlePalette" + }, + "{7CC444B1-F9B3-41B5-841B-0C4F2179F111}": { + "$type": "GeometrySaveData", + "Position": [ + 1200.0, + 300.0 + ] + }, + "{B0B99C8A-03AF-4CF6-A926-F65C874C3D97}": { + "$type": "StylingComponentSaveData", + "SubStyle": ".method" + }, + "{B1F49A35-8408-40DA-B79E-F1E3B64322CE}": { + "$type": "PersistentIdComponentSaveData", + "PersistentId": "{646FDAC6-AC92-436C-84D3-6C7C067F7662}" + } + } + } + }, + { + "Key": { + "id": 22580909175606 + }, + "Value": { + "ComponentData": { + "{24CB38BB-1705-4EC5-8F63-B574571B4DCD}": { + "$type": "NodeSaveData" + }, + "{7CC444B1-F9B3-41B5-841B-0C4F2179F111}": { + "$type": "GeometrySaveData", + "Position": [ + 1200.0, + 1100.0 + ] + }, + "{9E81C95F-89C0-4476-8E82-63CCC4E52E04}": { + "$type": "EBusHandlerNodeDescriptorSaveData", + "EventIds": [ + { + "Value": 3736070646 + } + ] + }, + "{B0B99C8A-03AF-4CF6-A926-F65C874C3D97}": { + "$type": "StylingComponentSaveData" + }, + "{B1F49A35-8408-40DA-B79E-F1E3B64322CE}": { + "$type": "PersistentIdComponentSaveData", + "PersistentId": "{A7E33C5C-1567-4ACF-AA26-07DCF02A0C31}" + } + } + } + }, + { + "Key": { + "id": 22585204142902 + }, + "Value": { + "ComponentData": { + "{24CB38BB-1705-4EC5-8F63-B574571B4DCD}": { + "$type": "NodeSaveData" + }, + "{7CC444B1-F9B3-41B5-841B-0C4F2179F111}": { + "$type": "GeometrySaveData", + "Position": [ + 1200.0, + 540.0 + ] + }, + "{9E81C95F-89C0-4476-8E82-63CCC4E52E04}": { + "$type": "EBusHandlerNodeDescriptorSaveData", + "EventIds": [ + { + "Value": 1722702500 + } + ] + }, + "{B0B99C8A-03AF-4CF6-A926-F65C874C3D97}": { + "$type": "StylingComponentSaveData" + }, + "{B1F49A35-8408-40DA-B79E-F1E3B64322CE}": { + "$type": "PersistentIdComponentSaveData", + "PersistentId": "{73A7B670-D516-477F-BAD2-AC948A0F30AF}" + } + } + } + }, + { + "Key": { + "id": 22589499110198 + }, + "Value": { + "ComponentData": { + "{24CB38BB-1705-4EC5-8F63-B574571B4DCD}": { + "$type": "NodeSaveData" + }, + "{328FF15C-C302-458F-A43D-E1794DE0904E}": { + "$type": "GeneralNodeTitleComponentSaveData", + "PaletteOverride": "MethodNodeTitlePalette" + }, + "{7CC444B1-F9B3-41B5-841B-0C4F2179F111}": { + "$type": "GeometrySaveData", + "Position": [ + 700.0, + 620.0 + ] + }, + "{B0B99C8A-03AF-4CF6-A926-F65C874C3D97}": { + "$type": "StylingComponentSaveData", + "SubStyle": ".method" + }, + "{B1F49A35-8408-40DA-B79E-F1E3B64322CE}": { + "$type": "PersistentIdComponentSaveData", + "PersistentId": "{8ED300CF-364B-4569-967D-2E1366510572}" + } + } + } + }, + { + "Key": { + "id": 22593794077494 + }, + "Value": { + "ComponentData": { + "{24CB38BB-1705-4EC5-8F63-B574571B4DCD}": { + "$type": "NodeSaveData" + }, + "{328FF15C-C302-458F-A43D-E1794DE0904E}": { + "$type": "GeneralNodeTitleComponentSaveData", + "PaletteOverride": "MethodNodeTitlePalette" + }, + "{7CC444B1-F9B3-41B5-841B-0C4F2179F111}": { + "$type": "GeometrySaveData", + "Position": [ + 280.0, + 1120.0 + ] + }, + "{B0B99C8A-03AF-4CF6-A926-F65C874C3D97}": { + "$type": "StylingComponentSaveData", + "SubStyle": ".method" + }, + "{B1F49A35-8408-40DA-B79E-F1E3B64322CE}": { + "$type": "PersistentIdComponentSaveData", + "PersistentId": "{59A81991-B4E6-48C4-9534-2DAF56ACE2EB}" + } + } + } + }, + { + "Key": { + "id": 22598089044790 + }, + "Value": { + "ComponentData": { + "{24CB38BB-1705-4EC5-8F63-B574571B4DCD}": { + "$type": "NodeSaveData" + }, + "{328FF15C-C302-458F-A43D-E1794DE0904E}": { + "$type": "GeneralNodeTitleComponentSaveData", + "PaletteOverride": "StringNodeTitlePalette" + }, + "{7CC444B1-F9B3-41B5-841B-0C4F2179F111}": { + "$type": "GeometrySaveData", + "Position": [ + 1720.0, + 1100.0 + ] + }, + "{B0B99C8A-03AF-4CF6-A926-F65C874C3D97}": { + "$type": "StylingComponentSaveData" + }, + "{B1F49A35-8408-40DA-B79E-F1E3B64322CE}": { + "$type": "PersistentIdComponentSaveData", + "PersistentId": "{1FB84C5F-E453-4160-947F-CF32F5E2628A}" + } + } + } + }, + { + "Key": { + "id": 22602384012086 + }, + "Value": { + "ComponentData": { + "{24CB38BB-1705-4EC5-8F63-B574571B4DCD}": { + "$type": "NodeSaveData" + }, + "{328FF15C-C302-458F-A43D-E1794DE0904E}": { + "$type": "GeneralNodeTitleComponentSaveData", + "PaletteOverride": "StringNodeTitlePalette" + }, + "{7CC444B1-F9B3-41B5-841B-0C4F2179F111}": { + "$type": "GeometrySaveData", + "Position": [ + 1720.0, + 1360.0 + ] + }, + "{B0B99C8A-03AF-4CF6-A926-F65C874C3D97}": { + "$type": "StylingComponentSaveData" + }, + "{B1F49A35-8408-40DA-B79E-F1E3B64322CE}": { + "$type": "PersistentIdComponentSaveData", + "PersistentId": "{3C3CA353-2C5F-4479-9FB5-BF089C18D90D}" + } + } + } + }, + { + "Key": { + "id": 22606678979382 + }, + "Value": { + "ComponentData": { + "{24CB38BB-1705-4EC5-8F63-B574571B4DCD}": { + "$type": "NodeSaveData" + }, + "{328FF15C-C302-458F-A43D-E1794DE0904E}": { + "$type": "GeneralNodeTitleComponentSaveData", + "PaletteOverride": "StringNodeTitlePalette" + }, + "{7CC444B1-F9B3-41B5-841B-0C4F2179F111}": { + "$type": "GeometrySaveData", + "Position": [ + 1720.0, + 580.0 + ] + }, + "{B0B99C8A-03AF-4CF6-A926-F65C874C3D97}": { + "$type": "StylingComponentSaveData" + }, + "{B1F49A35-8408-40DA-B79E-F1E3B64322CE}": { + "$type": "PersistentIdComponentSaveData", + "PersistentId": "{8766AD8F-F6D5-4DAD-B56D-7B1542B9E2EF}" + } + } + } + }, + { + "Key": { + "id": 22610973946678 + }, + "Value": { + "ComponentData": { + "{24CB38BB-1705-4EC5-8F63-B574571B4DCD}": { + "$type": "NodeSaveData" + }, + "{328FF15C-C302-458F-A43D-E1794DE0904E}": { + "$type": "GeneralNodeTitleComponentSaveData", + "PaletteOverride": "MethodNodeTitlePalette" + }, + "{7CC444B1-F9B3-41B5-841B-0C4F2179F111}": { + "$type": "GeometrySaveData", + "Position": [ + 680.0, + 300.0 + ] + }, + "{B0B99C8A-03AF-4CF6-A926-F65C874C3D97}": { + "$type": "StylingComponentSaveData", + "SubStyle": ".method" + }, + "{B1F49A35-8408-40DA-B79E-F1E3B64322CE}": { + "$type": "PersistentIdComponentSaveData", + "PersistentId": "{FD8E5258-B0B2-47E4-AEC1-06E61DA50C70}" + } + } + } + } + ], + "StatisticsHelper": { + "InstanceCounter": [ + { + "Key": 5842116761103598202, + "Value": 1 + }, + { + "Key": 5842117366976109617, + "Value": 1 + }, + { + "Key": 5842117367539594961, + "Value": 1 + }, + { + "Key": 5842117453459104876, + "Value": 1 + }, + { + "Key": 5842117453819001655, + "Value": 1 + }, + { + "Key": 10684225535275896474, + "Value": 4 + }, + { + "Key": 13774516282682374181, + "Value": 1 + }, + { + "Key": 13774516283013331095, + "Value": 1 + }, + { + "Key": 13774516352051377806, + "Value": 1 + }, + { + "Key": 13774516386968943251, + "Value": 1 + }, + { + "Key": 13774516392820282243, + "Value": 1 + } + ] + } + } + } + } + } +} \ No newline at end of file diff --git a/AutomatedTesting/Levels/AWS/ClientAuthPasswordSignUp/PasswordSignUp.scriptcanvas b/AutomatedTesting/Levels/AWS/ClientAuthPasswordSignUp/PasswordSignUp.scriptcanvas index f630d4aba3..b86160e387 100644 --- a/AutomatedTesting/Levels/AWS/ClientAuthPasswordSignUp/PasswordSignUp.scriptcanvas +++ b/AutomatedTesting/Levels/AWS/ClientAuthPasswordSignUp/PasswordSignUp.scriptcanvas @@ -1,4400 +1,2442 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +{ + "Type": "JsonSerialization", + "Version": 1, + "ClassName": "ScriptCanvasData", + "ClassData": { + "m_scriptCanvas": { + "Id": { + "id": 40366368748342 + }, + "Name": "PasswordSignUp", + "Components": { + "Component_[15293771356940612577]": { + "$type": "{4D755CA9-AB92-462C-B24F-0B3376F19967} Graph", + "Id": 15293771356940612577, + "m_graphData": { + "m_nodes": [ + { + "Id": { + "id": 40392138552118 + }, + "Name": "SC-Node(Initialize)", + "Components": { + "Component_[10218083367428942849]": { + "$type": "{E42861BD-1956-45AE-8DD7-CCFC1E3E5ACF} Method", + "Id": 10218083367428942849, + "Slots": [ + { + "id": { + "m_id": "{399A9DE3-F888-4941-95ED-51DAA3577806}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "In", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{7E46FB7B-9FFF-49BE-8A8B-59A6144BB567}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Out", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{A3A7AA49-0362-4F3C-81D9-C673BDC4CB9D}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Result: Boolean", + "DisplayDataType": { + "m_type": 0 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + } + ], + "methodType": 0, + "methodName": "Initialize", + "className": "AWSCognitoAuthorizationRequestBus", + "resultSlotIDs": [ + {} + ], + "prettyClassName": "AWSCognitoAuthorizationRequestBus" + } + } + }, + { + "Id": { + "id": 40387843584822 + }, + "Name": "SC-Node(Initialize)", + "Components": { + "Component_[1064784280691017359]": { + "$type": "{E42861BD-1956-45AE-8DD7-CCFC1E3E5ACF} Method", + "Id": 1064784280691017359, + "Slots": [ + { + "id": { + "m_id": "{3D4180D8-264F-40A6-B651-8AD9968800CD}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "In", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{12154F8B-6329-44B2-B220-25BBB4F4DA8C}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Out", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{65D3D1AD-0D98-48D0-9E6E-742535E78E15}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Result: Boolean", + "DisplayDataType": { + "m_type": 0 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + } + ], + "methodType": 0, + "methodName": "Initialize", + "className": "AWSCognitoUserManagementRequestBus", + "resultSlotIDs": [ + {} + ], + "prettyClassName": "AWSCognitoUserManagementRequestBus" + } + } + }, + { + "Id": { + "id": 40379253650230 + }, + "Name": "SC-Node(Print)", + "Components": { + "Component_[17066281136316039638]": { + "$type": "Print", + "Id": 17066281136316039638, + "Slots": [ + { + "id": { + "m_id": "{CE1EC1C9-479F-451E-BC7B-CF9A76C141B8}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "In", + "toolTip": "Input signal", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{6BFF8DF8-6D3B-47AD-8A6A-CCEAAC7B0B26}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Out", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + } + ], + "m_format": "Signup Fail", + "m_unresolvedString": [ + "Signup Fail" + ] + } + } + }, + { + "Id": { + "id": 40370663715638 + }, + "Name": "SC-Node(Print)", + "Components": { + "Component_[17066281136316039638]": { + "$type": "Print", + "Id": 17066281136316039638, + "Slots": [ + { + "id": { + "m_id": "{CE1EC1C9-479F-451E-BC7B-CF9A76C141B8}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "In", + "toolTip": "Input signal", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{6BFF8DF8-6D3B-47AD-8A6A-CCEAAC7B0B26}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Out", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + } + ], + "m_format": "Signup Success", + "m_unresolvedString": [ + "Signup Success" + ] + } + } + }, + { + "Id": { + "id": 40400728486710 + }, + "Name": "EBusEventHandler", + "Components": { + "Component_[3253175345351481273]": { + "$type": "EBusEventHandler", + "Id": 3253175345351481273, + "Slots": [ + { + "id": { + "m_id": "{1C7259B4-0505-48A2-B942-55CFBAE0F40D}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Connect", + "toolTip": "Connect this event handler to the specified entity.", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{274A7EFC-3117-4533-9F4D-814BB5E3A28C}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Disconnect", + "toolTip": "Disconnect this event handler.", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{37273EA1-C478-455A-8D8A-49BA9311B3D8}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "OnConnected", + "toolTip": "Signaled when a connection has taken place.", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{F66434BA-1E32-412A-9045-A4331871112B}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "OnDisconnected", + "toolTip": "Signaled when this event handler is disconnected.", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{69CD56BC-D598-4D76-83E1-1F1A9B6A9058}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "OnFailure", + "toolTip": "Signaled when it is not possible to connect this handler.", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{1D2D3BD0-1165-45A6-8310-3AB4E58513F5}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "String", + "DisplayDataType": { + "m_type": 5 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{6AA62561-DA82-4797-9DC4-615AB767F828}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnEmailSignUpSuccess", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + }, + { + "id": { + "m_id": "{6C1ECF44-14DE-4A96-A8BD-E317C80438C6}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "String", + "DisplayDataType": { + "m_type": 5 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{373F06F3-3019-469D-9668-B312D3E29617}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnEmailSignUpFail", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + }, + { + "id": { + "m_id": "{526BB736-AF73-4874-AB1F-5A31E32599E0}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "String", + "DisplayDataType": { + "m_type": 5 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{B156FBD5-F8D1-4856-9ED4-B39C0C2F1FBE}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnPhoneSignUpSuccess", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + }, + { + "id": { + "m_id": "{1CABB198-AE36-4929-A562-2C87F7A90946}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "String", + "DisplayDataType": { + "m_type": 5 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{BF5D1487-52AB-484E-B3A8-254126BCFBC8}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnPhoneSignUpFail", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + }, + { + "id": { + "m_id": "{E1E14BF9-5FC4-46F7-9284-BD971D6FBC7B}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnConfirmSignUpSuccess", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + }, + { + "id": { + "m_id": "{B3E9DEFA-DD55-495C-BCBD-BBB64C2F40E6}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "String", + "DisplayDataType": { + "m_type": 5 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{E8B771CC-6CB6-4A6F-9642-123E6A62BC39}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnConfirmSignUpFail", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + }, + { + "id": { + "m_id": "{52C45020-B7A6-452C-9624-0BA2CE4675A8}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnForgotPasswordSuccess", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + }, + { + "id": { + "m_id": "{61352C5D-E634-4E36-86AE-95B0AA0C67F1}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "String", + "DisplayDataType": { + "m_type": 5 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{C4F9C1F5-8CE0-4FAB-8068-2CDACDFBC7FB}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnForgotPasswordFail", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + }, + { + "id": { + "m_id": "{5AB5FB72-2D60-45C6-B2F2-6509AF91DCAF}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnConfirmForgotPasswordSuccess", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + }, + { + "id": { + "m_id": "{AA2660EA-141C-43E0-9B05-E233CF7637B9}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "String", + "DisplayDataType": { + "m_type": 5 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{6FF2A7E9-1716-47BC-97D6-77E7B108058A}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnConfirmForgotPasswordFail", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + }, + { + "id": { + "m_id": "{D50F225E-0251-4E45-B261-D66E11F8E259}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnEnableMFASuccess", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + }, + { + "id": { + "m_id": "{6926905E-56CF-424A-BD39-07CAC731CEE2}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "String", + "DisplayDataType": { + "m_type": 5 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{D8F3BE2B-E240-4AA3-BD3F-AECE3BA146B0}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnEnableMFAFail", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + } + ], + "m_eventMap": [ + { + "Key": { + "Value": 91595643 + }, + "Value": { + "m_eventName": "OnEnableMFAFail", + "m_eventId": { + "Value": 91595643 + }, + "m_eventSlotId": { + "m_id": "{D8F3BE2B-E240-4AA3-BD3F-AECE3BA146B0}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{6926905E-56CF-424A-BD39-07CAC731CEE2}" + } + ], + "m_numExpectedArguments": 1 + } + }, + { + "Key": { + "Value": 263629761 + }, + "Value": { + "m_eventName": "OnPhoneSignUpSuccess", + "m_eventId": { + "Value": 263629761 + }, + "m_eventSlotId": { + "m_id": "{B156FBD5-F8D1-4856-9ED4-B39C0C2F1FBE}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{526BB736-AF73-4874-AB1F-5A31E32599E0}" + } + ], + "m_numExpectedArguments": 1 + } + }, + { + "Key": { + "Value": 545635257 + }, + "Value": { + "m_eventName": "OnConfirmForgotPasswordFail", + "m_eventId": { + "Value": 545635257 + }, + "m_eventSlotId": { + "m_id": "{6FF2A7E9-1716-47BC-97D6-77E7B108058A}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{AA2660EA-141C-43E0-9B05-E233CF7637B9}" + } + ], + "m_numExpectedArguments": 1 + } + }, + { + "Key": { + "Value": 613710915 + }, + "Value": { + "m_eventName": "OnEmailSignUpSuccess", + "m_eventId": { + "Value": 613710915 + }, + "m_eventSlotId": { + "m_id": "{6AA62561-DA82-4797-9DC4-615AB767F828}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{1D2D3BD0-1165-45A6-8310-3AB4E58513F5}" + } + ], + "m_numExpectedArguments": 1 + } + }, + { + "Key": { + "Value": 885366379 + }, + "Value": { + "m_eventName": "OnForgotPasswordSuccess", + "m_eventId": { + "Value": 885366379 + }, + "m_eventSlotId": { + "m_id": "{52C45020-B7A6-452C-9624-0BA2CE4675A8}" + } + } + }, + { + "Key": { + "Value": 1053871188 + }, + "Value": { + "m_eventName": "OnEnableMFASuccess", + "m_eventId": { + "Value": 1053871188 + }, + "m_eventSlotId": { + "m_id": "{D50F225E-0251-4E45-B261-D66E11F8E259}" + } + } + }, + { + "Key": { + "Value": 1936419598 + }, + "Value": { + "m_eventName": "OnConfirmSignUpFail", + "m_eventId": { + "Value": 1936419598 + }, + "m_eventSlotId": { + "m_id": "{E8B771CC-6CB6-4A6F-9642-123E6A62BC39}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{B3E9DEFA-DD55-495C-BCBD-BBB64C2F40E6}" + } + ], + "m_numExpectedArguments": 1 + } + }, + { + "Key": { + "Value": 2472403994 + }, + "Value": { + "m_eventName": "OnConfirmForgotPasswordSuccess", + "m_eventId": { + "Value": 2472403994 + }, + "m_eventSlotId": { + "m_id": "{5AB5FB72-2D60-45C6-B2F2-6509AF91DCAF}" + } + } + }, + { + "Key": { + "Value": 2512783036 + }, + "Value": { + "m_eventName": "OnConfirmSignUpSuccess", + "m_eventId": { + "Value": 2512783036 + }, + "m_eventSlotId": { + "m_id": "{E1E14BF9-5FC4-46F7-9284-BD971D6FBC7B}" + } + } + }, + { + "Key": { + "Value": 3917632075 + }, + "Value": { + "m_eventName": "OnForgotPasswordFail", + "m_eventId": { + "Value": 3917632075 + }, + "m_eventSlotId": { + "m_id": "{C4F9C1F5-8CE0-4FAB-8068-2CDACDFBC7FB}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{61352C5D-E634-4E36-86AE-95B0AA0C67F1}" + } + ], + "m_numExpectedArguments": 1 + } + }, + { + "Key": { + "Value": 4207060091 + }, + "Value": { + "m_eventName": "OnEmailSignUpFail", + "m_eventId": { + "Value": 4207060091 + }, + "m_eventSlotId": { + "m_id": "{373F06F3-3019-469D-9668-B312D3E29617}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{6C1ECF44-14DE-4A96-A8BD-E317C80438C6}" + } + ], + "m_numExpectedArguments": 1 + } + }, + { + "Key": { + "Value": 4239863912 + }, + "Value": { + "m_eventName": "OnPhoneSignUpFail", + "m_eventId": { + "Value": 4239863912 + }, + "m_eventSlotId": { + "m_id": "{BF5D1487-52AB-484E-B3A8-254126BCFBC8}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{1CABB198-AE36-4929-A562-2C87F7A90946}" + } + ], + "m_numExpectedArguments": 1 + } + } + ], + "m_ebusName": "AWSCognitoUserManagementNotificationBus", + "m_busId": { + "Value": 447348268 + } + } + } + }, + { + "Id": { + "id": 40383548617526 + }, + "Name": "SC-Node(EmailSignUpAsync)", + "Components": { + "Component_[3828998640319414642]": { + "$type": "{E42861BD-1956-45AE-8DD7-CCFC1E3E5ACF} Method", + "Id": 3828998640319414642, + "Slots": [ + { + "id": { + "m_id": "{E27599AA-ECCC-479A-98BF-48AEE61B2555}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + }, + null + ], + "slotName": "String: 0", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{402E454D-087A-4B52-8559-0B4094339424}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + }, + null + ], + "slotName": "String: 1", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{37232683-A75B-40D3-BD2C-ACBF718622AC}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + }, + null + ], + "slotName": "String: 2", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{A0AF5A68-C8DD-4219-894A-4D7AF713FDFE}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "In", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{49E3F422-E17F-4540-8C55-CDDB3F8AB04D}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Out", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + } + ], + "Datums": [ + { + "isOverloadedStorage": false, + "scriptCanvasType": { + "m_type": 5 + }, + "isNullPointer": false, + "$type": "{03AAAB3F-5C47-5A66-9EBC-D5FA4DB353C9} AZStd::string", + "value": "test1", + "label": "String: 0" + }, + { + "isOverloadedStorage": false, + "scriptCanvasType": { + "m_type": 5 + }, + "isNullPointer": false, + "$type": "{03AAAB3F-5C47-5A66-9EBC-D5FA4DB353C9} AZStd::string", + "value": "Test1test1!", + "label": "String: 1" + }, + { + "isOverloadedStorage": false, + "scriptCanvasType": { + "m_type": 5 + }, + "isNullPointer": false, + "$type": "{03AAAB3F-5C47-5A66-9EBC-D5FA4DB353C9} AZStd::string", + "value": "test@test.com", + "label": "String: 2" + } + ], + "methodType": 0, + "methodName": "EmailSignUpAsync", + "className": "AWSCognitoUserManagementRequestBus", + "resultSlotIDs": [ + {} + ], + "prettyClassName": "AWSCognitoUserManagementRequestBus" + } + } + }, + { + "Id": { + "id": 40374958682934 + }, + "Name": "EBusEventHandler", + "Components": { + "Component_[6190924263230371473]": { + "$type": "EBusEventHandler", + "Id": 6190924263230371473, + "Slots": [ + { + "id": { + "m_id": "{0D5A6F1C-B9DA-4B49-8A54-1E6C2A959643}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Connect", + "toolTip": "Connect this event handler to the specified entity.", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{6F93EEBD-6EE6-4204-8B56-4D3F17FC74AD}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Disconnect", + "toolTip": "Disconnect this event handler.", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{41DFB9B0-EDFA-4DE6-B0EB-E6C8F6A9ED89}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "OnConnected", + "toolTip": "Signaled when a connection has taken place.", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{556C7487-6211-4173-8284-51479E4C8EF7}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "OnDisconnected", + "toolTip": "Signaled when this event handler is disconnected.", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{FC800E36-B7D5-46AE-920A-0A18A2D17EB2}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "OnFailure", + "toolTip": "Signaled when it is not possible to connect this handler.", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{5F4DB496-438B-4ED5-96A0-904FE5FAC305}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "String", + "DisplayDataType": { + "m_type": 5 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{B24F20EF-0119-4BF3-86DF-AD101B534F6C}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnEmailSignUpSuccess", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + }, + { + "id": { + "m_id": "{BA735BFB-DE2B-429A-BEE9-59BA712F5F9F}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "String", + "DisplayDataType": { + "m_type": 5 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{7EC15743-5DA5-4F9F-BF26-318CFAD73C48}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnEmailSignUpFail", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + }, + { + "id": { + "m_id": "{4A63B81E-A64D-448A-AAC5-F232393F3239}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "String", + "DisplayDataType": { + "m_type": 5 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{694A22A4-0218-40EB-BC46-91F14C7A5691}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnPhoneSignUpSuccess", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + }, + { + "id": { + "m_id": "{E5EA8BAC-6706-4E56-868A-60EB944EEF59}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "String", + "DisplayDataType": { + "m_type": 5 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{F1DA9F8C-99A5-4604-A2EF-36AA7E2F29D8}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnPhoneSignUpFail", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + }, + { + "id": { + "m_id": "{2A9AD20F-7C0F-4BCD-AE49-59763368ADF3}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnConfirmSignUpSuccess", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + }, + { + "id": { + "m_id": "{708EA595-441A-4BED-B753-D612F9D8D48C}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "String", + "DisplayDataType": { + "m_type": 5 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{7AA88F7B-82B5-4EB6-BD6F-67C7662A5E53}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnConfirmSignUpFail", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + }, + { + "id": { + "m_id": "{2E3F658E-D482-49EA-9F96-C7421D85E490}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnForgotPasswordSuccess", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + }, + { + "id": { + "m_id": "{72F9D996-4A42-4740-A1F1-40CF2A922558}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "String", + "DisplayDataType": { + "m_type": 5 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{16098C3C-67EF-456D-8CEC-3E447D25FBE9}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnForgotPasswordFail", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + }, + { + "id": { + "m_id": "{3DA27A98-45AF-4A95-87CE-65D7A2C415A5}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnConfirmForgotPasswordSuccess", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + }, + { + "id": { + "m_id": "{593C97CF-5549-4E7B-8303-4FC61575BDD8}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "String", + "DisplayDataType": { + "m_type": 5 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{CE9ED266-ACD3-4182-A63A-D989B204781B}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnConfirmForgotPasswordFail", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + }, + { + "id": { + "m_id": "{C1BC60F1-4BE6-425D-AB01-B500171F095D}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnEnableMFASuccess", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + }, + { + "id": { + "m_id": "{B884A8B1-7037-46A9-8C62-0E2D46737C90}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "String", + "DisplayDataType": { + "m_type": 5 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{1A8274FB-20C8-42B3-B220-098EBEBCA53B}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnEnableMFAFail", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + } + ], + "m_eventMap": [ + { + "Key": { + "Value": 91595643 + }, + "Value": { + "m_eventName": "OnEnableMFAFail", + "m_eventId": { + "Value": 91595643 + }, + "m_eventSlotId": { + "m_id": "{1A8274FB-20C8-42B3-B220-098EBEBCA53B}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{B884A8B1-7037-46A9-8C62-0E2D46737C90}" + } + ], + "m_numExpectedArguments": 1 + } + }, + { + "Key": { + "Value": 263629761 + }, + "Value": { + "m_eventName": "OnPhoneSignUpSuccess", + "m_eventId": { + "Value": 263629761 + }, + "m_eventSlotId": { + "m_id": "{694A22A4-0218-40EB-BC46-91F14C7A5691}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{4A63B81E-A64D-448A-AAC5-F232393F3239}" + } + ], + "m_numExpectedArguments": 1 + } + }, + { + "Key": { + "Value": 545635257 + }, + "Value": { + "m_eventName": "OnConfirmForgotPasswordFail", + "m_eventId": { + "Value": 545635257 + }, + "m_eventSlotId": { + "m_id": "{CE9ED266-ACD3-4182-A63A-D989B204781B}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{593C97CF-5549-4E7B-8303-4FC61575BDD8}" + } + ], + "m_numExpectedArguments": 1 + } + }, + { + "Key": { + "Value": 613710915 + }, + "Value": { + "m_eventName": "OnEmailSignUpSuccess", + "m_eventId": { + "Value": 613710915 + }, + "m_eventSlotId": { + "m_id": "{B24F20EF-0119-4BF3-86DF-AD101B534F6C}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{5F4DB496-438B-4ED5-96A0-904FE5FAC305}" + } + ], + "m_numExpectedArguments": 1 + } + }, + { + "Key": { + "Value": 885366379 + }, + "Value": { + "m_eventName": "OnForgotPasswordSuccess", + "m_eventId": { + "Value": 885366379 + }, + "m_eventSlotId": { + "m_id": "{2E3F658E-D482-49EA-9F96-C7421D85E490}" + } + } + }, + { + "Key": { + "Value": 1053871188 + }, + "Value": { + "m_eventName": "OnEnableMFASuccess", + "m_eventId": { + "Value": 1053871188 + }, + "m_eventSlotId": { + "m_id": "{C1BC60F1-4BE6-425D-AB01-B500171F095D}" + } + } + }, + { + "Key": { + "Value": 1936419598 + }, + "Value": { + "m_eventName": "OnConfirmSignUpFail", + "m_eventId": { + "Value": 1936419598 + }, + "m_eventSlotId": { + "m_id": "{7AA88F7B-82B5-4EB6-BD6F-67C7662A5E53}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{708EA595-441A-4BED-B753-D612F9D8D48C}" + } + ], + "m_numExpectedArguments": 1 + } + }, + { + "Key": { + "Value": 2472403994 + }, + "Value": { + "m_eventName": "OnConfirmForgotPasswordSuccess", + "m_eventId": { + "Value": 2472403994 + }, + "m_eventSlotId": { + "m_id": "{3DA27A98-45AF-4A95-87CE-65D7A2C415A5}" + } + } + }, + { + "Key": { + "Value": 2512783036 + }, + "Value": { + "m_eventName": "OnConfirmSignUpSuccess", + "m_eventId": { + "Value": 2512783036 + }, + "m_eventSlotId": { + "m_id": "{2A9AD20F-7C0F-4BCD-AE49-59763368ADF3}" + } + } + }, + { + "Key": { + "Value": 3917632075 + }, + "Value": { + "m_eventName": "OnForgotPasswordFail", + "m_eventId": { + "Value": 3917632075 + }, + "m_eventSlotId": { + "m_id": "{16098C3C-67EF-456D-8CEC-3E447D25FBE9}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{72F9D996-4A42-4740-A1F1-40CF2A922558}" + } + ], + "m_numExpectedArguments": 1 + } + }, + { + "Key": { + "Value": 4207060091 + }, + "Value": { + "m_eventName": "OnEmailSignUpFail", + "m_eventId": { + "Value": 4207060091 + }, + "m_eventSlotId": { + "m_id": "{7EC15743-5DA5-4F9F-BF26-318CFAD73C48}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{BA735BFB-DE2B-429A-BEE9-59BA712F5F9F}" + } + ], + "m_numExpectedArguments": 1 + } + }, + { + "Key": { + "Value": 4239863912 + }, + "Value": { + "m_eventName": "OnPhoneSignUpFail", + "m_eventId": { + "Value": 4239863912 + }, + "m_eventSlotId": { + "m_id": "{F1DA9F8C-99A5-4604-A2EF-36AA7E2F29D8}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{E5EA8BAC-6706-4E56-868A-60EB944EEF59}" + } + ], + "m_numExpectedArguments": 1 + } + } + ], + "m_ebusName": "AWSCognitoUserManagementNotificationBus", + "m_busId": { + "Value": 447348268 + } + } + } + }, + { + "Id": { + "id": 40396433519414 + }, + "Name": "EBusEventHandler", + "Components": { + "Component_[9562653061197598154]": { + "$type": "EBusEventHandler", + "Id": 9562653061197598154, + "Slots": [ + { + "id": { + "m_id": "{C7C58DC9-B78B-42B9-B2B5-478782DF46CC}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Connect", + "toolTip": "Connect this event handler to the specified entity.", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{FA026675-B1BE-491C-8EBF-E69CC1DE4C55}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Disconnect", + "toolTip": "Disconnect this event handler.", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{3C98E6EB-3C18-4068-B823-DB58C576DD78}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "OnConnected", + "toolTip": "Signaled when a connection has taken place.", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{57A45446-FFB1-4C50-8AAE-B8ECA6972D6E}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "OnDisconnected", + "toolTip": "Signaled when this event handler is disconnected.", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{A58F08C9-B5EF-4B7B-9CA0-D7971A0433F8}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "OnFailure", + "toolTip": "Signaled when it is not possible to connect this handler.", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{725CF674-BE9B-46C9-97A9-F479446C0229}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Source", + "toolTip": "ID used to connect on a specific Event address (Type: EntityId)", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{3CBA71E9-D536-4236-9663-EB756D317B5C}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "EntityID", + "DisplayDataType": { + "m_type": 1 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{69BC10FD-BF05-4377-91D0-88540202AEAB}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnEntityActivated", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + }, + { + "id": { + "m_id": "{B715798E-51A1-4A13-8597-D0FED7A84D64}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "EntityID", + "DisplayDataType": { + "m_type": 1 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{0D15697C-1B42-4F19-BD0D-3A19CB516B61}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnEntityDeactivated", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + } + ], + "Datums": [ + { + "isOverloadedStorage": false, + "scriptCanvasType": { + "m_type": 1 + }, + "isNullPointer": false, + "$type": "EntityId", + "value": { + "id": 2901262558 + }, + "label": "Source" + } + ], + "m_eventMap": [ + { + "Key": { + "Value": 245425936 + }, + "Value": { + "m_eventName": "OnEntityActivated", + "m_eventId": { + "Value": 245425936 + }, + "m_eventSlotId": { + "m_id": "{69BC10FD-BF05-4377-91D0-88540202AEAB}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{3CBA71E9-D536-4236-9663-EB756D317B5C}" + } + ], + "m_numExpectedArguments": 1 + } + }, + { + "Key": { + "Value": 4273369222 + }, + "Value": { + "m_eventName": "OnEntityDeactivated", + "m_eventId": { + "Value": 4273369222 + }, + "m_eventSlotId": { + "m_id": "{0D15697C-1B42-4F19-BD0D-3A19CB516B61}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{B715798E-51A1-4A13-8597-D0FED7A84D64}" + } + ], + "m_numExpectedArguments": 1 + } + } + ], + "m_ebusName": "EntityBus", + "m_busId": { + "Value": 3358774020 + } + } + } + } + ], + "m_connections": [ + { + "Id": { + "id": 40405023454006 + }, + "Name": "srcEndpoint=(Initialize: Out), destEndpoint=(Initialize: In)", + "Components": { + "Component_[2481873747935739489]": { + "$type": "{64CA5016-E803-4AC4-9A36-BDA2C890C6EB} Connection", + "Id": 2481873747935739489, + "sourceEndpoint": { + "nodeId": { + "id": 40387843584822 + }, + "slotId": { + "m_id": "{12154F8B-6329-44B2-B220-25BBB4F4DA8C}" + } + }, + "targetEndpoint": { + "nodeId": { + "id": 40392138552118 + }, + "slotId": { + "m_id": "{399A9DE3-F888-4941-95ED-51DAA3577806}" + } + } + } + } + }, + { + "Id": { + "id": 40409318421302 + }, + "Name": "srcEndpoint=(Initialize: Out), destEndpoint=(EmailSignUpAsync: In)", + "Components": { + "Component_[7194362106206674212]": { + "$type": "{64CA5016-E803-4AC4-9A36-BDA2C890C6EB} Connection", + "Id": 7194362106206674212, + "sourceEndpoint": { + "nodeId": { + "id": 40392138552118 + }, + "slotId": { + "m_id": "{7E46FB7B-9FFF-49BE-8A8B-59A6144BB567}" + } + }, + "targetEndpoint": { + "nodeId": { + "id": 40383548617526 + }, + "slotId": { + "m_id": "{A0AF5A68-C8DD-4219-894A-4D7AF713FDFE}" + } + } + } + } + }, + { + "Id": { + "id": 40413613388598 + }, + "Name": "srcEndpoint=(AWSCognitoUserManagementNotificationBus Handler: ExecutionSlot:OnEmailSignUpSuccess), destEndpoint=(Print: In)", + "Components": { + "Component_[16780678604896909105]": { + "$type": "{64CA5016-E803-4AC4-9A36-BDA2C890C6EB} Connection", + "Id": 16780678604896909105, + "sourceEndpoint": { + "nodeId": { + "id": 40400728486710 + }, + "slotId": { + "m_id": "{6AA62561-DA82-4797-9DC4-615AB767F828}" + } + }, + "targetEndpoint": { + "nodeId": { + "id": 40370663715638 + }, + "slotId": { + "m_id": "{CE1EC1C9-479F-451E-BC7B-CF9A76C141B8}" + } + } + } + } + }, + { + "Id": { + "id": 40417908355894 + }, + "Name": "srcEndpoint=(AWSCognitoUserManagementNotificationBus Handler: ExecutionSlot:OnEmailSignUpFail), destEndpoint=(Print: In)", + "Components": { + "Component_[10089558926172181947]": { + "$type": "{64CA5016-E803-4AC4-9A36-BDA2C890C6EB} Connection", + "Id": 10089558926172181947, + "sourceEndpoint": { + "nodeId": { + "id": 40374958682934 + }, + "slotId": { + "m_id": "{7EC15743-5DA5-4F9F-BF26-318CFAD73C48}" + } + }, + "targetEndpoint": { + "nodeId": { + "id": 40379253650230 + }, + "slotId": { + "m_id": "{CE1EC1C9-479F-451E-BC7B-CF9A76C141B8}" + } + } + } + } + }, + { + "Id": { + "id": 40422203323190 + }, + "Name": "srcEndpoint=(EntityBus Handler: ExecutionSlot:OnEntityActivated), destEndpoint=(Initialize: In)", + "Components": { + "Component_[4722263728953193176]": { + "$type": "{64CA5016-E803-4AC4-9A36-BDA2C890C6EB} Connection", + "Id": 4722263728953193176, + "sourceEndpoint": { + "nodeId": { + "id": 40396433519414 + }, + "slotId": { + "m_id": "{69BC10FD-BF05-4377-91D0-88540202AEAB}" + } + }, + "targetEndpoint": { + "nodeId": { + "id": 40387843584822 + }, + "slotId": { + "m_id": "{3D4180D8-264F-40A6-B651-8AD9968800CD}" + } + } + } + } + } + ] + }, + "m_assetType": "{3E2AC8CD-713F-453E-967F-29517F331784}", + "versionData": { + "_grammarVersion": 1, + "_runtimeVersion": 1 + }, + "m_variableCounter": 1, + "GraphCanvasData": [ + { + "Key": { + "id": 40366368748342 + }, + "Value": { + "ComponentData": { + "{5F84B500-8C45-40D1-8EFC-A5306B241444}": { + "$type": "SceneComponentSaveData", + "ViewParams": { + "Scale": 1.6678291666562495, + "AnchorX": -1140.404541015625, + "AnchorY": -510.2441101074219 + } + } + } + } + }, + { + "Key": { + "id": 40370663715638 + }, + "Value": { + "ComponentData": { + "{24CB38BB-1705-4EC5-8F63-B574571B4DCD}": { + "$type": "NodeSaveData" + }, + "{328FF15C-C302-458F-A43D-E1794DE0904E}": { + "$type": "GeneralNodeTitleComponentSaveData", + "PaletteOverride": "StringNodeTitlePalette" + }, + "{7CC444B1-F9B3-41B5-841B-0C4F2179F111}": { + "$type": "GeometrySaveData", + "Position": [ + 360.0, + -100.0 + ] + }, + "{B0B99C8A-03AF-4CF6-A926-F65C874C3D97}": { + "$type": "StylingComponentSaveData" + }, + "{B1F49A35-8408-40DA-B79E-F1E3B64322CE}": { + "$type": "PersistentIdComponentSaveData", + "PersistentId": "{EE80C02E-C46C-4F8B-9ED1-F455EAA1A180}" + } + } + } + }, + { + "Key": { + "id": 40374958682934 + }, + "Value": { + "ComponentData": { + "{24CB38BB-1705-4EC5-8F63-B574571B4DCD}": { + "$type": "NodeSaveData" + }, + "{7CC444B1-F9B3-41B5-841B-0C4F2179F111}": { + "$type": "GeometrySaveData", + "Position": [ + -140.0, + 120.0 + ] + }, + "{9E81C95F-89C0-4476-8E82-63CCC4E52E04}": { + "$type": "EBusHandlerNodeDescriptorSaveData", + "EventIds": [ + { + "Value": 4207060091 + } + ] + }, + "{B0B99C8A-03AF-4CF6-A926-F65C874C3D97}": { + "$type": "StylingComponentSaveData" + }, + "{B1F49A35-8408-40DA-B79E-F1E3B64322CE}": { + "$type": "PersistentIdComponentSaveData", + "PersistentId": "{0CF6BEC2-1C77-4588-9E0D-46E669A885D2}" + } + } + } + }, + { + "Key": { + "id": 40379253650230 + }, + "Value": { + "ComponentData": { + "{24CB38BB-1705-4EC5-8F63-B574571B4DCD}": { + "$type": "NodeSaveData" + }, + "{328FF15C-C302-458F-A43D-E1794DE0904E}": { + "$type": "GeneralNodeTitleComponentSaveData", + "PaletteOverride": "StringNodeTitlePalette" + }, + "{7CC444B1-F9B3-41B5-841B-0C4F2179F111}": { + "$type": "GeometrySaveData", + "Position": [ + 360.0, + 120.0 + ] + }, + "{B0B99C8A-03AF-4CF6-A926-F65C874C3D97}": { + "$type": "StylingComponentSaveData" + }, + "{B1F49A35-8408-40DA-B79E-F1E3B64322CE}": { + "$type": "PersistentIdComponentSaveData", + "PersistentId": "{7D65DC37-A004-4B96-B546-3AA21955B483}" + } + } + } + }, + { + "Key": { + "id": 40383548617526 + }, + "Value": { + "ComponentData": { + "{24CB38BB-1705-4EC5-8F63-B574571B4DCD}": { + "$type": "NodeSaveData" + }, + "{328FF15C-C302-458F-A43D-E1794DE0904E}": { + "$type": "GeneralNodeTitleComponentSaveData", + "PaletteOverride": "MethodNodeTitlePalette" + }, + "{7CC444B1-F9B3-41B5-841B-0C4F2179F111}": { + "$type": "GeometrySaveData", + "Position": [ + -480.0, + -20.0 + ] + }, + "{B0B99C8A-03AF-4CF6-A926-F65C874C3D97}": { + "$type": "StylingComponentSaveData", + "SubStyle": ".method" + }, + "{B1F49A35-8408-40DA-B79E-F1E3B64322CE}": { + "$type": "PersistentIdComponentSaveData", + "PersistentId": "{0A62049A-7A6F-49C4-8941-2FFE8C3C3D64}" + } + } + } + }, + { + "Key": { + "id": 40387843584822 + }, + "Value": { + "ComponentData": { + "{24CB38BB-1705-4EC5-8F63-B574571B4DCD}": { + "$type": "NodeSaveData" + }, + "{328FF15C-C302-458F-A43D-E1794DE0904E}": { + "$type": "GeneralNodeTitleComponentSaveData", + "PaletteOverride": "MethodNodeTitlePalette" + }, + "{7CC444B1-F9B3-41B5-841B-0C4F2179F111}": { + "$type": "GeometrySaveData", + "Position": [ + -520.0, + -360.0 + ] + }, + "{B0B99C8A-03AF-4CF6-A926-F65C874C3D97}": { + "$type": "StylingComponentSaveData", + "SubStyle": ".method" + }, + "{B1F49A35-8408-40DA-B79E-F1E3B64322CE}": { + "$type": "PersistentIdComponentSaveData", + "PersistentId": "{F194EF69-4648-4E48-8E09-0BA9D7CFEFAB}" + } + } + } + }, + { + "Key": { + "id": 40392138552118 + }, + "Value": { + "ComponentData": { + "{24CB38BB-1705-4EC5-8F63-B574571B4DCD}": { + "$type": "NodeSaveData" + }, + "{328FF15C-C302-458F-A43D-E1794DE0904E}": { + "$type": "GeneralNodeTitleComponentSaveData", + "PaletteOverride": "MethodNodeTitlePalette" + }, + "{7CC444B1-F9B3-41B5-841B-0C4F2179F111}": { + "$type": "GeometrySaveData", + "Position": [ + -880.0, + -20.0 + ] + }, + "{B0B99C8A-03AF-4CF6-A926-F65C874C3D97}": { + "$type": "StylingComponentSaveData", + "SubStyle": ".method" + }, + "{B1F49A35-8408-40DA-B79E-F1E3B64322CE}": { + "$type": "PersistentIdComponentSaveData", + "PersistentId": "{64AC1AA7-3D00-49C8-B721-FD8FA1F12974}" + } + } + } + }, + { + "Key": { + "id": 40396433519414 + }, + "Value": { + "ComponentData": { + "{24CB38BB-1705-4EC5-8F63-B574571B4DCD}": { + "$type": "NodeSaveData" + }, + "{7CC444B1-F9B3-41B5-841B-0C4F2179F111}": { + "$type": "GeometrySaveData", + "Position": [ + -840.0, + -420.0 + ] + }, + "{9E81C95F-89C0-4476-8E82-63CCC4E52E04}": { + "$type": "EBusHandlerNodeDescriptorSaveData", + "EventIds": [ + { + "Value": 245425936 + } + ] + }, + "{B0B99C8A-03AF-4CF6-A926-F65C874C3D97}": { + "$type": "StylingComponentSaveData" + }, + "{B1F49A35-8408-40DA-B79E-F1E3B64322CE}": { + "$type": "PersistentIdComponentSaveData", + "PersistentId": "{BE098530-CD45-403F-A8E6-19B1AF955998}" + } + } + } + }, + { + "Key": { + "id": 40400728486710 + }, + "Value": { + "ComponentData": { + "{24CB38BB-1705-4EC5-8F63-B574571B4DCD}": { + "$type": "NodeSaveData" + }, + "{7CC444B1-F9B3-41B5-841B-0C4F2179F111}": { + "$type": "GeometrySaveData", + "Position": [ + -140.0, + -120.0 + ] + }, + "{9E81C95F-89C0-4476-8E82-63CCC4E52E04}": { + "$type": "EBusHandlerNodeDescriptorSaveData", + "EventIds": [ + { + "Value": 613710915 + } + ] + }, + "{B0B99C8A-03AF-4CF6-A926-F65C874C3D97}": { + "$type": "StylingComponentSaveData" + }, + "{B1F49A35-8408-40DA-B79E-F1E3B64322CE}": { + "$type": "PersistentIdComponentSaveData", + "PersistentId": "{30CAA4F3-6D33-487A-AA24-5A0FDB7E44F7}" + } + } + } + } + ], + "StatisticsHelper": { + "InstanceCounter": [ + { + "Key": 5842116761103598202, + "Value": 1 + }, + { + "Key": 5842117047185225035, + "Value": 1 + }, + { + "Key": 5842117058899013251, + "Value": 1 + }, + { + "Key": 10684225535275896474, + "Value": 2 + }, + { + "Key": 13774516312719521631, + "Value": 1 + }, + { + "Key": 13774516352051377806, + "Value": 1 + }, + { + "Key": 13774516392820282243, + "Value": 1 + } + ] + } + }, + "Component_[2611898449683772344]": { + "$type": "EditorGraphVariableManagerComponent", + "Id": 2611898449683772344, + "m_variableData": { + "m_nameVariableMap": [ + { + "Key": { + "m_id": "{B26AAA33-F9F0-4CC4-81B2-E7D666AD6AD7}" + }, + "Value": { + "Datum": { + "isOverloadedStorage": false, + "scriptCanvasType": { + "m_type": 4, + "m_azType": "{99DAD0BC-740E-5E82-826B-8FC7968CC02C}" + }, + "isNullPointer": false, + "$type": "{99DAD0BC-740E-5E82-826B-8FC7968CC02C} AZStd::vector", + "value": [ + "AWSCognitoIDP" + ], + "label": "Array" + }, + "VariableId": { + "m_id": "{B26AAA33-F9F0-4CC4-81B2-E7D666AD6AD7}" + }, + "VariableName": "AuthenitcationProviders" + } + } + ] + } + } + } + } + } +} \ No newline at end of file diff --git a/AutomatedTesting/ScriptCanvas/dynamodbdemo.scriptcanvas b/AutomatedTesting/ScriptCanvas/dynamodbdemo.scriptcanvas index 286ac12551..d2c67b44d4 100644 --- a/AutomatedTesting/ScriptCanvas/dynamodbdemo.scriptcanvas +++ b/AutomatedTesting/ScriptCanvas/dynamodbdemo.scriptcanvas @@ -1,3449 +1,2296 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +{ + "Type": "JsonSerialization", + "Version": 1, + "ClassName": "ScriptCanvasData", + "ClassData": { + "m_scriptCanvas": { + "Id": { + "id": 25003641416736 + }, + "Name": "dynamodbdemo", + "Components": { + "Component_[12786284990698687901]": { + "$type": "EditorGraphVariableManagerComponent", + "Id": 12786284990698687901, + "m_variableData": { + "m_nameVariableMap": [ + { + "Key": { + "m_id": "{2B4769A0-AA75-4F68-8D20-0AD04D6A1BA9}" + }, + "Value": { + "Datum": { + "isOverloadedStorage": false, + "scriptCanvasType": { + "m_type": 5 + }, + "isNullPointer": false, + "$type": "{03AAAB3F-5C47-5A66-9EBC-D5FA4DB353C9} AZStd::string", + "value": "AWSCore.ExampleDynamoTableOutput", + "label": "String" + }, + "VariableId": { + "m_id": "{2B4769A0-AA75-4F68-8D20-0AD04D6A1BA9}" + }, + "VariableName": "table_name_key" + } + }, + { + "Key": { + "m_id": "{DEACAA6F-08F8-4938-A260-434B5A54B410}" + }, + "Value": { + "Datum": { + "isOverloadedStorage": false, + "scriptCanvasType": { + "m_type": 4, + "m_azType": "{F8A7460C-2CC2-5755-AFDA-49B1109A751E}" + }, + "isNullPointer": false, + "$type": "{F8A7460C-2CC2-5755-AFDA-49B1109A751E} AZStd::unordered_map", + "value": { + "id": "{\"S\":\"Item1\"}" + }, + "label": "Map" + }, + "VariableId": { + "m_id": "{DEACAA6F-08F8-4938-A260-434B5A54B410}" + }, + "VariableName": "key_map" + } + } + ] + } + }, + "Component_[7996788827269998313]": { + "$type": "{4D755CA9-AB92-462C-B24F-0B3376F19967} Graph", + "Id": 7996788827269998313, + "m_graphData": { + "m_nodes": [ + { + "Id": { + "id": 25025116253216 + }, + "Name": "EBusEventHandler", + "Components": { + "Component_[10578822574531029496]": { + "$type": "EBusEventHandler", + "Id": 10578822574531029496, + "Slots": [ + { + "id": { + "m_id": "{0DFB0301-EE5F-48AC-BBD2-25837DA49111}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Connect", + "toolTip": "Connect this event handler to the specified entity.", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{79098ED5-37E6-4C63-B1A5-D78083283A20}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Disconnect", + "toolTip": "Disconnect this event handler.", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{EE099D12-FC92-4A08-87E2-02D818FD52E2}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "OnConnected", + "toolTip": "Signaled when a connection has taken place.", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{92B219B0-ADC0-4461-A355-0DC9166961A8}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "OnDisconnected", + "toolTip": "Signaled when this event handler is disconnected.", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{63FEE16A-8E8B-4A66-AC05-39AC3B68CA70}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "OnFailure", + "toolTip": "Signaled when it is not possible to connect this handler.", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{96E24F07-C49C-47FD-8933-77A4DD3782D6}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Map", + "DisplayDataType": { + "m_type": 4, + "m_azType": "{F8A7460C-2CC2-5755-AFDA-49B1109A751E}" + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{34979410-5B6E-4BEF-9A46-48FF67F4D19D}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnGetItemSuccess", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + }, + { + "id": { + "m_id": "{00E8811F-BC79-4E6A-A324-813F7BF2ECE9}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "String", + "DisplayDataType": { + "m_type": 5 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{ADCC15B8-DAA0-4640-8B18-B8F2A20902F4}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnGetItemError", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + } + ], + "m_eventMap": [ + { + "Key": { + "Value": 1385231939 + }, + "Value": { + "m_eventName": "OnGetItemSuccess", + "m_eventId": { + "Value": 1385231939 + }, + "m_eventSlotId": { + "m_id": "{34979410-5B6E-4BEF-9A46-48FF67F4D19D}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{96E24F07-C49C-47FD-8933-77A4DD3782D6}" + } + ], + "m_numExpectedArguments": 1 + } + }, + { + "Key": { + "Value": 1405981398 + }, + "Value": { + "m_eventName": "OnGetItemError", + "m_eventId": { + "Value": 1405981398 + }, + "m_eventSlotId": { + "m_id": "{ADCC15B8-DAA0-4640-8B18-B8F2A20902F4}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{00E8811F-BC79-4E6A-A324-813F7BF2ECE9}" + } + ], + "m_numExpectedArguments": 1 + } + } + ], + "m_ebusName": "AWSDynamoDBBehaviorNotificationBus", + "m_busId": { + "Value": 3574293420 + } + } + } + }, + { + "Id": { + "id": 25046591089696 + }, + "Name": "SC-Node(Print)", + "Components": { + "Component_[12835504459049783614]": { + "$type": "Print", + "Id": 12835504459049783614, + "Slots": [ + { + "id": { + "m_id": "{4AC9E45B-5710-46B1-9255-DAC034603396}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "In", + "toolTip": "Input signal", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{8EB7444E-C872-45C0-A1C4-6D40B0DE58FC}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Out", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + } + ], + "m_format": "[DynamoDB] Results finished", + "m_unresolvedString": [ + "[DynamoDB] Results finished" + ] + } + } + }, + { + "Id": { + "id": 25033706187808 + }, + "Name": "EBusEventHandler", + "Components": { + "Component_[13226838068173099848]": { + "$type": "EBusEventHandler", + "Id": 13226838068173099848, + "Slots": [ + { + "id": { + "m_id": "{9AE4F6B5-2537-4CB0-A138-EFEBF3E686BB}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Connect", + "toolTip": "Connect this event handler to the specified entity.", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{69F56189-B639-4B3F-8007-10E06B25306B}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Disconnect", + "toolTip": "Disconnect this event handler.", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{BFC17F2C-0B66-4CE8-9333-EDD20AD25AAE}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "OnConnected", + "toolTip": "Signaled when a connection has taken place.", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{CB2E6E03-4D7C-43F4-87E0-A4B859C7F9BD}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "OnDisconnected", + "toolTip": "Signaled when this event handler is disconnected.", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{B165F16F-AE65-4FB3-B59E-5D76A116DF17}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "OnFailure", + "toolTip": "Signaled when it is not possible to connect this handler.", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{8C1C768C-177A-4145-B28C-8992C3AF567A}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Map", + "DisplayDataType": { + "m_type": 4, + "m_azType": "{F8A7460C-2CC2-5755-AFDA-49B1109A751E}" + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{6C1B44FB-914A-48F0-8A51-16260B1FF1AC}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnGetItemSuccess", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + }, + { + "id": { + "m_id": "{C2325175-BC9A-4015-994F-708E943FD08A}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "String", + "DisplayDataType": { + "m_type": 5 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{ED0836C9-1CE1-4F90-9515-AEA304BA439D}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnGetItemError", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + } + ], + "m_eventMap": [ + { + "Key": { + "Value": 1385231939 + }, + "Value": { + "m_eventName": "OnGetItemSuccess", + "m_eventId": { + "Value": 1385231939 + }, + "m_eventSlotId": { + "m_id": "{6C1B44FB-914A-48F0-8A51-16260B1FF1AC}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{8C1C768C-177A-4145-B28C-8992C3AF567A}" + } + ], + "m_numExpectedArguments": 1 + } + }, + { + "Key": { + "Value": 1405981398 + }, + "Value": { + "m_eventName": "OnGetItemError", + "m_eventId": { + "Value": 1405981398 + }, + "m_eventSlotId": { + "m_id": "{ED0836C9-1CE1-4F90-9515-AEA304BA439D}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{C2325175-BC9A-4015-994F-708E943FD08A}" + } + ], + "m_numExpectedArguments": 1 + } + } + ], + "m_ebusName": "AWSDynamoDBBehaviorNotificationBus", + "m_busId": { + "Value": 3574293420 + } + } + } + }, + { + "Id": { + "id": 25029411220512 + }, + "Name": "SC-Node(Print)", + "Components": { + "Component_[13444839192692766618]": { + "$type": "Print", + "Id": 13444839192692766618, + "Slots": [ + { + "id": { + "m_id": "{725A6880-59C3-4965-9BEA-713C21960C6E}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "In", + "toolTip": "Input signal", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{6156DD7F-94E1-410B-8580-673E865DF025}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Out", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + } + ], + "m_format": "[DynamoDB] Get item completed", + "m_unresolvedString": [ + "[DynamoDB] Get item completed" + ] + } + } + }, + { + "Id": { + "id": 25038001155104 + }, + "Name": "SC Node(GetVariable)", + "Components": { + "Component_[17700179894112153065]": { + "$type": "GetVariableNode", + "Id": 17700179894112153065, + "Slots": [ + { + "id": { + "m_id": "{E50EF36D-58B3-4C76-AB5D-D25703D5E820}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "In", + "toolTip": "When signaled sends the property referenced by this node to a Data Output slot", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{9A669D64-DA34-4D0C-8BF1-D898D5943023}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Out", + "toolTip": "Signaled after the referenced property has been pushed to the Data Output slot", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{360DF30D-C247-4E89-80B0-8E1D6D5350A9}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Map", + "DisplayDataType": { + "m_type": 4, + "m_azType": "{F8A7460C-2CC2-5755-AFDA-49B1109A751E}" + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + } + ], + "m_variableId": { + "m_id": "{DEACAA6F-08F8-4938-A260-434B5A54B410}" + }, + "m_variableDataOutSlotId": { + "m_id": "{360DF30D-C247-4E89-80B0-8E1D6D5350A9}" + } + } + } + }, + { + "Id": { + "id": 25050886056992 + }, + "Name": "SC-Node(GetItem)", + "Components": { + "Component_[2045201123947147066]": { + "$type": "{E42861BD-1956-45AE-8DD7-CCFC1E3E5ACF} Method", + "Id": 2045201123947147066, + "Slots": [ + { + "id": { + "m_id": "{B432784A-0BFF-4407-BA12-03331DBC5D25}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + }, + null + ], + "slotName": "Table Resource KeyName", + "toolTip": "The name of the table containing the requested item.", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 2 + }, + "DataType": 1, + "IsReference": true, + "VariableReference": { + "m_id": "{2B4769A0-AA75-4F68-8D20-0AD04D6A1BA9}" + } + }, + { + "id": { + "m_id": "{DCFA66C5-6976-41ED-BE3D-5691B925F0EB}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + }, + null + ], + "slotName": "Key Map", + "toolTip": "A map of attribute names to AttributeValue objects, representing the primary key of the item to retrieve.", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{92E2E9A5-2605-45DA-9058-5616BF32649F}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "In", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{CEF34783-6020-4ABF-B10B-758CF1576805}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Out", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + } + ], + "Datums": [ + { + "isOverloadedStorage": false, + "scriptCanvasType": { + "m_type": 5 + }, + "isNullPointer": false, + "$type": "{03AAAB3F-5C47-5A66-9EBC-D5FA4DB353C9} AZStd::string", + "value": "ExampleDynamoTableOutput", + "label": "Table Resource KeyName" + }, + { + "isOverloadedStorage": false, + "scriptCanvasType": { + "m_type": 4, + "m_azType": "{F8A7460C-2CC2-5755-AFDA-49B1109A751E}" + }, + "isNullPointer": true, + "label": "Key Map" + } + ], + "methodType": 2, + "methodName": "GetItem", + "className": "AWSScriptBehaviorDynamoDB", + "resultSlotIDs": [ + {} + ], + "prettyClassName": "AWSScriptBehaviorDynamoDB" + } + } + }, + { + "Id": { + "id": 25016526318624 + }, + "Name": "SC-Node(ReloadConfigFile)", + "Components": { + "Component_[4821100336024757285]": { + "$type": "{E42861BD-1956-45AE-8DD7-CCFC1E3E5ACF} Method", + "Id": 4821100336024757285, + "Slots": [ + { + "id": { + "m_id": "{25D3CEFF-AFA5-4275-BCD2-893A6D0C285B}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + }, + null + ], + "slotName": "Is Reloading Config FileName", + "toolTip": "Whether reload resource mapping config file name from AWS core configuration settings registry file.", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{1AA65429-3605-41C6-99A4-829A11D859D7}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "In", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{5D5F5BE8-68D5-4533-8D40-FA5F3D2F4A0E}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Out", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + } + ], + "Datums": [ + { + "isOverloadedStorage": false, + "scriptCanvasType": { + "m_type": 0 + }, + "isNullPointer": false, + "$type": "bool", + "value": true, + "label": "Is Reloading Config FileName" + } + ], + "methodType": 0, + "methodName": "ReloadConfigFile", + "className": "AWSResourceMappingRequestBus", + "resultSlotIDs": [ + {} + ], + "prettyClassName": "AWSResourceMappingRequestBus" + } + } + }, + { + "Id": { + "id": 25020821285920 + }, + "Name": "SC-Node(ForEach)", + "Components": { + "Component_[8848962104837464421]": { + "$type": "ForEach", + "Id": 8848962104837464421, + "Slots": [ + { + "id": { + "m_id": "{D76E259C-CE63-478B-ACF8-83018378034E}" + }, + "DynamicTypeOverride": 2, + "contracts": [ + { + "$type": "SlotTypeContract" + }, + null + ], + "slotName": "Source", + "DisplayDataType": { + "m_type": 4, + "m_azType": "{F8A7460C-2CC2-5755-AFDA-49B1109A751E}" + }, + "Descriptor": { + "ConnectionType": 1, + "SlotType": 2 + }, + "DynamicGroup": { + "Value": 3089028177 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{1AC44C40-E18B-4297-B6BF-13A5CB07AFDD}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "In", + "toolTip": "Signaled upon node entry", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{4A657F68-4B8B-48DE-808F-D2040FB2E314}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Break", + "toolTip": "Stops the iteration when signaled", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{EE086437-7A08-4369-8E38-83866AD22DAE}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Each", + "toolTip": "Signalled after each element of the container", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{E6CD3DE4-70BB-4876-B944-5255E997A2C0}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Finished", + "toolTip": "The container has been fully iterated over", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{67F86833-7B8B-4EB8-952B-33BA2E99F17F}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "String", + "DisplayDataType": { + "m_type": 5 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{831A40AE-767D-45B8-BE36-4FB432D37A02}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "String", + "DisplayDataType": { + "m_type": 5 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + } + ], + "Datums": [ + { + "isOverloadedStorage": false, + "scriptCanvasType": { + "m_type": 4, + "m_azType": "{F8A7460C-2CC2-5755-AFDA-49B1109A751E}" + }, + "isNullPointer": true, + "label": "Source" + } + ], + "m_sourceSlot": { + "m_id": "{D76E259C-CE63-478B-ACF8-83018378034E}" + }, + "m_previousTypeId": "{F8A7460C-2CC2-5755-AFDA-49B1109A751E}", + "m_propertySlots": [ + { + "m_propertySlotId": { + "m_id": "{67F86833-7B8B-4EB8-952B-33BA2E99F17F}" + }, + "m_propertyType": { + "m_type": 5 + }, + "m_propertyName": "String" + }, + { + "m_propertySlotId": { + "m_id": "{831A40AE-767D-45B8-BE36-4FB432D37A02}" + }, + "m_propertyType": { + "m_type": 5 + }, + "m_propertyName": "String" + } + ] + } + } + }, + { + "Id": { + "id": 25012231351328 + }, + "Name": "SC-Node(Print)", + "Components": { + "Component_[9330046059516327092]": { + "$type": "Print", + "Id": 9330046059516327092, + "Slots": [ + { + "id": { + "m_id": "{DF1E0DDB-6E1C-49E1-833C-D77642B634B9}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "In", + "toolTip": "Input signal", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{886F934E-F03B-458C-9624-27948F9BE968}" + }, + "DynamicTypeOverride": 3, + "contracts": [ + { + "$type": "SlotTypeContract" + }, + null + ], + "slotName": "Value", + "toolTip": "Value which replaces instances of {Value} in the resulting string.", + "DisplayDataType": { + "m_type": 5 + }, + "DisplayGroup": { + "Value": 1015031923 + }, + "Descriptor": { + "ConnectionType": 1, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{3753E1B8-D99A-4F25-8C3A-899A9E84742A}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Out", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + } + ], + "Datums": [ + { + "isOverloadedStorage": false, + "scriptCanvasType": { + "m_type": 5 + }, + "isNullPointer": false, + "$type": "{03AAAB3F-5C47-5A66-9EBC-D5FA4DB353C9} AZStd::string", + "value": "", + "label": "Value" + } + ], + "m_format": "[DynamoDB] Error: {Value}", + "m_arrayBindingMap": [ + { + "Key": 1, + "Value": { + "m_id": "{886F934E-F03B-458C-9624-27948F9BE968}" + } + } + ], + "m_unresolvedString": [ + "[DynamoDB] Error: ", + {} + ], + "m_formatSlotMap": { + "Value": { + "m_id": "{886F934E-F03B-458C-9624-27948F9BE968}" + } + } + } + } + }, + { + "Id": { + "id": 25007936384032 + }, + "Name": "SC-Node(Print)", + "Components": { + "Component_[9330046059516327092]": { + "$type": "Print", + "Id": 9330046059516327092, + "Slots": [ + { + "id": { + "m_id": "{DF1E0DDB-6E1C-49E1-833C-D77642B634B9}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "In", + "toolTip": "Input signal", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{886F934E-F03B-458C-9624-27948F9BE968}" + }, + "DynamicTypeOverride": 3, + "contracts": [ + { + "$type": "SlotTypeContract" + }, + null + ], + "slotName": "Value", + "toolTip": "Value which replaces instances of {Value} in the resulting string.", + "DisplayDataType": { + "m_type": 5 + }, + "DisplayGroup": { + "Value": 1015031923 + }, + "Descriptor": { + "ConnectionType": 1, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{D725EFD5-970D-4182-8913-F8BD005843FF}" + }, + "DynamicTypeOverride": 3, + "contracts": [ + { + "$type": "SlotTypeContract" + }, + null + ], + "slotName": "Value_1", + "toolTip": "Value which replaces instances of {Value_1} in the resulting string.", + "DisplayDataType": { + "m_type": 5 + }, + "DisplayGroup": { + "Value": 1015031923 + }, + "Descriptor": { + "ConnectionType": 1, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{3753E1B8-D99A-4F25-8C3A-899A9E84742A}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Out", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + } + ], + "Datums": [ + { + "isOverloadedStorage": false, + "scriptCanvasType": { + "m_type": 5 + }, + "isNullPointer": false, + "$type": "{03AAAB3F-5C47-5A66-9EBC-D5FA4DB353C9} AZStd::string", + "value": "", + "label": "Value" + }, + { + "isOverloadedStorage": false, + "scriptCanvasType": { + "m_type": 5 + }, + "isNullPointer": false, + "$type": "{03AAAB3F-5C47-5A66-9EBC-D5FA4DB353C9} AZStd::string", + "value": "", + "label": "Value_1" + } + ], + "m_format": "{Value}: {Value_1}", + "m_arrayBindingMap": [ + { + "Key": 1, + "Value": { + "m_id": "{886F934E-F03B-458C-9624-27948F9BE968}" + } + }, + { + "Key": 3, + "Value": { + "m_id": "{D725EFD5-970D-4182-8913-F8BD005843FF}" + } + } + ], + "m_unresolvedString": [ + {}, + {}, + ": ", + {} + ], + "m_formatSlotMap": { + "Value": { + "m_id": "{886F934E-F03B-458C-9624-27948F9BE968}" + }, + "Value_1": { + "m_id": "{D725EFD5-970D-4182-8913-F8BD005843FF}" + } + } + } + } + }, + { + "Id": { + "id": 25042296122400 + }, + "Name": "EBusEventHandler", + "Components": { + "Component_[9609589719561271825]": { + "$type": "EBusEventHandler", + "Id": 9609589719561271825, + "Slots": [ + { + "id": { + "m_id": "{B93CBA9F-469B-4C6F-BD79-50375AD3C27F}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Connect", + "toolTip": "Connect this event handler to the specified entity.", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{610D578A-D6C6-43E0-944F-719383606327}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Disconnect", + "toolTip": "Disconnect this event handler.", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{CD898A2F-56E2-40E5-B3EA-EAB098334C08}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "OnConnected", + "toolTip": "Signaled when a connection has taken place.", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{F8727284-7903-4074-935E-36F7885A0248}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "OnDisconnected", + "toolTip": "Signaled when this event handler is disconnected.", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{E93B874F-2AE3-4E1D-AA68-59B1C1EE4933}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "OnFailure", + "toolTip": "Signaled when it is not possible to connect this handler.", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{C4CAFE95-89EB-401F-89EF-C25307ACF59A}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Source", + "toolTip": "ID used to connect on a specific Event address (Type: EntityId)", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{462005BF-42CE-433D-ADC6-8B5699DEFD82}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "EntityID", + "DisplayDataType": { + "m_type": 1 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{A8CD4D6B-660C-4D19-9498-D802AB4AD958}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnEntityActivated", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + }, + { + "id": { + "m_id": "{132B287B-5DB7-4D1F-B98E-D22D000474CC}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "EntityID", + "DisplayDataType": { + "m_type": 1 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{979491D8-D45E-4477-9728-2F8EC559BAE4}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnEntityDeactivated", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + } + ], + "Datums": [ + { + "isOverloadedStorage": false, + "scriptCanvasType": { + "m_type": 1 + }, + "isNullPointer": false, + "$type": "EntityId", + "value": { + "id": 2901262558 + }, + "label": "Source" + } + ], + "m_eventMap": [ + { + "Key": { + "Value": 245425936 + }, + "Value": { + "m_eventName": "OnEntityActivated", + "m_eventId": { + "Value": 245425936 + }, + "m_eventSlotId": { + "m_id": "{A8CD4D6B-660C-4D19-9498-D802AB4AD958}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{462005BF-42CE-433D-ADC6-8B5699DEFD82}" + } + ], + "m_numExpectedArguments": 1 + } + }, + { + "Key": { + "Value": 4273369222 + }, + "Value": { + "m_eventName": "OnEntityDeactivated", + "m_eventId": { + "Value": 4273369222 + }, + "m_eventSlotId": { + "m_id": "{979491D8-D45E-4477-9728-2F8EC559BAE4}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{132B287B-5DB7-4D1F-B98E-D22D000474CC}" + } + ], + "m_numExpectedArguments": 1 + } + } + ], + "m_ebusName": "EntityBus", + "m_busId": { + "Value": 3358774020 + } + } + } + } + ], + "m_connections": [ + { + "Id": { + "id": 25055181024288 + }, + "Name": "srcEndpoint=(For Each: Each), destEndpoint=(Print: In)", + "Components": { + "Component_[5981589240511962073]": { + "$type": "{64CA5016-E803-4AC4-9A36-BDA2C890C6EB} Connection", + "Id": 5981589240511962073, + "sourceEndpoint": { + "nodeId": { + "id": 25020821285920 + }, + "slotId": { + "m_id": "{EE086437-7A08-4369-8E38-83866AD22DAE}" + } + }, + "targetEndpoint": { + "nodeId": { + "id": 25007936384032 + }, + "slotId": { + "m_id": "{DF1E0DDB-6E1C-49E1-833C-D77642B634B9}" + } + } + } + } + }, + { + "Id": { + "id": 25059475991584 + }, + "Name": "srcEndpoint=(AWSDynamoDBBehaviorNotificationBus Handler: Map), destEndpoint=(For Each: Source)", + "Components": { + "Component_[5561798385961633452]": { + "$type": "{64CA5016-E803-4AC4-9A36-BDA2C890C6EB} Connection", + "Id": 5561798385961633452, + "sourceEndpoint": { + "nodeId": { + "id": 25025116253216 + }, + "slotId": { + "m_id": "{96E24F07-C49C-47FD-8933-77A4DD3782D6}" + } + }, + "targetEndpoint": { + "nodeId": { + "id": 25020821285920 + }, + "slotId": { + "m_id": "{D76E259C-CE63-478B-ACF8-83018378034E}" + } + } + } + } + }, + { + "Id": { + "id": 25063770958880 + }, + "Name": "srcEndpoint=(AWSDynamoDBBehaviorNotificationBus Handler: ExecutionSlot:OnGetItemSuccess), destEndpoint=(For Each: In)", + "Components": { + "Component_[4777785631376877414]": { + "$type": "{64CA5016-E803-4AC4-9A36-BDA2C890C6EB} Connection", + "Id": 4777785631376877414, + "sourceEndpoint": { + "nodeId": { + "id": 25025116253216 + }, + "slotId": { + "m_id": "{34979410-5B6E-4BEF-9A46-48FF67F4D19D}" + } + }, + "targetEndpoint": { + "nodeId": { + "id": 25020821285920 + }, + "slotId": { + "m_id": "{1AC44C40-E18B-4297-B6BF-13A5CB07AFDD}" + } + } + } + } + }, + { + "Id": { + "id": 25068065926176 + }, + "Name": "srcEndpoint=(For Each: String), destEndpoint=(Print: Value)", + "Components": { + "Component_[4288056568853910529]": { + "$type": "{64CA5016-E803-4AC4-9A36-BDA2C890C6EB} Connection", + "Id": 4288056568853910529, + "sourceEndpoint": { + "nodeId": { + "id": 25020821285920 + }, + "slotId": { + "m_id": "{67F86833-7B8B-4EB8-952B-33BA2E99F17F}" + } + }, + "targetEndpoint": { + "nodeId": { + "id": 25007936384032 + }, + "slotId": { + "m_id": "{886F934E-F03B-458C-9624-27948F9BE968}" + } + } + } + } + }, + { + "Id": { + "id": 25072360893472 + }, + "Name": "srcEndpoint=(For Each: Finished), destEndpoint=(Print: In)", + "Components": { + "Component_[6176670532939452292]": { + "$type": "{64CA5016-E803-4AC4-9A36-BDA2C890C6EB} Connection", + "Id": 6176670532939452292, + "sourceEndpoint": { + "nodeId": { + "id": 25020821285920 + }, + "slotId": { + "m_id": "{E6CD3DE4-70BB-4876-B944-5255E997A2C0}" + } + }, + "targetEndpoint": { + "nodeId": { + "id": 25046591089696 + }, + "slotId": { + "m_id": "{4AC9E45B-5710-46B1-9255-DAC034603396}" + } + } + } + } + }, + { + "Id": { + "id": 25076655860768 + }, + "Name": "srcEndpoint=(AWSDynamoDBBehaviorNotificationBus Handler: ExecutionSlot:OnGetItemError), destEndpoint=(Print: In)", + "Components": { + "Component_[16360665037994631473]": { + "$type": "{64CA5016-E803-4AC4-9A36-BDA2C890C6EB} Connection", + "Id": 16360665037994631473, + "sourceEndpoint": { + "nodeId": { + "id": 25033706187808 + }, + "slotId": { + "m_id": "{ED0836C9-1CE1-4F90-9515-AEA304BA439D}" + } + }, + "targetEndpoint": { + "nodeId": { + "id": 25012231351328 + }, + "slotId": { + "m_id": "{DF1E0DDB-6E1C-49E1-833C-D77642B634B9}" + } + } + } + } + }, + { + "Id": { + "id": 25080950828064 + }, + "Name": "srcEndpoint=(AWSDynamoDBBehaviorNotificationBus Handler: String), destEndpoint=(Print: Value)", + "Components": { + "Component_[10819323363841801505]": { + "$type": "{64CA5016-E803-4AC4-9A36-BDA2C890C6EB} Connection", + "Id": 10819323363841801505, + "sourceEndpoint": { + "nodeId": { + "id": 25033706187808 + }, + "slotId": { + "m_id": "{C2325175-BC9A-4015-994F-708E943FD08A}" + } + }, + "targetEndpoint": { + "nodeId": { + "id": 25012231351328 + }, + "slotId": { + "m_id": "{886F934E-F03B-458C-9624-27948F9BE968}" + } + } + } + } + }, + { + "Id": { + "id": 25085245795360 + }, + "Name": "srcEndpoint=(For Each: String), destEndpoint=(Print: Value_1)", + "Components": { + "Component_[13063015828816681184]": { + "$type": "{64CA5016-E803-4AC4-9A36-BDA2C890C6EB} Connection", + "Id": 13063015828816681184, + "sourceEndpoint": { + "nodeId": { + "id": 25020821285920 + }, + "slotId": { + "m_id": "{831A40AE-767D-45B8-BE36-4FB432D37A02}" + } + }, + "targetEndpoint": { + "nodeId": { + "id": 25007936384032 + }, + "slotId": { + "m_id": "{D725EFD5-970D-4182-8913-F8BD005843FF}" + } + } + } + } + }, + { + "Id": { + "id": 25089540762656 + }, + "Name": "srcEndpoint=(ReloadConfigFile: Out), destEndpoint=(Get Variable: In)", + "Components": { + "Component_[18422701704926868421]": { + "$type": "{64CA5016-E803-4AC4-9A36-BDA2C890C6EB} Connection", + "Id": 18422701704926868421, + "sourceEndpoint": { + "nodeId": { + "id": 25016526318624 + }, + "slotId": { + "m_id": "{5D5F5BE8-68D5-4533-8D40-FA5F3D2F4A0E}" + } + }, + "targetEndpoint": { + "nodeId": { + "id": 25038001155104 + }, + "slotId": { + "m_id": "{E50EF36D-58B3-4C76-AB5D-D25703D5E820}" + } + } + } + } + }, + { + "Id": { + "id": 25093835729952 + }, + "Name": "srcEndpoint=(GetItem: Out), destEndpoint=(Print: In)", + "Components": { + "Component_[11329868553246834497]": { + "$type": "{64CA5016-E803-4AC4-9A36-BDA2C890C6EB} Connection", + "Id": 11329868553246834497, + "sourceEndpoint": { + "nodeId": { + "id": 25050886056992 + }, + "slotId": { + "m_id": "{CEF34783-6020-4ABF-B10B-758CF1576805}" + } + }, + "targetEndpoint": { + "nodeId": { + "id": 25029411220512 + }, + "slotId": { + "m_id": "{725A6880-59C3-4965-9BEA-713C21960C6E}" + } + } + } + } + }, + { + "Id": { + "id": 25098130697248 + }, + "Name": "srcEndpoint=(Get Variable: Out), destEndpoint=(GetItem: In)", + "Components": { + "Component_[296789729353182089]": { + "$type": "{64CA5016-E803-4AC4-9A36-BDA2C890C6EB} Connection", + "Id": 296789729353182089, + "sourceEndpoint": { + "nodeId": { + "id": 25038001155104 + }, + "slotId": { + "m_id": "{9A669D64-DA34-4D0C-8BF1-D898D5943023}" + } + }, + "targetEndpoint": { + "nodeId": { + "id": 25050886056992 + }, + "slotId": { + "m_id": "{92E2E9A5-2605-45DA-9058-5616BF32649F}" + } + } + } + } + }, + { + "Id": { + "id": 25102425664544 + }, + "Name": "srcEndpoint=(Get Variable: Map), destEndpoint=(GetItem: Key Map)", + "Components": { + "Component_[10402484137467106144]": { + "$type": "{64CA5016-E803-4AC4-9A36-BDA2C890C6EB} Connection", + "Id": 10402484137467106144, + "sourceEndpoint": { + "nodeId": { + "id": 25038001155104 + }, + "slotId": { + "m_id": "{360DF30D-C247-4E89-80B0-8E1D6D5350A9}" + } + }, + "targetEndpoint": { + "nodeId": { + "id": 25050886056992 + }, + "slotId": { + "m_id": "{DCFA66C5-6976-41ED-BE3D-5691B925F0EB}" + } + } + } + } + }, + { + "Id": { + "id": 25106720631840 + }, + "Name": "srcEndpoint=(EntityBus Handler: ExecutionSlot:OnEntityActivated), destEndpoint=(ReloadConfigFile: In)", + "Components": { + "Component_[16720125412018333818]": { + "$type": "{64CA5016-E803-4AC4-9A36-BDA2C890C6EB} Connection", + "Id": 16720125412018333818, + "sourceEndpoint": { + "nodeId": { + "id": 25042296122400 + }, + "slotId": { + "m_id": "{A8CD4D6B-660C-4D19-9498-D802AB4AD958}" + } + }, + "targetEndpoint": { + "nodeId": { + "id": 25016526318624 + }, + "slotId": { + "m_id": "{1AA65429-3605-41C6-99A4-829A11D859D7}" + } + } + } + } + } + ] + }, + "m_assetType": "{3E2AC8CD-713F-453E-967F-29517F331784}", + "versionData": { + "_grammarVersion": 1, + "_runtimeVersion": 1 + }, + "m_variableCounter": 5, + "GraphCanvasData": [ + { + "Key": { + "id": 25003641416736 + }, + "Value": { + "ComponentData": { + "{5F84B500-8C45-40D1-8EFC-A5306B241444}": { + "$type": "SceneComponentSaveData", + "ViewParams": { + "Scale": 0.7826294, + "AnchorX": -546.8744506835938, + "AnchorY": -167.38446044921875 + } + } + } + } + }, + { + "Key": { + "id": 25007936384032 + }, + "Value": { + "ComponentData": { + "{24CB38BB-1705-4EC5-8F63-B574571B4DCD}": { + "$type": "NodeSaveData" + }, + "{328FF15C-C302-458F-A43D-E1794DE0904E}": { + "$type": "GeneralNodeTitleComponentSaveData", + "PaletteOverride": "StringNodeTitlePalette" + }, + "{7CC444B1-F9B3-41B5-841B-0C4F2179F111}": { + "$type": "GeometrySaveData", + "Position": [ + 480.0, + 680.0 + ] + }, + "{B0B99C8A-03AF-4CF6-A926-F65C874C3D97}": { + "$type": "StylingComponentSaveData" + }, + "{B1F49A35-8408-40DA-B79E-F1E3B64322CE}": { + "$type": "PersistentIdComponentSaveData", + "PersistentId": "{C481D523-9BFE-4FEB-ADFC-5EE73734E510}" + } + } + } + }, + { + "Key": { + "id": 25012231351328 + }, + "Value": { + "ComponentData": { + "{24CB38BB-1705-4EC5-8F63-B574571B4DCD}": { + "$type": "NodeSaveData" + }, + "{328FF15C-C302-458F-A43D-E1794DE0904E}": { + "$type": "GeneralNodeTitleComponentSaveData", + "PaletteOverride": "StringNodeTitlePalette" + }, + "{7CC444B1-F9B3-41B5-841B-0C4F2179F111}": { + "$type": "GeometrySaveData", + "Position": [ + 160.0, + 400.0 + ] + }, + "{B0B99C8A-03AF-4CF6-A926-F65C874C3D97}": { + "$type": "StylingComponentSaveData" + }, + "{B1F49A35-8408-40DA-B79E-F1E3B64322CE}": { + "$type": "PersistentIdComponentSaveData", + "PersistentId": "{A1019F85-E1ED-4A76-A5F2-D18B69A3F7C8}" + } + } + } + }, + { + "Key": { + "id": 25016526318624 + }, + "Value": { + "ComponentData": { + "{24CB38BB-1705-4EC5-8F63-B574571B4DCD}": { + "$type": "NodeSaveData" + }, + "{328FF15C-C302-458F-A43D-E1794DE0904E}": { + "$type": "GeneralNodeTitleComponentSaveData", + "PaletteOverride": "MethodNodeTitlePalette" + }, + "{7CC444B1-F9B3-41B5-841B-0C4F2179F111}": { + "$type": "GeometrySaveData", + "Position": [ + -20.0, + 160.0 + ] + }, + "{B0B99C8A-03AF-4CF6-A926-F65C874C3D97}": { + "$type": "StylingComponentSaveData", + "SubStyle": ".method" + }, + "{B1F49A35-8408-40DA-B79E-F1E3B64322CE}": { + "$type": "PersistentIdComponentSaveData", + "PersistentId": "{BCD5F6D2-6A82-47D9-8C02-D02C298C22A5}" + } + } + } + }, + { + "Key": { + "id": 25020821285920 + }, + "Value": { + "ComponentData": { + "{24CB38BB-1705-4EC5-8F63-B574571B4DCD}": { + "$type": "NodeSaveData" + }, + "{328FF15C-C302-458F-A43D-E1794DE0904E}": { + "$type": "GeneralNodeTitleComponentSaveData", + "PaletteOverride": "DefaultNodeTitlePalette" + }, + "{7CC444B1-F9B3-41B5-841B-0C4F2179F111}": { + "$type": "GeometrySaveData", + "Position": [ + 160.0, + 680.0 + ] + }, + "{B0B99C8A-03AF-4CF6-A926-F65C874C3D97}": { + "$type": "StylingComponentSaveData" + }, + "{B1F49A35-8408-40DA-B79E-F1E3B64322CE}": { + "$type": "PersistentIdComponentSaveData", + "PersistentId": "{13F6FDDB-D161-4587-9F30-F617D012A062}" + } + } + } + }, + { + "Key": { + "id": 25025116253216 + }, + "Value": { + "ComponentData": { + "{24CB38BB-1705-4EC5-8F63-B574571B4DCD}": { + "$type": "NodeSaveData" + }, + "{7CC444B1-F9B3-41B5-841B-0C4F2179F111}": { + "$type": "GeometrySaveData", + "Position": [ + -140.0, + 640.0 + ] + }, + "{9E81C95F-89C0-4476-8E82-63CCC4E52E04}": { + "$type": "EBusHandlerNodeDescriptorSaveData", + "EventIds": [ + { + "Value": 1385231939 + } + ] + }, + "{B0B99C8A-03AF-4CF6-A926-F65C874C3D97}": { + "$type": "StylingComponentSaveData" + }, + "{B1F49A35-8408-40DA-B79E-F1E3B64322CE}": { + "$type": "PersistentIdComponentSaveData", + "PersistentId": "{21DC5FA5-0109-4A1B-8350-50A25A09290A}" + } + } + } + }, + { + "Key": { + "id": 25029411220512 + }, + "Value": { + "ComponentData": { + "{24CB38BB-1705-4EC5-8F63-B574571B4DCD}": { + "$type": "NodeSaveData" + }, + "{328FF15C-C302-458F-A43D-E1794DE0904E}": { + "$type": "GeneralNodeTitleComponentSaveData", + "PaletteOverride": "StringNodeTitlePalette" + }, + "{7CC444B1-F9B3-41B5-841B-0C4F2179F111}": { + "$type": "GeometrySaveData", + "Position": [ + 1120.0, + 80.0 + ] + }, + "{B0B99C8A-03AF-4CF6-A926-F65C874C3D97}": { + "$type": "StylingComponentSaveData" + }, + "{B1F49A35-8408-40DA-B79E-F1E3B64322CE}": { + "$type": "PersistentIdComponentSaveData", + "PersistentId": "{7F310716-7DCD-4C1F-8B62-88E907179D89}" + } + } + } + }, + { + "Key": { + "id": 25033706187808 + }, + "Value": { + "ComponentData": { + "{24CB38BB-1705-4EC5-8F63-B574571B4DCD}": { + "$type": "NodeSaveData" + }, + "{7CC444B1-F9B3-41B5-841B-0C4F2179F111}": { + "$type": "GeometrySaveData", + "Position": [ + -140.0, + 380.0 + ] + }, + "{9E81C95F-89C0-4476-8E82-63CCC4E52E04}": { + "$type": "EBusHandlerNodeDescriptorSaveData", + "EventIds": [ + { + "Value": 1405981398 + } + ] + }, + "{B0B99C8A-03AF-4CF6-A926-F65C874C3D97}": { + "$type": "StylingComponentSaveData" + }, + "{B1F49A35-8408-40DA-B79E-F1E3B64322CE}": { + "$type": "PersistentIdComponentSaveData", + "PersistentId": "{4AC68669-891A-48EA-93D3-1C210C117298}" + } + } + } + }, + { + "Key": { + "id": 25038001155104 + }, + "Value": { + "ComponentData": { + "{24CB38BB-1705-4EC5-8F63-B574571B4DCD}": { + "$type": "NodeSaveData" + }, + "{328FF15C-C302-458F-A43D-E1794DE0904E}": { + "$type": "GeneralNodeTitleComponentSaveData", + "PaletteOverride": "GetVariableNodeTitlePalette" + }, + "{7CC444B1-F9B3-41B5-841B-0C4F2179F111}": { + "$type": "GeometrySaveData", + "Position": [ + 320.0, + 120.0 + ] + }, + "{B0B99C8A-03AF-4CF6-A926-F65C874C3D97}": { + "$type": "StylingComponentSaveData", + "SubStyle": ".getVariable" + }, + "{B1F49A35-8408-40DA-B79E-F1E3B64322CE}": { + "$type": "PersistentIdComponentSaveData", + "PersistentId": "{B6D7974B-646A-4089-A530-7F6EB3C28328}" + } + } + } + }, + { + "Key": { + "id": 25042296122400 + }, + "Value": { + "ComponentData": { + "{24CB38BB-1705-4EC5-8F63-B574571B4DCD}": { + "$type": "NodeSaveData" + }, + "{7CC444B1-F9B3-41B5-841B-0C4F2179F111}": { + "$type": "GeometrySaveData", + "Position": [ + -360.0, + 100.0 + ] + }, + "{9E81C95F-89C0-4476-8E82-63CCC4E52E04}": { + "$type": "EBusHandlerNodeDescriptorSaveData", + "EventIds": [ + { + "Value": 245425936 + } + ] + }, + "{B0B99C8A-03AF-4CF6-A926-F65C874C3D97}": { + "$type": "StylingComponentSaveData" + }, + "{B1F49A35-8408-40DA-B79E-F1E3B64322CE}": { + "$type": "PersistentIdComponentSaveData", + "PersistentId": "{9D1121A0-707F-47A8-A1D9-6C3FF54ED9F8}" + } + } + } + }, + { + "Key": { + "id": 25046591089696 + }, + "Value": { + "ComponentData": { + "{24CB38BB-1705-4EC5-8F63-B574571B4DCD}": { + "$type": "NodeSaveData" + }, + "{328FF15C-C302-458F-A43D-E1794DE0904E}": { + "$type": "GeneralNodeTitleComponentSaveData", + "PaletteOverride": "StringNodeTitlePalette" + }, + "{7CC444B1-F9B3-41B5-841B-0C4F2179F111}": { + "$type": "GeometrySaveData", + "Position": [ + 480.0, + 960.0 + ] + }, + "{B0B99C8A-03AF-4CF6-A926-F65C874C3D97}": { + "$type": "StylingComponentSaveData" + }, + "{B1F49A35-8408-40DA-B79E-F1E3B64322CE}": { + "$type": "PersistentIdComponentSaveData", + "PersistentId": "{58E0C332-FAA1-419E-8F67-A0D057D90EF3}" + } + } + } + }, + { + "Key": { + "id": 25050886056992 + }, + "Value": { + "ComponentData": { + "{24CB38BB-1705-4EC5-8F63-B574571B4DCD}": { + "$type": "NodeSaveData" + }, + "{328FF15C-C302-458F-A43D-E1794DE0904E}": { + "$type": "GeneralNodeTitleComponentSaveData", + "PaletteOverride": "MethodNodeTitlePalette" + }, + "{7CC444B1-F9B3-41B5-841B-0C4F2179F111}": { + "$type": "GeometrySaveData", + "Position": [ + 660.0, + 80.0 + ] + }, + "{B0B99C8A-03AF-4CF6-A926-F65C874C3D97}": { + "$type": "StylingComponentSaveData", + "SubStyle": ".method" + }, + "{B1F49A35-8408-40DA-B79E-F1E3B64322CE}": { + "$type": "PersistentIdComponentSaveData", + "PersistentId": "{4238CE68-6891-45AF-880D-C6D8317A5506}" + } + } + } + } + ], + "StatisticsHelper": { + "InstanceCounter": [ + { + "Key": 5842116704362436814, + "Value": 1 + }, + { + "Key": 5842116704509535651, + "Value": 1 + }, + { + "Key": 5842116761103598202, + "Value": 1 + }, + { + "Key": 10181512461692697578, + "Value": 1 + }, + { + "Key": 10684225535275896474, + "Value": 4 + }, + { + "Key": 12348245020530250771, + "Value": 1 + }, + { + "Key": 13774516555319876501, + "Value": 1 + }, + { + "Key": 16512335735722000926, + "Value": 1 + } + ] + } + } + } + } + } +} \ No newline at end of file diff --git a/AutomatedTesting/ScriptCanvas/lambdademo.scriptcanvas b/AutomatedTesting/ScriptCanvas/lambdademo.scriptcanvas index ec4b161711..630d28f0da 100644 --- a/AutomatedTesting/ScriptCanvas/lambdademo.scriptcanvas +++ b/AutomatedTesting/ScriptCanvas/lambdademo.scriptcanvas @@ -1,2463 +1,1686 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +{ + "Type": "JsonSerialization", + "Version": 1, + "ClassName": "ScriptCanvasData", + "ClassData": { + "m_scriptCanvas": { + "Id": { + "id": 10426522414112 + }, + "Name": "lambdademo", + "Components": { + "Component_[5582017548010627717]": { + "$type": "EditorGraphVariableManagerComponent", + "Id": 5582017548010627717, + "m_variableData": { + "m_nameVariableMap": [ + { + "Key": { + "m_id": "{13AF5E48-B750-479D-8D27-9D79B382B29C}" + }, + "Value": { + "Datum": { + "isOverloadedStorage": false, + "scriptCanvasType": { + "m_type": 5 + }, + "isNullPointer": false, + "$type": "{03AAAB3F-5C47-5A66-9EBC-D5FA4DB353C9} AZStd::string", + "value": "AWSCore.ExampleLambdaOutput", + "label": "String" + }, + "VariableId": { + "m_id": "{13AF5E48-B750-479D-8D27-9D79B382B29C}" + }, + "VariableName": "function_key" + } + }, + { + "Key": { + "m_id": "{DCB889AA-7504-42E7-9D57-5D96C37ACFF0}" + }, + "Value": { + "Datum": { + "isOverloadedStorage": false, + "scriptCanvasType": { + "m_type": 5 + }, + "isNullPointer": false, + "$type": "{03AAAB3F-5C47-5A66-9EBC-D5FA4DB353C9} AZStd::string", + "value": "", + "label": "String" + }, + "VariableId": { + "m_id": "{DCB889AA-7504-42E7-9D57-5D96C37ACFF0}" + }, + "VariableName": "payload" + } + } + ] + } + }, + "Component_[9407870129852956697]": { + "$type": "{4D755CA9-AB92-462C-B24F-0B3376F19967} Graph", + "Id": 9407870129852956697, + "m_graphData": { + "m_nodes": [ + { + "Id": { + "id": 10435112348704 + }, + "Name": "SC-Node(ReloadConfigFile)", + "Components": { + "Component_[11167148136039722527]": { + "$type": "{E42861BD-1956-45AE-8DD7-CCFC1E3E5ACF} Method", + "Id": 11167148136039722527, + "Slots": [ + { + "id": { + "m_id": "{8AA5E0B5-F92E-42A5-AFA5-D73825783200}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + }, + null + ], + "slotName": "Is Reloading Config FileName", + "toolTip": "Whether reload resource mapping config file name from AWS core configuration settings registry file.", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{7D577F2E-978C-4523-9FDF-6BCEFF0D1F4E}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "In", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{DD5508D7-F1D1-451B-93CC-03DC448C03E7}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Out", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + } + ], + "Datums": [ + { + "isOverloadedStorage": false, + "scriptCanvasType": { + "m_type": 0 + }, + "isNullPointer": false, + "$type": "bool", + "value": true, + "label": "Is Reloading Config FileName" + } + ], + "methodType": 0, + "methodName": "ReloadConfigFile", + "className": "AWSResourceMappingRequestBus", + "resultSlotIDs": [ + {} + ], + "prettyClassName": "AWSResourceMappingRequestBus" + } + } + }, + { + "Id": { + "id": 10460882152480 + }, + "Name": "EBusEventHandler", + "Components": { + "Component_[12603515743535039255]": { + "$type": "EBusEventHandler", + "Id": 12603515743535039255, + "Slots": [ + { + "id": { + "m_id": "{45AA6102-92E2-458B-B269-231D05863FDA}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Connect", + "toolTip": "Connect this event handler to the specified entity.", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{4424B64A-299D-4164-A4D4-A275A1C2AB3D}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Disconnect", + "toolTip": "Disconnect this event handler.", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{92EB485B-1B25-4D3B-95F4-7FF7E2BCFB80}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "OnConnected", + "toolTip": "Signaled when a connection has taken place.", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{F12D1B7B-A26B-4CE3-A10C-FB510F8E0199}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "OnDisconnected", + "toolTip": "Signaled when this event handler is disconnected.", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{9265F022-057D-4464-AE9B-64458D51E2D6}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "OnFailure", + "toolTip": "Signaled when it is not possible to connect this handler.", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{34292C47-96F8-401B-8902-5F7FF32FF4C0}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Source", + "toolTip": "ID used to connect on a specific Event address (Type: EntityId)", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{7CCBDF78-CA73-40ED-A996-EBCA723286CB}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "EntityID", + "DisplayDataType": { + "m_type": 1 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{7587D651-DBD8-49B8-8CCC-BFD0E9C890A7}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnEntityActivated", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + }, + { + "id": { + "m_id": "{838A95D3-7F90-489E-87D2-05930C7C4F05}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "EntityID", + "DisplayDataType": { + "m_type": 1 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{6CBCAAE3-3ABE-4E3B-919D-271D943BAEB4}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnEntityDeactivated", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + } + ], + "Datums": [ + { + "isOverloadedStorage": false, + "scriptCanvasType": { + "m_type": 1 + }, + "isNullPointer": false, + "$type": "EntityId", + "value": { + "id": 2901262558 + }, + "label": "Source" + } + ], + "m_eventMap": [ + { + "Key": { + "Value": 245425936 + }, + "Value": { + "m_eventName": "OnEntityActivated", + "m_eventId": { + "Value": 245425936 + }, + "m_eventSlotId": { + "m_id": "{7587D651-DBD8-49B8-8CCC-BFD0E9C890A7}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{7CCBDF78-CA73-40ED-A996-EBCA723286CB}" + } + ], + "m_numExpectedArguments": 1 + } + }, + { + "Key": { + "Value": 4273369222 + }, + "Value": { + "m_eventName": "OnEntityDeactivated", + "m_eventId": { + "Value": 4273369222 + }, + "m_eventSlotId": { + "m_id": "{6CBCAAE3-3ABE-4E3B-919D-271D943BAEB4}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{838A95D3-7F90-489E-87D2-05930C7C4F05}" + } + ], + "m_numExpectedArguments": 1 + } + } + ], + "m_ebusName": "EntityBus", + "m_busId": { + "Value": 3358774020 + } + } + } + }, + { + "Id": { + "id": 10447997250592 + }, + "Name": "EBusEventHandler", + "Components": { + "Component_[13302482777442065739]": { + "$type": "EBusEventHandler", + "Id": 13302482777442065739, + "Slots": [ + { + "id": { + "m_id": "{382E9758-3981-48FF-8E20-FD99C1561DC3}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Connect", + "toolTip": "Connect this event handler to the specified entity.", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{86069A40-A7CE-4BD1-BD52-F7AA915085FA}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Disconnect", + "toolTip": "Disconnect this event handler.", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{D486C753-CC73-48FE-9E89-970AB98C4EA8}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "OnConnected", + "toolTip": "Signaled when a connection has taken place.", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{A549915E-EB3D-4E21-AF1B-3A9C6D9488A0}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "OnDisconnected", + "toolTip": "Signaled when this event handler is disconnected.", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{38628508-1F11-4B20-AB8D-42A8E4656375}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "OnFailure", + "toolTip": "Signaled when it is not possible to connect this handler.", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{C9F7A7D4-83F3-4393-9E47-3805627BBDBB}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "String", + "DisplayDataType": { + "m_type": 5 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{08D01109-BA01-4422-88FF-1E562C4A28D8}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnInvokeSuccess", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + }, + { + "id": { + "m_id": "{FF44C72A-CB92-4873-B5D3-43198DC06AC2}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "String", + "DisplayDataType": { + "m_type": 5 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{FCE32A95-1CDD-4330-8E94-85CF51731276}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnInvokeError", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + } + ], + "m_eventMap": [ + { + "Key": { + "Value": 1275872951 + }, + "Value": { + "m_eventName": "OnInvokeSuccess", + "m_eventId": { + "Value": 1275872951 + }, + "m_eventSlotId": { + "m_id": "{08D01109-BA01-4422-88FF-1E562C4A28D8}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{C9F7A7D4-83F3-4393-9E47-3805627BBDBB}" + } + ], + "m_numExpectedArguments": 1 + } + }, + { + "Key": { + "Value": 3274092371 + }, + "Value": { + "m_eventName": "OnInvokeError", + "m_eventId": { + "Value": 3274092371 + }, + "m_eventSlotId": { + "m_id": "{FCE32A95-1CDD-4330-8E94-85CF51731276}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{FF44C72A-CB92-4873-B5D3-43198DC06AC2}" + } + ], + "m_numExpectedArguments": 1 + } + } + ], + "m_ebusName": "AWSLambdaBehaviorNotificationBus", + "m_busId": { + "Value": 179676616 + } + } + } + }, + { + "Id": { + "id": 10456587185184 + }, + "Name": "EBusEventHandler", + "Components": { + "Component_[14277639653836430450]": { + "$type": "EBusEventHandler", + "Id": 14277639653836430450, + "Slots": [ + { + "id": { + "m_id": "{DB69AA96-AE16-4D06-B579-7DD0EFD529A2}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Connect", + "toolTip": "Connect this event handler to the specified entity.", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{FEB09F66-0727-4C28-A499-ECE1774945C9}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Disconnect", + "toolTip": "Disconnect this event handler.", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{0F23E212-E397-47CF-9941-530AEB2F8882}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "OnConnected", + "toolTip": "Signaled when a connection has taken place.", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{7679B464-A5AB-4CCC-9E18-176F9D98DBFB}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "OnDisconnected", + "toolTip": "Signaled when this event handler is disconnected.", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{185DDE19-CC78-467D-A776-05794E8D0DD1}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "OnFailure", + "toolTip": "Signaled when it is not possible to connect this handler.", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{70838AFF-91F4-417E-A253-41ED6C3AAB7D}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "String", + "DisplayDataType": { + "m_type": 5 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{387915AE-E556-43E3-B3A7-9176370D129C}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnInvokeSuccess", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + }, + { + "id": { + "m_id": "{4CC527B1-A85A-42F0-A806-FB19668F22E2}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "String", + "DisplayDataType": { + "m_type": 5 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{E8F2D62B-EFCE-4F85-A1DE-C158079F79EB}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnInvokeError", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + } + ], + "m_eventMap": [ + { + "Key": { + "Value": 1275872951 + }, + "Value": { + "m_eventName": "OnInvokeSuccess", + "m_eventId": { + "Value": 1275872951 + }, + "m_eventSlotId": { + "m_id": "{387915AE-E556-43E3-B3A7-9176370D129C}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{70838AFF-91F4-417E-A253-41ED6C3AAB7D}" + } + ], + "m_numExpectedArguments": 1 + } + }, + { + "Key": { + "Value": 3274092371 + }, + "Value": { + "m_eventName": "OnInvokeError", + "m_eventId": { + "Value": 3274092371 + }, + "m_eventSlotId": { + "m_id": "{E8F2D62B-EFCE-4F85-A1DE-C158079F79EB}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{4CC527B1-A85A-42F0-A806-FB19668F22E2}" + } + ], + "m_numExpectedArguments": 1 + } + } + ], + "m_ebusName": "AWSLambdaBehaviorNotificationBus", + "m_busId": { + "Value": 179676616 + } + } + } + }, + { + "Id": { + "id": 10452292217888 + }, + "Name": "SC-Node(Print)", + "Components": { + "Component_[15632666580273613138]": { + "$type": "Print", + "Id": 15632666580273613138, + "Slots": [ + { + "id": { + "m_id": "{2219BD38-0808-4D6D-9623-9560BCD8235D}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "In", + "toolTip": "Input signal", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{59EABC9A-5EA1-4E43-98CD-909870677390}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Out", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + } + ], + "m_format": "[Lambda] Completed Invoke", + "m_unresolvedString": [ + "[Lambda] Completed Invoke" + ] + } + } + }, + { + "Id": { + "id": 10443702283296 + }, + "Name": "SC-Node(Print)", + "Components": { + "Component_[15632666580273613138]": { + "$type": "Print", + "Id": 15632666580273613138, + "Slots": [ + { + "id": { + "m_id": "{2219BD38-0808-4D6D-9623-9560BCD8235D}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "In", + "toolTip": "Input signal", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{0972A320-2B33-4F31-AC0F-46C4E0CE539B}" + }, + "DynamicTypeOverride": 3, + "contracts": [ + { + "$type": "SlotTypeContract" + }, + null + ], + "slotName": "Value", + "toolTip": "Value which replaces instances of {Value} in the resulting string.", + "DisplayDataType": { + "m_type": 5 + }, + "DisplayGroup": { + "Value": 1015031923 + }, + "Descriptor": { + "ConnectionType": 1, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{59EABC9A-5EA1-4E43-98CD-909870677390}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Out", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + } + ], + "Datums": [ + { + "isOverloadedStorage": false, + "scriptCanvasType": { + "m_type": 5 + }, + "isNullPointer": false, + "$type": "{03AAAB3F-5C47-5A66-9EBC-D5FA4DB353C9} AZStd::string", + "value": "", + "label": "Value" + } + ], + "m_format": "[Lambda] Invoke error: {Value}", + "m_arrayBindingMap": [ + { + "Key": 1, + "Value": { + "m_id": "{0972A320-2B33-4F31-AC0F-46C4E0CE539B}" + } + } + ], + "m_unresolvedString": [ + "[Lambda] Invoke error: ", + {} + ], + "m_formatSlotMap": { + "Value": { + "m_id": "{0972A320-2B33-4F31-AC0F-46C4E0CE539B}" + } + } + } + } + }, + { + "Id": { + "id": 10439407316000 + }, + "Name": "SC-Node(Print)", + "Components": { + "Component_[15632666580273613138]": { + "$type": "Print", + "Id": 15632666580273613138, + "Slots": [ + { + "id": { + "m_id": "{2219BD38-0808-4D6D-9623-9560BCD8235D}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "In", + "toolTip": "Input signal", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{0972A320-2B33-4F31-AC0F-46C4E0CE539B}" + }, + "DynamicTypeOverride": 3, + "contracts": [ + { + "$type": "SlotTypeContract" + }, + null + ], + "slotName": "Value", + "toolTip": "Value which replaces instances of {Value} in the resulting string.", + "DisplayDataType": { + "m_type": 5 + }, + "DisplayGroup": { + "Value": 1015031923 + }, + "Descriptor": { + "ConnectionType": 1, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{59EABC9A-5EA1-4E43-98CD-909870677390}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Out", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + } + ], + "Datums": [ + { + "isOverloadedStorage": false, + "scriptCanvasType": { + "m_type": 5 + }, + "isNullPointer": false, + "$type": "{03AAAB3F-5C47-5A66-9EBC-D5FA4DB353C9} AZStd::string", + "value": "", + "label": "Value" + } + ], + "m_format": "[Lambda] Invoke success: {Value}", + "m_arrayBindingMap": [ + { + "Key": 1, + "Value": { + "m_id": "{0972A320-2B33-4F31-AC0F-46C4E0CE539B}" + } + } + ], + "m_unresolvedString": [ + "[Lambda] Invoke success: ", + {} + ], + "m_formatSlotMap": { + "Value": { + "m_id": "{0972A320-2B33-4F31-AC0F-46C4E0CE539B}" + } + } + } + } + }, + { + "Id": { + "id": 10430817381408 + }, + "Name": "SC-Node(Invoke)", + "Components": { + "Component_[5709396067277168591]": { + "$type": "{E42861BD-1956-45AE-8DD7-CCFC1E3E5ACF} Method", + "Id": 5709396067277168591, + "Slots": [ + { + "id": { + "m_id": "{5DA0BEDE-72C0-4DD7-977D-FF25974FC704}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + }, + null + ], + "slotName": "Function Resource KeyName", + "toolTip": "The resource key name of the lambda function in resource mapping config file.", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 2 + }, + "DataType": 1, + "IsReference": true, + "VariableReference": { + "m_id": "{13AF5E48-B750-479D-8D27-9D79B382B29C}" + } + }, + { + "id": { + "m_id": "{9BA842F4-68D5-442E-BF67-8182284396C0}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + }, + null + ], + "slotName": "Payload", + "toolTip": "The JSON that you want to provide to your Lambda function as input.", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 2 + }, + "DataType": 1, + "IsReference": true, + "VariableReference": { + "m_id": "{DCB889AA-7504-42E7-9D57-5D96C37ACFF0}" + } + }, + { + "id": { + "m_id": "{6DB4AD78-A00C-42D9-BEC9-04B98BFBA2B2}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "In", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{069560CB-28C5-499F-88D3-5CC178EB4824}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Out", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + } + ], + "Datums": [ + { + "isOverloadedStorage": false, + "scriptCanvasType": { + "m_type": 5 + }, + "isNullPointer": false, + "$type": "{03AAAB3F-5C47-5A66-9EBC-D5FA4DB353C9} AZStd::string", + "value": "", + "label": "Function Resource KeyName" + }, + { + "isOverloadedStorage": false, + "scriptCanvasType": { + "m_type": 5 + }, + "isNullPointer": false, + "$type": "{03AAAB3F-5C47-5A66-9EBC-D5FA4DB353C9} AZStd::string", + "value": "", + "label": "Payload" + } + ], + "methodType": 2, + "methodName": "Invoke", + "className": "AWSScriptBehaviorLambda", + "resultSlotIDs": [ + {} + ], + "prettyClassName": "AWSScriptBehaviorLambda" + } + } + } + ], + "m_connections": [ + { + "Id": { + "id": 10465177119776 + }, + "Name": "srcEndpoint=(ReloadConfigFile: Out), destEndpoint=(Invoke: In)", + "Components": { + "Component_[13136233722544432016]": { + "$type": "{64CA5016-E803-4AC4-9A36-BDA2C890C6EB} Connection", + "Id": 13136233722544432016, + "sourceEndpoint": { + "nodeId": { + "id": 10435112348704 + }, + "slotId": { + "m_id": "{DD5508D7-F1D1-451B-93CC-03DC448C03E7}" + } + }, + "targetEndpoint": { + "nodeId": { + "id": 10430817381408 + }, + "slotId": { + "m_id": "{6DB4AD78-A00C-42D9-BEC9-04B98BFBA2B2}" + } + } + } + } + }, + { + "Id": { + "id": 10469472087072 + }, + "Name": "srcEndpoint=(Invoke: Out), destEndpoint=(Print: In)", + "Components": { + "Component_[2618571426139838363]": { + "$type": "{64CA5016-E803-4AC4-9A36-BDA2C890C6EB} Connection", + "Id": 2618571426139838363, + "sourceEndpoint": { + "nodeId": { + "id": 10430817381408 + }, + "slotId": { + "m_id": "{069560CB-28C5-499F-88D3-5CC178EB4824}" + } + }, + "targetEndpoint": { + "nodeId": { + "id": 10452292217888 + }, + "slotId": { + "m_id": "{2219BD38-0808-4D6D-9623-9560BCD8235D}" + } + } + } + } + }, + { + "Id": { + "id": 10473767054368 + }, + "Name": "srcEndpoint=(AWSLambdaBehaviorNotificationBus Handler: ExecutionSlot:OnInvokeError), destEndpoint=(Print: In)", + "Components": { + "Component_[10492730210717605288]": { + "$type": "{64CA5016-E803-4AC4-9A36-BDA2C890C6EB} Connection", + "Id": 10492730210717605288, + "sourceEndpoint": { + "nodeId": { + "id": 10456587185184 + }, + "slotId": { + "m_id": "{E8F2D62B-EFCE-4F85-A1DE-C158079F79EB}" + } + }, + "targetEndpoint": { + "nodeId": { + "id": 10443702283296 + }, + "slotId": { + "m_id": "{2219BD38-0808-4D6D-9623-9560BCD8235D}" + } + } + } + } + }, + { + "Id": { + "id": 10478062021664 + }, + "Name": "srcEndpoint=(AWSLambdaBehaviorNotificationBus Handler: String), destEndpoint=(Print: Value)", + "Components": { + "Component_[7692047505820357673]": { + "$type": "{64CA5016-E803-4AC4-9A36-BDA2C890C6EB} Connection", + "Id": 7692047505820357673, + "sourceEndpoint": { + "nodeId": { + "id": 10456587185184 + }, + "slotId": { + "m_id": "{4CC527B1-A85A-42F0-A806-FB19668F22E2}" + } + }, + "targetEndpoint": { + "nodeId": { + "id": 10443702283296 + }, + "slotId": { + "m_id": "{0972A320-2B33-4F31-AC0F-46C4E0CE539B}" + } + } + } + } + }, + { + "Id": { + "id": 10482356988960 + }, + "Name": "srcEndpoint=(AWSLambdaBehaviorNotificationBus Handler: ExecutionSlot:OnInvokeSuccess), destEndpoint=(Print: In)", + "Components": { + "Component_[8999881801271525198]": { + "$type": "{64CA5016-E803-4AC4-9A36-BDA2C890C6EB} Connection", + "Id": 8999881801271525198, + "sourceEndpoint": { + "nodeId": { + "id": 10447997250592 + }, + "slotId": { + "m_id": "{08D01109-BA01-4422-88FF-1E562C4A28D8}" + } + }, + "targetEndpoint": { + "nodeId": { + "id": 10439407316000 + }, + "slotId": { + "m_id": "{2219BD38-0808-4D6D-9623-9560BCD8235D}" + } + } + } + } + }, + { + "Id": { + "id": 10486651956256 + }, + "Name": "srcEndpoint=(AWSLambdaBehaviorNotificationBus Handler: String), destEndpoint=(Print: Value)", + "Components": { + "Component_[5244143619937759473]": { + "$type": "{64CA5016-E803-4AC4-9A36-BDA2C890C6EB} Connection", + "Id": 5244143619937759473, + "sourceEndpoint": { + "nodeId": { + "id": 10447997250592 + }, + "slotId": { + "m_id": "{C9F7A7D4-83F3-4393-9E47-3805627BBDBB}" + } + }, + "targetEndpoint": { + "nodeId": { + "id": 10439407316000 + }, + "slotId": { + "m_id": "{0972A320-2B33-4F31-AC0F-46C4E0CE539B}" + } + } + } + } + }, + { + "Id": { + "id": 10490946923552 + }, + "Name": "srcEndpoint=(EntityBus Handler: ExecutionSlot:OnEntityActivated), destEndpoint=(ReloadConfigFile: In)", + "Components": { + "Component_[6075242503823085865]": { + "$type": "{64CA5016-E803-4AC4-9A36-BDA2C890C6EB} Connection", + "Id": 6075242503823085865, + "sourceEndpoint": { + "nodeId": { + "id": 10460882152480 + }, + "slotId": { + "m_id": "{7587D651-DBD8-49B8-8CCC-BFD0E9C890A7}" + } + }, + "targetEndpoint": { + "nodeId": { + "id": 10435112348704 + }, + "slotId": { + "m_id": "{7D577F2E-978C-4523-9FDF-6BCEFF0D1F4E}" + } + } + } + } + } + ] + }, + "m_assetType": "{3E2AC8CD-713F-453E-967F-29517F331784}", + "versionData": { + "_grammarVersion": 1, + "_runtimeVersion": 1 + }, + "m_variableCounter": 2, + "GraphCanvasData": [ + { + "Key": { + "id": 10426522414112 + }, + "Value": { + "ComponentData": { + "{5F84B500-8C45-40D1-8EFC-A5306B241444}": { + "$type": "SceneComponentSaveData", + "ViewParams": { + "Scale": 1.3385585, + "AnchorX": -277.910888671875, + "AnchorY": -378.0185852050781 + } + } + } + } + }, + { + "Key": { + "id": 10430817381408 + }, + "Value": { + "ComponentData": { + "{24CB38BB-1705-4EC5-8F63-B574571B4DCD}": { + "$type": "NodeSaveData" + }, + "{328FF15C-C302-458F-A43D-E1794DE0904E}": { + "$type": "GeneralNodeTitleComponentSaveData", + "PaletteOverride": "MethodNodeTitlePalette" + }, + "{7CC444B1-F9B3-41B5-841B-0C4F2179F111}": { + "$type": "GeometrySaveData", + "Position": [ + 460.0, + -240.0 + ] + }, + "{B0B99C8A-03AF-4CF6-A926-F65C874C3D97}": { + "$type": "StylingComponentSaveData", + "SubStyle": ".method" + }, + "{B1F49A35-8408-40DA-B79E-F1E3B64322CE}": { + "$type": "PersistentIdComponentSaveData", + "PersistentId": "{81C52F38-D73E-41E1-B0AB-D90267ECE76F}" + } + } + } + }, + { + "Key": { + "id": 10435112348704 + }, + "Value": { + "ComponentData": { + "{24CB38BB-1705-4EC5-8F63-B574571B4DCD}": { + "$type": "NodeSaveData" + }, + "{328FF15C-C302-458F-A43D-E1794DE0904E}": { + "$type": "GeneralNodeTitleComponentSaveData", + "PaletteOverride": "MethodNodeTitlePalette" + }, + "{7CC444B1-F9B3-41B5-841B-0C4F2179F111}": { + "$type": "GeometrySaveData", + "Position": [ + 140.0, + -240.0 + ] + }, + "{B0B99C8A-03AF-4CF6-A926-F65C874C3D97}": { + "$type": "StylingComponentSaveData", + "SubStyle": ".method" + }, + "{B1F49A35-8408-40DA-B79E-F1E3B64322CE}": { + "$type": "PersistentIdComponentSaveData", + "PersistentId": "{C501C00F-0E1D-4EC2-A2C1-F5B910826F40}" + } + } + } + }, + { + "Key": { + "id": 10439407316000 + }, + "Value": { + "ComponentData": { + "{24CB38BB-1705-4EC5-8F63-B574571B4DCD}": { + "$type": "NodeSaveData" + }, + "{328FF15C-C302-458F-A43D-E1794DE0904E}": { + "$type": "GeneralNodeTitleComponentSaveData", + "PaletteOverride": "StringNodeTitlePalette" + }, + "{7CC444B1-F9B3-41B5-841B-0C4F2179F111}": { + "$type": "GeometrySaveData", + "Position": [ + 360.0, + 380.0 + ] + }, + "{B0B99C8A-03AF-4CF6-A926-F65C874C3D97}": { + "$type": "StylingComponentSaveData" + }, + "{B1F49A35-8408-40DA-B79E-F1E3B64322CE}": { + "$type": "PersistentIdComponentSaveData", + "PersistentId": "{7711815B-6518-4F40-8A20-F5081EE5423D}" + } + } + } + }, + { + "Key": { + "id": 10443702283296 + }, + "Value": { + "ComponentData": { + "{24CB38BB-1705-4EC5-8F63-B574571B4DCD}": { + "$type": "NodeSaveData" + }, + "{328FF15C-C302-458F-A43D-E1794DE0904E}": { + "$type": "GeneralNodeTitleComponentSaveData", + "PaletteOverride": "StringNodeTitlePalette" + }, + "{7CC444B1-F9B3-41B5-841B-0C4F2179F111}": { + "$type": "GeometrySaveData", + "Position": [ + 360.0, + 120.0 + ] + }, + "{B0B99C8A-03AF-4CF6-A926-F65C874C3D97}": { + "$type": "StylingComponentSaveData" + }, + "{B1F49A35-8408-40DA-B79E-F1E3B64322CE}": { + "$type": "PersistentIdComponentSaveData", + "PersistentId": "{C0461745-3ABD-49F0-B805-0D9C07061D11}" + } + } + } + }, + { + "Key": { + "id": 10447997250592 + }, + "Value": { + "ComponentData": { + "{24CB38BB-1705-4EC5-8F63-B574571B4DCD}": { + "$type": "NodeSaveData" + }, + "{7CC444B1-F9B3-41B5-841B-0C4F2179F111}": { + "$type": "GeometrySaveData", + "Position": [ + 60.0, + 360.0 + ] + }, + "{9E81C95F-89C0-4476-8E82-63CCC4E52E04}": { + "$type": "EBusHandlerNodeDescriptorSaveData", + "EventIds": [ + { + "Value": 1275872951 + } + ] + }, + "{B0B99C8A-03AF-4CF6-A926-F65C874C3D97}": { + "$type": "StylingComponentSaveData" + }, + "{B1F49A35-8408-40DA-B79E-F1E3B64322CE}": { + "$type": "PersistentIdComponentSaveData", + "PersistentId": "{074D28ED-E23D-47EF-9F44-4FCE2E810905}" + } + } + } + }, + { + "Key": { + "id": 10452292217888 + }, + "Value": { + "ComponentData": { + "{24CB38BB-1705-4EC5-8F63-B574571B4DCD}": { + "$type": "NodeSaveData" + }, + "{328FF15C-C302-458F-A43D-E1794DE0904E}": { + "$type": "GeneralNodeTitleComponentSaveData", + "PaletteOverride": "StringNodeTitlePalette" + }, + "{7CC444B1-F9B3-41B5-841B-0C4F2179F111}": { + "$type": "GeometrySaveData", + "Position": [ + 900.0, + -240.0 + ] + }, + "{B0B99C8A-03AF-4CF6-A926-F65C874C3D97}": { + "$type": "StylingComponentSaveData" + }, + "{B1F49A35-8408-40DA-B79E-F1E3B64322CE}": { + "$type": "PersistentIdComponentSaveData", + "PersistentId": "{AF52E352-83AE-4F8B-BB92-CC08893B49CE}" + } + } + } + }, + { + "Key": { + "id": 10456587185184 + }, + "Value": { + "ComponentData": { + "{24CB38BB-1705-4EC5-8F63-B574571B4DCD}": { + "$type": "NodeSaveData" + }, + "{7CC444B1-F9B3-41B5-841B-0C4F2179F111}": { + "$type": "GeometrySaveData", + "Position": [ + 60.0, + 120.0 + ] + }, + "{9E81C95F-89C0-4476-8E82-63CCC4E52E04}": { + "$type": "EBusHandlerNodeDescriptorSaveData", + "EventIds": [ + { + "Value": 3274092371 + } + ] + }, + "{B0B99C8A-03AF-4CF6-A926-F65C874C3D97}": { + "$type": "StylingComponentSaveData" + }, + "{B1F49A35-8408-40DA-B79E-F1E3B64322CE}": { + "$type": "PersistentIdComponentSaveData", + "PersistentId": "{31A0049B-49B9-41FD-A487-30A747F9B700}" + } + } + } + }, + { + "Key": { + "id": 10460882152480 + }, + "Value": { + "ComponentData": { + "{24CB38BB-1705-4EC5-8F63-B574571B4DCD}": { + "$type": "NodeSaveData" + }, + "{7CC444B1-F9B3-41B5-841B-0C4F2179F111}": { + "$type": "GeometrySaveData", + "Position": [ + -200.0, + -300.0 + ] + }, + "{9E81C95F-89C0-4476-8E82-63CCC4E52E04}": { + "$type": "EBusHandlerNodeDescriptorSaveData", + "EventIds": [ + { + "Value": 245425936 + } + ] + }, + "{B0B99C8A-03AF-4CF6-A926-F65C874C3D97}": { + "$type": "StylingComponentSaveData" + }, + "{B1F49A35-8408-40DA-B79E-F1E3B64322CE}": { + "$type": "PersistentIdComponentSaveData", + "PersistentId": "{C4712614-EB76-4E3B-9FF5-3A4A6593EE2C}" + } + } + } + } + ], + "StatisticsHelper": { + "InstanceCounter": [ + { + "Key": 5842116761103598202, + "Value": 1 + }, + { + "Key": 5842117099792962512, + "Value": 1 + }, + { + "Key": 5842117100734473396, + "Value": 1 + }, + { + "Key": 10684225535275896474, + "Value": 3 + }, + { + "Key": 13774516555319876501, + "Value": 1 + }, + { + "Key": 14402610758592020379, + "Value": 1 + } + ] + } + } + } + } + } +} \ No newline at end of file diff --git a/AutomatedTesting/ScriptCanvas/s3demo.scriptcanvas b/AutomatedTesting/ScriptCanvas/s3demo.scriptcanvas index 925cc9da26..30a7d0ee0f 100644 --- a/AutomatedTesting/ScriptCanvas/s3demo.scriptcanvas +++ b/AutomatedTesting/ScriptCanvas/s3demo.scriptcanvas @@ -1,5317 +1,3334 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +{ + "Type": "JsonSerialization", + "Version": 1, + "ClassName": "ScriptCanvasData", + "ClassData": { + "m_scriptCanvas": { + "Id": { + "id": 43214302751776 + }, + "Name": "s3demo", + "Components": { + "Component_[10482302595531409814]": { + "$type": "EditorGraphVariableManagerComponent", + "Id": 10482302595531409814, + "m_variableData": { + "m_nameVariableMap": [ + { + "Key": { + "m_id": "{41203CA6-2B79-4EBD-A738-18A4E001CD22}" + }, + "Value": { + "Datum": { + "isOverloadedStorage": false, + "scriptCanvasType": { + "m_type": 5 + }, + "isNullPointer": false, + "$type": "{03AAAB3F-5C47-5A66-9EBC-D5FA4DB353C9} AZStd::string", + "value": "example.txt", + "label": "String" + }, + "VariableId": { + "m_id": "{41203CA6-2B79-4EBD-A738-18A4E001CD22}" + }, + "VariableName": "object key" + } + }, + { + "Key": { + "m_id": "{54D3DD1A-F7A1-4B90-80FF-E83F0C4F3C05}" + }, + "Value": { + "Datum": { + "isOverloadedStorage": false, + "scriptCanvasType": { + "m_type": 5 + }, + "isNullPointer": false, + "$type": "{03AAAB3F-5C47-5A66-9EBC-D5FA4DB353C9} AZStd::string", + "value": "@user@/s3_download/output.txt", + "label": "String" + }, + "VariableId": { + "m_id": "{54D3DD1A-F7A1-4B90-80FF-E83F0C4F3C05}" + }, + "VariableName": "outfile" + } + }, + { + "Key": { + "m_id": "{F3CCFFCC-1206-4817-91C6-AC42CA8D5A70}" + }, + "Value": { + "Datum": { + "isOverloadedStorage": false, + "scriptCanvasType": { + "m_type": 5 + }, + "isNullPointer": false, + "$type": "{03AAAB3F-5C47-5A66-9EBC-D5FA4DB353C9} AZStd::string", + "value": "AWSCore.ExampleBucketOutput", + "label": "String" + }, + "VariableId": { + "m_id": "{F3CCFFCC-1206-4817-91C6-AC42CA8D5A70}" + }, + "VariableName": "bucket resource key" + } + } + ] + } + }, + "Component_[4689937780747115490]": { + "$type": "{4D755CA9-AB92-462C-B24F-0B3376F19967} Graph", + "Id": 4689937780747115490, + "m_graphData": { + "m_nodes": [ + { + "Id": { + "id": 43231482620960 + }, + "Name": "SC-Node(HeadObject)", + "Components": { + "Component_[11559916401303020459]": { + "$type": "{E42861BD-1956-45AE-8DD7-CCFC1E3E5ACF} Method", + "Id": 11559916401303020459, + "Slots": [ + { + "id": { + "m_id": "{0173ADEB-F3B5-4CF6-8DB1-FD99AA146CFC}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + }, + null + ], + "slotName": "Bucket Resource KeyName", + "toolTip": "The resource key name of the bucket in resource mapping config file.", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 2 + }, + "DataType": 1, + "IsReference": true, + "VariableReference": { + "m_id": "{F3CCFFCC-1206-4817-91C6-AC42CA8D5A70}" + } + }, + { + "id": { + "m_id": "{9E1DAF70-48F9-4A1E-892C-1A22BD7D7DEA}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + }, + null + ], + "slotName": "Object KeyName", + "toolTip": "The object key.", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 2 + }, + "DataType": 1, + "IsReference": true, + "VariableReference": { + "m_id": "{41203CA6-2B79-4EBD-A738-18A4E001CD22}" + } + }, + { + "id": { + "m_id": "{1042005D-18F7-4B53-9546-2ACCDCCCC9E5}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "In", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{6C587F91-F656-4ADC-B03B-88B137B12BDF}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Out", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + } + ], + "Datums": [ + { + "isOverloadedStorage": false, + "scriptCanvasType": { + "m_type": 5 + }, + "isNullPointer": false, + "$type": "{03AAAB3F-5C47-5A66-9EBC-D5FA4DB353C9} AZStd::string", + "value": "", + "label": "Bucket Resource KeyName" + }, + { + "isOverloadedStorage": false, + "scriptCanvasType": { + "m_type": 5 + }, + "isNullPointer": false, + "$type": "{03AAAB3F-5C47-5A66-9EBC-D5FA4DB353C9} AZStd::string", + "value": "", + "label": "Object KeyName" + } + ], + "methodType": 2, + "methodName": "HeadObject", + "className": "AWSScriptBehaviorS3", + "resultSlotIDs": [ + {} + ], + "prettyClassName": "AWSScriptBehaviorS3" + } + } + }, + { + "Id": { + "id": 43257252424736 + }, + "Name": "EBusEventHandler", + "Components": { + "Component_[11561522857340259242]": { + "$type": "EBusEventHandler", + "Id": 11561522857340259242, + "Slots": [ + { + "id": { + "m_id": "{06B1CC9B-9265-4188-BB5E-B837B7266A8C}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Connect", + "toolTip": "Connect this event handler to the specified entity.", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{0E2EB357-2F5A-4C59-8843-1DADE32B4E24}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Disconnect", + "toolTip": "Disconnect this event handler.", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{159BD7EF-639F-404C-8B8F-68BD1ABA20C7}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "OnConnected", + "toolTip": "Signaled when a connection has taken place.", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{2A92BDF7-5546-43F1-ABC2-DB1023F368C9}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "OnDisconnected", + "toolTip": "Signaled when this event handler is disconnected.", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{A65AB85E-8F8E-4A66-AF1A-FFB4EC26434C}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "OnFailure", + "toolTip": "Signaled when it is not possible to connect this handler.", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{1A07C91E-56B9-4929-B557-245F839A4A9D}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "String", + "DisplayDataType": { + "m_type": 5 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{E71AFDE4-483A-439D-AF2E-9BA12B1B9A9E}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnHeadObjectSuccess", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + }, + { + "id": { + "m_id": "{12EF30C9-9A3E-42F5-982B-AD0C050D66C5}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "String", + "DisplayDataType": { + "m_type": 5 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{59125007-F1BC-4618-A04C-C96B4BAC3071}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnHeadObjectError", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + }, + { + "id": { + "m_id": "{3155816E-2FB1-4C8A-918C-40D4A5F91B49}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "String", + "DisplayDataType": { + "m_type": 5 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{A02F140B-1EDA-4E15-AFAC-CB319F84CA9C}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnGetObjectSuccess", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + }, + { + "id": { + "m_id": "{849B4270-F66F-4420-9D27-1E8FB3F179B4}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "String", + "DisplayDataType": { + "m_type": 5 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{C2389D75-02AA-4368-A9C2-C6F5B14711AD}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnGetObjectError", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + } + ], + "m_eventMap": [ + { + "Key": { + "Value": 1667438543 + }, + "Value": { + "m_eventName": "OnHeadObjectSuccess", + "m_eventId": { + "Value": 1667438543 + }, + "m_eventSlotId": { + "m_id": "{E71AFDE4-483A-439D-AF2E-9BA12B1B9A9E}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{1A07C91E-56B9-4929-B557-245F839A4A9D}" + } + ], + "m_numExpectedArguments": 1 + } + }, + { + "Key": { + "Value": 3580584090 + }, + "Value": { + "m_eventName": "OnGetObjectSuccess", + "m_eventId": { + "Value": 3580584090 + }, + "m_eventSlotId": { + "m_id": "{A02F140B-1EDA-4E15-AFAC-CB319F84CA9C}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{3155816E-2FB1-4C8A-918C-40D4A5F91B49}" + } + ], + "m_numExpectedArguments": 1 + } + }, + { + "Key": { + "Value": 3753331652 + }, + "Value": { + "m_eventName": "OnGetObjectError", + "m_eventId": { + "Value": 3753331652 + }, + "m_eventSlotId": { + "m_id": "{C2389D75-02AA-4368-A9C2-C6F5B14711AD}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{849B4270-F66F-4420-9D27-1E8FB3F179B4}" + } + ], + "m_numExpectedArguments": 1 + } + }, + { + "Key": { + "Value": 4007236435 + }, + "Value": { + "m_eventName": "OnHeadObjectError", + "m_eventId": { + "Value": 4007236435 + }, + "m_eventSlotId": { + "m_id": "{59125007-F1BC-4618-A04C-C96B4BAC3071}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{12EF30C9-9A3E-42F5-982B-AD0C050D66C5}" + } + ], + "m_numExpectedArguments": 1 + } + } + ], + "m_ebusName": "AWSS3BehaviorNotificationBus", + "m_busId": { + "Value": 1833099679 + } + } + } + }, + { + "Id": { + "id": 43222892686368 + }, + "Name": "EBusEventHandler", + "Components": { + "Component_[15552716946630136054]": { + "$type": "EBusEventHandler", + "Id": 15552716946630136054, + "Slots": [ + { + "id": { + "m_id": "{EC8B94FE-E310-4CAB-B7F3-7116130F3722}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Connect", + "toolTip": "Connect this event handler to the specified entity.", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{600A5FC3-5554-4296-B225-38A219D004F3}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Disconnect", + "toolTip": "Disconnect this event handler.", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{A0B1BB90-55CF-435A-990D-EDCB1A154DBC}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "OnConnected", + "toolTip": "Signaled when a connection has taken place.", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{CA35C08F-BD47-484E-9A18-3363BF55813F}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "OnDisconnected", + "toolTip": "Signaled when this event handler is disconnected.", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{DEFFE837-932D-4C86-A218-2491EAA0C40A}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "OnFailure", + "toolTip": "Signaled when it is not possible to connect this handler.", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{287A31DA-DB54-4C44-A88A-46B05D8C7410}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "String", + "DisplayDataType": { + "m_type": 5 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{113A79E3-0BB3-49A4-B131-4B4CB28B53E0}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnHeadObjectSuccess", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + }, + { + "id": { + "m_id": "{076938D3-8BBB-4784-8A7B-15CCAAEC3C29}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "String", + "DisplayDataType": { + "m_type": 5 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{4581870C-A1CF-49C1-A963-E86E73E1C874}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnHeadObjectError", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + }, + { + "id": { + "m_id": "{D06466C8-B9B4-4712-87C7-E8F034F64396}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "String", + "DisplayDataType": { + "m_type": 5 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{EDA3336F-D744-431D-927B-C5657911532F}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnGetObjectSuccess", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + }, + { + "id": { + "m_id": "{5367B4E4-AD4A-4851-A027-F7F5E4947D14}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "String", + "DisplayDataType": { + "m_type": 5 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{088A6BB7-701D-4CD4-B647-89E0C373E984}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnGetObjectError", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + } + ], + "m_eventMap": [ + { + "Key": { + "Value": 1667438543 + }, + "Value": { + "m_eventName": "OnHeadObjectSuccess", + "m_eventId": { + "Value": 1667438543 + }, + "m_eventSlotId": { + "m_id": "{113A79E3-0BB3-49A4-B131-4B4CB28B53E0}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{287A31DA-DB54-4C44-A88A-46B05D8C7410}" + } + ], + "m_numExpectedArguments": 1 + } + }, + { + "Key": { + "Value": 3580584090 + }, + "Value": { + "m_eventName": "OnGetObjectSuccess", + "m_eventId": { + "Value": 3580584090 + }, + "m_eventSlotId": { + "m_id": "{EDA3336F-D744-431D-927B-C5657911532F}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{D06466C8-B9B4-4712-87C7-E8F034F64396}" + } + ], + "m_numExpectedArguments": 1 + } + }, + { + "Key": { + "Value": 3753331652 + }, + "Value": { + "m_eventName": "OnGetObjectError", + "m_eventId": { + "Value": 3753331652 + }, + "m_eventSlotId": { + "m_id": "{088A6BB7-701D-4CD4-B647-89E0C373E984}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{5367B4E4-AD4A-4851-A027-F7F5E4947D14}" + } + ], + "m_numExpectedArguments": 1 + } + }, + { + "Key": { + "Value": 4007236435 + }, + "Value": { + "m_eventName": "OnHeadObjectError", + "m_eventId": { + "Value": 4007236435 + }, + "m_eventSlotId": { + "m_id": "{4581870C-A1CF-49C1-A963-E86E73E1C874}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{076938D3-8BBB-4784-8A7B-15CCAAEC3C29}" + } + ], + "m_numExpectedArguments": 1 + } + } + ], + "m_ebusName": "AWSS3BehaviorNotificationBus", + "m_busId": { + "Value": 1833099679 + } + } + } + }, + { + "Id": { + "id": 43218597719072 + }, + "Name": "SC-Node(GetObject)", + "Components": { + "Component_[16208640162035618090]": { + "$type": "{E42861BD-1956-45AE-8DD7-CCFC1E3E5ACF} Method", + "Id": 16208640162035618090, + "Slots": [ + { + "id": { + "m_id": "{3DA0B7C1-F06D-489D-B71E-61AF70D6F83E}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + }, + null + ], + "slotName": "Bucket Resource KeyName", + "toolTip": "The resource key name of the bucket in resource mapping config file.", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 2 + }, + "DataType": 1, + "IsReference": true, + "VariableReference": { + "m_id": "{F3CCFFCC-1206-4817-91C6-AC42CA8D5A70}" + } + }, + { + "id": { + "m_id": "{6DFD6A41-83C0-4F66-894A-81F24E5483B5}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + }, + null + ], + "slotName": "Object KeyName", + "toolTip": "The object key.", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 2 + }, + "DataType": 1, + "IsReference": true, + "VariableReference": { + "m_id": "{41203CA6-2B79-4EBD-A738-18A4E001CD22}" + } + }, + { + "id": { + "m_id": "{FA7CA3E5-73AA-4BC2-B865-4B10FCF37615}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + }, + null + ], + "slotName": "Outfile Name", + "toolTip": "Filename where the content will be saved.", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 2 + }, + "DataType": 1, + "IsReference": true, + "VariableReference": { + "m_id": "{54D3DD1A-F7A1-4B90-80FF-E83F0C4F3C05}" + } + }, + { + "id": { + "m_id": "{C93A1797-9A7C-4B04-BF26-583058F75A99}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "In", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{F3E487A8-9C6E-4774-A6BB-4638AF1E895B}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Out", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + } + ], + "Datums": [ + { + "isOverloadedStorage": false, + "scriptCanvasType": { + "m_type": 5 + }, + "isNullPointer": false, + "$type": "{03AAAB3F-5C47-5A66-9EBC-D5FA4DB353C9} AZStd::string", + "value": "", + "label": "Bucket Resource KeyName" + }, + { + "isOverloadedStorage": false, + "scriptCanvasType": { + "m_type": 5 + }, + "isNullPointer": false, + "$type": "{03AAAB3F-5C47-5A66-9EBC-D5FA4DB353C9} AZStd::string", + "value": "", + "label": "Object KeyName" + }, + { + "isOverloadedStorage": false, + "scriptCanvasType": { + "m_type": 5 + }, + "isNullPointer": false, + "$type": "{03AAAB3F-5C47-5A66-9EBC-D5FA4DB353C9} AZStd::string", + "value": "", + "label": "Outfile Name" + } + ], + "methodType": 2, + "methodName": "GetObject", + "className": "AWSScriptBehaviorS3", + "resultSlotIDs": [ + {} + ], + "prettyClassName": "AWSScriptBehaviorS3" + } + } + }, + { + "Id": { + "id": 43235777588256 + }, + "Name": "EBusEventHandler", + "Components": { + "Component_[16531379412549504774]": { + "$type": "EBusEventHandler", + "Id": 16531379412549504774, + "Slots": [ + { + "id": { + "m_id": "{A059B37C-D151-4700-9477-060A5EDAB8FD}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Connect", + "toolTip": "Connect this event handler to the specified entity.", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{2E2CEF9B-6B52-421D-B6EE-A3BA359E2E50}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Disconnect", + "toolTip": "Disconnect this event handler.", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{F5C1E1D6-5B8B-4792-959A-20DE4BCA91F5}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "OnConnected", + "toolTip": "Signaled when a connection has taken place.", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{0B64327E-FC0C-434A-BB3A-478CC5579389}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "OnDisconnected", + "toolTip": "Signaled when this event handler is disconnected.", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{D544DFF1-6A24-4087-82C1-55D2596A066B}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "OnFailure", + "toolTip": "Signaled when it is not possible to connect this handler.", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{7EC4DFDD-0097-4A33-9978-15E8215EA7E4}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Source", + "toolTip": "ID used to connect on a specific Event address (Type: EntityId)", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{C75FC969-A2BB-478D-A697-68194823E00F}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "EntityID", + "DisplayDataType": { + "m_type": 1 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{96132FCD-AE62-4841-9913-86B6FA7F702F}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnEntityActivated", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + }, + { + "id": { + "m_id": "{D461D2D9-2F50-4C54-B478-598A65DA146D}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "EntityID", + "DisplayDataType": { + "m_type": 1 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{F56C8572-06CA-42A6-BFCF-BF23D93882A1}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnEntityDeactivated", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + } + ], + "Datums": [ + { + "isOverloadedStorage": false, + "scriptCanvasType": { + "m_type": 1 + }, + "isNullPointer": false, + "$type": "EntityId", + "value": { + "id": 2901262558 + }, + "label": "Source" + } + ], + "m_eventMap": [ + { + "Key": { + "Value": 245425936 + }, + "Value": { + "m_eventName": "OnEntityActivated", + "m_eventId": { + "Value": 245425936 + }, + "m_eventSlotId": { + "m_id": "{96132FCD-AE62-4841-9913-86B6FA7F702F}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{C75FC969-A2BB-478D-A697-68194823E00F}" + } + ], + "m_numExpectedArguments": 1 + } + }, + { + "Key": { + "Value": 4273369222 + }, + "Value": { + "m_eventName": "OnEntityDeactivated", + "m_eventId": { + "Value": 4273369222 + }, + "m_eventSlotId": { + "m_id": "{F56C8572-06CA-42A6-BFCF-BF23D93882A1}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{D461D2D9-2F50-4C54-B478-598A65DA146D}" + } + ], + "m_numExpectedArguments": 1 + } + } + ], + "m_ebusName": "EntityBus", + "m_busId": { + "Value": 3358774020 + } + } + } + }, + { + "Id": { + "id": 43227187653664 + }, + "Name": "SC-Node(Print)", + "Components": { + "Component_[17130675518735369413]": { + "$type": "Print", + "Id": 17130675518735369413, + "Slots": [ + { + "id": { + "m_id": "{F20B6702-B739-412A-9FA5-7FE4BBDCD7BA}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "In", + "toolTip": "Input signal", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{42D58EFD-404D-4C73-A3A0-0CC8FA4E1A9D}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Out", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + } + ], + "m_format": "[S3] Get object request is done", + "m_unresolvedString": [ + "[S3] Get object request is done" + ] + } + } + }, + { + "Id": { + "id": 43270137326624 + }, + "Name": "EBusEventHandler", + "Components": { + "Component_[17252511747753189875]": { + "$type": "EBusEventHandler", + "Id": 17252511747753189875, + "Slots": [ + { + "id": { + "m_id": "{F1B6F60F-4147-4668-B223-E79476027DF3}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Connect", + "toolTip": "Connect this event handler to the specified entity.", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{A4278B10-16CF-4D74-AD0B-31341CFDB51A}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Disconnect", + "toolTip": "Disconnect this event handler.", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{2FB99DE6-7735-48B6-A3AE-BF172BE15A44}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "OnConnected", + "toolTip": "Signaled when a connection has taken place.", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{48130C37-5219-4815-8BBF-61024581E76F}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "OnDisconnected", + "toolTip": "Signaled when this event handler is disconnected.", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{E972E432-913D-4B69-AFAC-471AF421DB91}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "OnFailure", + "toolTip": "Signaled when it is not possible to connect this handler.", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{22E6A22A-8471-41AC-AAE5-25E4546EA7EB}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "String", + "DisplayDataType": { + "m_type": 5 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{0B510179-CCCA-4F39-A4A3-A06358F98949}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnHeadObjectSuccess", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + }, + { + "id": { + "m_id": "{8AC14310-1B94-45CB-9D66-3ACA519A0738}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "String", + "DisplayDataType": { + "m_type": 5 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{88DF506C-3993-4F7E-A7A7-C5E22D403AC3}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnHeadObjectError", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + }, + { + "id": { + "m_id": "{FE344DAB-ADA7-4BC3-95C7-887D8E48FC02}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "String", + "DisplayDataType": { + "m_type": 5 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{F81BAA46-01E0-448F-861A-338FD98BE040}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnGetObjectSuccess", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + }, + { + "id": { + "m_id": "{C5CD70CA-0D7C-4871-9DDA-839F50C2001E}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "String", + "DisplayDataType": { + "m_type": 5 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{14D416B3-1A25-4850-BF2B-1B26A0EBFB3D}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnGetObjectError", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + } + ], + "m_eventMap": [ + { + "Key": { + "Value": 1667438543 + }, + "Value": { + "m_eventName": "OnHeadObjectSuccess", + "m_eventId": { + "Value": 1667438543 + }, + "m_eventSlotId": { + "m_id": "{0B510179-CCCA-4F39-A4A3-A06358F98949}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{22E6A22A-8471-41AC-AAE5-25E4546EA7EB}" + } + ], + "m_numExpectedArguments": 1 + } + }, + { + "Key": { + "Value": 3580584090 + }, + "Value": { + "m_eventName": "OnGetObjectSuccess", + "m_eventId": { + "Value": 3580584090 + }, + "m_eventSlotId": { + "m_id": "{F81BAA46-01E0-448F-861A-338FD98BE040}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{FE344DAB-ADA7-4BC3-95C7-887D8E48FC02}" + } + ], + "m_numExpectedArguments": 1 + } + }, + { + "Key": { + "Value": 3753331652 + }, + "Value": { + "m_eventName": "OnGetObjectError", + "m_eventId": { + "Value": 3753331652 + }, + "m_eventSlotId": { + "m_id": "{14D416B3-1A25-4850-BF2B-1B26A0EBFB3D}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{C5CD70CA-0D7C-4871-9DDA-839F50C2001E}" + } + ], + "m_numExpectedArguments": 1 + } + }, + { + "Key": { + "Value": 4007236435 + }, + "Value": { + "m_eventName": "OnHeadObjectError", + "m_eventId": { + "Value": 4007236435 + }, + "m_eventSlotId": { + "m_id": "{88DF506C-3993-4F7E-A7A7-C5E22D403AC3}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{8AC14310-1B94-45CB-9D66-3ACA519A0738}" + } + ], + "m_numExpectedArguments": 1 + } + } + ], + "m_ebusName": "AWSS3BehaviorNotificationBus", + "m_busId": { + "Value": 1833099679 + } + } + } + }, + { + "Id": { + "id": 43252957457440 + }, + "Name": "SC-Node(Print)", + "Components": { + "Component_[2501234731758928832]": { + "$type": "Print", + "Id": 2501234731758928832, + "Slots": [ + { + "id": { + "m_id": "{02869715-99BB-4D3C-8F7A-1462CA96731D}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "In", + "toolTip": "Input signal", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{00E106ED-3EEA-4CB5-8112-7CD221D6B5AC}" + }, + "DynamicTypeOverride": 3, + "contracts": [ + { + "$type": "SlotTypeContract" + }, + null + ], + "slotName": "Value", + "toolTip": "Value which replaces instances of {Value} in the resulting string.", + "DisplayDataType": { + "m_type": 5 + }, + "DisplayGroup": { + "Value": 1015031923 + }, + "Descriptor": { + "ConnectionType": 1, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{D9C850A0-2C03-47D1-B9E5-BA78FB24AD8B}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Out", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + } + ], + "Datums": [ + { + "isOverloadedStorage": false, + "scriptCanvasType": { + "m_type": 5 + }, + "isNullPointer": false, + "$type": "{03AAAB3F-5C47-5A66-9EBC-D5FA4DB353C9} AZStd::string", + "value": "", + "label": "Value" + } + ], + "m_format": "[S3] Get object success: {Value}", + "m_arrayBindingMap": [ + { + "Key": 1, + "Value": { + "m_id": "{00E106ED-3EEA-4CB5-8112-7CD221D6B5AC}" + } + } + ], + "m_unresolvedString": [ + "[S3] Get object success: ", + {} + ], + "m_formatSlotMap": { + "Value": { + "m_id": "{00E106ED-3EEA-4CB5-8112-7CD221D6B5AC}" + } + } + } + } + }, + { + "Id": { + "id": 43244367522848 + }, + "Name": "EBusEventHandler", + "Components": { + "Component_[5737311846476161362]": { + "$type": "EBusEventHandler", + "Id": 5737311846476161362, + "Slots": [ + { + "id": { + "m_id": "{A2C22B56-F88F-45C3-BB08-2DCA89E0A78C}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Connect", + "toolTip": "Connect this event handler to the specified entity.", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{242CB789-E4B0-4A58-A1BA-65EE0B383A19}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Disconnect", + "toolTip": "Disconnect this event handler.", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{3512B770-50F3-450C-B1DE-C834D75D6426}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "OnConnected", + "toolTip": "Signaled when a connection has taken place.", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{CB8CC02E-F39A-49F2-B0D4-AAA79A305E38}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "OnDisconnected", + "toolTip": "Signaled when this event handler is disconnected.", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{0B743445-0102-4606-A4C8-37E19FD0E7AD}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "OnFailure", + "toolTip": "Signaled when it is not possible to connect this handler.", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{3D2D7D19-C7C1-4C2E-8543-5848C8A69A18}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "String", + "DisplayDataType": { + "m_type": 5 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{4D4EC3D0-FD4C-441C-B154-340A529C8ECB}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnHeadObjectSuccess", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + }, + { + "id": { + "m_id": "{CEA17C8D-B5D1-4BFC-A2A5-255E400E0CBB}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "String", + "DisplayDataType": { + "m_type": 5 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{6C74517A-866E-49F5-A40F-789824D17513}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnHeadObjectError", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + }, + { + "id": { + "m_id": "{95CE49C3-4F0A-4965-B5C3-913513569320}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "String", + "DisplayDataType": { + "m_type": 5 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{FDE03B1F-652D-4CDA-A206-31A26CA41AC3}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnGetObjectSuccess", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + }, + { + "id": { + "m_id": "{9B140702-0E62-4F33-A078-552BF9697528}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "String", + "DisplayDataType": { + "m_type": 5 + }, + "Descriptor": { + "ConnectionType": 2, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{1A667A27-E9D8-44E0-8ACF-EDE596B226FE}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "ExecutionSlot:OnGetObjectError", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + }, + "IsLatent": true + } + ], + "m_eventMap": [ + { + "Key": { + "Value": 1667438543 + }, + "Value": { + "m_eventName": "OnHeadObjectSuccess", + "m_eventId": { + "Value": 1667438543 + }, + "m_eventSlotId": { + "m_id": "{4D4EC3D0-FD4C-441C-B154-340A529C8ECB}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{3D2D7D19-C7C1-4C2E-8543-5848C8A69A18}" + } + ], + "m_numExpectedArguments": 1 + } + }, + { + "Key": { + "Value": 3580584090 + }, + "Value": { + "m_eventName": "OnGetObjectSuccess", + "m_eventId": { + "Value": 3580584090 + }, + "m_eventSlotId": { + "m_id": "{FDE03B1F-652D-4CDA-A206-31A26CA41AC3}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{95CE49C3-4F0A-4965-B5C3-913513569320}" + } + ], + "m_numExpectedArguments": 1 + } + }, + { + "Key": { + "Value": 3753331652 + }, + "Value": { + "m_eventName": "OnGetObjectError", + "m_eventId": { + "Value": 3753331652 + }, + "m_eventSlotId": { + "m_id": "{1A667A27-E9D8-44E0-8ACF-EDE596B226FE}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{9B140702-0E62-4F33-A078-552BF9697528}" + } + ], + "m_numExpectedArguments": 1 + } + }, + { + "Key": { + "Value": 4007236435 + }, + "Value": { + "m_eventName": "OnHeadObjectError", + "m_eventId": { + "Value": 4007236435 + }, + "m_eventSlotId": { + "m_id": "{6C74517A-866E-49F5-A40F-789824D17513}" + }, + "m_parameterSlotIds": [ + { + "m_id": "{CEA17C8D-B5D1-4BFC-A2A5-255E400E0CBB}" + } + ], + "m_numExpectedArguments": 1 + } + } + ], + "m_ebusName": "AWSS3BehaviorNotificationBus", + "m_busId": { + "Value": 1833099679 + } + } + } + }, + { + "Id": { + "id": 43265842359328 + }, + "Name": "SC-Node(Print)", + "Components": { + "Component_[6038075997199437353]": { + "$type": "Print", + "Id": 6038075997199437353, + "Slots": [ + { + "id": { + "m_id": "{47658951-971E-411F-9E31-B960D7F48DC8}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "In", + "toolTip": "Input signal", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{849AEBCF-3D93-486A-8A21-3461F96CBFAF}" + }, + "DynamicTypeOverride": 3, + "contracts": [ + { + "$type": "SlotTypeContract" + }, + null + ], + "slotName": "Value", + "toolTip": "Value which replaces instances of {Value} in the resulting string.", + "DisplayDataType": { + "m_type": 5 + }, + "DisplayGroup": { + "Value": 1015031923 + }, + "Descriptor": { + "ConnectionType": 1, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{7B689681-8F86-4DD4-A271-9F1343C85751}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Out", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + } + ], + "Datums": [ + { + "isOverloadedStorage": false, + "scriptCanvasType": { + "m_type": 5 + }, + "isNullPointer": false, + "$type": "{03AAAB3F-5C47-5A66-9EBC-D5FA4DB353C9} AZStd::string", + "value": "", + "label": "Value" + } + ], + "m_format": "[S3] Head object error: {Value}", + "m_arrayBindingMap": [ + { + "Key": 1, + "Value": { + "m_id": "{849AEBCF-3D93-486A-8A21-3461F96CBFAF}" + } + } + ], + "m_unresolvedString": [ + "[S3] Head object error: ", + {} + ], + "m_formatSlotMap": { + "Value": { + "m_id": "{849AEBCF-3D93-486A-8A21-3461F96CBFAF}" + } + } + } + } + }, + { + "Id": { + "id": 43274432293920 + }, + "Name": "SC-Node(Print)", + "Components": { + "Component_[7524644815559451168]": { + "$type": "Print", + "Id": 7524644815559451168, + "Slots": [ + { + "id": { + "m_id": "{230376C6-C66E-4820-806D-7DFD860B3E4E}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "In", + "toolTip": "Input signal", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{9D4AD3B1-5346-46BF-B41A-1E8DB0CFCEC0}" + }, + "DynamicTypeOverride": 3, + "contracts": [ + { + "$type": "SlotTypeContract" + }, + null + ], + "slotName": "Value", + "toolTip": "Value which replaces instances of {Value} in the resulting string.", + "DisplayDataType": { + "m_type": 5 + }, + "DisplayGroup": { + "Value": 1015031923 + }, + "Descriptor": { + "ConnectionType": 1, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{25ED2874-445E-4A51-A67C-918642660FE6}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Out", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + } + ], + "Datums": [ + { + "isOverloadedStorage": false, + "scriptCanvasType": { + "m_type": 5 + }, + "isNullPointer": false, + "$type": "{03AAAB3F-5C47-5A66-9EBC-D5FA4DB353C9} AZStd::string", + "value": "", + "label": "Value" + } + ], + "m_format": "[S3] Head object success: {Value}", + "m_arrayBindingMap": [ + { + "Key": 1, + "Value": { + "m_id": "{9D4AD3B1-5346-46BF-B41A-1E8DB0CFCEC0}" + } + } + ], + "m_unresolvedString": [ + "[S3] Head object success: ", + {} + ], + "m_formatSlotMap": { + "Value": { + "m_id": "{9D4AD3B1-5346-46BF-B41A-1E8DB0CFCEC0}" + } + } + } + } + }, + { + "Id": { + "id": 43248662490144 + }, + "Name": "SC-Node(Print)", + "Components": { + "Component_[8569132577613124023]": { + "$type": "Print", + "Id": 8569132577613124023, + "Slots": [ + { + "id": { + "m_id": "{8D6415DA-B0B8-49F1-885A-B95F974BF918}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "In", + "toolTip": "Input signal", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{2AF01FCE-39ED-4EF8-96EF-ABB1210CB96A}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Out", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + } + ], + "m_format": "[S3] Head object request is done", + "m_unresolvedString": [ + "[S3] Head object request is done" + ] + } + } + }, + { + "Id": { + "id": 43261547392032 + }, + "Name": "SC-Node(Print)", + "Components": { + "Component_[9427570285251689352]": { + "$type": "Print", + "Id": 9427570285251689352, + "Slots": [ + { + "id": { + "m_id": "{472018A5-91A3-420B-9A53-8C6C3BDB3B9A}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "In", + "toolTip": "Input signal", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{63318564-6CBD-48A0-A716-7EE608D79B9D}" + }, + "DynamicTypeOverride": 3, + "contracts": [ + { + "$type": "SlotTypeContract" + }, + null + ], + "slotName": "Value", + "toolTip": "Value which replaces instances of {Value} in the resulting string.", + "DisplayDataType": { + "m_type": 5 + }, + "DisplayGroup": { + "Value": 1015031923 + }, + "Descriptor": { + "ConnectionType": 1, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{308C5FF1-B80E-40E1-A532-D29B9BFCD19A}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Out", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + } + ], + "Datums": [ + { + "isOverloadedStorage": false, + "scriptCanvasType": { + "m_type": 5 + }, + "isNullPointer": false, + "$type": "{03AAAB3F-5C47-5A66-9EBC-D5FA4DB353C9} AZStd::string", + "value": "", + "label": "Value" + } + ], + "m_format": "[S3] Get object error: {Value}", + "m_arrayBindingMap": [ + { + "Key": 1, + "Value": { + "m_id": "{63318564-6CBD-48A0-A716-7EE608D79B9D}" + } + } + ], + "m_unresolvedString": [ + "[S3] Get object error: ", + {} + ], + "m_formatSlotMap": { + "Value": { + "m_id": "{63318564-6CBD-48A0-A716-7EE608D79B9D}" + } + } + } + } + }, + { + "Id": { + "id": 43240072555552 + }, + "Name": "SC-Node(ReloadConfigFile)", + "Components": { + "Component_[9465828106765719444]": { + "$type": "{E42861BD-1956-45AE-8DD7-CCFC1E3E5ACF} Method", + "Id": 9465828106765719444, + "Slots": [ + { + "id": { + "m_id": "{9DB59CFA-EB53-4A27-BA02-C0449B9D4E85}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + }, + null + ], + "slotName": "Is Reloading Config FileName", + "toolTip": "Whether reload resource mapping config file name from AWS core configuration settings registry file.", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 2 + }, + "DataType": 1 + }, + { + "id": { + "m_id": "{DEE8C121-E96B-440D-A2DE-9BD38D2BED44}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "In", + "Descriptor": { + "ConnectionType": 1, + "SlotType": 1 + } + }, + { + "id": { + "m_id": "{5B7C73DF-E637-4E11-A0A4-683B5A0DDC19}" + }, + "contracts": [ + { + "$type": "SlotTypeContract" + } + ], + "slotName": "Out", + "Descriptor": { + "ConnectionType": 2, + "SlotType": 1 + } + } + ], + "Datums": [ + { + "isOverloadedStorage": false, + "scriptCanvasType": { + "m_type": 0 + }, + "isNullPointer": false, + "$type": "bool", + "value": true, + "label": "Is Reloading Config FileName" + } + ], + "methodType": 0, + "methodName": "ReloadConfigFile", + "className": "AWSResourceMappingRequestBus", + "resultSlotIDs": [ + {} + ], + "prettyClassName": "AWSResourceMappingRequestBus" + } + } + } + ], + "m_connections": [ + { + "Id": { + "id": 43278727261216 + }, + "Name": "srcEndpoint=(AWSS3BehaviorNotificationBus Handler: String), destEndpoint=(Print: Value)", + "Components": { + "Component_[10778518234367908860]": { + "$type": "{64CA5016-E803-4AC4-9A36-BDA2C890C6EB} Connection", + "Id": 10778518234367908860, + "sourceEndpoint": { + "nodeId": { + "id": 43270137326624 + }, + "slotId": { + "m_id": "{8AC14310-1B94-45CB-9D66-3ACA519A0738}" + } + }, + "targetEndpoint": { + "nodeId": { + "id": 43265842359328 + }, + "slotId": { + "m_id": "{849AEBCF-3D93-486A-8A21-3461F96CBFAF}" + } + } + } + } + }, + { + "Id": { + "id": 43283022228512 + }, + "Name": "srcEndpoint=(AWSS3BehaviorNotificationBus Handler: ExecutionSlot:OnHeadObjectError), destEndpoint=(Print: In)", + "Components": { + "Component_[7890841757728312462]": { + "$type": "{64CA5016-E803-4AC4-9A36-BDA2C890C6EB} Connection", + "Id": 7890841757728312462, + "sourceEndpoint": { + "nodeId": { + "id": 43270137326624 + }, + "slotId": { + "m_id": "{88DF506C-3993-4F7E-A7A7-C5E22D403AC3}" + } + }, + "targetEndpoint": { + "nodeId": { + "id": 43265842359328 + }, + "slotId": { + "m_id": "{47658951-971E-411F-9E31-B960D7F48DC8}" + } + } + } + } + }, + { + "Id": { + "id": 43287317195808 + }, + "Name": "srcEndpoint=(AWSS3BehaviorNotificationBus Handler: String), destEndpoint=(Print: Value)", + "Components": { + "Component_[6865970583966228885]": { + "$type": "{64CA5016-E803-4AC4-9A36-BDA2C890C6EB} Connection", + "Id": 6865970583966228885, + "sourceEndpoint": { + "nodeId": { + "id": 43222892686368 + }, + "slotId": { + "m_id": "{287A31DA-DB54-4C44-A88A-46B05D8C7410}" + } + }, + "targetEndpoint": { + "nodeId": { + "id": 43274432293920 + }, + "slotId": { + "m_id": "{9D4AD3B1-5346-46BF-B41A-1E8DB0CFCEC0}" + } + } + } + } + }, + { + "Id": { + "id": 43291612163104 + }, + "Name": "srcEndpoint=(AWSS3BehaviorNotificationBus Handler: ExecutionSlot:OnHeadObjectSuccess), destEndpoint=(Print: In)", + "Components": { + "Component_[15391746362756122553]": { + "$type": "{64CA5016-E803-4AC4-9A36-BDA2C890C6EB} Connection", + "Id": 15391746362756122553, + "sourceEndpoint": { + "nodeId": { + "id": 43222892686368 + }, + "slotId": { + "m_id": "{113A79E3-0BB3-49A4-B131-4B4CB28B53E0}" + } + }, + "targetEndpoint": { + "nodeId": { + "id": 43274432293920 + }, + "slotId": { + "m_id": "{230376C6-C66E-4820-806D-7DFD860B3E4E}" + } + } + } + } + }, + { + "Id": { + "id": 43295907130400 + }, + "Name": "srcEndpoint=(AWSS3BehaviorNotificationBus Handler: String), destEndpoint=(Print: Value)", + "Components": { + "Component_[10039585713229296427]": { + "$type": "{64CA5016-E803-4AC4-9A36-BDA2C890C6EB} Connection", + "Id": 10039585713229296427, + "sourceEndpoint": { + "nodeId": { + "id": 43244367522848 + }, + "slotId": { + "m_id": "{9B140702-0E62-4F33-A078-552BF9697528}" + } + }, + "targetEndpoint": { + "nodeId": { + "id": 43261547392032 + }, + "slotId": { + "m_id": "{63318564-6CBD-48A0-A716-7EE608D79B9D}" + } + } + } + } + }, + { + "Id": { + "id": 43300202097696 + }, + "Name": "srcEndpoint=(AWSS3BehaviorNotificationBus Handler: ExecutionSlot:OnGetObjectError), destEndpoint=(Print: In)", + "Components": { + "Component_[8537998926774803273]": { + "$type": "{64CA5016-E803-4AC4-9A36-BDA2C890C6EB} Connection", + "Id": 8537998926774803273, + "sourceEndpoint": { + "nodeId": { + "id": 43244367522848 + }, + "slotId": { + "m_id": "{1A667A27-E9D8-44E0-8ACF-EDE596B226FE}" + } + }, + "targetEndpoint": { + "nodeId": { + "id": 43261547392032 + }, + "slotId": { + "m_id": "{472018A5-91A3-420B-9A53-8C6C3BDB3B9A}" + } + } + } + } + }, + { + "Id": { + "id": 43304497064992 + }, + "Name": "srcEndpoint=(AWSS3BehaviorNotificationBus Handler: String), destEndpoint=(Print: Value)", + "Components": { + "Component_[7088318236002637260]": { + "$type": "{64CA5016-E803-4AC4-9A36-BDA2C890C6EB} Connection", + "Id": 7088318236002637260, + "sourceEndpoint": { + "nodeId": { + "id": 43257252424736 + }, + "slotId": { + "m_id": "{3155816E-2FB1-4C8A-918C-40D4A5F91B49}" + } + }, + "targetEndpoint": { + "nodeId": { + "id": 43252957457440 + }, + "slotId": { + "m_id": "{00E106ED-3EEA-4CB5-8112-7CD221D6B5AC}" + } + } + } + } + }, + { + "Id": { + "id": 43308792032288 + }, + "Name": "srcEndpoint=(AWSS3BehaviorNotificationBus Handler: ExecutionSlot:OnGetObjectSuccess), destEndpoint=(Print: In)", + "Components": { + "Component_[6349865987641866384]": { + "$type": "{64CA5016-E803-4AC4-9A36-BDA2C890C6EB} Connection", + "Id": 6349865987641866384, + "sourceEndpoint": { + "nodeId": { + "id": 43257252424736 + }, + "slotId": { + "m_id": "{A02F140B-1EDA-4E15-AFAC-CB319F84CA9C}" + } + }, + "targetEndpoint": { + "nodeId": { + "id": 43252957457440 + }, + "slotId": { + "m_id": "{02869715-99BB-4D3C-8F7A-1462CA96731D}" + } + } + } + } + }, + { + "Id": { + "id": 43313086999584 + }, + "Name": "srcEndpoint=(ReloadConfigFile: Out), destEndpoint=(HeadObject: In)", + "Components": { + "Component_[755160556781400310]": { + "$type": "{64CA5016-E803-4AC4-9A36-BDA2C890C6EB} Connection", + "Id": 755160556781400310, + "sourceEndpoint": { + "nodeId": { + "id": 43240072555552 + }, + "slotId": { + "m_id": "{5B7C73DF-E637-4E11-A0A4-683B5A0DDC19}" + } + }, + "targetEndpoint": { + "nodeId": { + "id": 43231482620960 + }, + "slotId": { + "m_id": "{1042005D-18F7-4B53-9546-2ACCDCCCC9E5}" + } + } + } + } + }, + { + "Id": { + "id": 43317381966880 + }, + "Name": "srcEndpoint=(HeadObject: Out), destEndpoint=(Print: In)", + "Components": { + "Component_[17407727815180487561]": { + "$type": "{64CA5016-E803-4AC4-9A36-BDA2C890C6EB} Connection", + "Id": 17407727815180487561, + "sourceEndpoint": { + "nodeId": { + "id": 43231482620960 + }, + "slotId": { + "m_id": "{6C587F91-F656-4ADC-B03B-88B137B12BDF}" + } + }, + "targetEndpoint": { + "nodeId": { + "id": 43248662490144 + }, + "slotId": { + "m_id": "{8D6415DA-B0B8-49F1-885A-B95F974BF918}" + } + } + } + } + }, + { + "Id": { + "id": 43321676934176 + }, + "Name": "srcEndpoint=(Print: Out), destEndpoint=(GetObject: In)", + "Components": { + "Component_[8583709945803435033]": { + "$type": "{64CA5016-E803-4AC4-9A36-BDA2C890C6EB} Connection", + "Id": 8583709945803435033, + "sourceEndpoint": { + "nodeId": { + "id": 43274432293920 + }, + "slotId": { + "m_id": "{25ED2874-445E-4A51-A67C-918642660FE6}" + } + }, + "targetEndpoint": { + "nodeId": { + "id": 43218597719072 + }, + "slotId": { + "m_id": "{C93A1797-9A7C-4B04-BF26-583058F75A99}" + } + } + } + } + }, + { + "Id": { + "id": 43325971901472 + }, + "Name": "srcEndpoint=(GetObject: Out), destEndpoint=(Print: In)", + "Components": { + "Component_[3235938356873265601]": { + "$type": "{64CA5016-E803-4AC4-9A36-BDA2C890C6EB} Connection", + "Id": 3235938356873265601, + "sourceEndpoint": { + "nodeId": { + "id": 43218597719072 + }, + "slotId": { + "m_id": "{F3E487A8-9C6E-4774-A6BB-4638AF1E895B}" + } + }, + "targetEndpoint": { + "nodeId": { + "id": 43227187653664 + }, + "slotId": { + "m_id": "{F20B6702-B739-412A-9FA5-7FE4BBDCD7BA}" + } + } + } + } + }, + { + "Id": { + "id": 43330266868768 + }, + "Name": "srcEndpoint=(EntityBus Handler: ExecutionSlot:OnEntityActivated), destEndpoint=(ReloadConfigFile: In)", + "Components": { + "Component_[1671079381113308163]": { + "$type": "{64CA5016-E803-4AC4-9A36-BDA2C890C6EB} Connection", + "Id": 1671079381113308163, + "sourceEndpoint": { + "nodeId": { + "id": 43235777588256 + }, + "slotId": { + "m_id": "{96132FCD-AE62-4841-9913-86B6FA7F702F}" + } + }, + "targetEndpoint": { + "nodeId": { + "id": 43240072555552 + }, + "slotId": { + "m_id": "{DEE8C121-E96B-440D-A2DE-9BD38D2BED44}" + } + } + } + } + } + ] + }, + "m_assetType": "{3E2AC8CD-713F-453E-967F-29517F331784}", + "versionData": { + "_grammarVersion": 1, + "_runtimeVersion": 1 + }, + "m_variableCounter": 1, + "GraphCanvasData": [ + { + "Key": { + "id": 43214302751776 + }, + "Value": { + "ComponentData": { + "{5F84B500-8C45-40D1-8EFC-A5306B241444}": { + "$type": "SceneComponentSaveData", + "ViewParams": { + "Scale": 1.2767297, + "AnchorX": -135.50244140625, + "AnchorY": 99.47289276123047 + } + } + } + } + }, + { + "Key": { + "id": 43218597719072 + }, + "Value": { + "ComponentData": { + "{24CB38BB-1705-4EC5-8F63-B574571B4DCD}": { + "$type": "NodeSaveData" + }, + "{328FF15C-C302-458F-A43D-E1794DE0904E}": { + "$type": "GeneralNodeTitleComponentSaveData", + "PaletteOverride": "MethodNodeTitlePalette" + }, + "{7CC444B1-F9B3-41B5-841B-0C4F2179F111}": { + "$type": "GeometrySaveData", + "Position": [ + 620.0, + 700.0 + ] + }, + "{B0B99C8A-03AF-4CF6-A926-F65C874C3D97}": { + "$type": "StylingComponentSaveData", + "SubStyle": ".method" + }, + "{B1F49A35-8408-40DA-B79E-F1E3B64322CE}": { + "$type": "PersistentIdComponentSaveData", + "PersistentId": "{BB84AD11-429D-471E-BE7B-2931F9C332D5}" + } + } + } + }, + { + "Key": { + "id": 43222892686368 + }, + "Value": { + "ComponentData": { + "{24CB38BB-1705-4EC5-8F63-B574571B4DCD}": { + "$type": "NodeSaveData" + }, + "{7CC444B1-F9B3-41B5-841B-0C4F2179F111}": { + "$type": "GeometrySaveData", + "Position": [ + 0.0, + 680.0 + ] + }, + "{9E81C95F-89C0-4476-8E82-63CCC4E52E04}": { + "$type": "EBusHandlerNodeDescriptorSaveData", + "EventIds": [ + { + "Value": 1667438543 + } + ] + }, + "{B0B99C8A-03AF-4CF6-A926-F65C874C3D97}": { + "$type": "StylingComponentSaveData" + }, + "{B1F49A35-8408-40DA-B79E-F1E3B64322CE}": { + "$type": "PersistentIdComponentSaveData", + "PersistentId": "{EF2D56C8-CFAA-41F0-9C07-8CE818D86AA1}" + } + } + } + }, + { + "Key": { + "id": 43227187653664 + }, + "Value": { + "ComponentData": { + "{24CB38BB-1705-4EC5-8F63-B574571B4DCD}": { + "$type": "NodeSaveData" + }, + "{328FF15C-C302-458F-A43D-E1794DE0904E}": { + "$type": "GeneralNodeTitleComponentSaveData", + "PaletteOverride": "StringNodeTitlePalette" + }, + "{7CC444B1-F9B3-41B5-841B-0C4F2179F111}": { + "$type": "GeometrySaveData", + "Position": [ + 1060.0, + 700.0 + ] + }, + "{B0B99C8A-03AF-4CF6-A926-F65C874C3D97}": { + "$type": "StylingComponentSaveData" + }, + "{B1F49A35-8408-40DA-B79E-F1E3B64322CE}": { + "$type": "PersistentIdComponentSaveData", + "PersistentId": "{06BFB417-3B96-40F3-9D42-21AB0293D4DA}" + } + } + } + }, + { + "Key": { + "id": 43231482620960 + }, + "Value": { + "ComponentData": { + "{24CB38BB-1705-4EC5-8F63-B574571B4DCD}": { + "$type": "NodeSaveData" + }, + "{328FF15C-C302-458F-A43D-E1794DE0904E}": { + "$type": "GeneralNodeTitleComponentSaveData", + "PaletteOverride": "MethodNodeTitlePalette" + }, + "{7CC444B1-F9B3-41B5-841B-0C4F2179F111}": { + "$type": "GeometrySaveData", + "Position": [ + 480.0, + 140.0 + ] + }, + "{B0B99C8A-03AF-4CF6-A926-F65C874C3D97}": { + "$type": "StylingComponentSaveData", + "SubStyle": ".method" + }, + "{B1F49A35-8408-40DA-B79E-F1E3B64322CE}": { + "$type": "PersistentIdComponentSaveData", + "PersistentId": "{740DBD99-C319-404C-A3D7-450E64613B73}" + } + } + } + }, + { + "Key": { + "id": 43235777588256 + }, + "Value": { + "ComponentData": { + "{24CB38BB-1705-4EC5-8F63-B574571B4DCD}": { + "$type": "NodeSaveData" + }, + "{7CC444B1-F9B3-41B5-841B-0C4F2179F111}": { + "$type": "GeometrySaveData", + "Position": [ + -140.0, + 60.0 + ] + }, + "{9E81C95F-89C0-4476-8E82-63CCC4E52E04}": { + "$type": "EBusHandlerNodeDescriptorSaveData", + "EventIds": [ + { + "Value": 245425936 + } + ] + }, + "{B0B99C8A-03AF-4CF6-A926-F65C874C3D97}": { + "$type": "StylingComponentSaveData" + }, + "{B1F49A35-8408-40DA-B79E-F1E3B64322CE}": { + "$type": "PersistentIdComponentSaveData", + "PersistentId": "{93CC9E2D-86CD-4FB5-95E4-961F6ABF9B39}" + } + } + } + }, + { + "Key": { + "id": 43240072555552 + }, + "Value": { + "ComponentData": { + "{24CB38BB-1705-4EC5-8F63-B574571B4DCD}": { + "$type": "NodeSaveData" + }, + "{328FF15C-C302-458F-A43D-E1794DE0904E}": { + "$type": "GeneralNodeTitleComponentSaveData", + "PaletteOverride": "MethodNodeTitlePalette" + }, + "{7CC444B1-F9B3-41B5-841B-0C4F2179F111}": { + "$type": "GeometrySaveData", + "Position": [ + 180.0, + 140.0 + ] + }, + "{B0B99C8A-03AF-4CF6-A926-F65C874C3D97}": { + "$type": "StylingComponentSaveData", + "SubStyle": ".method" + }, + "{B1F49A35-8408-40DA-B79E-F1E3B64322CE}": { + "$type": "PersistentIdComponentSaveData", + "PersistentId": "{CD3D6D5F-F274-4592-A15D-01422CA3EBE7}" + } + } + } + }, + { + "Key": { + "id": 43244367522848 + }, + "Value": { + "ComponentData": { + "{24CB38BB-1705-4EC5-8F63-B574571B4DCD}": { + "$type": "NodeSaveData" + }, + "{7CC444B1-F9B3-41B5-841B-0C4F2179F111}": { + "$type": "GeometrySaveData", + "Position": [ + 0.0, + 980.0 + ] + }, + "{9E81C95F-89C0-4476-8E82-63CCC4E52E04}": { + "$type": "EBusHandlerNodeDescriptorSaveData", + "EventIds": [ + { + "Value": 3753331652 + } + ] + }, + "{B0B99C8A-03AF-4CF6-A926-F65C874C3D97}": { + "$type": "StylingComponentSaveData" + }, + "{B1F49A35-8408-40DA-B79E-F1E3B64322CE}": { + "$type": "PersistentIdComponentSaveData", + "PersistentId": "{DCBCA7D8-58C9-4C2C-8BF8-04EFD44F0988}" + } + } + } + }, + { + "Key": { + "id": 43248662490144 + }, + "Value": { + "ComponentData": { + "{24CB38BB-1705-4EC5-8F63-B574571B4DCD}": { + "$type": "NodeSaveData" + }, + "{328FF15C-C302-458F-A43D-E1794DE0904E}": { + "$type": "GeneralNodeTitleComponentSaveData", + "PaletteOverride": "StringNodeTitlePalette" + }, + "{7CC444B1-F9B3-41B5-841B-0C4F2179F111}": { + "$type": "GeometrySaveData", + "Position": [ + 920.0, + 140.0 + ] + }, + "{B0B99C8A-03AF-4CF6-A926-F65C874C3D97}": { + "$type": "StylingComponentSaveData" + }, + "{B1F49A35-8408-40DA-B79E-F1E3B64322CE}": { + "$type": "PersistentIdComponentSaveData", + "PersistentId": "{FE6ECEDF-A83B-4A89-A8DB-2166A3C8319E}" + } + } + } + }, + { + "Key": { + "id": 43252957457440 + }, + "Value": { + "ComponentData": { + "{24CB38BB-1705-4EC5-8F63-B574571B4DCD}": { + "$type": "NodeSaveData" + }, + "{328FF15C-C302-458F-A43D-E1794DE0904E}": { + "$type": "GeneralNodeTitleComponentSaveData", + "PaletteOverride": "StringNodeTitlePalette" + }, + "{7CC444B1-F9B3-41B5-841B-0C4F2179F111}": { + "$type": "GeometrySaveData", + "Position": [ + 980.0, + 1000.0 + ] + }, + "{B0B99C8A-03AF-4CF6-A926-F65C874C3D97}": { + "$type": "StylingComponentSaveData" + }, + "{B1F49A35-8408-40DA-B79E-F1E3B64322CE}": { + "$type": "PersistentIdComponentSaveData", + "PersistentId": "{F441C1CA-A02D-45D0-BB4F-D32F5B797464}" + } + } + } + }, + { + "Key": { + "id": 43257252424736 + }, + "Value": { + "ComponentData": { + "{24CB38BB-1705-4EC5-8F63-B574571B4DCD}": { + "$type": "NodeSaveData" + }, + "{7CC444B1-F9B3-41B5-841B-0C4F2179F111}": { + "$type": "GeometrySaveData", + "Position": [ + 640.0, + 980.0 + ] + }, + "{9E81C95F-89C0-4476-8E82-63CCC4E52E04}": { + "$type": "EBusHandlerNodeDescriptorSaveData", + "EventIds": [ + { + "Value": 3580584090 + } + ] + }, + "{B0B99C8A-03AF-4CF6-A926-F65C874C3D97}": { + "$type": "StylingComponentSaveData" + }, + "{B1F49A35-8408-40DA-B79E-F1E3B64322CE}": { + "$type": "PersistentIdComponentSaveData", + "PersistentId": "{5B28E54D-DC62-4358-9DA6-EA8B9CE006F9}" + } + } + } + }, + { + "Key": { + "id": 43261547392032 + }, + "Value": { + "ComponentData": { + "{24CB38BB-1705-4EC5-8F63-B574571B4DCD}": { + "$type": "NodeSaveData" + }, + "{328FF15C-C302-458F-A43D-E1794DE0904E}": { + "$type": "GeneralNodeTitleComponentSaveData", + "PaletteOverride": "StringNodeTitlePalette" + }, + "{7CC444B1-F9B3-41B5-841B-0C4F2179F111}": { + "$type": "GeometrySaveData", + "Position": [ + 320.0, + 1000.0 + ] + }, + "{B0B99C8A-03AF-4CF6-A926-F65C874C3D97}": { + "$type": "StylingComponentSaveData" + }, + "{B1F49A35-8408-40DA-B79E-F1E3B64322CE}": { + "$type": "PersistentIdComponentSaveData", + "PersistentId": "{EEDD65F5-EF45-458F-BF74-751F981F726B}" + } + } + } + }, + { + "Key": { + "id": 43265842359328 + }, + "Value": { + "ComponentData": { + "{24CB38BB-1705-4EC5-8F63-B574571B4DCD}": { + "$type": "NodeSaveData" + }, + "{328FF15C-C302-458F-A43D-E1794DE0904E}": { + "$type": "GeneralNodeTitleComponentSaveData", + "PaletteOverride": "StringNodeTitlePalette" + }, + "{7CC444B1-F9B3-41B5-841B-0C4F2179F111}": { + "$type": "GeometrySaveData", + "Position": [ + 320.0, + 380.0 + ] + }, + "{B0B99C8A-03AF-4CF6-A926-F65C874C3D97}": { + "$type": "StylingComponentSaveData" + }, + "{B1F49A35-8408-40DA-B79E-F1E3B64322CE}": { + "$type": "PersistentIdComponentSaveData", + "PersistentId": "{251706A4-3954-4D6D-A2BA-E69653339775}" + } + } + } + }, + { + "Key": { + "id": 43270137326624 + }, + "Value": { + "ComponentData": { + "{24CB38BB-1705-4EC5-8F63-B574571B4DCD}": { + "$type": "NodeSaveData" + }, + "{7CC444B1-F9B3-41B5-841B-0C4F2179F111}": { + "$type": "GeometrySaveData", + "Position": [ + 0.0, + 340.0 + ] + }, + "{9E81C95F-89C0-4476-8E82-63CCC4E52E04}": { + "$type": "EBusHandlerNodeDescriptorSaveData", + "EventIds": [ + { + "Value": 4007236435 + } + ] + }, + "{B0B99C8A-03AF-4CF6-A926-F65C874C3D97}": { + "$type": "StylingComponentSaveData" + }, + "{B1F49A35-8408-40DA-B79E-F1E3B64322CE}": { + "$type": "PersistentIdComponentSaveData", + "PersistentId": "{BBAC49E9-7973-4856-8679-3062BDC02E15}" + } + } + } + }, + { + "Key": { + "id": 43274432293920 + }, + "Value": { + "ComponentData": { + "{24CB38BB-1705-4EC5-8F63-B574571B4DCD}": { + "$type": "NodeSaveData" + }, + "{328FF15C-C302-458F-A43D-E1794DE0904E}": { + "$type": "GeneralNodeTitleComponentSaveData", + "PaletteOverride": "StringNodeTitlePalette" + }, + "{7CC444B1-F9B3-41B5-841B-0C4F2179F111}": { + "$type": "GeometrySaveData", + "Position": [ + 320.0, + 700.0 + ] + }, + "{B0B99C8A-03AF-4CF6-A926-F65C874C3D97}": { + "$type": "StylingComponentSaveData" + }, + "{B1F49A35-8408-40DA-B79E-F1E3B64322CE}": { + "$type": "PersistentIdComponentSaveData", + "PersistentId": "{6F86C19E-C1CB-48E9-A07E-E5530C0EB249}" + } + } + } + } + ], + "StatisticsHelper": { + "InstanceCounter": [ + { + "Key": 150571302584609517, + "Value": 1 + }, + { + "Key": 2868561716899956608, + "Value": 1 + }, + { + "Key": 5842116761103598202, + "Value": 1 + }, + { + "Key": 5842117502542734531, + "Value": 1 + }, + { + "Key": 5842117502822853940, + "Value": 1 + }, + { + "Key": 5842117516270952429, + "Value": 1 + }, + { + "Key": 5842117517645097144, + "Value": 1 + }, + { + "Key": 10684225535275896474, + "Value": 6 + }, + { + "Key": 13774516555319876501, + "Value": 1 + } + ] + } + } + } + } + } +} \ No newline at end of file From b06583745058ced12c325350552489c91149ae98 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Fri, 27 Aug 2021 17:44:08 -0700 Subject: [PATCH 129/131] Fix for non-unity file and double declaration of WCHAR (#3657) Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../Atom/Asset/ImageProcessingAtom/Code/CMakeLists.txt | 2 +- .../Code/Source/Compressors/Compressor.cpp | 1 + .../Code/Source/Compressors/PVRTC.cpp | 10 +--------- .../Code/imageprocessing_files.cmake | 4 ---- .../External/CubeMapGen/CCubeMapProcessor.h | 7 +++---- .../External/CubeMapGen/CImageSurface.h | 5 +++-- 6 files changed, 9 insertions(+), 20 deletions(-) diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/CMakeLists.txt b/Gems/Atom/Asset/ImageProcessingAtom/Code/CMakeLists.txt index 6227d74d7e..dfeee011cc 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/CMakeLists.txt +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/CMakeLists.txt @@ -48,7 +48,7 @@ ly_add_target( PLATFORM_INCLUDE_FILES ${pal_source_dir}/platform_${PAL_PLATFORM_NAME_LOWERCASE}.cmake ${common_source_dir}/${PAL_TRAIT_COMPILER_ID}/imageprocessingatom_editor_static_${PAL_TRAIT_COMPILER_ID_LOWERCASE}.cmake - ${platform_tools_files} + ${platform_tools_files} INCLUDE_DIRECTORIES PUBLIC Include diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Compressors/Compressor.cpp b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Compressors/Compressor.cpp index 2cd7ff0e9b..9013bff1db 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Compressors/Compressor.cpp +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Compressors/Compressor.cpp @@ -7,6 +7,7 @@ */ +#include #include #include #include diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Compressors/PVRTC.cpp b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Compressors/PVRTC.cpp index 0002ff4678..7c899e4ad2 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Compressors/PVRTC.cpp +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/Compressors/PVRTC.cpp @@ -7,20 +7,12 @@ */ #include +#include #include #include #include #include -#if AZ_TRAIT_IMAGEPROCESSING_PVRTEXLIB_USE_WINDLL_IMPORT -//_WINDLL_IMPORT need to be defined before including PVRTexLib header files to avoid linking error on windows. -#define _WINDLL_IMPORT -// NOMINMAX needs to be defined before including PVRTexLib header files (which include Windows.h) -// so that Windows.h doesn't define min/max. Otherwise, a compile error may arise in Uber builds -#ifndef NOMINMAX -#define NOMINMAX -#endif -#endif #include #include diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/imageprocessing_files.cmake b/Gems/Atom/Asset/ImageProcessingAtom/Code/imageprocessing_files.cmake index 29f7a9ca57..55ccdf1d89 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/imageprocessing_files.cmake +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/imageprocessing_files.cmake @@ -136,7 +136,3 @@ set(FILES Source/Thumbnail/ImageThumbnailSystemComponent.cpp Source/Thumbnail/ImageThumbnailSystemComponent.h ) - -set(SKIP_UNITY_BUILD_INCLUSION_FILES - Source/Compressors/PVRTC.cpp -) diff --git a/Gems/Atom/Asset/ImageProcessingAtom/External/CubeMapGen/CCubeMapProcessor.h b/Gems/Atom/Asset/ImageProcessingAtom/External/CubeMapGen/CCubeMapProcessor.h index 4a29e8621a..c78bfcfec6 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/External/CubeMapGen/CCubeMapProcessor.h +++ b/Gems/Atom/Asset/ImageProcessingAtom/External/CubeMapGen/CCubeMapProcessor.h @@ -14,6 +14,7 @@ #include #include #include +#include #include "VectorMacros.h" #include "CBBoxInt32.h" @@ -22,11 +23,9 @@ //has routines for saving .rgbe files #define CG_RGBE_SUPPORT - -#ifndef WCHAR +#ifndef WCHAR // For non-windows platforms, for Windows-based platforms it will be defined through PlatformIncl.h #define WCHAR wchar_t -#endif //WCHAR - +#endif // WCHAR //used to index cube faces #define CP_FACE_X_POS 0 diff --git a/Gems/Atom/Asset/ImageProcessingAtom/External/CubeMapGen/CImageSurface.h b/Gems/Atom/Asset/ImageProcessingAtom/External/CubeMapGen/CImageSurface.h index 848cbd1dbe..bbc41e756c 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/External/CubeMapGen/CImageSurface.h +++ b/Gems/Atom/Asset/ImageProcessingAtom/External/CubeMapGen/CImageSurface.h @@ -14,10 +14,11 @@ #include "VectorMacros.h" #include +#include -#ifndef WCHAR +#ifndef WCHAR // For non-windows platforms, for Windows-based platforms it will be defined through PlatformIncl.h #define WCHAR wchar_t -#endif //WCHAR +#endif // WCHAR #ifndef SAFE_DELETE #define SAFE_DELETE(p) { if(p) { delete (p); (p)=NULL; } } From c32740ad539e387385da0cf8719e7518452623c1 Mon Sep 17 00:00:00 2001 From: Qing Tao <55564570+VickyAtAZ@users.noreply.github.com> Date: Mon, 30 Aug 2021 09:30:13 -0700 Subject: [PATCH 130/131] Removed all preview.png and references of preview.png in all Atom related gems. (#3664) Signed-off-by: qingtao --- Gems/Atom/Asset/ImageProcessingAtom/preview.png | 3 --- Gems/Atom/Asset/Shader/preview.png | 3 --- Gems/Atom/Bootstrap/preview.png | 3 --- Gems/Atom/Component/DebugCamera/preview.png | 3 --- Gems/Atom/Feature/Common/preview.png | 3 --- Gems/Atom/Feature/Mesh/preview.png | 3 --- Gems/Atom/RHI/DX12/preview.png | 3 --- Gems/Atom/RHI/Metal/preview.png | 3 --- Gems/Atom/RHI/Vulkan/preview.png | 3 --- Gems/Atom/RHI/preview.png | 3 --- Gems/Atom/RPI/preview.png | 3 --- Gems/Atom/Tools/AtomToolsFramework/preview.png | 3 --- Gems/Atom/Utils/preview.png | 3 --- Gems/Atom/gem.json | 1 - Gems/AtomContent/ReferenceMaterials/gem.json | 1 - Gems/AtomContent/ReferenceMaterials/preview.png | 3 --- Gems/AtomContent/Sponza/gem.json | 1 - Gems/AtomContent/Sponza/preview.png | 3 --- Gems/AtomContent/gem.json | 1 - Gems/AtomLyIntegration/AtomBridge/preview.png | 3 --- Gems/AtomLyIntegration/AtomImGuiTools/preview.png | 3 --- Gems/AtomLyIntegration/CommonFeatures/preview.png | 3 --- Gems/AtomLyIntegration/ImguiAtom/preview.png | 3 --- .../TechnicalArt/DccScriptingInterface/preview.png | 3 --- Gems/AtomLyIntegration/gem.json | 1 - Gems/AtomTressFX/gem.json | 1 - Gems/AtomTressFX/preview.png | 3 --- 27 files changed, 69 deletions(-) delete mode 100644 Gems/Atom/Asset/ImageProcessingAtom/preview.png delete mode 100644 Gems/Atom/Asset/Shader/preview.png delete mode 100644 Gems/Atom/Bootstrap/preview.png delete mode 100644 Gems/Atom/Component/DebugCamera/preview.png delete mode 100644 Gems/Atom/Feature/Common/preview.png delete mode 100644 Gems/Atom/Feature/Mesh/preview.png delete mode 100644 Gems/Atom/RHI/DX12/preview.png delete mode 100644 Gems/Atom/RHI/Metal/preview.png delete mode 100644 Gems/Atom/RHI/Vulkan/preview.png delete mode 100644 Gems/Atom/RHI/preview.png delete mode 100644 Gems/Atom/RPI/preview.png delete mode 100644 Gems/Atom/Tools/AtomToolsFramework/preview.png delete mode 100644 Gems/Atom/Utils/preview.png delete mode 100644 Gems/AtomContent/ReferenceMaterials/preview.png delete mode 100644 Gems/AtomContent/Sponza/preview.png delete mode 100644 Gems/AtomLyIntegration/AtomBridge/preview.png delete mode 100644 Gems/AtomLyIntegration/AtomImGuiTools/preview.png delete mode 100644 Gems/AtomLyIntegration/CommonFeatures/preview.png delete mode 100644 Gems/AtomLyIntegration/ImguiAtom/preview.png delete mode 100644 Gems/AtomLyIntegration/TechnicalArt/DccScriptingInterface/preview.png delete mode 100644 Gems/AtomTressFX/preview.png diff --git a/Gems/Atom/Asset/ImageProcessingAtom/preview.png b/Gems/Atom/Asset/ImageProcessingAtom/preview.png deleted file mode 100644 index 2f1ed47754..0000000000 --- a/Gems/Atom/Asset/ImageProcessingAtom/preview.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:6d6204c6730e5675791765ca194e9b1cbec282208e280507de830afc2805e5fa -size 41127 diff --git a/Gems/Atom/Asset/Shader/preview.png b/Gems/Atom/Asset/Shader/preview.png deleted file mode 100644 index 2f1ed47754..0000000000 --- a/Gems/Atom/Asset/Shader/preview.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:6d6204c6730e5675791765ca194e9b1cbec282208e280507de830afc2805e5fa -size 41127 diff --git a/Gems/Atom/Bootstrap/preview.png b/Gems/Atom/Bootstrap/preview.png deleted file mode 100644 index 2f1ed47754..0000000000 --- a/Gems/Atom/Bootstrap/preview.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:6d6204c6730e5675791765ca194e9b1cbec282208e280507de830afc2805e5fa -size 41127 diff --git a/Gems/Atom/Component/DebugCamera/preview.png b/Gems/Atom/Component/DebugCamera/preview.png deleted file mode 100644 index 400b6e6e35..0000000000 --- a/Gems/Atom/Component/DebugCamera/preview.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:bc978169029b8ef4e69ee02abdc7f9bdc970900db90169bbf25d4b201f5c1287 -size 37625 diff --git a/Gems/Atom/Feature/Common/preview.png b/Gems/Atom/Feature/Common/preview.png deleted file mode 100644 index 2f1ed47754..0000000000 --- a/Gems/Atom/Feature/Common/preview.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:6d6204c6730e5675791765ca194e9b1cbec282208e280507de830afc2805e5fa -size 41127 diff --git a/Gems/Atom/Feature/Mesh/preview.png b/Gems/Atom/Feature/Mesh/preview.png deleted file mode 100644 index 2f1ed47754..0000000000 --- a/Gems/Atom/Feature/Mesh/preview.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:6d6204c6730e5675791765ca194e9b1cbec282208e280507de830afc2805e5fa -size 41127 diff --git a/Gems/Atom/RHI/DX12/preview.png b/Gems/Atom/RHI/DX12/preview.png deleted file mode 100644 index 2f1ed47754..0000000000 --- a/Gems/Atom/RHI/DX12/preview.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:6d6204c6730e5675791765ca194e9b1cbec282208e280507de830afc2805e5fa -size 41127 diff --git a/Gems/Atom/RHI/Metal/preview.png b/Gems/Atom/RHI/Metal/preview.png deleted file mode 100644 index 2f1ed47754..0000000000 --- a/Gems/Atom/RHI/Metal/preview.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:6d6204c6730e5675791765ca194e9b1cbec282208e280507de830afc2805e5fa -size 41127 diff --git a/Gems/Atom/RHI/Vulkan/preview.png b/Gems/Atom/RHI/Vulkan/preview.png deleted file mode 100644 index 2f1ed47754..0000000000 --- a/Gems/Atom/RHI/Vulkan/preview.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:6d6204c6730e5675791765ca194e9b1cbec282208e280507de830afc2805e5fa -size 41127 diff --git a/Gems/Atom/RHI/preview.png b/Gems/Atom/RHI/preview.png deleted file mode 100644 index 2f1ed47754..0000000000 --- a/Gems/Atom/RHI/preview.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:6d6204c6730e5675791765ca194e9b1cbec282208e280507de830afc2805e5fa -size 41127 diff --git a/Gems/Atom/RPI/preview.png b/Gems/Atom/RPI/preview.png deleted file mode 100644 index 2f1ed47754..0000000000 --- a/Gems/Atom/RPI/preview.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:6d6204c6730e5675791765ca194e9b1cbec282208e280507de830afc2805e5fa -size 41127 diff --git a/Gems/Atom/Tools/AtomToolsFramework/preview.png b/Gems/Atom/Tools/AtomToolsFramework/preview.png deleted file mode 100644 index 2f1ed47754..0000000000 --- a/Gems/Atom/Tools/AtomToolsFramework/preview.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:6d6204c6730e5675791765ca194e9b1cbec282208e280507de830afc2805e5fa -size 41127 diff --git a/Gems/Atom/Utils/preview.png b/Gems/Atom/Utils/preview.png deleted file mode 100644 index 2f1ed47754..0000000000 --- a/Gems/Atom/Utils/preview.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:6d6204c6730e5675791765ca194e9b1cbec282208e280507de830afc2805e5fa -size 41127 diff --git a/Gems/Atom/gem.json b/Gems/Atom/gem.json index f927e42e7e..99ca26025a 100644 --- a/Gems/Atom/gem.json +++ b/Gems/Atom/gem.json @@ -7,7 +7,6 @@ "summary": "The Atom Renderer Gem provides Atom Renderer and its associated tools (such as Material Editor), utilites, libraries, and interfaces.", "canonical_tags": ["Gem"], "user_tags": ["Rendering", "Core"], - "icon_path": "preview.png", "requirements": "", "documentation_url": "https://o3de.org/docs/user-guide/gems/reference/rendering/atom/atom/" } diff --git a/Gems/AtomContent/ReferenceMaterials/gem.json b/Gems/AtomContent/ReferenceMaterials/gem.json index cb1d6f7a2e..d66c2fa1db 100644 --- a/Gems/AtomContent/ReferenceMaterials/gem.json +++ b/Gems/AtomContent/ReferenceMaterials/gem.json @@ -7,6 +7,5 @@ "summary": "Atom Asset Gem with a library of reference materials for StandardPBR (and others in the future)", "canonical_tags": ["Gem"], "user_tags": ["Assets"], - "icon_path": "preview.png", "requirements": "" } diff --git a/Gems/AtomContent/ReferenceMaterials/preview.png b/Gems/AtomContent/ReferenceMaterials/preview.png deleted file mode 100644 index 2f1ed47754..0000000000 --- a/Gems/AtomContent/ReferenceMaterials/preview.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:6d6204c6730e5675791765ca194e9b1cbec282208e280507de830afc2805e5fa -size 41127 diff --git a/Gems/AtomContent/Sponza/gem.json b/Gems/AtomContent/Sponza/gem.json index ef054ce55a..3fc76927e1 100644 --- a/Gems/AtomContent/Sponza/gem.json +++ b/Gems/AtomContent/Sponza/gem.json @@ -7,6 +7,5 @@ "summary": "A standard test scene for Global Illumination (forked from crytek sponza scene)", "canonical_tags": ["Gem"], "user_tags": ["Assets"], - "icon_path": "preview.png", "requirements": "" } diff --git a/Gems/AtomContent/Sponza/preview.png b/Gems/AtomContent/Sponza/preview.png deleted file mode 100644 index 2f1ed47754..0000000000 --- a/Gems/AtomContent/Sponza/preview.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:6d6204c6730e5675791765ca194e9b1cbec282208e280507de830afc2805e5fa -size 41127 diff --git a/Gems/AtomContent/gem.json b/Gems/AtomContent/gem.json index 8161635f43..6fcb8903e4 100644 --- a/Gems/AtomContent/gem.json +++ b/Gems/AtomContent/gem.json @@ -7,7 +7,6 @@ "summary": "The Atom Content Gem provides assets for Atom Renderer and a modified version of the Pixar Look Development Studio.", "canonical_tags": ["Gem"], "user_tags": ["Rendering", "Assets", "Tools"], - "icon_path": "preview.png", "requirements": "", "documentation_url": "https://o3de.org/docs/user-guide/gems/reference/rendering/atom/atom-content/" } diff --git a/Gems/AtomLyIntegration/AtomBridge/preview.png b/Gems/AtomLyIntegration/AtomBridge/preview.png deleted file mode 100644 index 2f1ed47754..0000000000 --- a/Gems/AtomLyIntegration/AtomBridge/preview.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:6d6204c6730e5675791765ca194e9b1cbec282208e280507de830afc2805e5fa -size 41127 diff --git a/Gems/AtomLyIntegration/AtomImGuiTools/preview.png b/Gems/AtomLyIntegration/AtomImGuiTools/preview.png deleted file mode 100644 index 2f1ed47754..0000000000 --- a/Gems/AtomLyIntegration/AtomImGuiTools/preview.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:6d6204c6730e5675791765ca194e9b1cbec282208e280507de830afc2805e5fa -size 41127 diff --git a/Gems/AtomLyIntegration/CommonFeatures/preview.png b/Gems/AtomLyIntegration/CommonFeatures/preview.png deleted file mode 100644 index 2f1ed47754..0000000000 --- a/Gems/AtomLyIntegration/CommonFeatures/preview.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:6d6204c6730e5675791765ca194e9b1cbec282208e280507de830afc2805e5fa -size 41127 diff --git a/Gems/AtomLyIntegration/ImguiAtom/preview.png b/Gems/AtomLyIntegration/ImguiAtom/preview.png deleted file mode 100644 index 2f1ed47754..0000000000 --- a/Gems/AtomLyIntegration/ImguiAtom/preview.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:6d6204c6730e5675791765ca194e9b1cbec282208e280507de830afc2805e5fa -size 41127 diff --git a/Gems/AtomLyIntegration/TechnicalArt/DccScriptingInterface/preview.png b/Gems/AtomLyIntegration/TechnicalArt/DccScriptingInterface/preview.png deleted file mode 100644 index b48e4907fc..0000000000 --- a/Gems/AtomLyIntegration/TechnicalArt/DccScriptingInterface/preview.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:1bda4365dc85f8abbcb2b08e942ad03e3d7d9dabe555e079185789a2e1b282bf -size 23321 diff --git a/Gems/AtomLyIntegration/gem.json b/Gems/AtomLyIntegration/gem.json index 28faf364db..5af133c8e8 100644 --- a/Gems/AtomLyIntegration/gem.json +++ b/Gems/AtomLyIntegration/gem.json @@ -7,7 +7,6 @@ "summary": "The Atom O3DE Integration Gem provides components, libraries, and functionality to support and integrate Atom Renderer in Open 3D Engine.", "canonical_tags": ["Gem"], "user_tags": ["Rendering", "Core", "Utility"], - "icon_path": "preview.png", "requirements": "", "documentation_url": "https://o3de.org/docs/user-guide/gems/reference/rendering/atom/atom-ly-integration/" } diff --git a/Gems/AtomTressFX/gem.json b/Gems/AtomTressFX/gem.json index 5f2e25b8a9..f6ff2b41d5 100644 --- a/Gems/AtomTressFX/gem.json +++ b/Gems/AtomTressFX/gem.json @@ -7,7 +7,6 @@ "summary": "The Atom TressFX Gem provides realistic hair and fur simulation and rendering in Atom and Open 3D Engine with AMD TressFX.", "canonical_tags": ["Gem"], "user_tags": ["Rendering", "Physics", "Animation"], - "icon_path": "preview.png", "requirements": "", "documentation_url": "https://o3de.org/docs/user-guide/gems/reference/rendering/amd/atom-tressfx/" } diff --git a/Gems/AtomTressFX/preview.png b/Gems/AtomTressFX/preview.png deleted file mode 100644 index 2f1ed47754..0000000000 --- a/Gems/AtomTressFX/preview.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:6d6204c6730e5675791765ca194e9b1cbec282208e280507de830afc2805e5fa -size 41127 From f2eb8ff51fac69b65d7bf71311d1d5fa69a2d37c Mon Sep 17 00:00:00 2001 From: Qing Tao <55564570+VickyAtAZ@users.noreply.github.com> Date: Mon, 30 Aug 2021 10:10:22 -0700 Subject: [PATCH 131/131] ATOM-16237 Using setting registry to RPI system settings (#3663) * ATOM-16237 Using setting registry to RPI system settings Changes include: - Remove RHISystemDesriptor since the pre-registered draw list tag is not needed. - Remove EitorContext which was for system component settings. - Add atom_rpi.setreg file - Add getting RPISystemDescriptor from setting registry. Signed-off-by: qingtao --- .../Code/Source/CommonSystemComponent.cpp | 1 + .../Atom/RHI.Reflect/RHISystemDescriptor.h | 31 -------------- .../RHI/Code/Include/Atom/RHI/RHISystem.h | 3 +- .../RHI.Reflect/RHISystemDescriptor.cpp | 40 ------------------- .../RHI.Reflect/ReflectSystemComponent.cpp | 2 - Gems/Atom/RHI/Code/Source/RHI/RHISystem.cpp | 10 +---- .../RHI/Code/atom_rhi_reflect_files.cmake | 2 - .../RPI.Reflect/Image/ImageSystemDescriptor.h | 8 ++++ .../Atom/RPI.Reflect/RPISystemDescriptor.h | 3 -- .../Source/RPI.Private/RPISystemComponent.cpp | 11 +++-- .../RPI/Code/Source/RPI.Public/RPISystem.cpp | 4 +- .../Image/ImageSystemDescriptor.cpp | 15 ------- .../RPI.Reflect/RPISystemDescriptor.cpp | 25 +----------- Gems/Atom/RPI/Registry/atom_rpi.setreg | 24 +++++++++++ .../Code/Source/LyShineSystemComponent.cpp | 4 ++ 15 files changed, 50 insertions(+), 133 deletions(-) delete mode 100644 Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/RHISystemDescriptor.h delete mode 100644 Gems/Atom/RHI/Code/Source/RHI.Reflect/RHISystemDescriptor.cpp create mode 100644 Gems/Atom/RPI/Registry/atom_rpi.setreg diff --git a/Gems/Atom/Feature/Common/Code/Source/CommonSystemComponent.cpp b/Gems/Atom/Feature/Common/Code/Source/CommonSystemComponent.cpp index 1500079b00..de03c08c6f 100644 --- a/Gems/Atom/Feature/Common/Code/Source/CommonSystemComponent.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/CommonSystemComponent.cpp @@ -294,6 +294,7 @@ namespace AZ void CommonSystemComponent::Deactivate() { + m_loadTemplatesHandler.Disconnect(); AZ::RPI::FeatureProcessorFactory::Get()->UnregisterFeatureProcessor(); AZ::RPI::FeatureProcessorFactory::Get()->UnregisterFeatureProcessor(); AZ::RPI::FeatureProcessorFactory::Get()->UnregisterFeatureProcessor(); diff --git a/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/RHISystemDescriptor.h b/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/RHISystemDescriptor.h deleted file mode 100644 index 8c512662e7..0000000000 --- a/Gems/Atom/RHI/Code/Include/Atom/RHI.Reflect/RHISystemDescriptor.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#pragma once - -#include -#include - -namespace AZ -{ - class ReflectContext; - - - namespace RHI - { - class PlatformLimits; - struct RHISystemDescriptor final - { - AZ_TYPE_INFO(RHISystemDescriptor, "{A506DA28-856C-483A-938D-73471D2C5A5B}"); - static void Reflect(AZ::ReflectContext* context); - - //! The set of globally declared draw list tags, which will be registered with the registry at startup. - AZStd::vector m_drawListTags; - }; - } // namespace RHI -} // namespace AZ diff --git a/Gems/Atom/RHI/Code/Include/Atom/RHI/RHISystem.h b/Gems/Atom/RHI/Code/Include/Atom/RHI/RHISystem.h index 25026b5b87..599108654a 100644 --- a/Gems/Atom/RHI/Code/Include/Atom/RHI/RHISystem.h +++ b/Gems/Atom/RHI/Code/Include/Atom/RHI/RHISystem.h @@ -14,7 +14,6 @@ #include #include #include -#include namespace AZ { @@ -33,7 +32,7 @@ namespace AZ void InitDevice(); //! This function initializes the rest of the RHI/RHI backend. - void Init(const RHISystemDescriptor& descriptor); + void Init(); void Shutdown(); //! An external callback to build the frame graph. diff --git a/Gems/Atom/RHI/Code/Source/RHI.Reflect/RHISystemDescriptor.cpp b/Gems/Atom/RHI/Code/Source/RHI.Reflect/RHISystemDescriptor.cpp deleted file mode 100644 index 45463c79ac..0000000000 --- a/Gems/Atom/RHI/Code/Source/RHI.Reflect/RHISystemDescriptor.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include -#include - -#include -#include - -namespace AZ -{ - namespace RHI - { - void RHISystemDescriptor::Reflect(AZ::ReflectContext* context) - { - if (auto* serializeContext = azrtti_cast(context)) - { - serializeContext->Class() - ->Version(4) - ->Field("DrawItemTags", &RHISystemDescriptor::m_drawListTags) - ; - - if (AZ::EditContext* ec = serializeContext->GetEditContext()) - { - ec->Class("RHI Settings", "Settings for runtime RHI system") - ->ClassElement(AZ::Edit::ClassElements::EditorData, "") - ->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("System", 0xc94d118b)) - ->Attribute(AZ::Edit::Attributes::AutoExpand, true) - ->DataElement(AZ::Edit::UIHandlers::Default, &RHISystemDescriptor::m_drawListTags, "Draw List Tags", "The set of globally declared draw list tags, which will be registered with the registry at startup.") - ; - } - } - } - } // namespace RPI -} // namespace AZ diff --git a/Gems/Atom/RHI/Code/Source/RHI.Reflect/ReflectSystemComponent.cpp b/Gems/Atom/RHI/Code/Source/RHI.Reflect/ReflectSystemComponent.cpp index 691a07b24d..c7f7e777aa 100644 --- a/Gems/Atom/RHI/Code/Source/RHI.Reflect/ReflectSystemComponent.cpp +++ b/Gems/Atom/RHI/Code/Source/RHI.Reflect/ReflectSystemComponent.cpp @@ -27,7 +27,6 @@ #include #include #include -#include #include #include #include @@ -161,7 +160,6 @@ namespace AZ TransientAttachmentPoolBudgets::Reflect(context); PlatformLimits::Reflect(context); PlatformLimitsDescriptor::Reflect(context); - RHISystemDescriptor::Reflect(context); Origin::Reflect(context); ReflectVendorIdEnums(context); PhysicalDeviceDriverValidator::Reflect(context); diff --git a/Gems/Atom/RHI/Code/Source/RHI/RHISystem.cpp b/Gems/Atom/RHI/Code/Source/RHI/RHISystem.cpp index ed755c538a..b03cb34140 100644 --- a/Gems/Atom/RHI/Code/Source/RHI/RHISystem.cpp +++ b/Gems/Atom/RHI/Code/Source/RHI/RHISystem.cpp @@ -36,7 +36,7 @@ namespace AZ m_device = InitInternalDevice(); } - void RHISystem::Init(const RHISystemDescriptor& descriptor) + void RHISystem::Init() { m_cpuProfiler.Init(); @@ -86,14 +86,6 @@ namespace AZ frameSchedulerDescriptor.m_platformLimitsDescriptor = platformLimitsDescriptor; m_frameScheduler.Init(*m_device, frameSchedulerDescriptor); - - // Register draw list tags declared from content. - for (const Name& drawListName : descriptor.m_drawListTags) - { - RHI::DrawListTag drawListTag = m_drawListTagRegistry->AcquireTag(drawListName); - - AZ_Warning("RHISystem", drawListTag.IsValid(), "Failed to register draw list tag '%s'. Registry at capacity.", drawListName.GetCStr()); - } } RHI::Ptr RHISystem::InitInternalDevice() diff --git a/Gems/Atom/RHI/Code/atom_rhi_reflect_files.cmake b/Gems/Atom/RHI/Code/atom_rhi_reflect_files.cmake index 9c4ca9a60d..e211462eeb 100644 --- a/Gems/Atom/RHI/Code/atom_rhi_reflect_files.cmake +++ b/Gems/Atom/RHI/Code/atom_rhi_reflect_files.cmake @@ -118,9 +118,7 @@ set(FILES Include/Atom/RHI.Reflect/SwapChainDescriptor.h Source/RHI.Reflect/SwapChainDescriptor.cpp Include/Atom/RHI.Reflect/ReflectSystemComponent.h - Include/Atom/RHI.Reflect/RHISystemDescriptor.h Source/RHI.Reflect/ReflectSystemComponent.cpp - Source/RHI.Reflect/RHISystemDescriptor.cpp Include/Atom/RHI.Reflect/AliasedHeapEnums.h Include/Atom/RHI.Reflect/TransientBufferDescriptor.h Include/Atom/RHI.Reflect/TransientImageDescriptor.h diff --git a/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/Image/ImageSystemDescriptor.h b/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/Image/ImageSystemDescriptor.h index 22dec8ce64..e013c1dad1 100644 --- a/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/Image/ImageSystemDescriptor.h +++ b/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/Image/ImageSystemDescriptor.h @@ -21,8 +21,16 @@ namespace AZ AZ_TYPE_INFO(RPI::ImageSystemDescriptor, "{319D14F6-F7F2-487A-AA6B-5800E328C79B}"); static void Reflect(AZ::ReflectContext* context); + //! The maximum size of the image pool used for system streaming images. + //! Check ImageSystemInterface::GetSystemStreamingPool() for detail of this image pool uint64_t m_systemStreamingImagePoolSize = 128 * 1024 * 1024; + + //! The maximum size of the image pool used for system attachments images. + //! Check ImageSystemInterface::GetSystemAttachmentPool() for detail of this image pool uint64_t m_systemAttachmentImagePoolSize = 512 * 1024 * 1024; + + //! The maximum size of the image pool used for streaming images load from assets + //! Check ImageSystemInterface::GetStreamingPool() for detail of this image pool uint64_t m_assetStreamingImagePoolSize = 2u * 1024u * 1024u * 1024u; }; } // namespace RPI diff --git a/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/RPISystemDescriptor.h b/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/RPISystemDescriptor.h index 2076e72731..1b7b32c1e9 100644 --- a/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/RPISystemDescriptor.h +++ b/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/RPISystemDescriptor.h @@ -10,7 +10,6 @@ #include #include -#include namespace AZ { @@ -31,8 +30,6 @@ namespace AZ AZ_TYPE_INFO(RPISystemDescriptor, "{96DAC3DA-40D4-4C03-8D6A-3181E843262A}"); static void Reflect(AZ::ReflectContext* context); - RHI::RHISystemDescriptor m_rhiSystemDescriptor; - //! The asset cache relative path of the only common shader asset for the RPI system that is used //! as means to load the layout for scene srg and view srg. This is used to create any RPI::Scene. AZStd::string m_commonSrgsShaderAssetPath = "shader/sceneandviewsrgs.azshader"; diff --git a/Gems/Atom/RPI/Code/Source/RPI.Private/RPISystemComponent.cpp b/Gems/Atom/RPI/Code/Source/RPI.Private/RPISystemComponent.cpp index f73673f0e4..2567d221e5 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Private/RPISystemComponent.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Private/RPISystemComponent.cpp @@ -15,9 +15,11 @@ #include +#include #include #include -#include +#include + #ifdef RPI_EDITOR #include #endif @@ -84,8 +86,11 @@ namespace AZ void RPISystemComponent::Activate() { - // [GFX TODO] [ATOM-1436] this can be removed when setup and save system component's configure from projectConfigure.exe is fixed. - m_rpiDescriptor.m_rhiSystemDescriptor.m_drawListTags.push_back(AZ::Name("forward")); + auto settingsRegistry = AZ::SettingsRegistry::Get(); + if (settingsRegistry) + { + settingsRegistry->GetObject(m_rpiDescriptor, "/O3DE/Atom/RPI/Initialization"); + } m_rpiSystem.Initialize(m_rpiDescriptor); AZ::SystemTickBus::Handler::BusConnect(); diff --git a/Gems/Atom/RPI/Code/Source/RPI.Public/RPISystem.cpp b/Gems/Atom/RPI/Code/Source/RPI.Public/RPISystem.cpp index a9028627a0..66c4f6d20a 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Public/RPISystem.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Public/RPISystem.cpp @@ -372,7 +372,7 @@ namespace AZ return; } - m_rhiSystem.Init(m_descriptor.m_rhiSystemDescriptor); + m_rhiSystem.Init(); m_imageSystem.Init(m_descriptor.m_imageSystemDescriptor); m_bufferSystem.Init(); m_dynamicDraw.Init(m_descriptor.m_dynamicDrawSystemDescriptor); @@ -396,7 +396,7 @@ namespace AZ } //Init rhi/image/buffer systems to match InitializeSystemAssets - m_rhiSystem.Init(m_descriptor.m_rhiSystemDescriptor); + m_rhiSystem.Init(); m_imageSystem.Init(m_descriptor.m_imageSystemDescriptor); m_bufferSystem.Init(); diff --git a/Gems/Atom/RPI/Code/Source/RPI.Reflect/Image/ImageSystemDescriptor.cpp b/Gems/Atom/RPI/Code/Source/RPI.Reflect/Image/ImageSystemDescriptor.cpp index 611a83be93..937daf3f62 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Reflect/Image/ImageSystemDescriptor.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Reflect/Image/ImageSystemDescriptor.cpp @@ -25,21 +25,6 @@ namespace AZ ->Field("SystemStreamingImagePoolSize", &ImageSystemDescriptor::m_systemStreamingImagePoolSize) ->Field("SystemAttachmentImagePoolSize", &ImageSystemDescriptor::m_systemAttachmentImagePoolSize) ; - - if (AZ::EditContext* ec = serializeContext->GetEditContext()) - { - ec->Class("Image System Config", "Settings for RPI Image System") - ->ClassElement(AZ::Edit::ClassElements::EditorData, "") - ->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("System", 0xc94d118b)) - ->Attribute(AZ::Edit::Attributes::AutoExpand, true) - ->DataElement(AZ::Edit::UIHandlers::Default, &ImageSystemDescriptor::m_assetStreamingImagePoolSize, - "Streaming image pool size for assets", "Streaming image pool size in bytes for streaming images created from assets") - ->DataElement(AZ::Edit::UIHandlers::Default, &ImageSystemDescriptor::m_systemStreamingImagePoolSize, - "System streaming image pool size", "Streaming image pool size in bytes for streaming images created in memory") - ->DataElement(AZ::Edit::UIHandlers::Default, &ImageSystemDescriptor::m_systemAttachmentImagePoolSize, - "System attachment image pool size", "Default attachment image pool size in bytes") - ; - } } } } // namespace RPI diff --git a/Gems/Atom/RPI/Code/Source/RPI.Reflect/RPISystemDescriptor.cpp b/Gems/Atom/RPI/Code/Source/RPI.Reflect/RPISystemDescriptor.cpp index 21c6061d8e..dc379396eb 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Reflect/RPISystemDescriptor.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Reflect/RPISystemDescriptor.cpp @@ -25,35 +25,12 @@ namespace AZ ; serializeContext->Class() - ->Version(6) // ATOM-15472 - ->Field("RHISystemDescriptor", &RPISystemDescriptor::m_rhiSystemDescriptor) + ->Version(7) // ATOM-16237 ->Field("CommonSrgsShaderAssetPath", &RPISystemDescriptor::m_commonSrgsShaderAssetPath) ->Field("ImageSystemDescriptor", &RPISystemDescriptor::m_imageSystemDescriptor) ->Field("GpuQuerySystemDescriptor", &RPISystemDescriptor::m_gpuQuerySystemDescriptor) ->Field("DynamicDrawSystemDescriptor", &RPISystemDescriptor::m_dynamicDrawSystemDescriptor) ; - - if (AZ::EditContext* ec = serializeContext->GetEditContext()) - { - ec->Class("Dynamic Draw System Settings", "Settings for the Dynamic Draw System") - ->ClassElement(AZ::Edit::ClassElements::EditorData, "") - ->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("System", 0xc94d118b)) - ->Attribute(AZ::Edit::Attributes::AutoExpand, true) - ->DataElement(AZ::Edit::UIHandlers::Default, &DynamicDrawSystemDescriptor::m_dynamicBufferPoolSize, "Dynamic Buffer Pool Size", "The maxinum size of pool which is used to allocate dynamic buffers") - ; - - ec->Class("RPI Settings", "Settings for runtime RPI system") - ->ClassElement(AZ::Edit::ClassElements::EditorData, "") - ->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("System", 0xc94d118b)) - ->Attribute(AZ::Edit::Attributes::AutoExpand, true) - ->DataElement(AZ::Edit::UIHandlers::Default, &RPISystemDescriptor::m_commonSrgsShaderAssetPath, "Common Shader Asset Path For Scene & View SRGs", - "Shader asset path used to get the Scene and View SRGs for all RPI scenes and views respectively") - ->DataElement(AZ::Edit::UIHandlers::Default, &RPISystemDescriptor::m_rhiSystemDescriptor, "RHI System Config", "Configuration of Render Hardware Interface") - ->DataElement(AZ::Edit::UIHandlers::Default, &RPISystemDescriptor::m_imageSystemDescriptor, "Image System Config", "Configuration of Image System") - ->DataElement(AZ::Edit::UIHandlers::Default, &RPISystemDescriptor::m_gpuQuerySystemDescriptor, "Gpu Query System Config", "Configuration of Gpu Query System") - ->DataElement(AZ::Edit::UIHandlers::Default, &RPISystemDescriptor::m_dynamicDrawSystemDescriptor, "Dynamic Draw System Config", "Configuration of Dynamic Draw System") - ; - } } } } // namespace RPI diff --git a/Gems/Atom/RPI/Registry/atom_rpi.setreg b/Gems/Atom/RPI/Registry/atom_rpi.setreg new file mode 100644 index 0000000000..bcbade5d38 --- /dev/null +++ b/Gems/Atom/RPI/Registry/atom_rpi.setreg @@ -0,0 +1,24 @@ +{ + "O3DE": { + "Atom": { + "RPI": { + "Initialization": { + "CommonSrgsShaderAssetPath": "shader/sceneandviewsrgs.azshader", + "ImageSystemDescriptor": { + "AssetStreamingImagePoolSize": 2147483648, // 2 * 1024 * 1024 * 1024 + "SystemStreamingImagePoolSize": 134217728, // 128 * 1024 * 1024 + "SystemAttachmentImagePoolSize": 536870912 // 512 * 1024 * 1024 + }, + "GpuQuerySystemDescriptor": { + "OcclusionQueryCount": 128, + "StatisticsQueryCount": 256, + "TimestampQueryCount": 256 + }, + "DynamicDrawSystemDescriptor": { + "DynamicBufferPoolSize": 50331648 // 3 * 16 * 1024 * 1024 (for 3 frames) + } + } + } + } + } +} diff --git a/Gems/LyShine/Code/Source/LyShineSystemComponent.cpp b/Gems/LyShine/Code/Source/LyShineSystemComponent.cpp index d3d2d5655e..f815e2ddbd 100644 --- a/Gems/LyShine/Code/Source/LyShineSystemComponent.cpp +++ b/Gems/LyShine/Code/Source/LyShineSystemComponent.cpp @@ -205,6 +205,10 @@ namespace LyShine //////////////////////////////////////////////////////////////////////////////////////////////////// void LyShineSystemComponent::Deactivate() { +#if !defined(LYSHINE_BUILDER) && !defined(LYSHINE_TESTS) + m_loadTemplatesHandler.Disconnect(); +#endif + UiSystemBus::Handler::BusDisconnect(); UiSystemToolsBus::Handler::BusDisconnect(); UiFrameworkBus::Handler::BusDisconnect();