diff --git a/ovr-utils/Main.tscn b/ovr-utils/Main.tscn index 3acc914..ae80bdc 100644 --- a/ovr-utils/Main.tscn +++ b/ovr-utils/Main.tscn @@ -1,7 +1,7 @@ [gd_scene load_steps=4 format=2] [ext_resource path="res://addons/openvr_overlay/OverlayInstance.tscn" type="PackedScene" id=1] -[ext_resource path="res://overlays/MainOverlay.tscn" type="PackedScene" id=2] +[ext_resource path="res://ui/MainOverlay.tscn" type="PackedScene" id=2] [ext_resource path="res://overlay_manager.gd" type="Script" id=6] [node name="Main" type="Node"] diff --git a/ovr-utils/overlay_manager.gd b/ovr-utils/overlay_manager.gd index bb88f7f..bd08b32 100644 --- a/ovr-utils/overlay_manager.gd +++ b/ovr-utils/overlay_manager.gd @@ -18,7 +18,7 @@ func _load_overlays(): for key in Settings.s.overlays: # TODO remove this check, settings should always contain "type" if Settings.s.overlays[key].has("type"): - if not Settings.s.overlays[key].type == "MainOverlay": + if not key == "MainOverlay": add_overlay(Settings.s.overlays[key].type, key) else: print("No type defined for overlay ", key) diff --git a/ovr-utils/overlay_scripts/main_menu.gd b/ovr-utils/overlay_scripts/main_menu.gd index e7c306f..ee169dc 100644 --- a/ovr-utils/overlay_scripts/main_menu.gd +++ b/ovr-utils/overlay_scripts/main_menu.gd @@ -4,7 +4,8 @@ extends Control func _ready() -> void: get_node("/root/Main/OverlayManager").connect("added_overlay", self, "_add_overlay_to_list") for o in Settings.s.overlays: - _add_overlay_to_list(o) + if o != "MainOverlay": + _add_overlay_to_list(o) $VSplitContainer/Control/Overlays.visible = false @@ -14,10 +15,8 @@ func _add_overlay_to_list(name): $VSplitContainer/Control/Overlays.add_child(new) - func _on_GrabMode_toggled(state: bool) -> void: Settings.s.grab_mode = state - Settings.emit_signal("settings_changed") func _on_ShowOverlays_toggled(state: bool) -> void: @@ -25,5 +24,5 @@ func _on_ShowOverlays_toggled(state: bool) -> void: func _on_AddOverlay_pressed() -> void: - $VSplitContainer/Control/AddMenu.visible = true + $VSplitContainer/Control/AddMenu.visible = !$VSplitContainer/Control/AddMenu.visible diff --git a/ovr-utils/ui/ListOverlayItem.tscn b/ovr-utils/ui/ListOverlayItem.tscn index e973975..0a559b4 100644 --- a/ovr-utils/ui/ListOverlayItem.tscn +++ b/ovr-utils/ui/ListOverlayItem.tscn @@ -26,7 +26,7 @@ margin_left = 8.0 margin_top = 16.0 margin_right = 2040.0 margin_bottom = 191.0 -text = "BatteryLevel" +text = "MainOverlay" [node name="HBoxContainer" type="HBoxContainer" parent="."] margin_left = 8.0 diff --git a/ovr-utils/overlays/MainOverlay.tscn b/ovr-utils/ui/MainOverlay.tscn similarity index 88% rename from ovr-utils/overlays/MainOverlay.tscn rename to ovr-utils/ui/MainOverlay.tscn index 158b886..58a98f5 100644 --- a/ovr-utils/overlays/MainOverlay.tscn +++ b/ovr-utils/ui/MainOverlay.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=7 format=2] +[gd_scene load_steps=8 format=2] [ext_resource path="res://overlay_scripts/main_menu.gd" type="Script" id=1] [ext_resource path="res://styles/menu.theme" type="Theme" id=2] @@ -6,6 +6,7 @@ [ext_resource path="res://icons/add.svg" type="Texture" id=4] [ext_resource path="res://icons/move.svg" type="Texture" id=5] [ext_resource path="res://icons/list.svg" type="Texture" id=6] +[ext_resource path="res://ui/ListOverlayItem.tscn" type="PackedScene" id=7] [node name="MainOverlay" type="Control"] anchor_right = 1.0 @@ -37,7 +38,13 @@ __meta__ = { "_edit_use_anchors_": false } +[node name="ListOverlayItem" parent="VSplitContainer/Control/Overlays" instance=ExtResource( 7 )] +margin_top = 1638.0 +margin_bottom = 1845.0 +overlay_name = "MainOverlay" + [node name="AddMenu" parent="VSplitContainer/Control" instance=ExtResource( 3 )] +visible = false [node name="MainBar" type="HBoxContainer" parent="VSplitContainer"] margin_top = 1857.0 diff --git a/ovr-utils/ui/overlay_list_item.gd b/ovr-utils/ui/overlay_list_item.gd index 76165ee..a483a59 100644 --- a/ovr-utils/ui/overlay_list_item.gd +++ b/ovr-utils/ui/overlay_list_item.gd @@ -6,7 +6,7 @@ var overlay func _ready() -> void: overlay = get_node("/root/Main/OverlayManager").get_node(overlay_name) $Label.text = overlay_name - $HBoxContainer/Target.selected = overlay.TARGETS.find(overlay.target) + $HBoxContainer/Target.selected = overlay.TARGETS.find(Settings.s.overlays[overlay_name].target) overlay.connect("overlay_visibility_changed", self, "_overlay_visibility_changed")