rename project folder to src

This commit is contained in:
Crispy 2021-10-05 20:49:40 +02:00
parent 3a6d0469e5
commit b1eb8eb9d8
159 changed files with 0 additions and 0 deletions

3
src/Main.tscn Normal file
View file

@ -0,0 +1,3 @@
[gd_scene format=2]
[node name="Main" type="Node"]

13
src/OverlayManager.tscn Normal file
View file

@ -0,0 +1,13 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://addons/openvr_overlay/OverlayInstance.tscn" type="PackedScene" id=2]
[ext_resource path="res://OverlaySettingsSync.tscn" type="PackedScene" id=3]
[ext_resource path="res://overlay_manager.gd" type="Script" id=4]
[node name="OverlayManager" type="Node"]
script = ExtResource( 4 )
[node name="MainOverlay" parent="." instance=ExtResource( 2 )]
add_cursor = true
[node name="OverlaySettingsSync" parent="MainOverlay" instance=ExtResource( 3 )]

View file

@ -0,0 +1,12 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://overlay_settings_sync.gd" type="Script" id=1]
[node name="OverlaySettingsSync" type="Node"]
script = ExtResource( 1 )
[node name="SyncTimer" type="Timer" parent="."]
wait_time = 0.2
autostart = true
[connection signal="timeout" from="SyncTimer" to="." method="_on_SyncTimer_timeout"]

View file

@ -0,0 +1,34 @@
Changes to the Godot OpenVR asset
=================================
Note, version numbers listed here are the version number assigned to the asset. Each time a new version is uploaded to the asset store we will increase the version number.
More frequent updates may be available on the source repository.
1.1.0 - In progress
-------------------
- Build for Godot 3.2
- Added support for actions
- Added support for request play area
- Added skeleton support (finger tracking)
1.0.5 - 1 March 2019
--------------------
- Now using OpenVR 1.9.16
- Added support for overlays
- Proper asynchronious loading of controller meshes and textures
- Rewrite to using godot_cpp classes
1.0.4 - 27 March 2019
---------------------
- Build for Godot 3.1
- Now using OpenVR 1.2.10
- Added Mac binaries (untested)
1.0.3 - 23 June 2018
--------------------
- Now using OpenVR 1.0.15
- Fixed crash issue related to new reloadable property in GDNative
1.0.2 - 4 May 2018
------------------
Changes were not tracked

View file

@ -0,0 +1,25 @@
tool
extends EditorPlugin
var export_plugin
func _enter_tree():
# Initialization of the plugin goes here
export_plugin = preload("res://addons/godot-openvr/OpenVRExportPlugin.gd")
if export_plugin:
# print("Loaded res://addons/godot-openvr/OpenVRExportPlugin.gd")
export_plugin = export_plugin.new()
if export_plugin:
# print("New res://addons/godot-openvr/OpenVRExportPlugin.gd")
add_export_plugin(export_plugin)
# else:
# print("Failed to instance res://addons/godot-openvr/OpenVRExportPlugin.gd")
#else:
# print("Failed to load res://addons/godot-openvr/OpenVRExportPlugin.gd")
func _exit_tree():
# Clean-up of the plugin goes here
if export_plugin:
remove_export_plugin(export_plugin)

View file

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2018-2020 Bastiaan Olij
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.

View file

@ -0,0 +1,8 @@
[gd_resource type="NativeScript" load_steps=2 format=2]
[ext_resource path="res://addons/godot-openvr/godot_openvr.gdnlib" type="GDNativeLibrary" id=1]
[resource]
resource_name = "OpenVRAction"
class_name = "OpenVRAction"
library = ExtResource( 1 )

View file

@ -0,0 +1,8 @@
[gd_resource type="NativeScript" load_steps=2 format=2]
[ext_resource path="res://addons/godot-openvr/godot_openvr.gdnlib" type="GDNativeLibrary" id=1]
[resource]
resource_name = "OpenVRConfig"
class_name = "OpenVRConfig"
library = ExtResource( 1 )

View file

@ -0,0 +1,8 @@
[gd_resource type="NativeScript" load_steps=2 format=2]
[ext_resource path="res://addons/godot-openvr/godot_openvr.gdnlib" type="GDNativeLibrary" id=1]
[resource]
resource_name = "OpenVRController"
class_name = "OpenVRController"
library = ExtResource( 1 )

View file

@ -0,0 +1,40 @@
tool
extends EditorExportPlugin
func _export_begin(features: PoolStringArray, is_debug: bool, path: String, flags: int ):
var dir = Directory.new()
# we just want the path
var export_to = path.get_base_dir() + "/actions/"
# now determine which action files to export
var export_from = ""
if dir.file_exists("res://actions/actions.json"):
export_from = "res://actions/"
elif dir.file_exists("res://addons/godot-openvr/actions/actions.json"):
export_from = "res://addons/godot-openvr/actions/"
else:
print("WARNING: Couldn't locate actions files to export")
return
# print("Exporting " + export_from +" to " + export_to)
if !dir.dir_exists(export_to):
dir.make_dir(export_to)
if dir.open(export_from) == OK:
dir.list_dir_begin(true, true)
var filename = dir.get_next()
while filename != "":
# print("Copy " + filename)
dir.copy(export_from + filename, export_to + filename)
filename = dir.get_next()
dir.list_dir_end()
#func _export_end():
# print("Export ended")
#func _export_file(path: String, type: String, features: PoolStringArray):
# print("Export " + path)

View file

@ -0,0 +1,8 @@
[gd_resource type="NativeScript" load_steps=2 format=2]
[ext_resource path="res://addons/godot-openvr/godot_openvr.gdnlib" type="GDNativeLibrary" id=1]
[resource]
resource_name = "OpenVRHaptics"
class_name = "OpenVRHaptics"
library = ExtResource( 1 )

View file

@ -0,0 +1,8 @@
[gd_resource type="NativeScript" load_steps=2 format=2]
[ext_resource path="res://addons/godot-openvr/godot_openvr.gdnlib" type="GDNativeLibrary" id=1]
[resource]
resource_name = "OpenVROverlay"
class_name = "OpenVROverlay"
library = ExtResource( 1 )

View file

@ -0,0 +1,8 @@
[gd_resource type="NativeScript" load_steps=2 format=2]
[ext_resource path="res://addons/godot-openvr/godot_openvr.gdnlib" type="GDNativeLibrary" id=1]
[resource]
resource_name = "OpenVRPose"
class_name = "OpenVRPose"
library = ExtResource( 1 )

View file

@ -0,0 +1,11 @@
[gd_resource type="NativeScript" load_steps=2 format=2]
[ext_resource path="res://addons/godot-openvr/godot_openvr.gdnlib" type="GDNativeLibrary" id=1]
[resource]
resource_name = "OpenVRRenderModel"
class_name = "OpenVRRenderModel"
library = ExtResource( 1 )
_sections_unfolded = [ "Resource" ]

View file

@ -0,0 +1,10 @@
[gd_resource type="NativeScript" load_steps=2 format=2]
[ext_resource path="res://addons/godot-openvr/godot_openvr.gdnlib" type="GDNativeLibrary" id=1]
[resource]
resource_name = "OpenVRSkeleton"
class_name = "OpenVRSkeleton"
library = ExtResource( 1 )
_sections_unfolded = [ "Resource" ]

View file

@ -0,0 +1,107 @@
{
"action_set" : [
{
"name" : "/actions/godot",
"usage" : "leftright"
}
],
"actions" : [
{
"name" : "/actions/godot/in/trigger",
"requirement" : "mandatory",
"type" : "boolean"
},
{
"name" : "/actions/godot/in/analog_trigger",
"requirement" : "suggested",
"type" : "vector1"
},
{
"name" : "/actions/godot/in/grip",
"requirement" : "suggested",
"type" : "boolean"
},
{
"name" : "/actions/godot/in/analog_grip",
"requirement" : "suggested",
"type" : "vector1"
},
{
"name" : "/actions/godot/in/analog",
"requirement" : "suggested",
"type" : "vector2"
},
{
"name" : "/actions/godot/in/analog_click",
"requirement" : "suggested",
"type" : "boolean"
},
{
"name" : "/actions/godot/in/button_ax",
"requirement" : "optional",
"type" : "boolean"
},
{
"name" : "/actions/godot/in/button_by",
"requirement" : "optional",
"type" : "boolean"
},
{
"name" : "/actions/godot/out/haptic",
"requirement" : "optional",
"type" : "vibration"
},
{
"name": "/actions/godot/in/left_hand",
"type": "skeleton",
"skeleton": "/skeleton/hand/left"
},
{
"name": "/actions/godot/in/right_hand",
"type": "skeleton",
"skeleton": "/skeleton/hand/right"
} ],
"default_bindings" : [
{
"binding_url" : "bindings_index_controller.json",
"controller_type" : "knuckles"
},
{
"binding_url" : "bindings_oculus_touch.json",
"controller_type" : "oculus_touch"
},
{
"binding_url" : "bindings_vive_controller.json",
"controller_type" : "vive_controller"
},
{
"binding_url" : "bindings_holographic_controller.json",
"controller_type" : "holographic_controller"
},
{
"binding_url" : "bindings_generic.json",
"controller_type" : "generic"
},
{
"binding_url" : "bindings_gamepad.json",
"controller_type" : "gamepad"
}
],
"localization" : [
{
"/actions/godot" : "Godot actions",
"/actions/godot/in/analog" : "Analog Input",
"/actions/godot/in/analog_click" : "Analog Click",
"/actions/godot/in/analog_grip" : "Analog Grip",
"/actions/godot/in/analog_trigger" : "Analog Trigger",
"/actions/godot/in/button_ax" : "A/X Button",
"/actions/godot/in/button_by" : "B/Y Button",
"/actions/godot/in/grip" : "Grip",
"/actions/godot/in/trigger" : "Trigger",
"/actions/godot/out/haptic" : "Haptic Feedback",
"/actions/godot/in/left_hand" : "Left hand",
"/actions/godot/in/right_hand" : "Right hand",
"language_tag" : "en_US"
}
]
}

