You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+27-9Lines changed: 27 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,7 +24,7 @@ Once the plugin is installed and enabled, you get access to the 'PythonConsole'
24
24
25
25
All of the exposed engine features are under the 'unreal_engine' virtual module (it is completely coded in c into the plugin, so do not expect to run 'import unreal_engine' from a standard python shell)
26
26
27
-
The currently supported Unreal Engine versions are 4.12, 4.13, 4.14, 4.15, 4.16, 4.17and 4.18.
27
+
The currently supported Unreal Engine versions are 4.12, 4.13, 4.14, 4.15, 4.16, 4.17, 4.18 and 4.19
28
28
29
29
We support official python.org releases as well as IntelPython and Anaconda distributions.
30
30
@@ -487,6 +487,30 @@ To access the fields of a struct just call the fields() method.
487
487
488
488
A good example of struct usage is available here: https://github.com/20tab/UnrealEnginePython/blob/master/docs/Settings.md
489
489
490
+
As structs are passed by value, you need to pay attention when manipulating structs fields that are structs by themselves:
491
+
492
+
```python
493
+
from unreal_engine.structs import TerrificStruct, DumbStruct
494
+
495
+
ts = TerrificStruct()
496
+
ts.dumb = DumbStruct(Foo=17, Bar=22)
497
+
498
+
# will not modify the original DumbStruct but a copy of it !!!
499
+
ts.dumb.Foo =22
500
+
```
501
+
502
+
You can eventually force structs to be passed by ref (extremely dangerous as the internal C pointer could be a dangling one) using the ref() function:
503
+
504
+
```python
505
+
from unreal_engine.structs import TerrificStruct, DumbStruct
506
+
507
+
ts = TerrificStruct()
508
+
ts.dumb = DumbStruct(Foo=17, Bar=22)
509
+
510
+
# ref() will return a pointer to a struct
511
+
ts.ref().dumb.foo().Foo =22
512
+
```
513
+
490
514
The ue_site.py file
491
515
-------------------
492
516
@@ -808,15 +832,9 @@ Memory management
808
832
809
833
Dealing with 2 different GC's is really challenging.
810
834
811
-
PyActor, PyPawn and PythonComponent automatically DECREF's the mapped classes. This should be enough unless you hold references
812
-
in the python modules themselves. As this would be a bad programming practice, the current approach should be safe enough.
813
-
814
-
In addition to this, every time a uobject has to return its UObject mapping, it checks for its validity and safety:
835
+
Starting from release 20180226 a new memory management system has been added (FUnrealEnginePythonHouseKeeper, available here https://github.com/20tab/UnrealEnginePython/blob/master/Source/UnrealEnginePython/Public/PythonHouseKeeper.h). This new system is completely integrated with the Unreal Engine reflection-based GC and will hold track of each ue_PyUObject abd the related UObject to understand when a python object can be safely destroyed.
815
836
816
-
```c
817
-
#defineue_py_check(py_u) if (!py_u->ue_object || !py_u->ue_object->IsValidLowLevel() || py_u->ue_object->IsPendingKillOrUnreachable())\
818
-
return PyErr_Format(PyExc_Exception, "PyUObject is in invalid state")
819
-
```
837
+
The same system works for delegates, as well as Slate.
0 commit comments