Rearrange FormatDataLibrary to have less module coupling.
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
|
||||
#include "FormatMessage.h"
|
||||
#include "Editor.h"
|
||||
|
||||
#include "Internationalization/TextFormatter.h"
|
||||
#include "BlueprintActionDatabaseRegistrar.h"
|
||||
@@ -305,11 +306,11 @@ UFunction *ToFormatArgumentData(const UEdGraphSchema_K2 *Schema, const FEdGraphP
|
||||
return UlxFormatDataLibrary::StaticClass()->FindFunctionByName(GET_MEMBER_NAME_CHECKED(UlxFormatDataLibrary, FormatArgumentDataBlank));
|
||||
}
|
||||
|
||||
// Try to find a match in the UlxFormatDataLibrary.
|
||||
// Scan the cached converter list for a matching type.
|
||||
//
|
||||
for (auto It = TFieldIterator<UFunction>(UlxFormatDataLibrary::StaticClass()); It; ++It)
|
||||
UlxFormatDataLibrary* FormatDataLib = GEditor->GetEditorSubsystem<UlxFormatDataLibrary>();
|
||||
for (UFunction* Function : FormatDataLib->GetConverters())
|
||||
{
|
||||
UFunction* Function = *It;
|
||||
FProperty* ValueProperty = Function->FindPropertyByName(TEXT("AutoConvertedValue"));
|
||||
FEdGraphPinType ValuePinType;
|
||||
bool Convertible = Schema->ConvertPropertyToPinType(ValueProperty, ValuePinType);
|
||||
@@ -317,9 +318,9 @@ UFunction *ToFormatArgumentData(const UEdGraphSchema_K2 *Schema, const FEdGraphP
|
||||
if (!Schema->ArePinTypesEquivalent(PinType, ValuePinType)) continue;
|
||||
return Function;
|
||||
}
|
||||
|
||||
|
||||
// A general handler for Enums. You can override this for specific enums by
|
||||
// putting that particular enum into the UlxFormatDataLibrary.
|
||||
// putting that particular enum into any class with an AutoConvertedValue function.
|
||||
//
|
||||
if ((PinType.PinCategory == UEdGraphSchema_K2::PC_Byte) && (nullptr != Cast<const UEnum>(PinType.PinSubCategoryObject)))
|
||||
{
|
||||
@@ -332,7 +333,7 @@ UFunction *ToFormatArgumentData(const UEdGraphSchema_K2 *Schema, const FEdGraphP
|
||||
{
|
||||
return UlxFormatDataLibrary::StaticClass()->FindFunctionByName(GET_MEMBER_NAME_CHECKED(UlxFormatDataLibrary, FormatArgumentDataObject));
|
||||
}
|
||||
|
||||
|
||||
// We don't have a match.
|
||||
//
|
||||
return nullptr;
|
||||
|
||||
Reference in New Issue
Block a user