Commit Graph

256 Commits

Author SHA1 Message Date
jamie dale
4a8c78b719 Added additional tests for Python-generated overrides and non-POD data (re: CL# 7064650)
#jira UE-75405
#jira UE-75449
[FYI] Rex.Hill
#rb none
#rnx

#ROBOMERGE-OWNER: lina.halper
#ROBOMERGE-AUTHOR: jamie.dale
#ROBOMERGE-SOURCE: CL 7064660 in //UE4/Release-4.23/... via CL 7064661
#ROBOMERGE-BOT: ANIM (Main -> Dev-Anim) (v367-6836689)

[CL 7124303 by jamie dale in Dev-Anim branch]
2019-06-21 02:05:32 -04:00
jamie dale
c9cd40e406 Calling a Python-generated function no longer crashes when called from Blueprints, or with non-POD output data
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]
2019-06-21 02:05:29 -04:00
brandon schaefer
8789a57923 Get a DLLHandle for Linux as well when loadind in the python module
#jira UE-76551
#rb Jamie.Dale

#ROBOMERGE-SOURCE: CL 7094112 in //UE4/Release-4.23/...
#ROBOMERGE-BOT: RELEASE (Release-4.23 -> Main) (v367-6836689)

[CL 7094113 by brandon schaefer in Main branch]
2019-06-19 11:30:34 -04:00
jamie dale
d5647a15e8 CIS fix
#jira
#rb none
#rnx

#ROBOMERGE-SOURCE: CL 7064757 in //UE4/Release-4.23/...
#ROBOMERGE-BOT: RELEASE (Release-4.23 -> Main) (v367-6836689)

[CL 7064758 by jamie dale in Main branch]
2019-06-18 13:03:52 -04:00
jamie dale
d47d2b523b Added additional tests for Python-generated overrides and non-POD data (re: CL# 7064650)
#jira UE-75405
#jira UE-75449
[FYI] Rex.Hill
#rb none
#rnx

#ROBOMERGE-SOURCE: CL 7064660 in //UE4/Release-4.23/...
#ROBOMERGE-BOT: RELEASE (Release-4.23 -> Main) (v367-6836689)

[CL 7064661 by jamie dale in Main branch]
2019-06-18 12:52:17 -04:00
jamie dale
f51b5804bf Calling a Python-generated function no longer crashes when called from Blueprints, or with non-POD output data
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-SOURCE: CL 7064650 in //UE4/Release-4.23/...
#ROBOMERGE-BOT: RELEASE (Release-4.23 -> Main) (v367-6836689)

[CL 7064651 by jamie dale in Main branch]
2019-06-18 12:51:14 -04:00
Lina Halper
888010b766 Copying //UE4/Dev-Enterprise [at] cl 6890376 to Dev-Main (//UE4/Dev-Main)
#lockdown nick.penwarden
#rb none

#ROBOMERGE-OWNER: lina.halper
#ROBOMERGE-AUTHOR: jeanmichel.dignard
#ROBOMERGE-SOURCE: CL 6890764 in //UE4/Main/...
#ROBOMERGE-BOT: ANIM (Main -> Dev-Anim) (v366-6836689)

[CL 6942267 by Lina Halper in Dev-Anim branch]
2019-06-11 16:56:39 -04:00
JeanMichel Dignard
0f9ad96858 Copying //UE4/Dev-Enterprise @ cl 6890376 to Dev-Main (//UE4/Dev-Main)
#lockdown nick.penwarden
#rb none

[CL 6890764 by JeanMichel Dignard in Main branch]
2019-06-07 11:22:52 -04:00
Lina Halper
b0bdc590d5 Merging //UE4/Dev-Main to Dev-Anim (//UE4/Dev-Anim)
#lockdown: thomas.sarkanen
#fyi: Laurent.Delayen
#rb: none

[CL 6861656 by Lina Halper in Dev-Anim branch]
2019-06-06 12:33:54 -04:00
Chris Gagnon
930e33cb48 Copying //UE4/Dev-Editor to Dev-Main (//UE4/Dev-Main) for 4.23 From CL 6837861
#rb none

[CL 6838042 by Chris Gagnon in Main branch]
2019-06-04 15:42:48 -04:00
Marc Audy
cf48c338c5 Merging //UE4/Dev-Main to Dev-Framework (//UE4/Dev-Framework) @ 6834564
#rb
#rnx
#lockdown Michael.Noland

[CL 6834940 by Marc Audy in Dev-Framework branch]
2019-06-04 09:58:36 -04:00
stefan boberg
7f1f94b842 Copying //UE4/Dev-Core to Dev-Main (//UE4/Dev-Main)
#rb none

#ROBOMERGE-OWNER: lina.halper
#ROBOMERGE-AUTHOR: stefan.boberg
#ROBOMERGE-SOURCE: CL 6815521 in //UE4/Main/...
#ROBOMERGE-BOT: ANIM (Main -> Dev-Anim) (v365-6733468)

[CL 6821478 by stefan boberg in Dev-Anim branch]
2019-06-03 19:17:40 -04:00
jamie dale
d0c31a283c Added missing include
#jira UE-74616
#rb none
#rnx

#ROBOMERGE-OWNER: lina.halper
#ROBOMERGE-AUTHOR: jamie.dale
#ROBOMERGE-SOURCE: CL 6576371 via CL 6580688 via CL 6580904
#ROBOMERGE-BOT: ANIM (Main -> Dev-Anim) (v363-6677109)

[CL 6698846 by jamie dale in Dev-Anim branch]
2019-05-31 12:43:25 -04:00
jamie dale
5a02689b8a Added an interface for UObject types that own Python data so that they can be cleared during interpreter shutdown if the UObject is still externally referenced and couldn't be GC'd
#jira UE-74616
#rb Lauren.Ridge

#ROBOMERGE-OWNER: lina.halper
#ROBOMERGE-AUTHOR: jamie.dale
#ROBOMERGE-SOURCE: CL 6574505 via CL 6575624 via CL 6575649
#ROBOMERGE-BOT: ANIM (Main -> Dev-Anim) (v363-6677109)

[CL 6697322 by jamie dale in Dev-Anim branch]
2019-05-31 12:35:05 -04:00
Marc Audy
6fb39af50b Merging //UE4/Dev-Main to Dev-Framework (//UE4/Dev-Framework) @ 6662737
#rb
#rnx

[CL 6664141 by Marc Audy in Dev-Framework branch]
2019-05-29 11:33:11 -04:00
jamie dale
95ce23e65b Fixed delegate wrappers being incorrectly GC'd when no instances existed in Python
#jira UE-74616
#rb Lauren.Ridge

#ROBOMERGE-VERSION: 348-6547088
#ROBOMERGE-OWNER: lina.halper
#ROBOMERGE-AUTHOR: jamie.dale
#ROBOMERGE-SOURCE: CL 6540091 via CL 6540633 via CL 6540650
#ROBOMERGE-BOT: ANIM (Main -> Dev-Anim)

[CL 6567673 by jamie dale in Dev-Anim branch]
2019-05-18 10:59:31 -04:00
jamie dale
e0cd8ccd1a Disabling agressive Python type purging (and logging of lingering types) due to a GC crash
#jira
[FYI] Bob.Tellez
#rb none
#rnx

#ROBOMERGE-VERSION: 348-6547088
#ROBOMERGE-OWNER: lina.halper
#ROBOMERGE-AUTHOR: jamie.dale
#ROBOMERGE-SOURCE: CL 6537281 via CL 6538664 via CL 6538750
#ROBOMERGE-BOT: ANIM (Main -> Dev-Anim)

[CL 6565228 by jamie dale in Dev-Anim branch]
2019-05-18 10:46:13 -04:00
jamie dale
68680318a1 Attempt to forcefully purge any Python generated Unreal types and their instances when shutting down the Python plugin
#jira UE-74616
#rb Lauren.Ridge

#ROBOMERGE-VERSION: 348-6547088
#ROBOMERGE-OWNER: lina.halper
#ROBOMERGE-AUTHOR: jamie.dale
#ROBOMERGE-SOURCE: CL 6536765 via CL 6538378 via CL 6538487
#ROBOMERGE-BOT: ANIM (Main -> Dev-Anim)

[CL 6564508 by jamie dale in Dev-Anim branch]
2019-05-18 10:42:17 -04:00
jamie dale
58565d5084 Ensure Python callable wrapper types remove the Native flag from any function signatures that they duplicate
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]
2019-05-18 10:42:10 -04:00
Marc Audy
a3cfddf7f6 Merging //UE4/Dev-Main to Dev-Framework (//UE4/Dev-Framework) @ 6547008
#rb
#rnx

