J-Andersen-UvA / TakeRecorderUE

1 stars 0 forks source link

Make version 2 the main version

UE Take Recorder Control

This project provides a simple interface to control the Take Recorder within Unreal Engine for live recordings of motion capture data. It allows users to start and stop recordings programmatically, facilitating control over the Take Recorder through a TCP setup.

Requirements

Usage

Here are some examples on how to communicate using Javascript:

  function startCapture() {
    sendMessage(JSON.stringify({ handler: "startCapture", data: "startCapture" }));
  }

  function stopCapture() {
    sendMessage(JSON.stringify({ handler: "stopCapture", data: "stopCapture" }));
  }

  function exportLevelSequenceName() {
    sendMessage(JSON.stringify({ handler: "exportLevelSequenceName", data: "exportLevelSequenceName" }));
  }

  function broadcastGlos(glosText) {
    sendMessage(JSON.stringify({ data: "broadcastGlos", glos: glosText }));
  }
  function isRecording() {
    sendMessage(JSON.stringify({ handler: "isRecording", data: "isRecording" }));
  }

Important scripts

recorder.py

wsCommunicationScript.py

config.yaml

Replaying animations

Currently, we call the replay functionality of a blueprint event bound to an actor with a skeletalmesh. The blueprint can be found here: https://blueprintue.com/blueprint/es9tq8mb/ . Feel free to change this to solely python or implement the blueprint.

Why hook into the tick?

In Unreal Engine, many API calls, especially those related to the game world, UI updates, and editor functions, must be called from the main thread. This makes it difficult to use a waiting/listening Python program. If we let the socket listen and wait on the main thread, the entire engine stalls. The workaround: in Unreal Engine Python scripting, especially in editor contexts, hooking into the tick method (such as using register_slate_post_tick_callback) is a common approach for executing continuous or periodic tasks. Creating a new Python thread to handle functionality might seem like a simpler solution, but it poses several issues in the Unreal Engine environment:

TODO: