CameraRigComponent - Disable Component Checkbox when the two others are toggled (#5546)

* Disable component checkbox when the other two components are already ignored.

Signed-off-by: AMZN-Igarri <82394219+AMZN-Igarri@users.noreply.github.com>

* Fixed EditContext Indents

Signed-off-by: AMZN-Igarri <82394219+AMZN-Igarri@users.noreply.github.com>

* Fixed Header file

Signed-off-by: AMZN-Igarri <82394219+AMZN-Igarri@users.noreply.github.com>

* Fixed Spaces

Signed-off-by: AMZN-Igarri <82394219+AMZN-Igarri@users.noreply.github.com>

* fixed new line

Signed-off-by: AMZN-Igarri <82394219+AMZN-Igarri@users.noreply.github.com>
monroegm-disable-blank-issue-2
AMZN-Igarri 4 years ago committed by GitHub
parent 76b7e73f6f
commit f2068397fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -9,8 +9,8 @@
#include "SlideAlongAxisBasedOnAngle.h" #include "SlideAlongAxisBasedOnAngle.h"
#include "StartingPointCamera/StartingPointCameraUtilities.h" #include "StartingPointCamera/StartingPointCameraUtilities.h"
#include <AzCore/Math/Quaternion.h> #include <AzCore/Math/Quaternion.h>
#include <AzCore/Serialization/EditContext.h>
#include <AzCore/Math/Transform.h> #include <AzCore/Math/Transform.h>
#include <AzCore/Serialization/EditContext.h>
namespace Camera namespace Camera
{ {
@ -32,31 +32,43 @@ namespace Camera
AZ::EditContext* editContext = serializeContext->GetEditContext(); AZ::EditContext* editContext = serializeContext->GetEditContext();
if (editContext) if (editContext)
{ {
editContext->Class<SlideAlongAxisBasedOnAngle>("SlideAlongAxisBasedOnAngle", "Slide 0..SlideDistance along Axis based on Angle Type. Maps from 90..-90 degrees") editContext->Class<SlideAlongAxisBasedOnAngle>("SlideAlongAxisBasedOnAngle",
->ClassElement(AZ::Edit::ClassElements::EditorData, "") "Slide 0..SlideDistance along Axis based on Angle Type. Maps from 90..-90 degrees")
->DataElement(AZ::Edit::UIHandlers::ComboBox, &SlideAlongAxisBasedOnAngle::m_axisToSlideAlong, "Axis to slide along", "The Axis to slide along") ->ClassElement(AZ::Edit::ClassElements::EditorData, "")
->EnumAttribute(RelativeAxisType::ForwardBackward, "Forwards and Backwards") ->DataElement(AZ::Edit::UIHandlers::ComboBox, &SlideAlongAxisBasedOnAngle::m_axisToSlideAlong, "Axis to slide along",
->EnumAttribute(RelativeAxisType::LeftRight, "Right and Left") "The Axis to slide along")
->EnumAttribute(RelativeAxisType::UpDown, "Up and Down") ->EnumAttribute(RelativeAxisType::ForwardBackward, "Forwards and Backwards")
->DataElement(AZ::Edit::UIHandlers::ComboBox, &SlideAlongAxisBasedOnAngle::m_angleTypeToChangeFor, "Angle Type", "The angle type to base the slide off of") ->EnumAttribute(RelativeAxisType::LeftRight, "Right and Left")
->EnumAttribute(EulerAngleType::Pitch, "Pitch") ->EnumAttribute(RelativeAxisType::UpDown, "Up and Down")
->EnumAttribute(EulerAngleType::Roll, "Roll") ->DataElement(AZ::Edit::UIHandlers::ComboBox, &SlideAlongAxisBasedOnAngle::m_angleTypeToChangeFor, "Angle Type",
->EnumAttribute(EulerAngleType::Yaw, "Yaw") "The angle type to base the slide off of")
->DataElement(0, &SlideAlongAxisBasedOnAngle::m_maximumPositiveSlideDistance, "Max Positive Slide Distance", "The maximum distance to slide in the positive") ->EnumAttribute(EulerAngleType::Pitch, "Pitch")
->Attribute(AZ::Edit::Attributes::Suffix, "m") ->EnumAttribute(EulerAngleType::Roll, "Roll")
->DataElement(0, &SlideAlongAxisBasedOnAngle::m_maximumNegativeSlideDistance, "Max Negative Slide Distance", "The maximum distance to slide in the negative") ->EnumAttribute(EulerAngleType::Yaw, "Yaw")
->Attribute(AZ::Edit::Attributes::Suffix, "m") ->DataElement(0, &SlideAlongAxisBasedOnAngle::m_maximumPositiveSlideDistance, "Max Positive Slide Distance",
->ClassElement(AZ::Edit::ClassElements::Group, "Vector Components To Ignore") "The maximum distance to slide in the positive")
->Attribute(AZ::Edit::Attributes::AutoExpand, true) ->Attribute(AZ::Edit::Attributes::Suffix, "m")
->DataElement(0, &SlideAlongAxisBasedOnAngle::m_ignoreX, "X", "When active, the X Component will be ignored.") ->DataElement(0, &SlideAlongAxisBasedOnAngle::m_maximumNegativeSlideDistance, "Max Negative Slide Distance",
->DataElement(0, &SlideAlongAxisBasedOnAngle::m_ignoreY, "Y", "When active, the Y Component will be ignored.") "The maximum distance to slide in the negative")
->DataElement(0, &SlideAlongAxisBasedOnAngle::m_ignoreZ, "Z", "When active, the Z Component will be ignored.") ->Attribute(AZ::Edit::Attributes::Suffix, "m")
->ClassElement(AZ::Edit::ClassElements::Group, "Vector Components To Ignore")
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
->DataElement(0, &SlideAlongAxisBasedOnAngle::m_ignoreX, "X", "When active, the X Component will be ignored.")
->Attribute(AZ::Edit::Attributes::ReadOnly, &SlideAlongAxisBasedOnAngle::YAndZIgnored)
->Attribute(AZ::Edit::Attributes::ChangeNotify, AZ::Edit::PropertyRefreshLevels::AttributesAndValues)
->DataElement(0, &SlideAlongAxisBasedOnAngle::m_ignoreY, "Y", "When active, the Y Component will be ignored.")
->Attribute(AZ::Edit::Attributes::ReadOnly, &SlideAlongAxisBasedOnAngle::XAndZIgnored)
->Attribute(AZ::Edit::Attributes::ChangeNotify, AZ::Edit::PropertyRefreshLevels::AttributesAndValues)
->DataElement(0, &SlideAlongAxisBasedOnAngle::m_ignoreZ, "Z", "When active, the Z Component will be ignored.")
->Attribute(AZ::Edit::Attributes::ReadOnly, &SlideAlongAxisBasedOnAngle::XAndYIgnored)
->Attribute(AZ::Edit::Attributes::ChangeNotify, AZ::Edit::PropertyRefreshLevels::AttributesAndValues)
; ;
} }
} }
} }
void SlideAlongAxisBasedOnAngle::AdjustLookAtTarget([[maybe_unused]] float deltaTime, [[maybe_unused]] const AZ::Transform& targetTransform, AZ::Transform& outLookAtTargetTransform) void SlideAlongAxisBasedOnAngle::AdjustLookAtTarget(
[[maybe_unused]] float deltaTime, [[maybe_unused]] const AZ::Transform& targetTransform, AZ::Transform& outLookAtTargetTransform)
{ {
float angle = GetEulerAngleFromTransform(outLookAtTargetTransform, m_angleTypeToChangeFor); float angle = GetEulerAngleFromTransform(outLookAtTargetTransform, m_angleTypeToChangeFor);
float currentPositionOnRange = -angle / AZ::Constants::HalfPi; float currentPositionOnRange = -angle / AZ::Constants::HalfPi;
@ -67,4 +79,20 @@ namespace Camera
outLookAtTargetTransform.SetTranslation(outLookAtTargetTransform.GetTranslation() + basis * currentPositionOnRange * slideScale); outLookAtTargetTransform.SetTranslation(outLookAtTargetTransform.GetTranslation() + basis * currentPositionOnRange * slideScale);
} }
}
bool SlideAlongAxisBasedOnAngle::XAndYIgnored() const
{
return m_ignoreX && m_ignoreY;
}
bool SlideAlongAxisBasedOnAngle::XAndZIgnored() const
{
return m_ignoreX && m_ignoreZ;
}
bool SlideAlongAxisBasedOnAngle::YAndZIgnored() const
{
return m_ignoreY && m_ignoreZ;
}
} // namespace Camera

@ -6,11 +6,11 @@
* *
*/ */
#pragma once #pragma once
#include <CameraFramework/ICameraLookAtBehavior.h>
#include <AzCore/Math/Transform.h>
#include <AzCore/RTTI/ReflectContext.h>
#include "StartingPointCamera/StartingPointCameraConstants.h" #include "StartingPointCamera/StartingPointCameraConstants.h"
#include <AzCore/Math/Transform.h>
#include <AzCore/Memory/SystemAllocator.h> #include <AzCore/Memory/SystemAllocator.h>
#include <AzCore/RTTI/ReflectContext.h>
#include <CameraFramework/ICameraLookAtBehavior.h>
namespace Camera namespace Camera
{ {
@ -38,6 +38,10 @@ namespace Camera
void Activate(AZ::EntityId) override {} void Activate(AZ::EntityId) override {}
void Deactivate() override {} void Deactivate() override {}
bool XAndYIgnored() const;
bool XAndZIgnored() const;
bool YAndZIgnored() const;
private: private:
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
// Reflected data // Reflected data

Loading…
Cancel
Save