Fix float math struct proxy customizations (FTransform, FMatrix, FQuat)

#jira UE-145983
#rb zak.middleton
#lockdown nick.whiting
#preflight 6230faf5ac0173aa4123c050

#ROBOMERGE-OWNER: andrew.davidson
#ROBOMERGE-AUTHOR: andrew.davidson
#ROBOMERGE-SOURCE: CL 19396721 in //UE5/Release-5.0/... via CL 19398359
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v926-19321884)

[CL 19403218 by andrew davidson in ue5-main branch]
This commit is contained in:
andrew davidson
2022-03-16 03:30:04 -04:00
parent 134462bf96
commit bb66f7e357
3 changed files with 181 additions and 156 deletions

View File

@@ -222,15 +222,15 @@ void FDetailCustomizationsModule::RegisterPropertyTypeCustomizations()
REGISTER_UIMINMAX_CUSTOMIZATION(NAME_Rotator3d, &FRotatorStructCustomization::MakeInstance);
RegisterCustomPropertyTypeLayout(NAME_LinearColor, FOnGetPropertyTypeCustomizationInstance::CreateStatic(&FColorStructCustomization::MakeInstance));
RegisterCustomPropertyTypeLayout(NAME_Color, FOnGetPropertyTypeCustomizationInstance::CreateStatic(&FColorStructCustomization::MakeInstance));
RegisterCustomPropertyTypeLayout(NAME_Matrix, FOnGetPropertyTypeCustomizationInstance::CreateStatic(&FMatrixStructCustomization::MakeInstance));
RegisterCustomPropertyTypeLayout(NAME_Matrix44f, FOnGetPropertyTypeCustomizationInstance::CreateStatic(&FMatrixStructCustomization::MakeInstance));
RegisterCustomPropertyTypeLayout(NAME_Matrix44d, FOnGetPropertyTypeCustomizationInstance::CreateStatic(&FMatrixStructCustomization::MakeInstance));
RegisterCustomPropertyTypeLayout(NAME_Transform, FOnGetPropertyTypeCustomizationInstance::CreateStatic(&FTransformStructCustomization::MakeInstance));
RegisterCustomPropertyTypeLayout(NAME_Transform3f, FOnGetPropertyTypeCustomizationInstance::CreateStatic(&FTransformStructCustomization::MakeInstance));
RegisterCustomPropertyTypeLayout(NAME_Transform3d, FOnGetPropertyTypeCustomizationInstance::CreateStatic(&FTransformStructCustomization::MakeInstance));
RegisterCustomPropertyTypeLayout(NAME_Quat, FOnGetPropertyTypeCustomizationInstance::CreateStatic(&FQuatStructCustomization::MakeInstance));
RegisterCustomPropertyTypeLayout(NAME_Quat4f, FOnGetPropertyTypeCustomizationInstance::CreateStatic(&FQuatStructCustomization::MakeInstance));
RegisterCustomPropertyTypeLayout(NAME_Quat4d, FOnGetPropertyTypeCustomizationInstance::CreateStatic(&FQuatStructCustomization::MakeInstance));
RegisterCustomPropertyTypeLayout(NAME_Matrix, FOnGetPropertyTypeCustomizationInstance::CreateStatic(&FMatrixStructCustomization<FMatrix::FReal>::MakeInstance));
RegisterCustomPropertyTypeLayout(NAME_Matrix44f, FOnGetPropertyTypeCustomizationInstance::CreateStatic(&FMatrixStructCustomization<FMatrix44f::FReal>::MakeInstance));
RegisterCustomPropertyTypeLayout(NAME_Matrix44d, FOnGetPropertyTypeCustomizationInstance::CreateStatic(&FMatrixStructCustomization<FMatrix44d::FReal>::MakeInstance));
RegisterCustomPropertyTypeLayout(NAME_Transform, FOnGetPropertyTypeCustomizationInstance::CreateStatic(&FTransformStructCustomization<FTransform::FReal>::MakeInstance));
RegisterCustomPropertyTypeLayout(NAME_Transform3f, FOnGetPropertyTypeCustomizationInstance::CreateStatic(&FTransformStructCustomization<FTransform3f::FReal>::MakeInstance));
RegisterCustomPropertyTypeLayout(NAME_Transform3d, FOnGetPropertyTypeCustomizationInstance::CreateStatic(&FTransformStructCustomization<FTransform3d::FReal>::MakeInstance));
RegisterCustomPropertyTypeLayout(NAME_Quat, FOnGetPropertyTypeCustomizationInstance::CreateStatic(&FQuatStructCustomization<FQuat::FReal>::MakeInstance));
RegisterCustomPropertyTypeLayout(NAME_Quat4f, FOnGetPropertyTypeCustomizationInstance::CreateStatic(&FQuatStructCustomization<FQuat4f::FReal>::MakeInstance));
RegisterCustomPropertyTypeLayout(NAME_Quat4d, FOnGetPropertyTypeCustomizationInstance::CreateStatic(&FQuatStructCustomization<FQuat4d::FReal>::MakeInstance));
RegisterCustomPropertyTypeLayout("SlateColor", FOnGetPropertyTypeCustomizationInstance::CreateStatic(&FSlateColorCustomization::MakeInstance));
RegisterCustomPropertyTypeLayout("ForceFeedbackAttenuationSettings", FOnGetPropertyTypeCustomizationInstance::CreateStatic(&FForceFeedbackAttenuationSettingsCustomization::MakeInstance));
RegisterCustomPropertyTypeLayout("SoundAttenuationSettings", FOnGetPropertyTypeCustomizationInstance::CreateStatic(&FSoundAttenuationSettingsCustomization::MakeInstance));