View file

@ -0,0 +1,112 @@
{
"action_manifest_version" : 0,
"alias_info" : {},
"bindings" : {
"/actions/godot" : {
"haptics" : [
{
"output" : "/actions/godot/out/haptic",
"path" : "/user/hand/left/output/haptic"
},
{
"output" : "/actions/godot/out/haptic",
"path" : "/user/hand/right/output/haptic"
}
],
"sources" : [
{
"inputs" : {
"click" : {
"output" : "/actions/godot/in/trigger"
}
},
"mode" : "button",
"path" : "/user/hand/left/input/trigger"
},
{
"inputs" : {
"click" : {
"output" : "/actions/godot/in/trigger"
}
},
"mode" : "button",
"path" : "/user/hand/right/input/trigger"
},
{
"inputs" : {
"click" : {
"output" : "/actions/godot/in/grip"
}
},
"mode" : "button",
"path" : "/user/hand/right/input/grip"
},
{
"inputs" : {
"click" : {
"output" : "/actions/godot/in/grip"
}
},
"mode" : "button",
"path" : "/user/hand/left/input/grip"
},
{
"inputs" : {
"position" : {
"output" : "/actions/godot/in/analog"
}
},
"mode" : "trackpad",
"path" : "/user/hand/left/input/trackpad"
},
{
"inputs" : {
"position" : {
"output" : "/actions/godot/in/analog"
}
},
"mode" : "trackpad",
"path" : "/user/hand/right/input/trackpad"
},
{
"inputs" : {
"pull" : {
"output" : "/actions/godot/in/analog_trigger"
}
},
"mode" : "trigger",
"path" : "/user/gamepad/input/trigger_right"
},
{
"inputs" : {
"click" : {
"output" : "/actions/godot/in/grip"
}
},
"mode" : "button",
"path" : "/user/gamepad/input/shoulder_right"
},
{
"inputs" : {
"click" : {
"output" : "/actions/godot/in/analog_click"
},
"position" : {
"output" : "/actions/godot/in/analog"
}
},
"mode" : "joystick",
"path" : "/user/gamepad/input/joystick_right"
}
]
}
},
"category" : "steamvr_input",
"controller_type" : "gamepad",
"description" : "Bindings for the Godot OpenVR plugin for a generic controller",
"name" : "Godot bindings for Gamepad",
"options" : {
"returnBindingsWithRightHand" : true
},
"simulated_actions" : []
}

View file

@ -0,0 +1,75 @@
{
"bindings" : {
"/actions/godot" : {
"haptics" : [
{
"output" : "/actions/godot/out/haptic",
"path" : "/user/hand/left/output/haptic"
},
{
"output" : "/actions/godot/out/haptic",
"path" : "/user/hand/right/output/haptic"
}
],
"sources" : [
{
"inputs" : {
"click" : {
"output" : "/actions/godot/in/trigger"
}
},
"mode" : "button",
"path" : "/user/hand/left/input/trigger"
},
{
"inputs" : {
"click" : {
"output" : "/actions/godot/in/trigger"
}
},
"mode" : "button",
"path" : "/user/hand/right/input/trigger"
},
{
"inputs" : {
"click" : {
"output" : "/actions/godot/in/grip"
}
},
"mode" : "button",
"path" : "/user/hand/right/input/grip"
},
{
"inputs" : {
"click" : {
"output" : "/actions/godot/in/grip"
}
},
"mode" : "button",
"path" : "/user/hand/left/input/grip"
},
{
"inputs" : {
"position" : {
"output" : "/actions/godot/in/analog"
}
},
"mode" : "trackpad",
"path" : "/user/hand/left/input/trackpad"
},
{
"inputs" : {
"position" : {
"output" : "/actions/godot/in/analog"
}
},
"mode" : "trackpad",
"path" : "/user/hand/right/input/trackpad"
}
]
}
},
"controller_type" : "generic",
"description" : "Bindings for the Godot OpenVR plugin for a generic controller",
"name" : "Godot bindings for a generic controller"
}

View file

@ -0,0 +1,132 @@
{
"action_manifest_version" : 0,
"alias_info" : {},
"bindings" : {
"/actions/godot" : {
"haptics" : [
{
"output" : "/actions/godot/out/haptic",
"path" : "/user/hand/left/output/haptic"
},
{
"output" : "/actions/godot/out/haptic",
"path" : "/user/hand/right/output/haptic"
}
],
"skeleton" : [
{
"output" : "/actions/godot/in/left_hand",
"path" : "/user/hand/left/input/skeleton/left"
},
{
"output" : "/actions/godot/in/right_hand",
"path" : "/user/hand/right/input/skeleton/right"
}
],
"sources" : [
{
"inputs" : {
"click" : {
"output" : "/actions/godot/in/grip"
}
},
"mode" : "button",
"path" : "/user/hand/right/input/grip"
},
{
"inputs" : {
"click" : {
"output" : "/actions/godot/in/grip"
}
},
"mode" : "button",
"path" : "/user/hand/left/input/grip"
},
{
"inputs" : {
"pull" : {
"output" : "/actions/godot/in/analog_trigger"
}
},
"mode" : "trigger",
"path" : "/user/hand/left/input/trigger"
},
{
"inputs" : {
"click" : {
"output" : "/actions/godot/in/trigger"
}
},
"mode" : "button",
"path" : "/user/hand/left/input/trigger"
},
{
"inputs" : {
"pull" : {
"output" : "/actions/godot/in/analog_trigger"
}
},
"mode" : "trigger",
"path" : "/user/hand/right/input/trigger"
},
{
"inputs" : {
"click" : {
"output" : "/actions/godot/in/trigger"
}
},
"mode" : "button",
"path" : "/user/hand/right/input/trigger"
},
{
"inputs" : {
"value" : {
"output" : "/actions/godot/in/analog_grip"
}
},
"mode" : "scalar_constant",
"path" : "/user/hand/left/input/grip"
},
{
"inputs" : {
"value" : {
"output" : "/actions/godot/in/analog_grip"
}
},
"mode" : "scalar_constant",
"path" : "/user/hand/right/input/grip"
},
{
"inputs" : {
"click" : {
"output" : "/actions/godot/in/analog_click"
},
"position" : {
"output" : "/actions/godot/in/analog"
}
},
"mode" : "joystick",
"path" : "/user/hand/left/input/joystick"
},
{
"inputs" : {
"click" : {
"output" : "/actions/godot/in/analog_click"
},
"position" : {
"output" : "/actions/godot/in/analog"
}
},
"mode" : "joystick",
"path" : "/user/hand/right/input/joystick"
}
]
}
},
"category" : "steamvr_input",
"controller_type" : "holographic_controller",
"description" : "Bindings for the Godot OpenVR plugin for Windows Mixed Reality Controller",
"name" : "Godot bindings for Windows Mixed Reality Controller",
"options" : {},
"simulated_actions" : []
}

View file

@ -0,0 +1,144 @@
{
"action_manifest_version" : 0,
"alias_info" : {},
"bindings" : {
"/actions/godot" : {
"haptics" : [
{
"output" : "/actions/godot/out/haptic",
"path" : "/user/hand/left/output/haptic"
},
{
"output" : "/actions/godot/out/haptic",
"path" : "/user/hand/right/output/haptic"
}
],
"skeleton" : [
{
"output" : "/actions/godot/in/left_hand",
"path" : "/user/hand/left/input/skeleton/left"
},
{
"output" : "/actions/godot/in/right_hand",
"path" : "/user/hand/right/input/skeleton/right"
}
],
"sources" : [
{
"inputs" : {
"click" : {
"output" : "/actions/godot/in/trigger"
},
"pull" : {
"output" : "/actions/godot/in/analog_trigger"
}
},
"mode" : "trigger",
"path" : "/user/hand/left/input/trigger"
},
{
"inputs" : {
"click" : {
"output" : "/actions/godot/in/trigger"
},
"pull" : {
"output" : "/actions/godot/in/analog_trigger"
}
},
"mode" : "trigger",
"path" : "/user/hand/right/input/trigger"
},
{
"inputs" : {
"click" : {
"output" : "/actions/godot/in/analog_click"
},
"position" : {
"output" : "/actions/godot/in/analog"
}
},
"mode" : "joystick",
"path" : "/user/hand/left/input/thumbstick"
},
{
"inputs" : {
"click" : {
"output" : "/actions/godot/in/analog_click"
},
"position" : {
"output" : "/actions/godot/in/analog"
}
},
"mode" : "joystick",
"path" : "/user/hand/right/input/thumbstick"
},
{
"inputs" : {
"pull" : {
"output" : "/actions/godot/in/analog_grip"
},
"touch" : {
"output" : "/actions/godot/in/grip"
}
},
"mode" : "trigger",
"path" : "/user/hand/left/input/grip"
},
{
"inputs" : {
"pull" : {
"output" : "/actions/godot/in/analog_grip"
},
"touch" : {
"output" : "/actions/godot/in/grip"
}
},
"mode" : "trigger",
"path" : "/user/hand/right/input/grip"
},
{
"inputs" : {
"click" : {
"output" : "/actions/godot/in/button_by"
}
},
"mode" : "button",
"path" : "/user/hand/left/input/b"
},
{
"inputs" : {
"click" : {
"output" : "/actions/godot/in/button_by"
}
},
"mode" : "button",
"path" : "/user/hand/right/input/b"
},
{
"inputs" : {
"click" : {
"output" : "/actions/godot/in/button_ax"
}
},
"mode" : "button",
"path" : "/user/hand/left/input/a"
},
{
"inputs" : {
"click" : {
"output" : "/actions/godot/in/button_ax"
}
},
"mode" : "button",
"path" : "/user/hand/right/input/a"
}
]
}
},
"category" : "steamvr_input",
"controller_type" : "knuckles",
"description" : "Bindings for the Godot OpenVR plugin for an index controller",
"name" : "Godot bindings for an index controller",
"options" : {},
"simulated_actions" : []
}

