Skip to content

Commit

Permalink
Initial Revision
Browse files Browse the repository at this point in the history
  • Loading branch information
Malcolmnixon committed Aug 2, 2024
1 parent 10b4ea6 commit 597386f
Show file tree
Hide file tree
Showing 180 changed files with 4,309 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Normalize EOL for all files that Git considers text files.
* text=auto eol=lf
59 changes: 59 additions & 0 deletions .github/workflows/build-on-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Workflow to automatically create deliverables
name: Build on push

on:
[push, pull_request]

jobs:
build:
name: Assembling artifacts
runs-on: ubuntu-20.04

# Note, to satisfy the asset library we need to make sure our zip files have a root folder
# this is why we checkout into demo/godot_rokoko_tracker
# and build plugin/godot_rokoko_tracker
steps:
- name: Checkout
uses: actions/checkout@v4
with:
path: demo/godot_rokoko_tracker
- name: Create Godot Rokoko Tracker plugin
run: |
mkdir plugin
mkdir plugin/godot_rokoko_tracker
mkdir plugin/godot_rokoko_tracker/addons
cp -r demo/godot_rokoko_tracker/addons/godot_rokoko_tracker plugin/godot_rokoko_tracker/addons
cp demo/godot_rokoko_tracker/LICENSE plugin/godot_rokoko_tracker/addons/godot_rokoko_tracker
cp demo/godot_rokoko_tracker/CONTRIBUTORS.md plugin/godot_rokoko_tracker/addons/godot_rokoko_tracker
cp demo/godot_rokoko_tracker/VERSIONS.md plugin/godot_rokoko_tracker/addons/godot_rokoko_tracker
rm -rf demo/godot_rokoko_tracker/.git
rm -rf demo/godot_rokoko_tracker/.github
- name: Create Godot Rokoko Tracker library artifact
uses: actions/upload-artifact@v4
with:
name: godot_rokoko_tracker
path: |
plugin
- name: Create Godot Rokoko Tracker demo artifact
uses: actions/upload-artifact@v4
with:
name: godot_rokoko_tracker_demo
path: |
demo
- name: Zip asset
run: |
cd plugin
zip -qq -r ../godot_rokoko_tracker.zip godot_rokoko_tracker
cd ../demo
zip -qq -r ../godot_rokoko_tracker_demo.zip godot_rokoko_tracker
cd ..
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
- name: Create and upload asset
uses: ncipollo/release-action@v1
with:
allowUpdates: true
artifacts: "godot_rokoko_tracker.zip,godot_rokoko_tracker_demo.zip"
omitNameDuringUpdate: true
omitBodyDuringUpdate: true
token: ${{ secrets.GITHUB_TOKEN }}
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
26 changes: 26 additions & 0 deletions .github/workflows/gdlint-on-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Workflow to automatically lint gdscript code
name: gdlint on push

on:
[push, pull_request]

jobs:
gdlint:
name: gdlint scripts
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
python -m pip install 'gdtoolkit==4.*'
- name: Lint Godot Rokoko Tracker
run: |
gdlint addons/godot_rokoko_tracker
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Godot 4+ specific ignores
.godot/
android/
11 changes: 11 additions & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Contributors
============