View File

@@ -222,9 +222,21 @@ protected:
TSharedPtr<IPropertyUtilities> PropertyUtilities;
};
struct FTransformField
{
enum Type
{
Location,
Rotation,
Scale
};
};
/**
* Proxy struct customization that displays a matrix as a position, rotation & scale.
*/
template<typename T>
class DETAILCUSTOMIZATIONS_API FMatrixStructCustomization : public FMathStructProxyCustomization
{
public:
@@ -232,18 +244,18 @@ public:
public:
FMatrixStructCustomization()
: CachedRotation(MakeShareable( new TProxyValue<FRotator>(FRotator::ZeroRotator)))
, CachedRotationYaw(MakeShareable( new TProxyProperty<FRotator, FRotator::FReal>(CachedRotation, CachedRotation->Get().Yaw)))
, CachedRotationPitch(MakeShareable( new TProxyProperty<FRotator, FRotator::FReal>(CachedRotation, CachedRotation->Get().Pitch)))
, CachedRotationRoll(MakeShareable( new TProxyProperty<FRotator, FRotator::FReal>(CachedRotation, CachedRotation->Get().Roll)))
, CachedTranslation(MakeShareable( new TProxyValue<FVector>(FVector::ZeroVector)))
, CachedTranslationX(MakeShareable( new TProxyProperty<FVector, FVector::FReal>(CachedTranslation, CachedTranslation->Get().X)))
, CachedTranslationY(MakeShareable( new TProxyProperty<FVector, FVector::FReal>(CachedTranslation, CachedTranslation->Get().Y)))
, CachedTranslationZ(MakeShareable( new TProxyProperty<FVector, FVector::FReal>(CachedTranslation, CachedTranslation->Get().Z)))
, CachedScale(MakeShareable( new TProxyValue<FVector>(FVector::ZeroVector)))
, CachedScaleX(MakeShareable( new TProxyProperty<FVector, FVector::FReal>(CachedScale, CachedScale->Get().X)))
, CachedScaleY(MakeShareable( new TProxyProperty<FVector, FVector::FReal>(CachedScale, CachedScale->Get().Y)))
, CachedScaleZ(MakeShareable( new TProxyProperty<FVector, FVector::FReal>(CachedScale, CachedScale->Get().Z)))
: CachedRotation(MakeShareable( new TProxyValue<UE::Math::TRotator<T>>(UE::Math::TRotator<T>::ZeroRotator)))
, CachedRotationYaw(MakeShareable( new TProxyProperty<UE::Math::TRotator<T>, T>(CachedRotation, CachedRotation->Get().Yaw)))
, CachedRotationPitch(MakeShareable( new TProxyProperty<UE::Math::TRotator<T>, T>(CachedRotation, CachedRotation->Get().Pitch)))
, CachedRotationRoll(MakeShareable( new TProxyProperty<UE::Math::TRotator<T>, T>(CachedRotation, CachedRotation->Get().Roll)))
, CachedTranslation(MakeShareable( new TProxyValue<UE::Math::TVector<T>>(UE::Math::TVector<T>::ZeroVector)))
, CachedTranslationX(MakeShareable( new TProxyProperty<UE::Math::TVector<T>, T>(CachedTranslation, CachedTranslation->Get().X)))
, CachedTranslationY(MakeShareable( new TProxyProperty<UE::Math::TVector<T>, T>(CachedTranslation, CachedTranslation->Get().Y)))
, CachedTranslationZ(MakeShareable( new TProxyProperty<UE::Math::TVector<T>, T>(CachedTranslation, CachedTranslation->Get().Z)))
, CachedScale(MakeShareable( new TProxyValue<UE::Math::TVector<T>>(UE::Math::TVector<T>::ZeroVector)))
, CachedScaleX(MakeShareable( new TProxyProperty<UE::Math::TVector<T>, T>(CachedScale, CachedScale->Get().X)))
, CachedScaleY(MakeShareable( new TProxyProperty<UE::Math::TVector<T>, T>(CachedScale, CachedScale->Get().Y)))
, CachedScaleZ(MakeShareable( new TProxyProperty<UE::Math::TVector<T>, T>(CachedScale, CachedScale->Get().Z)))
{
}
@@ -263,43 +275,34 @@ protected:
virtual bool CacheValues(TWeakPtr<IPropertyHandle> PropertyHandlePtr) const override;
virtual bool FlushValues(TWeakPtr<IPropertyHandle> PropertyHandlePtr) const override;
struct FTransformField
{
enum Type
{
Location,
Rotation,
Scale
};
};
void OnCopy(FTransformField::Type Type, TWeakPtr<IPropertyHandle> PropertyHandlePtr);
void OnPaste(FTransformField::Type Type, TWeakPtr<IPropertyHandle> PropertyHandlePtr);
protected:
/** Cached rotation values */
mutable TSharedRef< TProxyValue<FRotator> > CachedRotation;
mutable TSharedRef< TProxyProperty<FRotator, FRotator::FReal> > CachedRotationYaw;
mutable TSharedRef< TProxyProperty<FRotator, FRotator::FReal> > CachedRotationPitch;
mutable TSharedRef< TProxyProperty<FRotator, FRotator::FReal> > CachedRotationRoll;
mutable TSharedRef< TProxyValue<UE::Math::TRotator<T>> > CachedRotation;
mutable TSharedRef< TProxyProperty<UE::Math::TRotator<T>, T> > CachedRotationYaw;
mutable TSharedRef< TProxyProperty<UE::Math::TRotator<T>, T> > CachedRotationPitch;
mutable TSharedRef< TProxyProperty<UE::Math::TRotator<T>, T> > CachedRotationRoll;
/** Cached translation values */
mutable TSharedRef< TProxyValue<FVector> > CachedTranslation;
mutable TSharedRef< TProxyProperty<FVector, FVector::FReal> > CachedTranslationX;
mutable TSharedRef< TProxyProperty<FVector, FVector::FReal> > CachedTranslationY;
mutable TSharedRef< TProxyProperty<FVector, FVector::FReal> > CachedTranslationZ;
mutable TSharedRef< TProxyValue<UE::Math::TVector<T>> > CachedTranslation;
mutable TSharedRef< TProxyProperty<UE::Math::TVector<T>, T > > CachedTranslationX;
mutable TSharedRef< TProxyProperty<UE::Math::TVector<T>, T > > CachedTranslationY;
mutable TSharedRef< TProxyProperty<UE::Math::TVector<T>, T> > CachedTranslationZ;
/** Cached scale values */
mutable TSharedRef< TProxyValue<FVector> > CachedScale;
mutable TSharedRef< TProxyProperty<FVector, FVector::FReal> > CachedScaleX;
mutable TSharedRef< TProxyProperty<FVector, FVector::FReal> > CachedScaleY;
mutable TSharedRef< TProxyProperty<FVector, FVector::FReal> > CachedScaleZ;
mutable TSharedRef< TProxyValue<UE::Math::TVector<T>> > CachedScale;
mutable TSharedRef< TProxyProperty<UE::Math::TVector<T>, T> > CachedScaleX;
mutable TSharedRef< TProxyProperty<UE::Math::TVector<T>, T> > CachedScaleY;
mutable TSharedRef< TProxyProperty<UE::Math::TVector<T>, T> > CachedScaleZ;
};
/**
* Proxy struct customization that displays an FTransform as a position, euler rotation & scale.
*/
class FTransformStructCustomization : public FMatrixStructCustomization
template<typename T>
class FTransformStructCustomization : public FMatrixStructCustomization<T>
{
public:
static TSharedRef<IPropertyTypeCustomization> MakeInstance();
@@ -313,7 +316,8 @@ protected:
/**
* Proxy struct customization that displays an FQuat as an euler rotation
*/
class DETAILCUSTOMIZATIONS_API FQuatStructCustomization : public FMatrixStructCustomization
template<typename T>
class DETAILCUSTOMIZATIONS_API FQuatStructCustomization : public FMatrixStructCustomization<T>
{
public:
static TSharedRef<IPropertyTypeCustomization> MakeInstance();