Skip to content

Commit

Permalink
fix return value for struct with custom thunk
Browse files Browse the repository at this point in the history
  • Loading branch information
getnamo committed Dec 5, 2019
1 parent bc9ff98 commit 0c8aa54
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 22 deletions.
2 changes: 1 addition & 1 deletion GlobalEventSystem.uplugin
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"FileVersion": 3,
"Version": 1,
"VersionName": "0.3.0",
"VersionName": "0.3.1",
"FriendlyName": "GlobalEventSystem",
"Description": "Loosely coupled internal event system plugin for the unreal engine.",
"Category": "Other",
Expand Down
21 changes: 3 additions & 18 deletions Source/GlobalEventSystem/Private/GlobalEventSystemBPLibrary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,25 +214,10 @@ bool UGlobalEventSystemBPLibrary::Conv_PropToName(const FGESWildcardProperty& In
}
}

void UGlobalEventSystemBPLibrary::Conv_PropToStruct(const FGESWildcardProperty& InProp, UProperty*& OutStruct)
bool UGlobalEventSystemBPLibrary::Conv_PropToStruct(const FGESWildcardProperty& InProp, UProperty*& OutStruct)
{
/*if (InProp.Property->IsA<UStructProperty>())
{
UStructProperty* StructProperty = Cast<UStructProperty>(InProp.Property);
//OutStruct = InProp.Property;
//StructProperty->Struct->
//StructProperty->ContainerPtrToValuePtrForDefaults(StructProperty->Struct);
//OutStruct->CopyCompleteValue(StructProperty->Value)
//TODO figure out how to copy... wait a minute we can do a custom thunk to get struct ptr! yay...
UE_LOG(LogTemp, Warning, TEXT("UStructProperty not supported due to lack of copy operation. TBC"));
return false;
}
else
{
UE_LOG(LogTemp, Warning, TEXT("UGlobalEventSystemBPLibrary::Conv_PropToStruct %s is not a Struct."), *InProp.Property->GetName());
return false;
}*/
//return false;
//doesn't get called due to custom thunk
return false;
}

bool UGlobalEventSystemBPLibrary::HandlePropToStruct(const FGESWildcardProperty& InProp, FGESWildcardProperty& OutProp)
Expand Down
9 changes: 6 additions & 3 deletions Source/GlobalEventSystem/Public/GlobalEventSystemBPLibrary.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class UGlobalEventSystemBPLibrary : public UBlueprintFunctionLibrary
static bool Conv_PropToName(const FGESWildcardProperty& InProp, FName& OutName);

UFUNCTION(BlueprintPure, CustomThunk, meta = (DisplayName = "To Struct (Wildcard Property)", CustomStructureParam = "OutStruct", BlueprintAutocast), Category = "Utilities|SocketIO")
static void Conv_PropToStruct(const FGESWildcardProperty& InProp, UProperty*& OutStruct);
static bool Conv_PropToStruct(const FGESWildcardProperty& InProp, UProperty*& OutStruct);

UFUNCTION(BlueprintPure, meta = (DisplayName = "To Object (Wildcard Property)", BlueprintAutocast), Category = "Utilities|SocketIO")
static bool Conv_PropToObject(const FGESWildcardProperty& InProp, UObject*& OutObject);
Expand Down Expand Up @@ -113,7 +113,7 @@ class UGlobalEventSystemBPLibrary : public UBlueprintFunctionLibrary

DECLARE_FUNCTION(execConv_PropToStruct)
{
//Stack.MostRecentProperty = nullptr;
Stack.MostRecentProperty = nullptr;
FGESWildcardProperty InProp;
FGESWildcardProperty OutProp;

Expand All @@ -127,11 +127,14 @@ class UGlobalEventSystemBPLibrary : public UBlueprintFunctionLibrary

OutProp.Property = ParameterProp;
OutProp.PropertyPtr = PropPtr;
bool bDidCopy = false;

P_FINISH;
P_NATIVE_BEGIN;
bool bDidCopy = HandlePropToStruct(InProp, OutProp);
bDidCopy = HandlePropToStruct(InProp, OutProp); //todo: add return support
P_NATIVE_END;

*(bool*)RESULT_PARAM = bDidCopy;
}


Expand Down

0 comments on commit 0c8aa54

Please sign in to comment.