static void AddNamedValuesFromObject(const UObject* Ob, TArray<FEnvNamedValue>& NamedValues, TArray<FName>& RequiredParams) { if (Ob == NULL) { return; } for (UProperty* TestProperty = Ob->GetClass()->PropertyLink; TestProperty; TestProperty = TestProperty->PropertyLinkNext) { UStructProperty* TestStruct = Cast<UStructProperty>(TestProperty); if (TestStruct == NULL) { continue; } FString TypeDesc = TestStruct->GetCPPType(NULL, CPPF_None); if (TypeDesc.Contains(GET_STRUCT_NAME_CHECKED(FEnvIntParam))) { const FEnvIntParam* PropertyValue = TestStruct->ContainerPtrToValuePtr<FEnvIntParam>(Ob); AddNamedValue(PropertyValue->ParamName, EEnvQueryParam::Int, *((float*)&PropertyValue->Value), NamedValues, RequiredParams); } else if (TypeDesc.Contains(GET_STRUCT_NAME_CHECKED(FEnvFloatParam))) { const FEnvFloatParam* PropertyValue = TestStruct->ContainerPtrToValuePtr<FEnvFloatParam>(Ob); AddNamedValue(PropertyValue->ParamName, EEnvQueryParam::Float, PropertyValue->Value, NamedValues, RequiredParams); } else if (TypeDesc.Contains(GET_STRUCT_NAME_CHECKED(FEnvBoolParam))) { const FEnvBoolParam* PropertyValue = TestStruct->ContainerPtrToValuePtr<FEnvBoolParam>(Ob); AddNamedValue(PropertyValue->ParamName, EEnvQueryParam::Bool, PropertyValue->Value ? 1.0f : -1.0f, NamedValues, RequiredParams); } } }
bool FAIDataProviderStructValue::IsMatchingType(UProperty* PropType) const { UStructProperty* StructProp = Cast<UStructProperty>(PropType); if (StructProp) { // skip inital "struct " FString CPPType = StructProp->GetCPPType(nullptr, CPPF_None).Mid(8); return CPPType == StructName; } return false; }