The main author of this project is [Malcolm Nixon](https://github.com/Malcolmnixon) who manages the source repository found at:
https://github.com/Malcolmnixon/GodotXRRokokoTracker

Other people who have helped out by submitting fixes, enhancements, etc are:

- TODO

Want to be on this list? We would love your help.
100 changes: 98 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,98 @@
# GodotXRRokokoTracker
Godot XR Tracker for Rokoko Protocol
# Godot XR Rokoko Tracker

![GitHub forks](https://img.shields.io/github/forks/Malcolmnixon/GodotXRRokokoTracker?style=plastic)
![GitHub Repo stars](https://img.shields.io/github/stars/Malcolmnixon/GodotXRRokokoTracker?style=plastic)
![GitHub contributors](https://img.shields.io/github/contributors/Malcolmnixon/GodotXRRokokoTracker?style=plastic)
![GitHub](https://img.shields.io/github/license/Malcolmnixon/GodotXRRokokoTracker?style=plastic)

This repository contains a Rokoko packet decoder for Godot that can drive avatars through the XR Tracker system.

![Rokoko Tracker Preview](/docs/rokoko_preview.png)

## Versions

Official releases are tagged and can be found [here](https://github.com/Malcolmnixon/GodotXRRokokoTracker/releases).

The following branches are in active development:
| Branch | Description | Godot version |
|-----------|-------------------------------|------------------|
| master | Current development branch | Godot 4.3-rc2+ |

## Overview

[Rokoko Studio](https://www.rokoko.com/products/studio) is a Motion Capture package by Rokoko.

## Usage

The following steps show how to add the Godot Rokoko tracker to a project.

### Enable Addon

The addon files needs to be copied to the `/addons/godot_rokoko_tracker` folder of the Godot project, and then enabled in Plugins under the Project Settings:
![Enable Plugin](/docs/enable_plugin.png)

### Plugin Settings

The plugin has numerous options to control behavior:

![Plugin Options](/docs/plugin_settings.png)

| Option | Description |
| :----- | :---------- |
| Tracking - Position Mode | Controls the position of the character:<br>- Free = Free Movement<br>- Calibrate = Calibrate to origin on first frame<br>- Locked = Lock to origin |
| Tracking - Face Tracker Name | Name for the [XRFaceTracker](https://docs.godotengine.org/en/latest/classes/class_xrfacetracker.html) |
| Tracking - Body Tracker Name | Name for the [XRBodyTracker](https://docs.godotengine.org/en/latest/classes/class_xrbodytracker.html) |
| Network - Udp Listener Port | Port to listen for Rokoko network packets |

### Character Importing

The character model must be in Godot Humanoid format. This can be achieved in the importer settings by retarteting the skeleton to the SkeletonProfileHumanoid bone map:

![Character Import](/docs/character_import.png)

### Body Driving

The body is positioned using an [XRNode3D](https://docs.godotengine.org/en/latest/classes/class_xrnode3d.html) node configured to track the character body:

![XRNode3D](/docs/xrnode3d.png)

The body is posed using an [XRBodyModifier3D](https://docs.godotengine.org/en/latest/classes/class_xrbodymodifier3d.html) node skeleton modifier:

![XRBodyModifier3D](/docs/xrbodymodifier3d.png)

Note that the Body Tracker name should match the Body Tracker Name specified in the Plugin Settings.

### Face Driving

The face is driven using an [XRFaceModifier3D](https://docs.godotengine.org/en/latest/classes/class_xrfacemodifier3d.html) node configured to drive the facial blendshapes of the character:

![XRFaceModifier3D](/docs/xrfacemodifier3d.png)

Note that the Face Tracker name should match the Face Tracker Name specified in the Plugin Settings.

### Rokoko Studio

Rokoko Studio must be configured for network streaming, which is an option only in the Plus, Pro, and Enterprise subscriptions.

![Rokoko Studio Streaming](/docs/rokoko_studio_streaming.png)

| Option | Description |
| :----- | :---------- |
| Protocol | Custom Streaming |
| Forward IP | Host address (127.0.0.1 for localhost) |
| Port | UDP Port 14043 (default) |
| Data Format | Json (Rokoko JSON v3.0) |


## Licensing

Code in this repository is licensed under the MIT license.

## About this repository

This repository was created by Malcolm Nixon

It is primarily maintained by:
- [Malcolm Nixon](https://github.com/Malcolmnixon/)

For further contributors please see `CONTRIBUTORS.md`
2 changes: 2 additions & 0 deletions VERSIONS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# 1.0.0
- Initial Revision
7 changes: 7 additions & 0 deletions addons/godot_rokoko_tracker/plugin.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[plugin]

name="Godot Rokoko Tracker"
description="Godot Rokoko Tracker plugin"
author="Malcolm Nixon and Contributors"
version="1.0.0"
script="plugin.gd"
71 changes: 71 additions & 0 deletions addons/godot_rokoko_tracker/plugin.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
@tool
extends EditorPlugin


func _define_project_setting(
p_name : String,
p_type : int,
p_hint : int = PROPERTY_HINT_NONE,
p_hint_string : String = "",
p_default_val = "") -> void:
# p_default_val can be any type!!

if !ProjectSettings.has_setting(p_name):
ProjectSettings.set_setting(p_name, p_default_val)

var property_info : Dictionary = {
"name" : p_name,
"type" : p_type,
"hint" : p_hint,
"hint_string" : p_hint_string
}

ProjectSettings.add_property_info(property_info)
if ProjectSettings.has_method("set_as_basic"):
ProjectSettings.call("set_as_basic", p_name, true)
ProjectSettings.set_initial_value(p_name, p_default_val)



func _enter_tree():
# Add face tracker name
_define_project_setting(
"rokoko_tracker/tracking/face_tracker_name",
TYPE_STRING,
PROPERTY_HINT_NONE,
"",
"/rokoko/face_tracker")

# Add body tracker name
_define_project_setting(
"rokoko_tracker/tracking/body_tracker_name",
TYPE_STRING,
PROPERTY_HINT_NONE,
"",
"/rokoko/body_tracker")

# Add position mode
_define_project_setting(
"rokoko_tracker/tracking/position_mode",
TYPE_INT,
PROPERTY_HINT_ENUM,
"Free,Calibrate,Locked",
0)

# Add network port
_define_project_setting(
"rokoko_tracker/network/udp_listener_port",
TYPE_INT,
PROPERTY_HINT_NONE,
"",
14043)

# Register our autoload user settings object
add_autoload_singleton(
"RokokoPlugin",
"res://addons/godot_rokoko_tracker/rokoko_plugin.gd")


func _exit_tree():
# our plugin is turned off
pass
Loading

0 comments on commit 597386f

Please sign in to comment.