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
{{ message }}
Repository navigation
Commit cc75a04
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: tutorials/WritingAColladaFactoryWithPython.md
+11-5Lines changed: 11 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,8 +7,8 @@ This tutorial has been tested with Unreal Engine 4.16 and Python 3.6 and assumes
7
7
If this is your first experience with the Unreal Engine Python plugin, this link is a good place to start: https://github.com/20tab/UnrealEnginePython/blob/master/tutorials/PlottingGraphsWithMatplotlibAndUnrealEnginePython.md#installing-the-python-plugin
8
8
9
9
10
-
The objective is to instruct the editor to import .dae (collada) files as static meshes., by building a new Factory. A Factory is a special class
11
-
in Unreal Engine 4 allowing to create and import assets. There are factories for fbx's, wav's, images and all of the media files supported by UE4.
10
+
The objective is to instruct the editor to import .dae (collada) files as static meshes, by building a new Factory.
11
+
A Factory is a special class in Unreal Engine 4 allowing to create and import assets. There are factories for fbx's, wav's, images and all of the media files supported by UE4.
12
12
13
13
You generally create new factories by subclassing the UFactory class in C++, but in this tutorial we will see how to subclass UE4 C++ classes in pure python.
14
14
@@ -17,7 +17,7 @@ You generally create new factories by subclassing the UFactory class in C++, but
17
17
## Subclassing UFactory: PyFactory
18
18
19
19
The subclassing api allows the developer to subclass any UClass (classes exposed to the UE4 reflection system). Unfortunately the UFactory class does not expose
20
-
its methods to the reflection system, so an handy class named 'UPyFactory' is exposed by the python plugin:
20
+
its methods to the reflection system, so an handy class named 'UPyFactory' (it ia simple subclass of UFactory) is exposed by the python plugin:
21
21
22
22
```python
23
23
from unreal_engine.classes import PyFactory
@@ -30,9 +30,15 @@ class ColladaFactory(PyFactory):
30
30
ue.log_error('Hello World, i am a useless factory')
31
31
```
32
32
33
-
save the file as collada_factory.py into the /Content/Scripts directory and run it rom the Unreal Engine Python Console.
33
+
save the file as collada_factory.py into the /Content/Scripts directory and run it rom the Unreal Engine Python Console:
34
34
35
-
Note that whenever you re-run the scripts, the internal Unreal Engine reflection system is updated, so you do not need to restart the editor (or launch slow compilations) when you make changes to the script code
Note that whenever you re-run the scripts, the internal Unreal Engine reflection system is updated, so you do not need to restart the editor (or launch slow compilations) when you make changes to the script code:
as you can see from the screenshot, the address of the UClass as well as its python UObject counterpart remains the same, while the __init__ call is updated. Remember that whenever you create a new UClass from python, the __init__ method is automatically called by the ClassDefaultObject (this information is useful only if you are into unreal engine internals, otherwise you can simply ignore it ;).
0 commit comments