diff --git a/Code/Framework/AzCore/AzCore/Component/TransformBus.h b/Code/Framework/AzCore/AzCore/Component/TransformBus.h index b180e97332..2a8d82c34c 100644 --- a/Code/Framework/AzCore/AzCore/Component/TransformBus.h +++ b/Code/Framework/AzCore/AzCore/Component/TransformBus.h @@ -219,18 +219,11 @@ namespace AZ //! Scale modifiers //! @{ - //! Set local scale of the transform. - //! @param scale The new scale to set. - virtual void SetLocalScale([[maybe_unused]] const AZ::Vector3& scale) {} - - //! Get the scale value in local space. + //! @deprecated GetLocalScale is deprecated, and is left only to allow migration of legacy vector scale. + //! Get the legacy vector scale value in local space. //! @return The scale value in local space. virtual AZ::Vector3 GetLocalScale() { return AZ::Vector3(FLT_MAX); } - //! Get the scale value in world space. - //! @return The scale value in world space. - virtual AZ::Vector3 GetWorldScale() { return AZ::Vector3(FLT_MAX); } - //! Set the uniform scale value in local space. virtual void SetLocalUniformScale([[maybe_unused]] float scale) {} diff --git a/Code/Framework/AzFramework/AzFramework/Components/TransformComponent.cpp b/Code/Framework/AzFramework/AzFramework/Components/TransformComponent.cpp index 3fd5c4d81c..ef2816d355 100644 --- a/Code/Framework/AzFramework/AzFramework/Components/TransformComponent.cpp +++ b/Code/Framework/AzFramework/AzFramework/Components/TransformComponent.cpp @@ -406,23 +406,12 @@ namespace AzFramework return m_localTM.GetRotation(); } - void TransformComponent::SetLocalScale(const AZ::Vector3& scale) - { - AZ::Transform newLocalTM = m_localTM; - newLocalTM.SetScale(scale); - SetLocalTM(newLocalTM); - } - AZ::Vector3 TransformComponent::GetLocalScale() { + AZ_WarningOnce("TransformComponent", false, "GetLocalScale is deprecated, please use GetLocalUniformScale instead"); return m_localTM.GetScale(); } - AZ::Vector3 TransformComponent::GetWorldScale() - { - return m_worldTM.GetScale(); - } - void TransformComponent::SetLocalUniformScale(float scale) { AZ::Transform newLocalTM = m_localTM; @@ -756,13 +745,11 @@ namespace AzFramework ->Event("GetLocalRotationQuaternion", &AZ::TransformBus::Events::GetLocalRotationQuaternion) ->Attribute("Rotation", AZ::Edit::Attributes::PropertyRotation) ->VirtualProperty("Rotation", "GetLocalRotationQuaternion", "SetLocalRotationQuaternion") - ->Event("SetLocalScale", &AZ::TransformBus::Events::SetLocalScale) ->Event("GetLocalScale", &AZ::TransformBus::Events::GetLocalScale) ->Attribute("Scale", AZ::Edit::Attributes::PropertyScale) ->Event("SetLocalUniformScale", &AZ::TransformBus::Events::SetLocalUniformScale) ->Event("GetLocalUniformScale", &AZ::TransformBus::Events::GetLocalUniformScale) ->VirtualProperty("Uniform Scale", "GetLocalUniformScale", "SetLocalUniformScale") - ->Event("GetWorldScale", &AZ::TransformBus::Events::GetWorldScale) ->Event("GetChildren", &AZ::TransformBus::Events::GetChildren) ->Event("GetAllDescendants", &AZ::TransformBus::Events::GetAllDescendants) ->Event("GetEntityAndAllDescendants", &AZ::TransformBus::Events::GetEntityAndAllDescendants) diff --git a/Code/Framework/AzFramework/AzFramework/Components/TransformComponent.h b/Code/Framework/AzFramework/AzFramework/Components/TransformComponent.h index 9009c6bff9..0301334a0d 100644 --- a/Code/Framework/AzFramework/AzFramework/Components/TransformComponent.h +++ b/Code/Framework/AzFramework/AzFramework/Components/TransformComponent.h @@ -128,9 +128,7 @@ namespace AzFramework AZ::Quaternion GetLocalRotationQuaternion() override; // Scale Modifiers - void SetLocalScale(const AZ::Vector3& scale) override; AZ::Vector3 GetLocalScale() override; - AZ::Vector3 GetWorldScale() override; void SetLocalUniformScale(float scale) override; float GetLocalUniformScale() override; diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/TransformComponent.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/TransformComponent.cpp index 285d962b46..631478fcb0 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/TransformComponent.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/TransformComponent.cpp @@ -599,22 +599,12 @@ namespace AzToolsFramework return result; } - void TransformComponent::SetLocalScale(const AZ::Vector3& scale) - { - m_editorTransform.m_scale = scale; - TransformChanged(); - } - AZ::Vector3 TransformComponent::GetLocalScale() { + AZ_WarningOnce("TransformComponent", false, "GetLocalScale is deprecated, please use GetLocalUniformScale instead"); return m_editorTransform.m_scale; } - AZ::Vector3 TransformComponent::GetWorldScale() - { - return GetWorldTM().GetScale(); - } - void TransformComponent::SetLocalUniformScale(float scale) { m_editorTransform.m_scale = AZ::Vector3(scale); diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/TransformComponent.h b/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/TransformComponent.h index f772b608c1..80db5e10fb 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/TransformComponent.h +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/TransformComponent.h @@ -115,9 +115,7 @@ namespace AzToolsFramework AZ::Quaternion GetLocalRotationQuaternion() override; // Scale Modifiers - void SetLocalScale(const AZ::Vector3& scale) override; AZ::Vector3 GetLocalScale() override; - AZ::Vector3 GetWorldScale() override; void SetLocalUniformScale(float scale) override; float GetLocalUniformScale() override; diff --git a/Code/Framework/AzToolsFramework/Tests/SliceStabilityTests/SliceStabilityTestFramework.cpp b/Code/Framework/AzToolsFramework/Tests/SliceStabilityTests/SliceStabilityTestFramework.cpp index 8455e6d669..5dcdaa045c 100644 --- a/Code/Framework/AzToolsFramework/Tests/SliceStabilityTests/SliceStabilityTestFramework.cpp +++ b/Code/Framework/AzToolsFramework/Tests/SliceStabilityTests/SliceStabilityTestFramework.cpp @@ -141,7 +141,7 @@ namespace UnitTest // Set the new entity's transform to non zero values // This helps validate in comparison tests that the transform values of created entities persist during slice operations - entityTransform->SetLocalScale(AZ::Vector3(5, 5, 5)); + entityTransform->SetLocalUniformScale(5); entityTransform->SetLocalRotation(AZ::Vector3RadToDeg(AZ::Vector3(90, 90, 90))); entityTransform->SetLocalTranslation(AZ::Vector3(100, 100, 100)); diff --git a/Code/Sandbox/Editor/TrackView/TrackViewAnimNode.cpp b/Code/Sandbox/Editor/TrackView/TrackViewAnimNode.cpp index ae7077b4fc..35306b9535 100644 --- a/Code/Sandbox/Editor/TrackView/TrackViewAnimNode.cpp +++ b/Code/Sandbox/Editor/TrackView/TrackViewAnimNode.cpp @@ -2012,9 +2012,9 @@ void CTrackViewAnimNode::SetPosRotScaleTracksDefaultValues(bool positionAllowed, } if (scaleAllowed) { - AZ::Vector3 scale = AZ::Vector3::CreateOne(); - AZ::TransformBus::EventResult(scale, entityId, &AZ::TransformBus::Events::GetWorldScale); - m_animNode->SetScale(time, AZVec3ToLYVec3(scale)); + float scale = 1.0f; + AZ::TransformBus::EventResult(scale, entityId, &AZ::TransformBus::Events::GetWorldUniformScale); + m_animNode->SetScale(time, Vec3(scale, scale, scale)); } } } diff --git a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/ReflectionProbe/EditorReflectionProbeComponent.cpp b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/ReflectionProbe/EditorReflectionProbeComponent.cpp index 735eab5368..7880d5e88c 100644 --- a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/ReflectionProbe/EditorReflectionProbeComponent.cpp +++ b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/ReflectionProbe/EditorReflectionProbeComponent.cpp @@ -209,8 +209,8 @@ namespace AZ AZ::Vector3 position = AZ::Vector3::CreateZero(); AZ::TransformBus::EventResult(position, GetEntityId(), &AZ::TransformBus::Events::GetWorldTranslation); - AZ::Vector3 scale = AZ::Vector3::CreateOne(); - AZ::TransformBus::EventResult(scale, GetEntityId(), &AZ::TransformBus::Events::GetLocalScale); + float scale = 1.0f; + AZ::TransformBus::EventResult(scale, GetEntityId(), &AZ::TransformBus::Events::GetLocalUniformScale); // draw AABB at probe position using the inner dimensions Color color(0.0f, 0.0f, 1.0f, 1.0f); diff --git a/Gems/Blast/Code/Tests/Mocks/BlastMocks.h b/Gems/Blast/Code/Tests/Mocks/BlastMocks.h index 00aa12cb84..ca78623a8a 100644 --- a/Gems/Blast/Code/Tests/Mocks/BlastMocks.h +++ b/Gems/Blast/Code/Tests/Mocks/BlastMocks.h @@ -654,9 +654,7 @@ namespace Blast MOCK_METHOD1(RotateAroundLocalZ, void(float)); MOCK_METHOD0(GetLocalRotation, AZ::Vector3()); MOCK_METHOD0(GetLocalRotationQuaternion, AZ::Quaternion()); - MOCK_METHOD1(SetLocalScale, void(const AZ::Vector3&)); MOCK_METHOD0(GetLocalScale, AZ::Vector3()); - MOCK_METHOD0(GetWorldScale, AZ::Vector3()); MOCK_METHOD1(SetLocalUniformScale, void(float)); MOCK_METHOD0(GetLocalUniformScale, float()); MOCK_METHOD0(GetWorldUniformScale, float()); diff --git a/Gems/PhysX/Code/Source/Utils.cpp b/Gems/PhysX/Code/Source/Utils.cpp index 55be7c92f7..a85a80e573 100644 --- a/Gems/PhysX/Code/Source/Utils.cpp +++ b/Gems/PhysX/Code/Source/Utils.cpp @@ -920,9 +920,9 @@ namespace PhysX AZ::Vector3 GetTransformScale(AZ::EntityId entityId) { - AZ::Vector3 worldScale = AZ::Vector3::CreateOne(); - AZ::TransformBus::EventResult(worldScale, entityId, &AZ::TransformBus::Events::GetWorldScale); - return worldScale; + float worldUniformScale = 1.0f; + AZ::TransformBus::EventResult(worldUniformScale, entityId, &AZ::TransformBus::Events::GetWorldUniformScale); + return AZ::Vector3(worldUniformScale); } AZ::Vector3 GetUniformScale(AZ::EntityId entityId)