mirror of
https://github.com/CrispyPin/ovr-utils.git
synced 2024-11-21 23:20:25 +01:00
main menu basic mockup
This commit is contained in:
parent
7166f9899f
commit
634ea013b7
9 changed files with 120 additions and 18 deletions
40
ovr-utils/ListOverlayItem.tscn
Normal file
40
ovr-utils/ListOverlayItem.tscn
Normal file
|
@ -0,0 +1,40 @@
|
|||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://menu.theme" type="Theme" id=1]
|
||||
[ext_resource path="res://icons/visible.svg" type="Texture" id=2]
|
||||
[ext_resource path="res://overlay_list_item.gd" type="Script" id=3]
|
||||
|
||||
[node name="ListOverlayItem" type="PanelContainer"]
|
||||
margin_top = 1727.0
|
||||
margin_right = 2048.0
|
||||
margin_bottom = 1855.0
|
||||
rect_min_size = Vector2( 100, 128 )
|
||||
theme = ExtResource( 1 )
|
||||
script = ExtResource( 3 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Label" type="Label" parent="."]
|
||||
margin_left = 7.0
|
||||
margin_top = 10.0
|
||||
margin_right = 2041.0
|
||||
margin_bottom = 185.0
|
||||
text = "BatteryLevel"
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="."]
|
||||
margin_left = 7.0
|
||||
margin_top = 7.0
|
||||
margin_right = 2041.0
|
||||
margin_bottom = 188.0
|
||||
alignment = 2
|
||||
|
||||
[node name="Visibility" type="Button" parent="HBoxContainer"]
|
||||
margin_left = 1862.0
|
||||
margin_right = 2034.0
|
||||
margin_bottom = 181.0
|
||||
toggle_mode = true
|
||||
pressed = true
|
||||
icon = ExtResource( 2 )
|
||||
|
||||
[connection signal="toggled" from="HBoxContainer/Visibility" to="." method="_on_Visibility_toggled"]
|
|
@ -11,6 +11,7 @@ var trackers = {
|
|||
}
|
||||
|
||||
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
|
||||
|
|
|
@ -25,12 +25,12 @@ var _offsets:Dictionary = {
|
|||
# what's actually tracking
|
||||
var current_target: String = "world" setget _set_current_target# most of the time the actual target, but will fall back
|
||||
var fallback = ["left", "right", "head"] # TODO setget that updates tracking (not important)
|
||||
var interaction_handler: Node
|
||||
|
||||
var _tracker_id: int = 0
|
||||
|
||||
onready var container = $OverlayViewport/Container
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
current_target = target
|
||||
|
||||
|
@ -42,12 +42,12 @@ func _ready() -> void:
|
|||
|
||||
load_settings()
|
||||
if add_cursor or add_grabbing:
|
||||
var interaction_handler = load("res://addons/openvr_overlay/OverlayInteraction.tscn").instance()
|
||||
interaction_handler = load("res://addons/openvr_overlay/OverlayInteraction.tscn").instance()
|
||||
add_child(interaction_handler)
|
||||
if add_cursor:
|
||||
interaction_handler.add_child(load("res://addons/openvr_overlay/OverlayCursor.tscn").instance())
|
||||
add_cursor()
|
||||
if add_grabbing:
|
||||
interaction_handler.add_child(load("res://addons/openvr_overlay/OverlayGrab.tscn").instance())
|
||||
add_grab()
|
||||
|
||||
if overlay_scene:
|
||||
container.add_child(overlay_scene.instance())
|
||||
|
@ -55,6 +55,14 @@ func _ready() -> void:
|
|||
update_tracker_id()
|
||||
|
||||
|
||||
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 load_settings():
|
||||
if Settings.s.overlays.has(name):
|
||||
if Settings.s.overlays[name].has("fallback"):
|
||||
|
|
BIN
ovr-utils/menu.theme
Normal file
BIN
ovr-utils/menu.theme
Normal file
Binary file not shown.
14
ovr-utils/overlay_list_item.gd
Normal file
14
ovr-utils/overlay_list_item.gd
Normal file
|
@ -0,0 +1,14 @@
|
|||
extends PanelContainer
|
||||
|
||||
var overlay
|
||||
|
||||
func _ready() -> void:
|
||||
overlay = get_node("/root/Main/OverlayManager").get_child(1)
|
||||
|
||||
|
||||
func _on_Visibility_toggled(state: bool) -> void:
|
||||
overlay.get_node("OverlayViewport").overlay_visible = state
|
||||
if state:
|
||||
$HBoxContainer/Visibility.icon = preload("res://icons/visible.svg")
|
||||
else:
|
||||
$HBoxContainer/Visibility.icon = preload("res://icons/hidden.svg")
|
|
@ -2,9 +2,13 @@ extends Control
|
|||
|
||||
|
||||
func _ready() -> void:
|
||||
pass
|
||||
$VSplitContainer/Control/Overlays.visible = false
|
||||
|
||||
|
||||
func _on_GrabMode_toggled(state: bool) -> void:
|
||||
Settings.s.grab_mode = state
|
||||
Settings.emit_signal("settings_changed")
|
||||
|
||||
|
||||
func _on_ShowOverlays_toggled(state: bool) -> void:
|
||||
$VSplitContainer/Control/Overlays.visible = state
|
||||
|
|
|
@ -7,6 +7,8 @@ var oinst
|
|||
func _ready() -> void:
|
||||
oinst = get_viewport().get_parent()
|
||||
ihandler = get_viewport().get_node("../OverlayInteraction/OverlayGrab")
|
||||
if not oinst.add_cursor:
|
||||
oinst.add_cursor()
|
||||
for t in oinst.TARGETS:
|
||||
$OptionButton.add_item(t)
|
||||
$OptionButton.selected = oinst.TARGETS.find(oinst.target)
|
||||
|
|
|
@ -1,34 +1,62 @@
|
|||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://overlay_scripts/main_menu.gd" type="Script" id=1]
|
||||
[ext_resource path="res://fonts/OpenSans-Bold.ttf" type="DynamicFontData" id=2]
|
||||
|
||||
[sub_resource type="DynamicFont" id=1]
|
||||
size = 64
|
||||
font_data = ExtResource( 2 )
|
||||
[ext_resource path="res://menu.theme" type="Theme" id=2]
|
||||
[ext_resource path="res://ListOverlayItem.tscn" type="PackedScene" id=3]
|
||||
|
||||
[node name="MainOverlay" type="Control"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
theme = ExtResource( 2 )
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="."]
|
||||
anchor_top = 1.0
|
||||
[node name="VSplitContainer" type="VSplitContainer" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_top = -99.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="GrabMode" type="Button" parent="HBoxContainer"]
|
||||
margin_right = 366.0
|
||||
margin_bottom = 99.0
|
||||
custom_fonts/font = SubResource( 1 )
|
||||
[node name="Control" type="Control" parent="VSplitContainer"]
|
||||
margin_right = 2048.0
|
||||
margin_bottom = 1855.0
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="Overlays" type="VBoxContainer" parent="VSplitContainer/Control"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
size_flags_vertical = 3
|
||||
alignment = 2
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="ListOverlayItem" parent="VSplitContainer/Control/Overlays" instance=ExtResource( 3 )]
|
||||
margin_top = 1660.0
|
||||
|
||||
[node name="MainBar" type="HBoxContainer" parent="VSplitContainer"]
|
||||
margin_top = 1867.0
|
||||
margin_right = 2048.0
|
||||
margin_bottom = 2048.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="GrabMode" type="Button" parent="VSplitContainer/MainBar"]
|
||||
margin_right = 716.0
|
||||
margin_bottom = 181.0
|
||||
toggle_mode = true
|
||||
text = "Grab mode"
|
||||
|
||||
[connection signal="toggled" from="HBoxContainer/GrabMode" to="." method="_on_GrabMode_toggled"]
|
||||
[node name="ShowOverlays" type="Button" parent="VSplitContainer/MainBar"]
|
||||
margin_left = 720.0
|
||||
margin_right = 1294.0
|
||||
margin_bottom = 181.0
|
||||
toggle_mode = true
|
||||
text = "Overlays"
|
||||
|
||||
[connection signal="toggled" from="VSplitContainer/MainBar/GrabMode" to="." method="_on_GrabMode_toggled"]
|
||||
[connection signal="toggled" from="VSplitContainer/MainBar/ShowOverlays" to="." method="_on_ShowOverlays_toggled"]
|
||||
|
|
|
@ -21,6 +21,11 @@ config/icon="res://textures/icon.png"
|
|||
Settings="*res://addons/settings-manager/Settings.tscn"
|
||||
OverlayInit="*res://addons/openvr_overlay/overlay_init.gd"
|
||||
|
||||
[display]
|
||||
|
||||
window/size/width=2048
|
||||
window/size/height=2048
|
||||
|
||||
[editor_plugins]
|
||||
|
||||
enabled=PoolStringArray( "res://addons/godot-openvr/plugin.cfg", "res://addons/openvr_overlay/plugin.cfg", "res://addons/settings-manager/plugin.cfg" )
|
||||
|
|
Loading…
Reference in a new issue