You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
[Remote Control] Enums not properly supported in RCP
C++ and BP enum properties are handled differently, with the former not properly working with RC Controllers. #jira UE-189659 #rb Jeremie.Roy [CL 26608918 by Dario Mazzanti in 5.3 branch]
This commit is contained in:
@@ -252,10 +252,12 @@ void URCPropertyBindAction::Execute() const
|
||||
}
|
||||
|
||||
// Numeric to Byte/Enum
|
||||
if (RemoteControlProperty->IsA(FByteProperty::StaticClass()))
|
||||
if (RemoteControlProperty->IsA(FByteProperty::StaticClass()) ||
|
||||
RemoteControlProperty->IsA(FEnumProperty::StaticClass()))
|
||||
{
|
||||
Handle->SetValue((uint8)NumericValue);
|
||||
}
|
||||
|
||||
// Numeric To Numeric
|
||||
if (RemoteControlProperty->IsA(FNumericProperty::StaticClass()))
|
||||
{
|
||||
|
||||
@@ -161,6 +161,19 @@ bool URCBehaviourBind::CanHaveActionForField(URCController* Controller, TSharedR
|
||||
return false; // Unbound Property
|
||||
}
|
||||
|
||||
// Enums with base other than 8bits should be ignored, so let's make sure of that
|
||||
if (const FEnumProperty* EnumProperty = CastField<FEnumProperty>(RemoteControlProperty))
|
||||
{
|
||||
if (const UEnum* Enum = EnumProperty->GetEnum())
|
||||
{
|
||||
const int64 MaxEnumValue = Enum->GetMaxEnumValue();
|
||||
const uint32 NeededBits = FMath::RoundUpToPowerOfTwo(MaxEnumValue);
|
||||
|
||||
// 8 bits enums only
|
||||
return NeededBits <= 256;
|
||||
}
|
||||
}
|
||||
|
||||
// Indirect Binding (related types)
|
||||
//
|
||||
const static TMap<FFieldClass*, TArray<FFieldClass*>> SupportedIndirectBindsMap =
|
||||
@@ -168,7 +181,7 @@ bool URCBehaviourBind::CanHaveActionForField(URCController* Controller, TSharedR
|
||||
/* Controller Type */ /* Supported Remote Control Property Types */
|
||||
|
||||
{ FStrProperty::StaticClass(), /* --> */ { FTextProperty::StaticClass(), FNameProperty::StaticClass()}},
|
||||
{ FNumericProperty::StaticClass(), /* --> */ { FNumericProperty::StaticClass(), FBoolProperty::StaticClass(), FByteProperty::StaticClass() } },
|
||||
{ FNumericProperty::StaticClass(), /* --> */ { FNumericProperty::StaticClass(), FBoolProperty::StaticClass(), FByteProperty::StaticClass(), FEnumProperty::StaticClass() } },
|
||||
{ FBoolProperty::StaticClass(), /* --> */ { FFloatProperty::StaticClass(), FIntProperty::StaticClass(), FBoolProperty::StaticClass() } }
|
||||
};
|
||||
|
||||
|
||||
@@ -807,11 +807,17 @@ bool SRCControllerPanelList::IsEntitySupported(const FGuid ExposedEntityId)
|
||||
if (RemoteControlProperty->FieldType == EExposedFieldType::Property)
|
||||
{
|
||||
const FProperty* Property = RemoteControlProperty->GetProperty();
|
||||
|
||||
// enums are currently not properly supported by controllers (e.g. C++ enums action binding won't work)
|
||||
if (Property->IsA<FEnumProperty>())
|
||||
|
||||
if (const FEnumProperty* EnumProperty = CastField<FEnumProperty>(Property))
|
||||
{
|
||||
return false;
|
||||
if (const UEnum* Enum = EnumProperty->GetEnum())
|
||||
{
|
||||
const int64 MaxEnumValue = Enum->GetMaxEnumValue();
|
||||
const uint32 NeededBits = FMath::RoundUpToPowerOfTwo(MaxEnumValue);
|
||||
|
||||
// 8 bits enums only
|
||||
return NeededBits <= 256;
|
||||
}
|
||||
}
|
||||
else if (const FStructProperty* StructProperty = CastField<FStructProperty>(Property))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user