apply minor feedback from PR

Signed-off-by: greerdv <greerdv@amazon.com>
monroegm-disable-blank-issue-2
greerdv 4 years ago
parent c7e1a6d0b6
commit 36285aa834

@ -59,8 +59,8 @@ namespace AzToolsFramework
if (auto& linearManipulator = m_linearManipulators[manipulatorIndex]) if (auto& linearManipulator = m_linearManipulators[manipulatorIndex])
{ {
linearManipulator->SetSpace(boxWorldFromLocal); linearManipulator->SetSpace(boxWorldFromLocal);
linearManipulator->SetLocalTransform(boxLocalTransform * AZ::Transform::CreateTranslation( linearManipulator->SetLocalTransform(
s_boxAxes[manipulatorIndex] * 0.5f * boxDimensions)); boxLocalTransform * AZ::Transform::CreateTranslation(s_boxAxes[manipulatorIndex] * 0.5f * boxDimensions));
linearManipulator->SetNonUniformScale(nonUniformScale); linearManipulator->SetNonUniformScale(nonUniformScale);
linearManipulator->SetBoundsDirty(); linearManipulator->SetBoundsDirty();
} }
@ -88,7 +88,8 @@ namespace AzToolsFramework
ManipulatorViews views; ManipulatorViews views;
views.emplace_back(CreateManipulatorViewQuadBillboard( views.emplace_back(CreateManipulatorViewQuadBillboard(
AzFramework::ViewportColors::DefaultManipulatorHandleColor, AzFramework::ViewportConstants::DefaultManipulatorHandleSize)); AzFramework::ViewportColors::DefaultManipulatorHandleColor,
AzFramework::ViewportConstants::DefaultManipulatorHandleSize));
linearManipulator->SetViews(AZStd::move(views)); linearManipulator->SetViews(AZStd::move(views));
linearManipulator->InstallMouseMoveCallback( linearManipulator->InstallMouseMoveCallback(
@ -105,7 +106,8 @@ namespace AzToolsFramework
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
// the local position offset of the manipulator does not take the transform scale into account, so need to apply it here // the local position offset of the manipulator does not take the transform scale into account
// so need to apply it here
const AZ::Vector3 localPosition = boxLocalTransform.GetInverse().TransformPoint( const AZ::Vector3 localPosition = boxLocalTransform.GetInverse().TransformPoint(
action.m_start.m_localPosition + action.m_current.m_localPositionOffset / boxScale); action.m_start.m_localPosition + action.m_current.m_localPositionOffset / boxScale);
@ -113,7 +115,7 @@ namespace AzToolsFramework
// clamp movement so it cannot go negative based on axis direction // clamp movement so it cannot go negative based on axis direction
const AZ::Vector3 axisDisplacement = const AZ::Vector3 axisDisplacement =
localPosition.GetAbs() * 2.0f localPosition.GetAbs() * 2.0f
* AZ::GetMax<float>(0.0f, localPosition.GetNormalized().Dot(action.m_fixed.m_axis)); * AZ::GetMax(0.0f, localPosition.GetNormalized().Dot(action.m_fixed.m_axis));
AZ::Vector3 boxDimensions = AZ::Vector3::CreateZero(); AZ::Vector3 boxDimensions = AZ::Vector3::CreateZero();
BoxManipulatorRequestBus::EventResult( BoxManipulatorRequestBus::EventResult(

@ -118,7 +118,7 @@ namespace LmbrCentral
TEST_F(EditorBoxShapeComponentManipulatorFixture, BoxShapeNonUniformScaleManipulatorsScaleCorrectly) TEST_F(EditorBoxShapeComponentManipulatorFixture, BoxShapeNonUniformScaleManipulatorsScaleCorrectly)
{ {
// a rotation which should map (1, 0, 0) to (0.8, 0.6, 0) // a rotation which rotates the x-axis to (0.8, 0.6, 0)
const AZ::Quaternion boxRotation(0.0f, 0.0f, 0.316228f, 0.948683f); const AZ::Quaternion boxRotation(0.0f, 0.0f, 0.316228f, 0.948683f);
AZ::Transform boxTransform = AZ::Transform::CreateFromQuaternionAndTranslation(boxRotation, AZ::Vector3(2.0f, 3.0f, 4.0f)); AZ::Transform boxTransform = AZ::Transform::CreateFromQuaternionAndTranslation(boxRotation, AZ::Vector3(2.0f, 3.0f, 4.0f));
boxTransform.SetUniformScale(1.5f); boxTransform.SetUniformScale(1.5f);
@ -132,7 +132,6 @@ namespace LmbrCentral
// enter the box shape component's component mode // enter the box shape component's component mode
AzToolsFramework::SelectEntity(m_entity->GetId()); AzToolsFramework::SelectEntity(m_entity->GetId());
AzToolsFramework::ComponentModeFramework::ComponentModeSystemRequestBus::Broadcast( AzToolsFramework::ComponentModeFramework::ComponentModeSystemRequestBus::Broadcast(
&AzToolsFramework::ComponentModeFramework::ComponentModeSystemRequestBus::Events::AddSelectedComponentModesOfType, &AzToolsFramework::ComponentModeFramework::ComponentModeSystemRequestBus::Events::AddSelectedComponentModesOfType,
EditorBoxShapeComponentTypeId); EditorBoxShapeComponentTypeId);

Loading…
Cancel
Save