From cbeafe29d324060e2ee3e1c4142250d28afed9ff Mon Sep 17 00:00:00 2001 From: Chris Burel Date: Fri, 18 Jun 2021 14:14:42 -0700 Subject: [PATCH] Avoid serializing `size_t` in EMotionFX code (#1423) `size_t` is a typedef that is sized differently on different platforms. Instead, use `AZ::u64`, which is large enough to hold all platforms' `size_t` types but is a fixed size, to avoid size mismatches per platform. --- .../Code/EMotionFX/CommandSystem/Source/ColliderCommands.cpp | 3 ++- .../Code/EMotionFX/CommandSystem/Source/ColliderCommands.h | 2 +- .../EMotionFX/Pipeline/SceneAPIExt/Rules/MorphTargetRule.h | 2 +- .../EMotionFX/Pipeline/SceneAPIExt/Rules/MotionAdditiveRule.h | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/ColliderCommands.cpp b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/ColliderCommands.cpp index bd0d998737..4bc6d51d94 100644 --- a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/ColliderCommands.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/ColliderCommands.cpp @@ -10,6 +10,7 @@ * */ +#include #include #include #include @@ -717,7 +718,7 @@ namespace EMotionFX const size_t shapeCount = nodeConfig->m_shapes.size(); if (m_colliderIndex >= shapeCount) { - outResult = AZStd::string::format("Cannot remove collider. The joint '%s' is only holding %zu colliders and the index %zu is out of range.", m_jointName.c_str(), shapeCount, m_colliderIndex); + outResult = AZStd::string::format("Cannot remove collider. The joint '%s' is only holding %zu colliders and the index %llu is out of range.", m_jointName.c_str(), shapeCount, m_colliderIndex); return false; } diff --git a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/ColliderCommands.h b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/ColliderCommands.h index bb84e955ef..51608e3055 100644 --- a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/ColliderCommands.h +++ b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/ColliderCommands.h @@ -222,7 +222,7 @@ namespace EMotionFX private: PhysicsSetup::ColliderConfigType m_configType; - size_t m_colliderIndex; + AZ::u64 m_colliderIndex; bool m_oldIsDirty; AZStd::string m_oldContents; diff --git a/Gems/EMotionFX/Code/EMotionFX/Pipeline/SceneAPIExt/Rules/MorphTargetRule.h b/Gems/EMotionFX/Code/EMotionFX/Pipeline/SceneAPIExt/Rules/MorphTargetRule.h index e2a86116d0..99075d4903 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Pipeline/SceneAPIExt/Rules/MorphTargetRule.h +++ b/Gems/EMotionFX/Code/EMotionFX/Pipeline/SceneAPIExt/Rules/MorphTargetRule.h @@ -73,7 +73,7 @@ namespace EMotionFX static size_t DetectMorphTargetAnimations(const AZ::SceneAPI::Containers::Scene& scene); protected: - size_t m_morphAnimationCount; + AZ::u64 m_morphAnimationCount; AZStd::string m_descriptionText; }; diff --git a/Gems/EMotionFX/Code/EMotionFX/Pipeline/SceneAPIExt/Rules/MotionAdditiveRule.h b/Gems/EMotionFX/Code/EMotionFX/Pipeline/SceneAPIExt/Rules/MotionAdditiveRule.h index 40839cc5b8..718ab04529 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Pipeline/SceneAPIExt/Rules/MotionAdditiveRule.h +++ b/Gems/EMotionFX/Code/EMotionFX/Pipeline/SceneAPIExt/Rules/MotionAdditiveRule.h @@ -42,7 +42,7 @@ namespace EMotionFX static void Reflect(AZ::ReflectContext* context); protected: - size_t m_sampleFrameIndex; + AZ::u64 m_sampleFrameIndex; }; } // Rule } // Pipeline