The old logic for dealing with the parameters within the Unreal function thunk (UPythonGeneratedClass::CallPythonFunction and UPythonCallableForDelegate::CallPythonNative) assumed that Stack.Locals would be set-up correctly for input, and could be written to for output. This isn't true, as Stack.Locals is populated by a memcpy in UObject::ProcessEvent (so isn't safe to write to for non-POD data), and Blueprints just pass along their existing frame data since they skip the call to ProcessScriptFunction (as Python generated functions are marked FUNC_Native).
This change adds a common thunk processing function (PyGenUtil::InvokePythonCallableFromUnrealFunctionThunk) which is used when calling into Python from an Unreal function thunk. This function steps the data off the stack frame for each property, copying input data to Python, and building the output chain (FOutParmRec) from output data addresses. This matches what the UHT generated thunk does for native functions (via P_GET_PROPERTY and P_GET_PROPERTY_REF), as well as what ProcessScriptFunction does for functions with Blueprint bytecode.
#jira UE-75405
#jira UE-75449
[FYI] Rex.Hill
#rb Dan.OConnor
#ROBOMERGE-OWNER: lina.halper
#ROBOMERGE-AUTHOR: jamie.dale
#ROBOMERGE-SOURCE: CL 7064650 in //UE4/Release-4.23/... via CL 7064651
#ROBOMERGE-BOT: ANIM (Main -> Dev-Anim) (v367-6836689)
[CL 7124296 by jamie dale in Dev-Anim branch]
Failing to do this leads to a Native instance inside a non-native instance, which causes GC confusion
#jira UE-74616
#rb Lauren.Ridge
#ROBOMERGE-VERSION: 348-6547088
#ROBOMERGE-OWNER: lina.halper
#ROBOMERGE-AUTHOR: jamie.dale
#ROBOMERGE-SOURCE: CL 6536762 via CL 6538364 via CL 6538485
#ROBOMERGE-BOT: ANIM (Main -> Dev-Anim)
[CL 6564488 by jamie dale in Dev-Anim branch]
We now ARO these pending types to stop them being GC'd, and added unreal.flush_generated_type_reinstancing() to allow you to force the reinstancing to happen at a certain point in your script (rather than when it ends, or on the next Tick).
#jira UE-72853
#rb Chris.Gagnon
#lockdown Cristina.Riveron
#ROBOMERGE-OWNER: lina.halper
#ROBOMERGE-AUTHOR: jamie.dale
#ROBOMERGE-SOURCE: CL 5956901 in //UE4/Release-4.22/... via CL 5956925
#ROBOMERGE-BOT: ANIM (Main -> Dev-Anim)
[CL 5962663 by jamie dale in Dev-Anim branch]
The definition of the delegate type must specify the class and property name of the delegate that will use it and the type cannot be used outside of that context or just on the stack.
UMulticastDelegateProperty is now abstract and has 2 subclasses (UMulticastDelegateInlineProperty and UMulticastDelegateSparseProperty). The SparseProperty SignatureFunction will be a USparseDelegateFunction.
The sparse delegates do not work correctly with the python bindings at this point, but this will be visited soon.
#rb Michael.Noland
#jira
#ROBOMERGE-OWNER: lina.halper
#ROBOMERGE-AUTHOR: marc.audy
#ROBOMERGE-SOURCE: CL 5295832 via CL 5306530 via CL 5306657
#ROBOMERGE-BOT: ANIM (Main -> Dev-Anim)
[CL 5322213 by marc audy in Dev-Anim branch]
This fixes crashes where they would take references to things like an actor within a world, and then the active editor world was changed (which verifies against GC reference leaks).
#jira UE-69150
[FYI] Michael.Noland
#rb Lauren.Ridge
#ROBOMERGE-OWNER: lina.halper
#ROBOMERGE-AUTHOR: jamie.dale
#ROBOMERGE-SOURCE: CL 4987801 in //UE4/Release-4.22/... via CL 4987804
#ROBOMERGE-BOT: ANIM (Main -> Dev-Anim)
[CL 5043990 by jamie dale in Dev-Anim branch]
BlueprintInternalUseOnly functions are usually designed to be called via a K2 node wrapper, which may provide additional sanitization or data transformation (which Python is unaware of, so cannot mimic).
CustomThunk functions rely on popping Bytecode data off the stack, but Python calls functions natively so there is no Bytecode available and these functions will crash. We hope to address CustomThunk support in the future by synthesizing the correct Bytecode.
#jira UE-69818
#rb none
#ROBOMERGE-OWNER: lina.halper
#ROBOMERGE-AUTHOR: jamie.dale
#ROBOMERGE-SOURCE: CL 4951261 in //UE4/Release-4.22/... via CL 4951262
#ROBOMERGE-BOT: ANIM (Main -> Dev-Anim)
[CL 5023925 by jamie dale in Dev-Anim branch]