Skip to content

Commit 0c8aa54

Browse files
committed
fix return value for struct with custom thunk
1 parent bc9ff98 commit 0c8aa54

File tree

3 files changed

+10
-22
lines changed

3 files changed

+10
-22
lines changed

GlobalEventSystem.uplugin

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"FileVersion": 3,
33
"Version": 1,
4-
"VersionName": "0.3.0",
4+
"VersionName": "0.3.1",
55
"FriendlyName": "GlobalEventSystem",
66
"Description": "Loosely coupled internal event system plugin for the unreal engine.",
77
"Category": "Other",

Source/GlobalEventSystem/Private/GlobalEventSystemBPLibrary.cpp

+3-18
Original file line numberDiff line numberDiff line change
@@ -214,25 +214,10 @@ bool UGlobalEventSystemBPLibrary::Conv_PropToName(const FGESWildcardProperty& In
214214
}
215215
}
216216

217-
void UGlobalEventSystemBPLibrary::Conv_PropToStruct(const FGESWildcardProperty& InProp, UProperty*& OutStruct)
217+
bool UGlobalEventSystemBPLibrary::Conv_PropToStruct(const FGESWildcardProperty& InProp, UProperty*& OutStruct)
218218
{
219-
/*if (InProp.Property->IsA<UStructProperty>())
220-
{
221-
UStructProperty* StructProperty = Cast<UStructProperty>(InProp.Property);
222-
//OutStruct = InProp.Property;
223-
//StructProperty->Struct->
224-
//StructProperty->ContainerPtrToValuePtrForDefaults(StructProperty->Struct);
225-
//OutStruct->CopyCompleteValue(StructProperty->Value)
226-
//TODO figure out how to copy... wait a minute we can do a custom thunk to get struct ptr! yay...
227-
UE_LOG(LogTemp, Warning, TEXT("UStructProperty not supported due to lack of copy operation. TBC"));
228-
return false;
229-
}
230-
else
231-
{
232-
UE_LOG(LogTemp, Warning, TEXT("UGlobalEventSystemBPLibrary::Conv_PropToStruct %s is not a Struct."), *InProp.Property->GetName());
233-
return false;
234-
}*/
235-
//return false;
219+
//doesn't get called due to custom thunk
220+
return false;
236221
}
237222

238223
bool UGlobalEventSystemBPLibrary::HandlePropToStruct(const FGESWildcardProperty& InProp, FGESWildcardProperty& OutProp)

Source/GlobalEventSystem/Public/GlobalEventSystemBPLibrary.h

+6-3
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ class UGlobalEventSystemBPLibrary : public UBlueprintFunctionLibrary
8181
static bool Conv_PropToName(const FGESWildcardProperty& InProp, FName& OutName);
8282

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

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

114114
DECLARE_FUNCTION(execConv_PropToStruct)
115115
{
116-
//Stack.MostRecentProperty = nullptr;
116+
Stack.MostRecentProperty = nullptr;
117117
FGESWildcardProperty InProp;
118118
FGESWildcardProperty OutProp;
119119

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

128128
OutProp.Property = ParameterProp;
129129
OutProp.PropertyPtr = PropPtr;
130+
bool bDidCopy = false;
130131

131132
P_FINISH;
132133
P_NATIVE_BEGIN;
133-
bool bDidCopy = HandlePropToStruct(InProp, OutProp);
134+
bDidCopy = HandlePropToStruct(InProp, OutProp); //todo: add return support
134135
P_NATIVE_END;
136+
137+
*(bool*)RESULT_PARAM = bDidCopy;
135138
}
136139

137140

0 commit comments

Comments
 (0)