[CL 6548655 by Marc Audy in Dev-Framework branch]
2019-05-17 17:18:20 -04:00
jamie dale
1335e6f993 Fixed name conflict when re-instancing Python generated structs
#jira UE-74324
#rb Lauren.Ridge
#lockdown Cristina.Riveron

#ROBOMERGE-OWNER: lina.halper
#ROBOMERGE-AUTHOR: jamie.dale
#ROBOMERGE-SOURCE: CL 6405053 in //UE4/Release-4.22/... via CL 6405057
#ROBOMERGE-BOT: ANIM (Main -> Dev-Anim)

[CL 6465078 by jamie dale in Dev-Anim branch]
2019-05-15 04:23:29 -04:00
Marc Audy
a59ec411f9 Merging //UE4/Dev-Main to Dev-Framework (//UE4/Dev-Framework) @ 6142244
#rb
#rnx

[CL 6173076 by Marc Audy in Dev-Framework branch]
2019-04-30 10:19:36 -04:00
jamie dale
8dd60e6f4e init_unreal.py files are now run using the console scope to let them set-up the console environment in the editor
#jira
[FYI] James.McNatton
#rb Francis.Hurteau

#ROBOMERGE-OWNER: lina.halper
#ROBOMERGE-AUTHOR: jamie.dale
#ROBOMERGE-SOURCE: CL 6112368 via CL 6113193 via CL 6113292
#ROBOMERGE-BOT: ANIM (Main -> Dev-Anim)

[CL 6130838 by jamie dale in Dev-Anim branch]
2019-04-26 22:36:23 -04:00
jamie dale
b5160d9dc0 Prevent a crash when a Python generated class pending reinstancing is GC'd
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]
2019-04-17 21:03:26 -04:00
Ben Zeigler
e873f817b2 Hook up referencer name for editor FGCObjects that are likely to hold world references
#rb marc.audy

[CL 5536472 by Ben Zeigler in Dev-Framework branch]
2019-03-25 14:40:23 -04:00