Skip to content

Commit cf429c6

Browse files
author
Roberto De Ioris
authored
Update WritingAColladaFactoryWithPython.md
1 parent 3f9d3c8 commit cf429c6

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

‎tutorials/WritingAColladaFactoryWithPython.md‎

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,46 @@ Obviously if we reimport the duck with the current code, its rotation will be wr
239239

240240
## Adding a GUI to the importer: The Slate API
241241

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'),
256+
)
257+
(
258+
SBorder(color_and_opacity=FLinearColor(1, 0, 0, 1))
259+
(
260+
STextBlock(text='I am the second top vertical item with center/bottom alignment'),
261+
),
262+
h_align = EHorizontalAlignment.HAlign_Center,
263+
v_align = EVerticalAlignment.VAlign_Bottom
264+
)
265+
(
266+
SHorizontalBox()
267+
(
268+
SButton(text='Button Left', on_clicked=lambda: ue.log('Hello from left'), h_align=EHorizontalAlignment.HAlign_Center)
269+
)
270+
(
271+
SButton(text='Button Right', on_clicked=lambda: ue.log('Hello from right'), v_align=EVerticalAlignment.VAlign_Center)
272+
),
273+
fill_height=0.2
274+
)
275+
)
276+
```
277+
278+
feel free to run the previous code to obtain something like this (click on the buttons, they will write to the console !):
279+
280+
![Slate demo](https://github.com/20tab/UnrealEnginePython/blob/master/tutorials/WritingAColladaFactoryWithPython_Assets/slate_demo.png)
281+
242282
## Persistent importer options: more subclassing
243283

244284
## Automatically add the ColladaFactory on editor startup

0 commit comments

Comments
 (0)