// Copyright Epic Games, Inc. All Rights Reserved. #include "MovieScene/MovieSceneLiveLinkStructProperties.h" #include "Channels/MovieSceneBoolChannel.h" #include "MovieScene/MovieSceneLiveLinkEnumHandler.h" #include "Channels/MovieSceneByteChannel.h" #include "MovieScene/MovieSceneLiveLinkPropertyHandler.h" #include "Channels/MovieSceneIntegerChannel.h" #include "MovieScene/MovieSceneLiveLinkTransformHandler.h" #include "Channels/MovieSceneStringChannel.h" #include "UObject/EnumProperty.h" #include UE_INLINE_GENERATED_CPP_BY_NAME(MovieSceneLiveLinkStructProperties) FLiveLinkPropertyData::FLiveLinkPropertyData() = default; FLiveLinkPropertyData::~FLiveLinkPropertyData() = default; namespace LiveLinkPropertiesUtils { TSharedPtr CreateHandlerFromProperty(FProperty* InProperty, const FLiveLinkStructPropertyBindings& InBinding, FLiveLinkPropertyData* InPropertyData) { if (InProperty->IsA(FFloatProperty::StaticClass())) { return MakeShared>(InBinding, InPropertyData); } else if (InProperty->IsA(FIntProperty::StaticClass())) { return MakeShared>(InBinding, InPropertyData); } else if (InProperty->IsA(FBoolProperty::StaticClass())) { return MakeShared>(InBinding, InPropertyData); } else if (InProperty->IsA(FStrProperty::StaticClass())) { return MakeShared>(InBinding, InPropertyData); } else if (InProperty->IsA(FByteProperty::StaticClass())) { return MakeShared>(InBinding, InPropertyData); } else if (InProperty->IsA(FEnumProperty::StaticClass())) { return MakeShared(InBinding, InPropertyData); } else if (InProperty->IsA(FStructProperty::StaticClass())) { if (FStructProperty* StructProperty = CastField(InProperty)) { if (StructProperty->Struct->GetFName() == NAME_Transform) { return MakeShared(InBinding, InPropertyData); } else if (StructProperty->Struct->GetFName() == NAME_Vector) { return MakeShared>(InBinding, InPropertyData); } else if (StructProperty->Struct->GetFName() == NAME_Color) { return MakeShared>(InBinding, InPropertyData); } } } return TSharedPtr(); } TSharedPtr CreatePropertyHandler(const UScriptStruct& InStruct, FLiveLinkPropertyData* InPropertyData) { FLiveLinkStructPropertyBindings PropertyBinding(InPropertyData->PropertyName, InPropertyData->PropertyName.ToString()); FProperty* PropertyPtr = PropertyBinding.GetProperty(InStruct); if (PropertyPtr == nullptr) { return TSharedPtr(); } if (PropertyPtr->IsA(FArrayProperty::StaticClass())) { return CreateHandlerFromProperty(CastFieldChecked(PropertyPtr)->Inner, PropertyBinding, InPropertyData); } else { return CreateHandlerFromProperty(PropertyPtr, PropertyBinding, InPropertyData); } } }