View file

@ -0,0 +1,144 @@
{
"action_manifest_version" : 0,
"alias_info" : {},
"bindings" : {
"/actions/godot" : {
"haptics" : [
{
"output" : "/actions/godot/out/haptic",
"path" : "/user/hand/left/output/haptic"
},
{
"output" : "/actions/godot/out/haptic",
"path" : "/user/hand/right/output/haptic"
}
],
"skeleton" : [
{
"output" : "/actions/godot/in/left_hand",
"path" : "/user/hand/left/input/skeleton/left"
},
{
"output" : "/actions/godot/in/right_hand",
"path" : "/user/hand/right/input/skeleton/right"
}
],
"sources" : [
{
"inputs" : {
"click" : {
"output" : "/actions/godot/in/analog_click"
},
"position" : {
"output" : "/actions/godot/in/analog"
}
},
"mode" : "joystick",
"path" : "/user/hand/left/input/joystick"
},
{
"inputs" : {
"click" : {
"output" : "/actions/godot/in/button_ax"
}
},
"mode" : "button",
"path" : "/user/hand/left/input/x"
},
{
"inputs" : {
"click" : {
"output" : "/actions/godot/in/button_by"
}
},
"mode" : "button",
"path" : "/user/hand/left/input/y"
},
{
"inputs" : {
"click" : {
"output" : "/actions/godot/in/analog_click"
},
"position" : {
"output" : "/actions/godot/in/analog"
}
},
"mode" : "joystick",
"path" : "/user/hand/right/input/joystick"
},
{
"inputs" : {
"click" : {
"output" : "/actions/godot/in/button_ax"
}
},
"mode" : "button",
"path" : "/user/hand/right/input/a"
},
{
"inputs" : {
"click" : {
"output" : "/actions/godot/in/button_by"
}
},
"mode" : "button",
"path" : "/user/hand/right/input/b"
},
{
"inputs" : {
"click" : {
"output" : "/actions/godot/in/trigger"
},
"pull" : {
"output" : "/actions/godot/in/analog_trigger"
}
},
"mode" : "trigger",
"path" : "/user/hand/left/input/trigger"
},
{
"inputs" : {
"click" : {
"output" : "/actions/godot/in/trigger"
},
"pull" : {
"output" : "/actions/godot/in/analog_trigger"
}
},
"mode" : "trigger",
"path" : "/user/hand/right/input/trigger"
},
{
"inputs" : {
"click" : {
"output" : "/actions/godot/in/grip"
},
"pull" : {
"output" : "/actions/godot/in/analog_grip"
}
},
"mode" : "trigger",
"path" : "/user/hand/left/input/grip"
},
{
"inputs" : {
"click" : {
"output" : "/actions/godot/in/grip"
},
"pull" : {
"output" : "/actions/godot/in/analog_grip"
}
},
"mode" : "trigger",
"path" : "/user/hand/right/input/grip"
}
]
}
},
"category" : "steamvr_input",
"controller_type" : "oculus_touch",
"description" : "Bindings for the Godot OpenVR SDK plugin for the Oculus Touch",
"name" : "Godot bindings for Oculus Touch",
"options" : {},
"simulated_actions" : []
}

View file

@ -0,0 +1,120 @@
{
"action_manifest_version" : 0,
"alias_info" : {},
"bindings" : {
"/actions/godot" : {
"haptics" : [
{
"output" : "/actions/godot/out/haptic",
"path" : "/user/hand/left/output/haptic"
},
{
"output" : "/actions/godot/out/haptic",
"path" : "/user/hand/right/output/haptic"
}
],
"skeleton" : [
{
"output" : "/actions/godot/in/left_hand",
"path" : "/user/hand/left/input/skeleton/left"
},
{
"output" : "/actions/godot/in/right_hand",
"path" : "/user/hand/right/input/skeleton/right"
}
],
"sources" : [
{
"inputs" : {
"click" : {
"output" : "/actions/godot/in/analog_click"
},
"position" : {
"output" : "/actions/godot/in/analog"
}
},
"mode" : "trackpad",
"path" : "/user/hand/left/input/trackpad"
},
{
"inputs" : {
"click" : {
"output" : "/actions/godot/in/analog_click"
},
"position" : {
"output" : "/actions/godot/in/analog"
}
},
"mode" : "trackpad",
"path" : "/user/hand/right/input/trackpad"
},
{
"inputs" : {
"click" : {
"output" : "/actions/godot/in/grip"
}
},
"mode" : "button",
"path" : "/user/hand/left/input/grip"
},
{
"inputs" : {
"click" : {
"output" : "/actions/godot/in/grip"
}
},
"mode" : "button",
"path" : "/user/hand/right/input/grip"
},
{
"inputs" : {
"click" : {
"output" : "/actions/godot/in/trigger"
},
"pull" : {
"output" : "/actions/godot/in/analog_trigger"
}
},
"mode" : "trigger",
"path" : "/user/hand/left/input/trigger"
},
{
"inputs" : {
"click" : {
"output" : "/actions/godot/in/trigger"
},
"pull" : {
"output" : "/actions/godot/in/analog_trigger"
}
},
"mode" : "trigger",
"path" : "/user/hand/right/input/trigger"
},
{
"inputs" : {
"value" : {
"output" : "/actions/godot/in/analog_grip"
}
},
"mode" : "scalar_constant",
"path" : "/user/hand/left/input/grip"
},
{
"inputs" : {
"value" : {
"output" : "/actions/godot/in/analog_grip"
}
},
"mode" : "scalar_constant",
"path" : "/user/hand/right/input/grip"
}
]
}
},
"category" : "steamvr_input",
"controller_type" : "vive_controller",
"description" : "Bindings for the Godot OpenVR SDK plugin for the Vive controller",
"name" : "Godot bindings for Vive Controller",
"options" : {},
"simulated_actions" : []
}

View file

