Skip to content

Commit a02e841

Browse files
author
Roberto De Ioris
authored
Update Slate_API.md
1 parent 28d1bcc commit a02e841

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

docs/Slate_API.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,35 @@ window = SWindow(client_size=(512, 256), title='Mannequin Properties', sizing_ru
764764

765765
Note that by calling the .simulate(bool) method on the SPythonEditorViewport instance you can enable/disable the world ticking
766766

767+
## Nomad Tabs
768+
769+
If you plan to make a slate tool, very probably you do not want to spawn a plain SWindow, instead you want a dock (SDockTab) that you can move/rearrange in your editor and (more important) that is unique and runnable from an editor menu.
770+
771+
This can be accomplished in a single step with nomad tab spawner:
772+
773+
```python
774+
from unreal_engine import SWindow, SPythonEditorViewport, FVector, FRotator
775+
from unreal_engine.classes import Blueprint
776+
import unreal_engine as ue
777+
778+
779+
def create_tab(dock_tab):
780+
editor_viewport = SPythonEditorViewport()
781+
world = editor_viewport.get_world()
782+
world.actor_spawn(ue.load_object(Blueprint, '/Game/ThirdPersonCPP/Blueprints/ThirdPersonCharacter').GeneratedClass)
783+
editor_viewport_client = editor_viewport.get_editor_viewport_client()
784+
editor_viewport_client.set_view_location(FVector(-200, 300, 200))
785+
editor_viewport_client.set_view_rotation(FRotator(0, -30, -90))
786+
787+
editor_viewport.simulate(True)
788+
789+
dock_tab.set_content(editor_viewport)
790+
791+
ue.register_nomad_tab_spawner('Hello Nomads !', create_tab)
792+
```
793+
794+
![Nomad](https://github.com/20tab/UnrealEnginePython/raw/master/docs/screenshots/slate_Nomad.png)
795+
767796
## Properties Editors
768797

769798
```python

0 commit comments

Comments
 (0)