Skip to content

Commit 21c0d12

Browse files
committed
5.1 compile changes
- Set elementsize manually - Still fails C++ -> Blueprint ustruct path
1 parent 378a55d commit 21c0d12

File tree

1 file changed

+8
-24
lines changed

1 file changed

+8
-24
lines changed

Source/GlobalEventSystem/Private/GESHandler.cpp

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -563,34 +563,18 @@ void FGESHandler::EmitEvent(const FGESEmitContext& EmitData, UStruct* Struct, vo
563563

564564
FField* OldProperty = Class->ChildProperties;
565565

566-
FStructProperty* StructProperty =
567-
new FStructProperty(FFieldVariant(Class),
568-
TEXT("StructValue"),
569-
EObjectFlags::RF_Public | EObjectFlags::RF_LoadCompleted,
570-
0, EPropertyFlags::CPF_BlueprintVisible | EPropertyFlags::CPF_Edit,
571-
(UScriptStruct*)Struct); //added to ensure elementsize is set correctly
566+
567+
//GetTransientPackage(), EmitData.WorldContext
568+
//UScriptStruct* NewStruct = NewObject<UScriptStruct>(GetTransientPackage(), *Struct->GetName(), RF_NoFlags);
572569

570+
FStructProperty* StructProperty = new FStructProperty(FFieldVariant(Class), TEXT("StructProperty"), RF_NoFlags);
573571
StructProperty->Struct = (UScriptStruct*)Struct;
572+
StructProperty->ElementSize = Struct->GetStructureSize();
573+
//NewStruct->AddCppProperty(StructProperty);
574574

575575
//undo what we just did so it won't be traversed because of init
576576
Class->ChildProperties = OldProperty;
577577

578-
//class ChildProperties
579-
//NB: elementsize is incorrect when constructed like this
580-
//we need this workaround so init isn't called
581-
/*
582-
* if (GetOwner<UObject>())
583-
{
584-
UField* OwnerField = GetOwnerChecked<UField>();
585-
OwnerField->AddCppProperty(this);
586-
}
587-
else
588-
{
589-
FField* OwnerField = GetOwnerChecked<FField>();
590-
OwnerField->AddCppProperty(this);
591-
}
592-
}
593-
*/
594578
//Store our struct data in a buffer we can reference
595579
TArray<uint8> Buffer;
596580
int32 Size = Struct->GetStructureSize();
@@ -607,7 +591,7 @@ void FGESHandler::EmitEvent(const FGESEmitContext& EmitData, UStruct* Struct, vo
607591
PropData.bHandleAllocation = true;
608592
}
609593

610-
EmitToListenersWithData(PropData, [&PropData, &Struct, &Buffer, &StructProperty, bValidateStructs](const FGESEventListener& Listener)
594+
EmitToListenersWithData(PropData, [&PropData, &Struct, &Buffer, bValidateStructs](const FGESEventListener& Listener)
611595
{
612596
UE_LOG(LogTemp, Warning, TEXT("FGESHandler::EmitEvent struct Emit called"));
613597

@@ -624,7 +608,7 @@ void FGESHandler::EmitEvent(const FGESEmitContext& EmitData, UStruct* Struct, vo
624608
FStructProperty* SubStructProperty = CastField<FStructProperty>(Properties[0]);
625609
if (SubStructProperty->Struct == Struct)
626610
{
627-
Listener.ReceiverWCO->ProcessEvent(Listener.Function, PropData.PropertyPtr);// PropData.PropertyPtr
611+
Listener.ReceiverWCO->ProcessEvent(Listener.Function, PropData.PropertyPtr);
628612
}
629613
else
630614
{

0 commit comments

Comments
 (0)