tidy up bus usage

Signed-off-by: greerdv <greerdv@amazon.com>
monroegm-disable-blank-issue-2
greerdv 4 years ago
parent 08eb115e26
commit d37315c2af

@ -14,6 +14,8 @@
#include <AzToolsFramework/Manipulators/ManipulatorSnapping.h> #include <AzToolsFramework/Manipulators/ManipulatorSnapping.h>
#include <AzFramework/Viewport/ViewportColors.h> #include <AzFramework/Viewport/ViewportColors.h>
#include <AzFramework/Viewport/ViewportConstants.h> #include <AzFramework/Viewport/ViewportConstants.h>
#include <AzCore/Component/TransformBus.h>
#include <AzCore/Component/NonUniformScaleBus.h>
namespace AzToolsFramework namespace AzToolsFramework
{ {
@ -37,12 +39,12 @@ namespace AzToolsFramework
void BoxViewportEdit::UpdateManipulators() void BoxViewportEdit::UpdateManipulators()
{ {
AZ::Transform boxWorldFromLocal = AZ::Transform::CreateIdentity(); AZ::Transform boxWorldFromLocal = AZ::Transform::CreateIdentity();
BoxManipulatorRequestBus::EventResult( AZ::TransformBus::EventResult(
boxWorldFromLocal, m_entityComponentIdPair, &BoxManipulatorRequests::GetCurrentTransform); boxWorldFromLocal, m_entityComponentIdPair.GetEntityId(), &AZ::TransformBus::Events::GetWorldTM);
AZ::Vector3 nonUniformScale = AZ::Vector3::CreateOne(); AZ::Vector3 nonUniformScale = AZ::Vector3::CreateOne();
BoxManipulatorRequestBus::EventResult( AZ::NonUniformScaleRequestBus::EventResult(
nonUniformScale, m_entityComponentIdPair, &BoxManipulatorRequests::GetCurrentNonUniformScale); nonUniformScale, m_entityComponentIdPair.GetEntityId(), &AZ::NonUniformScaleRequests::GetScale);
AZ::Vector3 boxDimensions = AZ::Vector3::CreateZero(); AZ::Vector3 boxDimensions = AZ::Vector3::CreateZero();
BoxManipulatorRequestBus::EventResult( BoxManipulatorRequestBus::EventResult(
@ -70,8 +72,8 @@ namespace AzToolsFramework
m_entityComponentIdPair = entityComponentIdPair; m_entityComponentIdPair = entityComponentIdPair;
AZ::Transform worldFromLocal = AZ::Transform::CreateIdentity(); AZ::Transform worldFromLocal = AZ::Transform::CreateIdentity();
BoxManipulatorRequestBus::EventResult( AZ::TransformBus::EventResult(
worldFromLocal, entityComponentIdPair, &BoxManipulatorRequests::GetCurrentTransform); worldFromLocal, entityComponentIdPair.GetEntityId(), &AZ::TransformBus::Events::GetWorldTM);
for (size_t manipulatorIndex = 0; manipulatorIndex < m_linearManipulators.size(); ++manipulatorIndex) for (size_t manipulatorIndex = 0; manipulatorIndex < m_linearManipulators.size(); ++manipulatorIndex)
{ {
@ -98,8 +100,8 @@ namespace AzToolsFramework
boxLocalTransform, entityComponentIdPair, &BoxManipulatorRequests::GetCurrentLocalTransform); boxLocalTransform, entityComponentIdPair, &BoxManipulatorRequests::GetCurrentLocalTransform);
AZ::Transform boxWorldTransform = AZ::Transform::CreateIdentity(); AZ::Transform boxWorldTransform = AZ::Transform::CreateIdentity();
BoxManipulatorRequestBus::EventResult( AZ::TransformBus::EventResult(
boxWorldTransform, entityComponentIdPair, &BoxManipulatorRequests::GetCurrentTransform); boxWorldTransform, m_entityComponentIdPair.GetEntityId(), &AZ::TransformBus::Events::GetWorldTM);
float boxScale = AZ::GetMax(AZ::MinTransformScale, boxWorldTransform.GetUniformScale()); float boxScale = AZ::GetMax(AZ::MinTransformScale, boxWorldTransform.GetUniformScale());
// calculate the position of the manipulator in the reference frame of the box // calculate the position of the manipulator in the reference frame of the box

@ -26,22 +26,25 @@ namespace AzToolsFramework
virtual AZ::Vector3 GetDimensions() = 0; virtual AZ::Vector3 GetDimensions() = 0;
//! Set the X/Y/Z dimensions of the box shape/collider. //! Set the X/Y/Z dimensions of the box shape/collider.
virtual void SetDimensions(const AZ::Vector3& dimensions) = 0; virtual void SetDimensions(const AZ::Vector3& dimensions) = 0;
//! @deprecated Because non-uniform scale effects can be complex, it is recommended to separately use
//! AZ::TransformBus::Events::GetWorldTM, AZ::NonUniformScaleRequests::GetScale and GetCurrentLocalTransform
//! and combine their effects.
//! Get the transform of the box shape/collider. //! Get the transform of the box shape/collider.
//! This is used by \ref BoxComponentMode instead of the \ref \AZ::TransformBus //! This is used by \ref BoxComponentMode instead of the \ref \AZ::TransformBus
//! because a collider may have an additional translation/orientation offset from //! because a collider may have an additional translation/orientation offset from
//! the Entity transform. //! the Entity transform.
virtual AZ::Transform GetCurrentTransform() = 0; virtual AZ::Transform GetCurrentTransform() = 0;
//! //! Get the transform of the box relative to the entity.
//!
virtual AZ::Transform GetCurrentLocalTransform() = 0; virtual AZ::Transform GetCurrentLocalTransform() = 0;
//! @deprecated Because non-uniform scale effects can be complex, it is recommended to separately use
//! AZ::TransformBus::Events::GetWorldTM, AZ::NonUniformScaleRequests::GetScale and GetCurrentLocalTransform
//! and combine their effects.
//! Get the scale currently applied to the box. //! Get the scale currently applied to the box.
//! With the Box Shape, the largest x/y/z component is taken //! With the Box Shape, the largest x/y/z component is taken
//! so scale is always uniform, with colliders the scale may //! so scale is always uniform, with colliders the scale may
//! be different per component. //! be different per component.
virtual AZ::Vector3 GetBoxScale() = 0; virtual AZ::Vector3 GetBoxScale() = 0;
virtual AZ::Vector3 GetCurrentNonUniformScale() { return AZ::Vector3::CreateOne(); }
protected: protected:
~BoxManipulatorRequests() = default; ~BoxManipulatorRequests() = default;
}; };

@ -1065,11 +1065,6 @@ namespace PhysX
return AZ::Vector3::CreateOne(); return AZ::Vector3::CreateOne();
} }
AZ::Vector3 EditorColliderComponent::GetCurrentNonUniformScale()
{
return m_cachedNonUniformScale;
}
void EditorColliderComponent::OnTransformChanged(const AZ::Transform& /*local*/, const AZ::Transform& world) void EditorColliderComponent::OnTransformChanged(const AZ::Transform& /*local*/, const AZ::Transform& world)
{ {
if (world.IsClose(m_cachedWorldTransform)) if (world.IsClose(m_cachedWorldTransform))

@ -173,7 +173,6 @@ namespace PhysX
AZ::Transform GetCurrentTransform() override; AZ::Transform GetCurrentTransform() override;
AZ::Transform GetCurrentLocalTransform() override; AZ::Transform GetCurrentLocalTransform() override;
AZ::Vector3 GetBoxScale() override; AZ::Vector3 GetBoxScale() override;
AZ::Vector3 GetCurrentNonUniformScale() override;
// AZ::Render::MeshComponentNotificationBus // AZ::Render::MeshComponentNotificationBus
void OnModelReady(const AZ::Data::Asset<AZ::RPI::ModelAsset>& modelAsset, void OnModelReady(const AZ::Data::Asset<AZ::RPI::ModelAsset>& modelAsset,

Loading…
Cancel
Save