/UE4PyServer

Unreal Engine Python Plugin

Primary LanguagePythonMIT LicenseMIT

UE4PyServer

Importent

This project is no longer maintained it is replaced by the UE4PyhtonBridge

Unreal Engine Python Plugin

This is a plugin dedicated to enabling communication between Python code and Unreal Engine, especially enables retrieving video from the unreal engine editor to the python environment. I am also working on a parallel project UE4PyhtonBridge which eventually will replace this project. UE4PyhtonBridge has support for stand alone games and also used by the DroneSimLab project.

Installation: (Tested only on Linux)


Prerequisites

- Unreal Engine for Linux installation: UE4
- Python 3.x installation
For the purpose of the demo, I installed Python 3.5 Anaconda Anaconda.

Prerequisites For Optical-Flow Demo

- OpenCV for Python 3
conda install -c menpo opencv3
- numpy
conda install numpy

Plugin Setup

- Create a project in unreal engine:
- Add an empty c++ class so the project will be a code project
- Close the project
- In the project dir create Plugins dir
- Clone UE4PyServer into that dir
git clone https://github.com/orig74/UE4PyServer.git
- cd to: [ProjectPath]/Plugins/UE4PyServer/Source/PyServer
- run:
python config.py --entry_point \
for the test demo run:
python config.py --entry_point track_test - run:
python build.py --ue4path=\
or (if you are using other python distribution)
python3 build.py --ue4path=\
- Open your project and enable the plugin:
goto Edit->Plugins and enable the PyServer Plugin (under other).

Running minimal example:

- Set entry point for the minimal file
python config.py --entry_point minimal
the minimal file is minimal.py
- Add "PyServerTickActor":
Press the Plugin button PyServer. PyServerTickActor will appear in the Outliner panel on the right.
- Play:
Press the play button in Play button in the Toolbar.

working in your own directory:

run:
python config.py --entry_point \< your entrypoint module \> --entry_path \< module path \>
The entry_point tells the module where the main_loop function exists. If the entrypoint file does not exists, it is created with the functions main_loop and the function kill.

Running The Demo:

The demo is "Lucas-Kanade optical flow tracking" from OpenCV library.
- Add Camera CameraActor_2 and a WindDirectionalSource:
In the Modes Pannel in the Place Tab add a Camera Actor. Change The name of the actor to "CameraActor_2".
In the Modes Pannel in the Place Tab add a WindDirectionalSource. Change The name to "WindDirectionalSource1"
- Add "PyServerTickActor":
Press the Plugin button PyServer. PyServerTickActor will appear in the Outliner panel on the right.
- Play:
Press the play button in Play button in the Toolbar. The supporting modes for this demo are: "Selected ViewPort" and "New Editor Window"
Focus on the engine window to get 30 fps!!
Watch demo on: demo
- More Demos:
This demo uses a SceneCapture2D and a Render Target to play inside an OpenCV window.
Another demo uses two SceneCapture2D one for RGB image and the other for depth image.

Contact Me:

For any help regarding the installation, please contact me at:
oga13@uclive.ac.nz