-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
981ca81
commit 368b663
Showing
48 changed files
with
5,291 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,206 @@ | ||
# This workflow file build the Godot XR Tools Demo project for multiple target systems. | ||
--- | ||
|
||
|
||
# Publish Demo workflow | ||
name: Publish Demo | ||
|
||
|
||
# Trigger rules (adjust to configure when CI is performed) | ||
on: | ||
[push, pull_request] | ||
|
||
|
||
# Environment variables | ||
env: | ||
# Configure Godot version | ||
GODOT_VERSION: 4.3.0 | ||
|
||
# OpenXR Vendors version | ||
OPENXR_VENDORS_VERSION: 3.1.1-stable | ||
|
||
# Butler API Key (comment to disable) | ||
BUTLER_API_KEY: ${{ secrets.BUTLER_API_KEY }} | ||
|
||
# Butler User/Game (set to itch.io user/game) | ||
BUTLER_USER_GAME: malcolmnixon/enchanted | ||
|
||
|
||
# CI jobs | ||
jobs: | ||
# Build job (Matrix build for all exports) | ||
build: | ||
name: Building for ${{ matrix.name }} | ||
runs-on: ${{ matrix.os }} | ||
permissions: | ||
contents: write | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
include: | ||
# Export for Windows | ||
- name: 🏁 Windows | ||
os: windows-latest | ||
platform: windows | ||
export-preset: Windows | ||
export-type: release | ||
export-folder: build/windows | ||
archive: Windows | ||
butler-channel: windows | ||
|
||
# Export for Linux | ||
- name: 🐧 Linux | ||
os: ubuntu-22.04 | ||
platform: linux | ||
export-preset: Linux | ||
export-type: release | ||
export-folder: build/linux | ||
archive: Linux | ||
butler-channel: linux | ||
|
||
# Export for Android Quest | ||
- name: 🤖 Android Quest | ||
os: ubuntu-22.04 | ||
platform: android | ||
export-preset: Android Quest | ||
export-type: debug | ||
export-args: --install-android-build-template | ||
export-folder: build/android-quest | ||
archive: Android-Quest | ||
butler-channel: android-quest | ||
|
||
# Export for Android Pico | ||
- name: 🤖 Android Pico | ||
os: ubuntu-22.04 | ||
platform: android | ||
export-preset: Android Pico | ||
export-type: debug | ||
export-args: --install-android-build-template | ||
export-folder: build/android-pico | ||
archive: Android-Pico | ||
butler-channel: android-pico | ||
|
||
# Export for WebXR | ||
- name: 🌐 WebXR | ||
os: ubuntu-22.04 | ||
platform: web | ||
export-preset: WebXR | ||
export-type: release | ||
export-folder: build/webxr | ||
archive: WebXR | ||
butler-channel: webxr | ||
|
||
steps: | ||
# Check out the repository | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
# Install the OpenXR Vendors Plugin | ||
- name: Install OpenXR Vendors Plugin | ||
shell: bash | ||
run: | | ||
curl -L -O https://github.com/GodotVR/godot_openxr_vendors/releases/download/${{ env.OPENXR_VENDORS_VERSION }}/godotopenxrvendorsaddon.zip | ||
unzip -o godotopenxrvendorsaddon.zip -d godotopenxrvendorsaddon | ||
mkdir -p addons | ||
mv godotopenxrvendorsaddon/asset/addons/godotopenxrvendors addons/godotopenxrvendors | ||
rm godotopenxrvendorsaddon.zip | ||
rm -rf godotopenxrvendorsaddon | ||
# If targeting android then install JDK | ||
- name: Set up JDK 17 | ||
if: matrix.platform == 'android' | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
|
||
# If targeting android then install Android SDK | ||
- name: Setup Android SDK | ||
if: matrix.platform == 'android' | ||
uses: android-actions/setup-android@v3 | ||
|
||
# If targeting android then install Android SDK Packages | ||
- name: Install Android SDK Packages | ||
if: matrix.platform == 'android' | ||
run: > | ||
sdkmanager | ||
"platform-tools" | ||
"build-tools;34.0.0" | ||
"platforms;android-34" | ||
"cmdline-tools;latest" | ||
"cmake;3.10.2.4988404" | ||
"ndk;23.2.8568313" | ||
# Setup Godot | ||
- name: Setup Godot | ||
uses: chickensoft-games/setup-godot@v2 | ||
with: | ||
version: ${{ env.GODOT_VERSION }} | ||
use-dotnet: false | ||
include-templates: true | ||
|
||
# Import Godot Project | ||
- name: Initial Godot Import | ||
shell: bash | ||
run: | | ||
godot --headless --verbose --import || exit 0 | ||
# Export project | ||
- name: Export Godot Project | ||
shell: bash | ||
run: | | ||
godot --headless ${{ matrix.export-args }} --export-${{ matrix.export-type }} "${{ matrix.export-preset }}" || exit 0 | ||
# Upload artifacts | ||
- name: Upload Artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ matrix.archive }}-Artifacts | ||
path: | | ||
${{ matrix.export-folder }}/*.* | ||
!**/.gitignore | ||
# Install butler (if building release with butler support) | ||
- name: Install Butler | ||
if: > | ||
github.event_name == 'push' && | ||
github.ref_type == 'tag' && | ||
env.BUTLER_API_KEY != '' | ||
uses: remarkablegames/setup-butler@v1 | ||
with: | ||
butler-version: LATEST | ||
|
||
# Push to itch.io (if building release) | ||
- name: Push to itch.io | ||
if: > | ||
github.event_name == 'push' && | ||
github.ref_type == 'tag' && | ||
env.BUTLER_API_KEY != '' | ||
run: > | ||
butler push | ||
--ignore '.gitignore' | ||
${{ matrix.export-folder }} | ||
${{ env.BUTLER_USER_GAME }}:${{ matrix.butler-channel }} | ||
--userversion ${{ github.ref_name }} | ||
# Compress project (if building release) | ||
- name: Compress Project | ||
if: > | ||
github.event_name == 'push' && | ||
github.ref_type == 'tag' | ||
run: | | ||
cd ${{ matrix.export-folder }} | ||
7z a -tzip ${{ matrix.archive }}.zip *.* -x'!.gitignore' | ||
# Publish release (if building release) | ||
- name: Publish Release | ||
uses: ncipollo/release-action@v1 | ||
if: > | ||
github.event_name == 'push' && | ||
github.ref_type == 'tag' | ||
with: | ||
allowUpdates: true | ||
artifacts: '${{ matrix.export-folder }}/${{ matrix.archive }}.zip' | ||
omitNameDuringUpdate: true | ||
omitBodyDuringUpdate: true | ||
token: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Godot 4+ specific ignores | ||
.godot/ | ||
/android/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
godotopenxrvendors/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/GodotXRHandPoseDetector | ||
|
||
Other people who have helped out by submitting fixes, enhancements, etc are: | ||
|
||
- TODO | ||
|
||
Want to be on this list? We would love your help. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 Malcolm Nixon | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# 2.0.0 (in progress) | ||
- Rename Action-Set to Action-Map to better match OpenXR naming | ||
- Modify HandPoseController to extend from HandPoseDetector (breaking change) | ||
- Minor adjustment to point-thumbs-up to make it work better for UI framing | ||
|
||
# 1.3.0 | ||
- Fine-tune aim pose | ||
|
||
# 1.2.0 | ||
- Added hand pose controller capable of generating XR input actions | ||
- Added debounce hold and release times for poses | ||
- Added controller pose type [skeleton, aim, grab] | ||
- Added basic hand models to addon | ||
|
||
# 1.1.0 | ||
- Moved fitness function to separate resource | ||
- Simplified hand resource definition | ||
|
||
# 1.0.0 | ||
- Initial Revision |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
@tool | ||
class_name FitnessFunction | ||
extends Resource | ||
|
||
|
||
## Fitness Function Resource | ||
## | ||
## This resource defines a fitness function which returns values in the range | ||
## 0..1 in response to an input measurement. | ||
|
||
|
||
## Function Type enumeration | ||
enum Type { | ||
SMOOTHSTEP, ## Smoothstep response | ||
RANGE ## Range response | ||
} | ||
|
||
|
||
## Function Type | ||
@export var type : Type = Type.SMOOTHSTEP : set = _set_type | ||
|
||
## Min parameter | ||
@export var min : float | ||
|
||
## From parameter | ||
@export var from : float | ||
|
||
## To parameter | ||
@export var to : float | ||
|
||
## Max parameter | ||
@export var max : float | ||
|
||
|
||
# Update visibility of parameters based on function type | ||
func _validate_property(property: Dictionary) -> void: | ||
match type: | ||
Type.SMOOTHSTEP: | ||
# Update controls for smoothstep | ||
match property.name: | ||
"min", "max": | ||
property.usage = PROPERTY_USAGE_NO_EDITOR | ||
|
||
Type.RANGE: | ||
# Nothing to hide | ||
pass | ||
|
||
_: | ||
# Unknown function | ||
match property.name: | ||
"min", "from", "to", "max": | ||
property.usage = PROPERTY_USAGE_NO_EDITOR | ||
|
||
|
||
# Calculate the fitness function | ||
func calculate(input : float) -> float: | ||
match type: | ||
Type.SMOOTHSTEP: | ||
# Handle smoothstep | ||
return smoothstep(from, to, input) | ||
|
||
Type.RANGE: | ||
# Handle range function | ||
return _calculate_range(input) | ||
|
||
_: | ||
# Unknown | ||
return 0.0 | ||
|
||
|
||
## Returns configuration warnings associated with this function. | ||
func get_warnings() -> Array[String]: | ||
# Create the warnings array | ||
var warnings : Array[String] = [] | ||
|
||
# Add warnings for the two types of functions | ||
match type: | ||
Type.SMOOTHSTEP: | ||
# Check smoothstep parameters | ||
if from == to: | ||
warnings.append("Smoothstep Function: from == to") | ||
|
||
Type.RANGE: | ||
# Check range parameters | ||
if min >= from: | ||
warnings.append("Range Function: min >= from") | ||
if from >= to: | ||
warnings.append("Range Function: from >= to") | ||
if to >= max: | ||
warnings.append("Range Function: to >= max") | ||
|
||
_: | ||
# Unknown function | ||
warnings.append("Unknown Function Type") | ||
|
||
# Return the warnings | ||
return warnings | ||
|
||
|
||
# Calculate the range function response | ||
func _calculate_range(input : float) -> float: | ||
# Process based on input | ||
if input < min: | ||
return 0.0 | ||
if input < from: | ||
return smoothstep(min, from, input) | ||
if input < to: | ||
return 1.0 | ||
if input < max: | ||
return smoothstep(max, to, input) | ||
return 0.0 | ||
|
||
|
||
# Update property visibility when function type changes | ||
func _set_type(p_type : Type) -> void: | ||
type = p_type | ||
notify_property_list_changed() |
Oops, something went wrong.