@ -0,0 +1,27 @@
Copyright (c) 2015, Valve Corporation
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,20 @@
[general]
singleton=true
load_once=true
symbol_prefix="godot_openvr_"
reloadable=false
[entry]
X11.64="res://addons/godot-openvr/bin/x11/libgodot_openvr.so"
Windows.32="res://addons/godot-openvr/bin/win32/libgodot_openvr.dll"
Windows.64="res://addons/godot-openvr/bin/win64/libgodot_openvr.dll"
OSX.64="res://addons/godot-openvr/bin/osx/libgodot_openvr.dylib"
[dependencies]
X11.64=[ "res://addons/godot-openvr/bin/x11/libopenvr_api.so" ]
Windows.32=[ "res://addons/godot-openvr/bin/win32/openvr_api.dll" ]
Windows.64=[ "res://addons/godot-openvr/bin/win64/openvr_api.dll" ]
OSX.64=[ "res://addons/godot-openvr/bin/osx/OpenVR.framework" ]

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/icon.png-a89ecb8be28ea6c50eeae0c3cb0cd271.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://addons/godot-openvr/icon.png"
dest_files=[ "res://.import/icon.png-a89ecb8be28ea6c50eeae0c3cb0cd271.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

View file

@ -0,0 +1,5 @@
The resources here are taken from: `Steam\steamapps\common\SteamVR\resources\rendermodels\vr_glove\`
To save space in the repository only the slim models are included while the texture maps have been taken from the full versions.
See `../scenes/ovr_left_hand.tscn` and `../scenes/ovr_right_hand.tscn` for implementation details

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 MiB

View file

@ -0,0 +1,36 @@
[remap]
importer="texture"
type="StreamTexture"
path.s3tc="res://.import/hands_albedo.png-149a10baba7906560a9f9eab8fadf1d8.s3tc.stex"
path.etc2="res://.import/hands_albedo.png-149a10baba7906560a9f9eab8fadf1d8.etc2.stex"
metadata={
"imported_formats": [ "s3tc", "etc2" ],
"vram_texture": true
}
[deps]
source_file="res://addons/godot-openvr/meshes/hands_albedo.png"
dest_files=[ "res://.import/hands_albedo.png-149a10baba7906560a9f9eab8fadf1d8.s3tc.stex", "res://.import/hands_albedo.png-149a10baba7906560a9f9eab8fadf1d8.etc2.stex" ]
[params]
compress/mode=2
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=true
flags/filter=true
flags/mipmaps=true
flags/anisotropic=false
flags/srgb=1
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 MiB

View file

@ -0,0 +1,36 @@
[remap]
importer="texture"
type="StreamTexture"
path.s3tc="res://.import/hands_normal.png-eab7a86e959f13e1294e8f67904a8873.s3tc.stex"
path.etc2="res://.import/hands_normal.png-eab7a86e959f13e1294e8f67904a8873.etc2.stex"
metadata={
"imported_formats": [ "s3tc", "etc2" ],
"vram_texture": true
}
[deps]
source_file="res://addons/godot-openvr/meshes/hands_normal.png"
dest_files=[ "res://.import/hands_normal.png-eab7a86e959f13e1294e8f67904a8873.s3tc.stex", "res://.import/hands_normal.png-eab7a86e959f13e1294e8f67904a8873.etc2.stex" ]
[params]
compress/mode=2
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=1
flags/repeat=true
flags/filter=true
flags/mipmaps=true
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,7 @@
[plugin]
name="Godot OpenVR"
description="Godot OpenVR plugin"
author="Bastiaan Olij and contributors"
version="1.1.0"
script="EditorPlugin.gd"

View file

@ -0,0 +1,61 @@
[gd_scene load_steps=5 format=2]
[sub_resource type="PlaneMesh" id=1]
size = Vector2( 0.3, 0.15 )
subdivide_width = 10
subdivide_depth = 10
[sub_resource type="Shader" id=2]
code = "shader_type spatial;
render_mode unshaded;
uniform sampler2D viewport_texture : hint_albedo;
void vertex() {
VERTEX.y = 1.0 - cos(VERTEX.x) * 0.5 - cos(VERTEX.z) * 0.5;
}
void fragment() {
vec4 col = texture(viewport_texture, vec2(1.0 - UV.x, UV.y));
ALBEDO = col.rgb;
ALPHA = col.a;
}
"
[sub_resource type="ShaderMaterial" id=3]
shader = SubResource( 2 )
[sub_resource type="GDScript" id=4]
script/source = "extends MeshInstance
func _ready():
get_surface_material(0).set_shader_param(\"viewport_texture\", $Viewport.get_texture())
func _process(delta):
$Viewport/Label.text = str(Engine.get_frames_per_second()) + \" FPS\"
"
[node name="FPS" type="MeshInstance"]
transform = Transform( 1, 0, 0, 0, 0, -1, 0, 1, 0, 0, 0, 0 )
mesh = SubResource( 1 )
material/0 = SubResource( 3 )
script = SubResource( 4 )
[node name="Viewport" type="Viewport" parent="."]
size = Vector2( 200, 100 )
transparent_bg = true
hdr = false
usage = 0
render_target_update_mode = 3
[node name="Label" type="Label" parent="Viewport"]
anchor_right = 1.0
anchor_bottom = 1.0
rect_scale = Vector2( 3, 3 )
custom_colors/font_color = Color( 1, 1, 1, 1 )
custom_colors/font_color_shadow = Color( 0, 0, 0, 1 )
text = "FPS"
__meta__ = {
"_edit_use_anchors_": false
}

View file

@ -0,0 +1,32 @@
extends ARVRController
signal controller_activated(controller)
export var show_controller_mesh = true setget set_show_controller_mesh, get_show_controller_mesh
func set_show_controller_mesh(p_show):
show_controller_mesh = p_show
if $OVRRenderModel:
$OVRRenderModel.visible = p_show
func get_show_controller_mesh():
return show_controller_mesh
func _ready():
# set our starting vaule
$OVRRenderModel.visible = show_controller_mesh
# hide to begin with
visible = false
func _process(delta):
if !get_is_active():
visible = false
return
if visible:
return
# make it visible
visible = true
emit_signal("controller_activated", self)

View file

@ -0,0 +1,9 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://addons/godot-openvr/scenes/ovr_controller.gd" type="Script" id=1]
[ext_resource path="res://addons/godot-openvr/scenes/ovr_render_model.tscn" type="PackedScene" id=2]
[node name="OVRController" type="ARVRController"]
script = ExtResource( 1 )
[node name="OVRRenderModel" parent="." instance=ExtResource( 2 )]

View file

@ -0,0 +1,46 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://addons/godot-openvr/scenes/ovr_shader_cache.tscn" type="PackedScene" id=1]
[ext_resource path="res://addons/godot-openvr/scenes/ovr_controller.tscn" type="PackedScene" id=2]
[ext_resource path="res://addons/godot-openvr/scenes/ovr_main.gd" type="Script" id=3]
[sub_resource type="GDScript" id=1]
script/source = "extends Spatial
func _physics_process(delta):
# we keep this in line with our camera but we remove the tilt
var new_transform = get_node(\"../ARVRCamera\").transform
var new_basis = Basis()
new_basis.z = Vector3(new_transform.basis.z.x, 0.0, new_transform.basis.z.z).normalized()
if new_basis.z.length() > 0.5:
new_basis.y - Vector3(0.0, 1.0, 0.0)
new_basis.x = new_basis.y.cross(new_basis.z)
new_transform.basis = new_basis
transform = new_transform
else:
# we're looking straight up or down, ignore this
pass"
[node name="OVRFirstPerson" type="ARVROrigin"]
script = ExtResource( 3 )
[node name="ARVRCamera" type="ARVRCamera" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.85, 0 )
fov = 65.0
near = 0.01
far = 1000.01
[node name="ovr_shader_cache" parent="ARVRCamera" instance=ExtResource( 1 )]
[node name="HUD_Anchor" type="Spatial" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.85, 0 )
script = SubResource( 1 )
[node name="Left_Hand" parent="." instance=ExtResource( 2 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -0.5, 1.25, 0 )
[node name="Right_Hand" parent="." instance=ExtResource( 2 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.5, 1.25, 0 )
controller_id = 2

View file

@ -0,0 +1,42 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://addons/godot-openvr/meshes/vr_glove_left_model_slim.glb" type="PackedScene" id=1]
[ext_resource path="res://addons/godot-openvr/meshes/models_hands_vr_glove_vmat.material" type="Material" id=2]
[ext_resource path="res://addons/godot-openvr/OpenVRPose.gdns" type="Script" id=3]
[ext_resource path="res://addons/godot-openvr/OpenVRSkeleton.gdns" type="Script" id=4]
[node name="ovr_left_hand" instance=ExtResource( 1 )]
script = ExtResource( 3 )
action = "/actions/godot/in/left_hand"
[node name="Skeleton" parent="RootNode" index="0"]
bones/5/bound_children = [ NodePath("Thumb") ]
bones/10/bound_children = [ NodePath("Index") ]
bones/15/bound_children = [ NodePath("Middle") ]
bones/20/bound_children = [ NodePath("Ring") ]
bones/25/bound_children = [ NodePath("Pinky") ]
script = ExtResource( 4 )
action = "/actions/godot/in/left_hand"
[node name="vr_glove_left_slim" parent="RootNode/Skeleton" index="0"]
material/0 = ExtResource( 2 )
[node name="Thumb" type="BoneAttachment" parent="RootNode/Skeleton" index="1"]
transform = Transform( -0.347509, 0.0284256, 0.937246, -0.13095, -0.991217, -0.0184906, 0.928488, -0.129158, 0.348178, -0.0498674, 0.056092, 0.112777 )
bone_name = "finger_thumb_l_end"
[node name="Index" type="BoneAttachment" parent="RootNode/Skeleton" index="2"]
transform = Transform( -0.717079, -0.669965, 0.19221, -0.076153, -0.19881, -0.977075, 0.69282, -0.715277, 0.0915429, -0.0345977, 0.0355404, 0.164767 )
bone_name = "finger_index_l_end"
[node name="Middle" type="BoneAttachment" parent="RootNode/Skeleton" index="3"]
transform = Transform( -0.755126, -0.650532, 0.0812012, -0.0513261, -0.064817, -0.996576, 0.653568, -0.756708, 0.0155557, -0.0321126, 0.00654218, 0.171613 )
bone_name = "finger_middle_l_end"
[node name="Ring" type="BoneAttachment" parent="RootNode/Skeleton" index="4"]
transform = Transform( -0.749612, -0.661178, -0.0304372, -0.0961052, 0.154228, -0.98335, 0.654864, -0.734206, -0.179154, -0.0346831, -0.0253934, 0.156924 )
bone_name = "finger_ring_l_end"
[node name="Pinky" type="BoneAttachment" parent="RootNode/Skeleton" index="5"]
transform = Transform( -0.615435, -0.749373, -0.244295, -0.0354297, 0.335934, -0.941219, 0.787391, -0.570604, -0.233296, -0.0270969, -0.0462902, 0.133467 )
bone_name = "finger_pinky_l_end"

View file

@ -0,0 +1,68 @@
extends ARVROrigin
# Add this script to your ARVROrigin node and it will initialise OpenVR for you automatically.
# Our plugin will now use the first actions.json found in the following locations
# 1) in the actions folder alongside the executable
# 2) in the actions folder within your project folder (i.e. "res://actions/actions.json")
# 3) in the actions folder within the plugin (i.e. "res://addons/godot-openvr/actions/actions.json")
# OpenVR can't read actions files within the exported datapack.
# The plugin always registers atleast one action set.
# If you have renamed this action set you can specify the name here
export (String) var default_action_set = "/actions/godot"
# If we render to a custom viewport give our node path here.
export (NodePath) var viewport = null
# Convenience setting for setting physics update rate to a multiple of our HMDs frame rate (set to 0 to ignore)
export var physics_factor = 2
var arvr_interface : ARVRInterface = null
var openvr_config = null
func get_openvr_config():
return openvr_config
func _ready():
# Load our config before we initialise
openvr_config = preload("res://addons/godot-openvr/OpenVRConfig.gdns");
if openvr_config:
print("Setup configuration")
openvr_config = openvr_config.new()
openvr_config.default_action_set = default_action_set
# Find the interface and initialise
arvr_interface = ARVRServer.find_interface("OpenVR")
if arvr_interface and arvr_interface.initialize():
# We can't query our HMDs refresh rate just yet so we hardcode this to 90
var refresh_rate = 90
# check our viewport
var vp : Viewport = null
if viewport:
vp = get_node(viewport)
if vp:
# We copy this, while the ARVRServer will resize the size of the viewport automatically
# it can't feed it back into the node.
vp.size = arvr_interface.get_render_targetsize()
# No viewport? get our main viewport
if !vp:
vp = get_viewport()
# switch to ARVR mode
vp.arvr = true
# keep linear color space, not needed and thus ignored with the GLES2 renderer
vp.keep_3d_linear = true
# make sure vsync is disabled or we'll be limited to 60fps
OS.vsync_enabled = false
if physics_factor > 0:
# Set our physics to a multiple of our refresh rate to get in sync with our rendering
Engine.iterations_per_second = refresh_rate * physics_factor

View file

@ -0,0 +1,53 @@
extends MeshInstance
var ovr_render_model
var ws = 0
var controller_is_loaded = false
func apply_world_scale():
var new_ws = ARVRServer.world_scale
if (ws != new_ws):
ws = new_ws
scale = Vector3(ws, ws, ws)
func _load_controller_mesh(controller_name):
if ovr_render_model.load_model(controller_name.substr(0, controller_name.length()-2)):
return ovr_render_model
if ovr_render_model.load_model("generic_controller"):
return ovr_render_model
return Mesh.new()
# Called when the node enters the scene tree for the first time.
func _ready():
# instance our render model object
ovr_render_model = preload("res://addons/godot-openvr/OpenVRRenderModel.gdns").new()
# we haven't loaded it
controller_is_loaded = false
func _process(delta):
var controller = get_parent();
if !controller is ARVRController:
return
if !controller.get_is_active():
if controller_is_loaded:
mesh = Mesh.new()
controller_is_loaded = false
return
# always set our world scale, user may end up changing this
apply_world_scale()
if controller_is_loaded:
return
# became active? lets handle it...
var controller_name = controller.get_controller_name()
print("Controller " + controller_name + " became active")
# attempt to load a mesh for this
mesh = _load_controller_mesh(controller_name)
controller_is_loaded = true

View file

@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://addons/godot-openvr/scenes/ovr_render_model.gd" type="Script" id=1]
[node name="OVRRenderModel" type="MeshInstance"]
script = ExtResource( 1 )

View file

@ -0,0 +1,42 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://addons/godot-openvr/meshes/vr_glove_right_model_slim.glb" type="PackedScene" id=1]
[ext_resource path="res://addons/godot-openvr/meshes/models_hands_vr_glove_vmat.material" type="Material" id=2]
[ext_resource path="res://addons/godot-openvr/OpenVRPose.gdns" type="Script" id=3]
[ext_resource path="res://addons/godot-openvr/OpenVRSkeleton.gdns" type="Script" id=4]
[node name="ovr_right_hand" instance=ExtResource( 1 )]
script = ExtResource( 3 )
action = "/actions/godot/in/right_hand"
[node name="Skeleton" parent="RootNode" index="0"]
bones/5/bound_children = [ NodePath("Thumb") ]
bones/10/bound_children = [ NodePath("Index") ]
bones/15/bound_children = [ NodePath("Middle") ]
bones/20/bound_children = [ NodePath("Ring") ]
bones/25/bound_children = [ NodePath("Pinky") ]
script = ExtResource( 4 )
action = "/actions/godot/in/right_hand"
[node name="vr_glove_right_slim" parent="RootNode/Skeleton" index="0"]
material/0 = ExtResource( 2 )
[node name="Thumb" type="BoneAttachment" parent="RootNode/Skeleton" index="1"]
transform = Transform( -0.347509, 0.0284256, 0.937246, 0.130949, 0.991217, 0.0184906, -0.928488, 0.129158, -0.348179, 0.0498674, 0.0560921, 0.112777 )
bone_name = "finger_thumb_r_end"
[node name="Index" type="BoneAttachment" parent="RootNode/Skeleton" index="2"]
transform = Transform( -0.717079, -0.669965, 0.19221, 0.0761528, 0.19881, 0.977075, -0.69282, 0.715277, -0.0915429, 0.0345977, 0.0355405, 0.164767 )
bone_name = "finger_index_r_end"
[node name="Middle" type="BoneAttachment" parent="RootNode/Skeleton" index="3"]
transform = Transform( -0.755126, -0.650532, 0.0812013, 0.0513261, 0.064817, 0.996577, -0.653568, 0.756708, -0.0155557, 0.0321126, 0.00654219, 0.171613 )
bone_name = "finger_middle_r_end"
[node name="Ring" type="BoneAttachment" parent="RootNode/Skeleton" index="4"]
transform = Transform( -0.749612, -0.661178, -0.0304372, 0.0961052, -0.154228, 0.98335, -0.654864, 0.734206, 0.179154, 0.0346831, -0.0253934, 0.156924 )
bone_name = "finger_ring_r_end"
[node name="Pinky" type="BoneAttachment" parent="RootNode/Skeleton" index="5"]
transform = Transform( -0.615435, -0.749373, -0.244295, 0.0354297, -0.335934, 0.941219, -0.787391, 0.570604, 0.233296, 0.0270969, -0.0462902, 0.133467 )
bone_name = "finger_pinky_r_end"

View file

@ -0,0 +1,10 @@
extends Spatial
var countdown = 2
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
countdown = countdown - 1
if countdown == 0:
visible = false
set_process(false)

View file

@ -0,0 +1,16 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://addons/godot-openvr/scenes/ovr_shader_cache.gd" type="Script" id=1]
[sub_resource type="PlaneMesh" id=1]
size = Vector2( 0.001, 0.001 )
[sub_resource type="SpatialMaterial" id=2]
[node name="ovr_shader_cache" type="Spatial"]
script = ExtResource( 1 )
[node name="Controller" type="MeshInstance" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -2 )
mesh = SubResource( 1 )
material/0 = SubResource( 2 )

View file

@ -0,0 +1,24 @@
[gd_scene format=2]
[node name="Overlay" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
size_flags_horizontal = 3
size_flags_vertical = 3
__meta__ = {
"_edit_use_anchors_": false
}
[node name="ColorRect" type="ColorRect" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
color = Color( 0.601562, 0, 0, 0.501961 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Label" type="Label" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
rect_scale = Vector2( 8, 8 )
text = "No overlay assigned"

View file

@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://addons/openvr_overlay/interaction/overlay_cursor.gd" type="Script" id=1]
[node name="OverlayCursor" type="Node"]
script = ExtResource( 1 )

View file

@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://addons/openvr_overlay/interaction/overlay_grab.gd" type="Script" id=1]
[node name="OverlayGrab" type="Node"]
script = ExtResource( 1 )

View file

@ -0,0 +1,66 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://addons/openvr_overlay/overlay_instance.gd" type="Script" id=1]
[ext_resource path="res://addons/godot-openvr/OpenVROverlay.gdns" type="Script" id=3]
[sub_resource type="StyleBoxFlat" id=1]
bg_color = Color( 0, 1, 1, 0.231373 )
border_width_left = 24
border_width_top = 24
border_width_right = 24
border_width_bottom = 24
border_color = Color( 0, 0.784314, 1, 0.611765 )
[sub_resource type="ViewportTexture" id=2]
flags = 4
viewport_path = NodePath("OverlayViewport")
[node name="OverlayInstance" type="Spatial"]
script = ExtResource( 1 )
[node name="OverlayViewport" type="Viewport" parent="."]
size = Vector2( 2048, 2048 )
transparent_bg = true
handle_input_locally = false
hdr = false
disable_3d = true
usage = 0
render_target_update_mode = 3
shadow_atlas_quad_0 = 0
shadow_atlas_quad_1 = 0
shadow_atlas_quad_2 = 0
shadow_atlas_quad_3 = 0
[node name="Container" type="Control" parent="OverlayViewport"]
anchor_right = 1.0
anchor_bottom = 1.0
[node name="Selected" type="Panel" parent="OverlayViewport"]
visible = false
anchor_right = 1.0
anchor_bottom = 1.0
mouse_filter = 2
custom_styles/panel = SubResource( 1 )
[node name="VROverlayViewport" type="Viewport" parent="."]
size = Vector2( 100, 100 )
transparent_bg = true
handle_input_locally = false
hdr = false
disable_3d = true
usage = 0
render_target_update_mode = 3
shadow_atlas_quad_0 = 0
shadow_atlas_quad_1 = 0
shadow_atlas_quad_2 = 0
shadow_atlas_quad_3 = 0
script = ExtResource( 3 )
overlay_width_in_meters = 0.4
[node name="TextureRect" type="TextureRect" parent="VROverlayViewport"]
anchor_right = 1.0
anchor_bottom = 1.0
texture = SubResource( 2 )
expand = true
stretch_mode = 5
flip_v = true

View file

@ -0,0 +1,26 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://addons/openvr_overlay/interaction/overlay_interaction.gd" type="Script" id=1]
[ext_resource path="res://addons/openvr_overlay/interaction/OverlayActivator.tscn" type="PackedScene" id=6]
[node name="OverlayInteraction" type="Node"]
script = ExtResource( 1 )
[node name="VR" type="ARVROrigin" parent="."]
[node name="left" type="ARVRController" parent="VR"]
[node name="OverlayActivator" parent="VR/left" instance=ExtResource( 6 )]
[node name="right" type="ARVRController" parent="VR"]
controller_id = 2
[node name="OverlayActivator" parent="VR/right" instance=ExtResource( 6 )]
[node name="head" type="ARVRCamera" parent="VR"]
visible = false
[connection signal="button_pressed" from="VR/left" to="." method="_on_LeftHand_button_pressed"]
[connection signal="button_release" from="VR/left" to="." method="_on_LeftHand_button_release"]
[connection signal="button_pressed" from="VR/right" to="." method="_on_RightHand_button_pressed"]
[connection signal="button_release" from="VR/right" to="." method="_on_RightHand_button_release"]

View file

@ -0,0 +1,23 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://addons/openvr_overlay/interaction/cursor.png" type="Texture" id=1]
[node name="Cursor" type="Control"]
margin_right = 1024.0
margin_bottom = 600.0
mouse_filter = 2
__meta__ = {
"_edit_use_anchors_": false
}
[node name="TextureRect" type="TextureRect" parent="."]
margin_left = -70.0
margin_top = -70.0
margin_right = 70.0
margin_bottom = 70.0
mouse_filter = 2
texture = ExtResource( 1 )
expand = true
__meta__ = {
"_edit_use_anchors_": false
}

View file

@ -0,0 +1,10 @@
[gd_scene load_steps=2 format=2]
[sub_resource type="SphereShape" id=1]
margin = 0.001
radius = 0.01
[node name="OverlayActivator" type="StaticBody"]
[node name="Collision" type="CollisionShape" parent="."]
shape = SubResource( 1 )

View file

@ -0,0 +1,10 @@
[gd_scene load_steps=2 format=2]
[sub_resource type="BoxShape" id=1]
resource_local_to_scene = true
extents = Vector3( 0.2, 0.2, 0.01 )
[node name="OverlayArea" type="Area"]
[node name="CollisionShape" type="CollisionShape" parent="."]
shape = SubResource( 1 )

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 B

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/cursor.png-7f24cea8864d49e2d004ac92503853e7.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://addons/openvr_overlay/interaction/cursor.png"
dest_files=[ "res://.import/cursor.png-7f24cea8864d49e2d004ac92503853e7.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

View file

@ -0,0 +1,70 @@
extends Node
var cursor_node = preload("res://addons/openvr_overlay/interaction/Cursor.tscn").instance()
onready var viewport: Viewport = get_node("../../OverlayViewport")
onready var _i = get_parent()
var curr_pos: Vector2
var prev_pos := Vector2(-1000, 1000)
func _ready() -> void:
viewport.add_child(cursor_node)
get_parent().connect("trigger_on", self, "_trigger_on")
get_parent().connect("trigger_off", self, "_trigger_off")
func _process(_delta: float) -> void:
curr_pos = get_canvas_pos()
_update_cursor()
_send_move_event()
prev_pos = curr_pos
#get canvas position of active controller
func get_canvas_pos() -> Vector2:
if not _i.active_controller:
return Vector2(-1000, 1000) # offscreen
var controller_local_pos = _i._overlay_area.global_transform.xform_inv(\
_i.tracker_nodes[_i.active_controller].translation)
var pos = Vector2(controller_local_pos.x, controller_local_pos.y)
var overlay_size = Vector2(2048, 2048)
# scale to pixels
pos *= overlay_size.x
pos /= _i.get_parent().width_meters
# adjust to center
pos.y *= -1
pos += overlay_size * 0.5
return pos
func _update_cursor():
cursor_node.rect_position = get_canvas_pos()
func _send_move_event():
var event = InputEventMouseMotion.new()
event.position = prev_pos
event.relative = curr_pos - prev_pos
event.speed = event.relative
viewport.input(event)
func _send_click_event(state: bool):
var click_event = InputEventMouseButton.new()
click_event.position = curr_pos
click_event.pressed = state
click_event.button_index = 1
viewport.input(click_event)
func _trigger_on():
_send_click_event(true)
func _trigger_off():
_send_click_event(false)

View file

@ -0,0 +1,78 @@
extends Node
var is_moving := false
var _pre_move_target = ""# what offset is being changed
var _mover_hand_name = ""# left or right, which hand is grabbing (/active controller)
var _mover_hand_offsets = {"pos": Vector3(), "rot": Quat()} # original offsets for grabbing hand
onready var _overlay = get_node("../..") # overlay instance
onready var _interaction = get_parent() # interaction handler
onready var tracker_nodes = {
"head": $"../VR/head",
"left": $"../VR/left",
"right": $"../VR/right",
"world": $"../VR"
}
func _ready() -> void:
get_parent().connect("trigger_on", self, "_trigger_on")
get_parent().connect("trigger_off", self, "_trigger_off")
func _trigger_on():
if Settings.s.grab_mode or _interaction.grab_mode:
begin_move()
func _trigger_off():
finish_move()
func begin_move():
if not _interaction.active_controller:
print("Could not begin moving overlay, no controller is touching overlay. <", _overlay.name, ">")
return
if is_moving:
return
is_moving = true
_interaction.pause_triggers = true
# store current states to revert after move
_pre_move_target = _overlay.current_target
_mover_hand_name = _interaction.active_controller
_mover_hand_offsets = _overlay.get_offset(_mover_hand_name)
# calculate offsets from active controller to overlay
var controller_t = tracker_nodes[_mover_hand_name].transform
var overlay_t = _interaction._overlay_area.global_transform
var new_pos = controller_t.xform_inv(overlay_t.origin)
var new_rot = Quat(controller_t.basis).inverse() * Quat(overlay_t.basis)
_overlay.set_offset(_mover_hand_name, new_pos, new_rot)
_overlay.current_target = _mover_hand_name
func finish_move():
if not is_moving:
return
is_moving = false
# calculate and apply the new offsets
var new_target_t = tracker_nodes[_pre_move_target].transform
var ovelay_t = _interaction._overlay_area.global_transform
var new_pos = new_target_t.xform_inv(ovelay_t.origin)
var new_rot = Quat(new_target_t.basis).inverse() * Quat(ovelay_t.basis)
_overlay.set_offset(_pre_move_target, new_pos, new_rot)
# revert the grabbing hands offsets
_overlay.set_offset(_mover_hand_name, _mover_hand_offsets.pos, _mover_hand_offsets.rot)
# revert target
_overlay.update_current_target()
_interaction._update_target()
_interaction.pause_triggers = false

View file

@ -0,0 +1,126 @@
extends Node
signal touch_on # a controller entered
signal touch_off # a controller exited
signal trigger_on # trigger pushed while touching
signal trigger_off# trigger released
var touch_state := false
var trigger_state := false
var grab_mode := false setget set_grab_mode
# controller that currently has the trigger down
var active_controller := ""
# reference to the area node thats used for touch
var _overlay_area = preload("res://addons/openvr_overlay/interaction/OverlayArea.tscn").instance()
var _right_is_activator := false # this hand has a collider on it to trigger things on the overlay
var _left_is_activator := false
var pause_triggers := false # disable triggers updating
onready var tracker_nodes = {
"head": $VR/head,
"left": $VR/left,
"right": $VR/right,
"world": $VR
}
func _ready() -> void:
add_child(_overlay_area)
_overlay_area.connect("body_entered", self, "_on_OverlayArea_entered")
_overlay_area.connect("body_exited", self, "_on_OverlayArea_exited")
get_parent().connect("width_changed", self, "_update_width")
get_parent().connect("offset_changed", self, "_update_offset")
get_parent().connect("target_changed", self, "_update_target")
OverlayManager.connect("grab_mode_changed", self, "update_selection")
_update_width()
_update_offset()
_update_target()
func _trigger_on(controller):
if touch_state:
active_controller = controller
trigger_state = true
emit_signal("trigger_on")
func _trigger_off():
trigger_state = false
emit_signal("trigger_off")
func _on_OverlayArea_entered(body: Node) -> void:
if body.get_node("../../..") != self or pause_triggers or !get_parent().overlay_visible:
return
touch_state = true
active_controller = body.get_parent().name
update_selection()
emit_signal("touch_on")
func _on_OverlayArea_exited(body: Node) -> void:
if body.get_node("../../..") != self or pause_triggers or !get_parent().overlay_visible:
return
# TODO revert to other controller if both were touching (edge case)
active_controller = ""
touch_state = false
update_selection()
emit_signal("touch_off")
func update_selection():
var sel = touch_state and (Settings.s.grab_mode or grab_mode)
get_parent().get_node("OverlayViewport/Selected").visible = sel
func set_grab_mode(state: bool) -> void:
grab_mode = state
update_selection()
func _update_width():
var ratio = OverlayInit.ovr_interface.get_render_targetsize()
var extents = get_parent().width_meters * 0.5
_overlay_area.get_child(0).shape.set_extents(Vector3(extents, extents * ratio.y/ratio.x, 0.05))
func _update_offset():
_overlay_area.translation = get_parent().translation
_overlay_area.rotation = get_parent().rotation
func _update_target():
# reparent _overlay_area
_overlay_area.get_parent().remove_child(_overlay_area)
tracker_nodes[get_parent().current_target].add_child(_overlay_area)
_left_is_activator = get_parent().current_target != "left"
_right_is_activator = get_parent().current_target != "right"
# toggle appropriate colliders
$VR/left/OverlayActivator/Collision.disabled = !_left_is_activator
$VR/right/OverlayActivator/Collision.disabled = !_right_is_activator
func _on_RightHand_button_pressed(button: int) -> void:
if button == JOY_VR_TRIGGER and _right_is_activator:
_trigger_on("right")
func _on_RightHand_button_release(button: int) -> void:
if button == JOY_VR_TRIGGER and active_controller == "right":
_trigger_off()
func _on_LeftHand_button_pressed(button: int) -> void:
if button == JOY_VR_TRIGGER and _left_is_activator:
_trigger_on("left")
func _on_LeftHand_button_release(button: int) -> void:
if button == JOY_VR_TRIGGER and active_controller == "left":
_trigger_off()

View file

@ -0,0 +1,10 @@
tool
extends EditorPlugin
func _enter_tree() -> void:
add_autoload_singleton("OverlayInit", "res://addons/openvr_overlay/overlay_init.gd")
func _exit_tree() -> void:
remove_autoload_singleton("OverlayInit")

View file

@ -0,0 +1,57 @@
extends Node
var ovr_interface: ARVRInterface
var ovr_config := preload("res://addons/godot-openvr/OpenVRConfig.gdns").new()
var trackers = {
"head": 0,
"left": -1,
"right": -1,
"world": 63,
}
func _init() -> void:
# OS.window_minimized = true
ovr_config = preload("res://addons/godot-openvr/OpenVRConfig.gdns").new()
ovr_config.set_application_type(2) # Set to OVERLAY MODE = 2, NORMAL MODE = 1
ovr_config.set_tracking_universe(1) # Set to SEATED MODE = 0, STANDING MODE = 1, RAW MODE = 2
# Find the OpenVR interface and initialise it
ovr_interface = ARVRServer.find_interface("OpenVR")
if ovr_interface and ovr_interface.initialize():
print("OpenVR Initialized.")
func _ready() -> void:
ARVRServer.connect("tracker_added", self, "_tracker_added")
ARVRServer.connect("tracker_removed", self, "_tracker_removed")
update_hand_ids()
func _tracker_added(tracker_name: String, type: int, id: int):
update_hand_ids()
func _tracker_removed(tracker_name: String, type: int, id: int):
match id:
1:
trackers.left = -1
2:
trackers.right = -1
func update_hand_ids():
trackers.left = -1
trackers.right = -1
for i in ARVRServer.get_tracker_count():
var t = ARVRServer.get_tracker(i)
var tracking_id = get_id(t)
match t.get_hand():
1:
trackers.left = tracking_id
2:
trackers.right = tracking_id
static func get_id(tracker) -> int:
return int(tracker.get_name().split("_")[-1])

View file

@ -0,0 +1,186 @@
extends Spatial
signal path_changed
signal overlay_visible_changed
signal width_changed
signal alpha_changed
signal target_changed
signal fallback_changed
signal offset_changed
const TARGETS = ["head", "left", "right", "world"]
export (String, "head", "left", "right", "world") var target = "left" setget set_target
export var width_meters := 0.4 setget set_width_in_meters
export var alpha := 1.0 setget set_alpha
export var add_grabbing := true # add grabbing module
export var add_cursor := false # add cursor module
var _tracker_id := 0
var _offsets:Dictionary = {
"head": {"pos": Vector3(0, 0, -0.35), "rot": Quat()},
"left": {"pos": Vector3(), "rot": Quat()},
"right": {"pos": Vector3(), "rot": Quat()},
"world": {"pos": Vector3(0,1,0), "rot": Quat()},
}
# what's actually tracking
var current_target: String = "world" setget _set_current_target
var fallback = ["left", "right", "head"] # TODO setget that updates tracking (not important)
var interaction_handler: Node
var overlay_visible := true setget set_overlay_visible
var path := "res://special_overlays/MainOverlay.tscn" setget set_path
var path_invalid := false
var OVERLAY_PROPERTIES: Dictionary
onready var container = $OverlayViewport/Container
var overlay_scene: Node
func _ready() -> void:
current_target = target
ARVRServer.connect("tracker_added", self, "_tracker_changed")
ARVRServer.connect("tracker_removed", self, "_tracker_changed")
$VROverlayViewport.size = OverlayInit.ovr_interface.get_render_targetsize()
set_notify_transform(true)
if add_cursor or add_grabbing:
interaction_handler = load("res://addons/openvr_overlay/OverlayInteraction.tscn").instance()
add_child(interaction_handler)
if add_cursor:
add_cursor()
if add_grabbing:
add_grab()
update_tracker_id()
call_deferred("update_offset")
func add_cursor():
interaction_handler.add_child(load("res://addons/openvr_overlay/OverlayCursor.tscn").instance())
func add_grab():
interaction_handler.add_child(load("res://addons/openvr_overlay/OverlayGrab.tscn").instance())
func update_tracker_id():
_tracker_id = -1
match current_target:
"left":
_tracker_id = OverlayInit.trackers.left
"right":
_tracker_id = OverlayInit.trackers.right
_:
return
if _tracker_id == -1:
# could not find controller, fallback
print("Missing controller ", current_target, " ", target, " ", fallback, " - ", name)
_tracker_id = 63 # highest tracker id (unused, at origin)
func update_offset():
translation = _offsets[current_target].pos
transform.basis = Basis(_offsets[current_target].rot)
match current_target:
"head":
$VROverlayViewport.track_relative_to_device(0, global_transform)
"world":
$VROverlayViewport.overlay_position_absolute(global_transform)
_:
$VROverlayViewport.track_relative_to_device(_tracker_id, global_transform)
func update_current_target():
if OverlayInit.trackers[target] != -1:
_set_current_target(target)
else: # fallback if not found
for f in fallback:
if OverlayInit.trackers[f] != -1:
_set_current_target(f)
break
update_tracker_id()
func set_overlay_visible(state: bool):
overlay_visible = state
$VROverlayViewport.overlay_visible = state
emit_signal("overlay_visible_changed", state)
func _tracker_changed(tracker_name: String, type: int, id: int):
update_current_target()
update_offset()
func set_target(new: String):
target = new
call_deferred("update_offset")
update_current_target()
func _set_current_target(new: String): # overrides target
current_target = new
update_tracker_id()
update_offset()
emit_signal("target_changed")
func get_offset(offset_target: String) -> Dictionary:
return _offsets[offset_target].duplicate()
func set_offset(offset_target: String, pos: Vector3, rot: Quat) -> void:
_offsets[offset_target].pos = pos
_offsets[offset_target].rot = rot
update_offset()
func set_width_in_meters(width: float) -> void:
width_meters = width
$VROverlayViewport.overlay_width_in_meters = width_meters
emit_signal("width_changed")
func set_path(new: String) -> void:
path = new
path_invalid = false
var packed_overlay = load(path)
if not packed_overlay:
path_invalid = true
overlay_scene = load("res://special_overlays/UnknownType.tscn").instance()
else:
overlay_scene = packed_overlay.instance()
if container.get_child_count() > 0:
container.get_child(0).queue_free()
container.add_child(overlay_scene)
if overlay_scene.get("OVERLAY_PROPERTIES") != null:
OVERLAY_PROPERTIES = overlay_scene.OVERLAY_PROPERTIES
emit_signal("path_changed")
func set_alpha(val: float):
alpha = val
$VROverlayViewport/TextureRect.modulate.a = val
emit_signal("alpha_changed")
func reset_offset() -> void:
_offsets[current_target].rot = Quat()
_offsets[current_target].pos = Vector3()
if current_target == "head":
_offsets[current_target].pos.z = -0.5
update_offset()
func _notification(what: int) -> void:
if what == NOTIFICATION_TRANSFORM_CHANGED:
emit_signal("offset_changed")

View file

@ -0,0 +1,7 @@
[plugin]
name="OpenVR Overlay"
description="Toolkit for making OpenVR overlays in Godot."
author="CrispyPin"
version=""
script="openvr_overlay.gd"

View file

@ -0,0 +1,14 @@
tool
extends EditorPlugin
var export_plugin
func _enter_tree():
export_plugin = preload("res://addons/ovr_utils/ovr_utils_exporter.gd").new()
add_export_plugin(export_plugin)
func _exit_tree():
if export_plugin:
remove_export_plugin(export_plugin)

View file

@ -0,0 +1,12 @@
tool
extends EditorExportPlugin
func _export_begin(features: PoolStringArray, is_debug: bool, path: String, flags: int) -> void:
ProjectSettings.set_setting("display/window/size/height", 16)
ProjectSettings.set_setting("display/window/size/width", 16)
ProjectSettings.save()
func _export_end() -> void:
ProjectSettings.set_setting("display/window/size/height", 2048)
ProjectSettings.set_setting("display/window/size/width", 2048)
ProjectSettings.save()

View file

@ -0,0 +1,7 @@
[plugin]
name="OVR Utils"
description="OVR Utils exporter"
author="CrispyPin"
version=""
script="ovr_utils.gd"

View file

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2021 CrispyPin
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.

View file

@ -0,0 +1,11 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://addons/settings-manager/settings_manager.gd" type="Script" id=1]
[node name="Settings" type="Node"]
script = ExtResource( 1 )
[node name="SaveTimer" type="Timer" parent="."]
autostart = true
[connection signal="timeout" from="SaveTimer" to="." method="_on_SaveTimer_timeout"]

View file

@ -0,0 +1,7 @@
[plugin]
name="SettingsManager"
description="Simple settings manager for godot"
author="CrispyPin"
version=""
script="settings_plugin.gd"

View file

@ -0,0 +1,142 @@
extends Node
signal settings_saved
signal settings_loaded # emitted when settings are loaded from file, needs to be connected in _init()
signal settings_changed # has to be manually called by the modifying script
var DEBUG_SETTINGS = false
var SETTINGS_PATH = preload("res://settings_definition.gd").PATH
const SETTINGS_DEF = preload("res://settings_definition.gd").DEF
var has_loaded := false
var s := {}
var _saved_hash: int
func _ready() -> void:
_init_settings()
load_settings()
force_save()
func _on_SaveTimer_timeout() -> void:
var new_h: int = s.hash()
if new_h != _saved_hash:
_saved_hash = new_h
print("Saving to ", SETTINGS_PATH)
force_save()
func _init_settings() -> void:
for key in SETTINGS_DEF:
s[key] = _init_sub_setting(SETTINGS_DEF[key])
if DEBUG_SETTINGS:
print("Default settings: ", s)
func _init_sub_setting(def):
match def.type:
"dict":
if has_flag(def, "resize"):
return def.default
var _s = {}
for key in def.definition:
_s[key] = _init_sub_setting(def.definition[key])
return _s
_:
return def.default
func force_save():
var to_save = {}
for key in s:
var val = _save_sub_setting(s[key], SETTINGS_DEF[key])
if val != null:
to_save[key] = val
var file = File.new()
file.open(SETTINGS_PATH, File.WRITE)
file.store_line(to_json(to_save))
file.close()
emit_signal("settings_saved")
if DEBUG_SETTINGS:
print("Settings saved to file")
func _save_sub_setting(val, def):
if has_flag(def, "no_save"):
return null
match def.type:
"vector2":
return [val.x, val.y]
"vector3":
return [val.x, val.y, val.z]
"quat":
return [val.x, val.y, val.z, val.w]
"dict":
var resize = has_flag(def, "resize")
var _s = {}
for key in val:
var subdef = def.definition if resize else def.definition[key]
var v = _save_sub_setting(val[key], subdef)
if v != null:
_s[key] = v
return _s
_:
return val
func load_settings() -> void:
var file = File.new()
var validator: Script = preload("res://settings_validator.gd")
if not file.file_exists(SETTINGS_PATH):
if DEBUG_SETTINGS:
print("No settings file exists, using defaults")
return
file.open(SETTINGS_PATH, File.READ)
var new_settings = parse_json(file.get_as_text())
file.close()
if validator.is_valid(new_settings):
for key in new_settings:
s[key] = _load_sub_setting(new_settings[key], SETTINGS_DEF[key])
else:
print("Invalid or outdated config file, using defaults")
if DEBUG_SETTINGS:
print("Loaded settings from file")
emit_signal("settings_loaded")
has_loaded = true
func _load_sub_setting(val, def):
match def.type:
"vector2":
return Vector2(val[0], val[1])
"vector3":
return Vector3(val[0], val[1], val[2])
"quat":
return Quat(val[0], val[1], val[2], val[3])
"dict":
var _s = {}
var resize = has_flag(def, "resize")
for key in val:
if resize:
_s[key] = _load_sub_setting(val[key], def.definition)
elif def.definition.has(key):
_s[key] = _load_sub_setting(val[key], def.definition[key])
return _s
_:
return val
func has_flag(def, flag):
return def.has("flags") and flag in def.flags
func _exit_tree() -> void:
force_save()

View file

@ -0,0 +1,10 @@
tool
extends EditorPlugin
func _enter_tree() -> void:
add_autoload_singleton("Settings", "res://addons/settings-manager/Settings.tscn")
func _exit_tree() -> void:
remove_autoload_singleton("Settings")

7
src/default_env.tres Normal file
View file

@ -0,0 +1,7 @@
[gd_resource type="Environment" load_steps=2 format=2]
[sub_resource type="ProceduralSky" id=1]
[resource]
background_mode = 2
background_sky = SubResource( 1 )

65
src/export_presets.cfg Normal file
View file

@ -0,0 +1,65 @@
[preset.0]
name="Linux/X11"
platform="Linux/X11"
runnable=true
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path="../builds/linux/ovr-utils.x86_64"
script_export_mode=1
script_encryption_key=""
[preset.0.options]
custom_template/debug=""
custom_template/release=""
binary_format/64_bits=true
binary_format/embed_pck=true
texture_format/bptc=false
texture_format/s3tc=true
texture_format/etc=false
texture_format/etc2=false
texture_format/no_bptc_fallbacks=true
[preset.1]
name="Windows Desktop"
platform="Windows Desktop"
runnable=true
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path="../builds/windows/ovr-utils.exe"
script_export_mode=1
script_encryption_key=""
[preset.1.options]
custom_template/debug=""
custom_template/release=""
binary_format/64_bits=true
binary_format/embed_pck=true
texture_format/bptc=false
texture_format/s3tc=true
texture_format/etc=false
texture_format/etc2=false
texture_format/no_bptc_fallbacks=true
codesign/enable=false
codesign/identity=""
codesign/password=""
codesign/timestamp=true
codesign/timestamp_server_url=""
codesign/digest_algorithm=1
codesign/description=""
codesign/custom_options=PoolStringArray( )
application/icon=""
application/file_version=""
application/product_version=""
application/company_name=""
application/product_name=""
application/file_description=""
application/copyright=""
application/trademarks=""

202
src/fonts/LICENSE.txt Normal file
View file

@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

BIN
src/fonts/OpenSans-Bold.ttf Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

1
src/icons/add.svg Normal file
View file

@ -0,0 +1 @@
<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m7 1v6h-6v2h6v6h2v-6h6v-2h-6v-6z" fill="#e0e0e0"/></svg>

After

Width:  |  Height:  |  Size: 149 B

34
src/icons/add.svg.import Normal file
View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/add.svg-3a64ab77744329b708208f7f819028d8.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://icons/add.svg"
dest_files=[ "res://.import/add.svg-3a64ab77744329b708208f7f819028d8.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=10.0

1
src/icons/alpha.svg Normal file
View file

@ -0,0 +1 @@
<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><g fill="#e0e0e0" fill-rule="evenodd"><path d="m7.9998 2c-2.5567 0-5.7907 1.9477-6.9551 5.7051a1.0001 1.0001 0 0 0 -.00586.5703c1.1244 3.9354 4.4609 5.7246 6.9609 5.7246s5.8365-1.7892 6.9609-5.7246a1.0001 1.0001 0 0 0 0-.5527c-1.1003-3.7876-4.4066-5.7227-6.9609-5.7227zm0 2a4 4 0 0 1 4 4 4 4 0 0 1 -4 4 4 4 0 0 1 -4-4 4 4 0 0 1 4-4zm0 2a2 2 0 0 0 -2 2 2 2 0 0 0 2 2 2 2 0 0 0 2-2 2 2 0 0 0 -2-2z" fill-opacity=".39216"/><path d="m8 2c-2.5567 0-5.7907 1.9477-6.9551 5.7051a1.0001 1.0001 0 0 0 -.00586.57031c1.1244 3.9354 4.4609 5.7246 6.9609 5.7246v-2a4 4 0 0 1 -4-4 4 4 0 0 1 4-4zm0 4a2 2 0 0 0 -2 2 2 2 0 0 0 2 2z" fill-opacity=".99608"/></g></svg>

After

Width:  |  Height:  |  Size: 733 B

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/alpha.svg-22384cad50da35235f001642b0f4e493.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://icons/alpha.svg"
dest_files=[ "res://.import/alpha.svg-22384cad50da35235f001642b0f4e493.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=10.0

1
src/icons/close.svg Normal file
View file

@ -0,0 +1 @@
<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m3.7578 2.3438-1.4141 1.4141 4.2422 4.2422-4.2422 4.2422 1.4141 1.4141 4.2422-4.2422 4.2422 4.2422 1.4141-1.4141-4.2422-4.2422 4.2422-4.2422-1.4141-1.4141-4.2422 4.2422z" fill="#e0e0e0"/></svg>

After

Width:  |  Height:  |  Size: 286 B

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/close.svg-4ddfafaefba273b37f7839c4b0365913.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://icons/close.svg"
dest_files=[ "res://.import/close.svg-4ddfafaefba273b37f7839c4b0365913.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=10.0

1
src/icons/hidden.svg Normal file
View file

@ -0,0 +1 @@
<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m2.9609 7.7266-1.9219.54883c.31999 1.12.8236 2.0593 1.4316 2.8398l-.83398.83398 1.4141 1.4141.84375-.84375c.98585.74762 2.0766 1.2067 3.1055 1.3867v1.0938h2v-1.0938c1.0288-.17998 2.1196-.6391 3.1055-1.3867l.84375.84375 1.4141-1.4141-.83398-.83398c.60804-.78055 1.1117-1.7199 1.4316-2.8398l-1.9219-.54883c-.8756 3.0646-3.5391 4.2734-5.0391 4.2734s-4.1635-1.2088-5.0391-4.2734z" fill="#e0e0e0" fill-opacity=".99608" fill-rule="evenodd"/></svg>

After

Width:  |  Height:  |  Size: 534 B

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/hidden.svg-8f0a2cdef2d740b3c5126f9455f5dc74.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://icons/hidden.svg"
dest_files=[ "res://.import/hidden.svg-8f0a2cdef2d740b3c5126f9455f5dc74.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=10.0

Some files were not shown because too many files have changed in this diff Show more