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: tutorials/WritingAColladaFactoryWithPython.md
+81Lines changed: 81 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -196,8 +196,89 @@ Try to play a bit with MeshBuildSettings values in the code (expecially note the
196
196
197
197
## A more complex model: Mixamo's Vampire
198
198
199
+
Download this file: https://github.com/20tab/UnrealEnginePython/raw/master/tutorials/WritingAColladaFactoryWithPython_Assets/vampire.dae
200
+
201
+
it is the Vampire from mixmamo.com.
202
+
203
+
Technically it is a skeletal mesh with an animation (something we will try to import in a future tutorial), if we try to import it we will end with a dead vampire :P
nor = FVector(zn *-1, xn, yn) * FRotator(0, -90, 180)
225
+
# invert forward
226
+
self.normals[i] = nor.x
227
+
self.normals[i+1] = nor.y
228
+
self.normals[i+2] = nor.z
229
+
230
+
# fix uvs from 0 on bottom to 0 on top
231
+
for i, uv inenumerate(uvs):
232
+
if i %2!=0:
233
+
uvs[i] =1- uv
234
+
```
235
+
236
+
re-run and re-import the vampire, it should be correctly rotated now.
237
+
238
+
Obviously if we reimport the duck with the current code, its rotation will be wrong. So, time to add a configurator GUI for the factory.
239
+
199
240
## Adding a GUI to the importer: The Slate API
200
241
242
+
Slate is the GUI technology of Unreal Engine. It is based on tons of preprocessor macros to simplify readability to the developer building graphical interfaces. Its python wrapper tries to resemble this spirit by adapting it to the pythonic style. Note: the slate python api wrapper development has been completely sponsored by Kite & Lightning (http://kiteandlightning.la/). Big thanks to them.
243
+
244
+
A Python Slate interface looks like this:
245
+
246
+
```python
247
+
from unreal_engine import SWindow, SVerticalBox, SHorizontalBox, SButton, STextBlock, SBorder, FLinearColor
248
+
from unreal_engine.enums import EHorizontalAlignment, EVerticalAlignment
249
+
250
+
import unreal_engine as ue
251
+
252
+
SWindow(title='Hello I am Slate', client_size=(1024, 512))(
253
+
SVerticalBox()
254
+
(
255
+
STextBlock(text='I am the first top vertical item, without alignment'),
0 commit comments