mirror of
https://github.com/CrispyPin/ovr-utils.git
synced 2024-11-10 02:40:25 +01:00
add warning for missing overlay scene, and a placeholder showing the path
This commit is contained in:
parent
9a5e58351f
commit
2fefd5a03b
9 changed files with 141 additions and 21 deletions
|
@ -1,6 +1,6 @@
|
|||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://ui/MainOverlay.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://special_overlays/MainOverlay.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://addons/openvr_overlay/OverlayInstance.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://overlay_manager.gd" type="Script" id=4]
|
||||
|
||||
|
|
1
ovr-utils/icons/warning.svg
Normal file
1
ovr-utils/icons/warning.svg
Normal file
|
@ -0,0 +1 @@
|
|||
<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m8.0293 2.002a1.0001 1.0001 0 0 0 -.88672.48438l-6 10a1.0001 1.0001 0 0 0 .85742 1.5137h12a1.0001 1.0001 0 0 0 .85742-1.5137l-6-10a1.0001 1.0001 0 0 0 -.82812-.48438zm-1.0293 2.998h2v5h-2zm0 6h2v2h-2z" fill="#ffdd65" fill-rule="evenodd"/></svg>
|
After Width: | Height: | Size: 337 B |
34
ovr-utils/icons/warning.svg.import
Normal file
34
ovr-utils/icons/warning.svg.import
Normal file
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/warning.svg-b033954d2064445c7f6c3060b1067f3b.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://icons/warning.svg"
|
||||
dest_files=[ "res://.import/warning.svg-b033954d2064445c7f6c3060b1067f3b.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
|
|
@ -26,12 +26,15 @@ func _load_overlays():
|
|||
|
||||
|
||||
func add_overlay(type, name):
|
||||
var scene = load("res://overlays/" + type + ".tscn")
|
||||
if not scene:
|
||||
print("Unknown overlay type: '", type, "'. Skipping overlay '", name, "'")
|
||||
return
|
||||
print("Adding overlay '", name, "' of type '", type, "'")
|
||||
var scene = load("res://overlays/" + type + ".tscn")
|
||||
|
||||
if not scene:
|
||||
print("Unknown overlay type: '", type, "'")
|
||||
scene = load("res://special_overlays/UnknownType.tscn")
|
||||
|
||||
var instance = preload("res://addons/openvr_overlay/OverlayInstance.tscn").instance()
|
||||
|
||||
instance.name = name
|
||||
instance.overlay_scene = scene
|
||||
instance.type = type
|
||||
|
|
5
ovr-utils/overlay_scripts/unknown_type.gd
Normal file
5
ovr-utils/overlay_scripts/unknown_type.gd
Normal file
|
@ -0,0 +1,5 @@
|
|||
extends Control
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
$Label.text += get_viewport().get_parent().type
|
|
@ -1,18 +1,18 @@
|
|||
[gd_scene load_steps=9 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]
|
||||
[ext_resource path="res://ui/AddMenu.tscn" type="PackedScene" id=3]
|
||||
[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]
|
||||
[ext_resource path="res://icons/close.svg" type="Texture" id=8]
|
||||
[ext_resource path="res://icons/move.svg" type="Texture" id=2]
|
||||
[ext_resource path="res://icons/list.svg" type="Texture" id=3]
|
||||
[ext_resource path="res://icons/close.svg" type="Texture" id=4]
|
||||
[ext_resource path="res://icons/add.svg" type="Texture" id=5]
|
||||
[ext_resource path="res://ui/ListOverlayItem.tscn" type="PackedScene" id=6]
|
||||
[ext_resource path="res://styles/menu.theme" type="Theme" id=7]
|
||||
[ext_resource path="res://ui/AddMenu.tscn" type="PackedScene" id=8]
|
||||
|
||||
[node name="MainOverlay" type="Control"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
theme = ExtResource( 2 )
|
||||
theme = ExtResource( 7 )
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
|
@ -53,13 +53,13 @@ __meta__ = {
|
|||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="ListOverlayItem" parent="MarginContainer/VSplitContainer/Control/Overlays" instance=ExtResource( 7 )]
|
||||
[node name="ListOverlayItem" parent="MarginContainer/VSplitContainer/Control/Overlays" instance=ExtResource( 6 )]
|
||||
margin_top = 1618.0
|
||||
margin_right = 2032.0
|
||||
margin_bottom = 1841.0
|
||||
overlay_name = "MainOverlay"
|
||||
|
||||
[node name="AddMenu" parent="MarginContainer/VSplitContainer/Control" instance=ExtResource( 3 )]
|
||||
[node name="AddMenu" parent="MarginContainer/VSplitContainer/Control" instance=ExtResource( 8 )]
|
||||
visible = false
|
||||
|
||||
[node name="MainBar" type="HBoxContainer" parent="MarginContainer/VSplitContainer"]
|
||||
|
@ -75,7 +75,7 @@ margin_right = 176.0
|
|||
margin_bottom = 191.0
|
||||
focus_mode = 0
|
||||
toggle_mode = true
|
||||
icon = ExtResource( 6 )
|
||||
icon = ExtResource( 3 )
|
||||
|
||||
[node name="AddOverlay" type="Button" parent="MarginContainer/VSplitContainer/MainBar"]
|
||||
margin_left = 180.0
|
||||
|
@ -83,7 +83,7 @@ margin_right = 356.0
|
|||
margin_bottom = 191.0
|
||||
focus_mode = 0
|
||||
toggle_mode = true
|
||||
icon = ExtResource( 4 )
|
||||
icon = ExtResource( 5 )
|
||||
|
||||
[node name="GrabMode" type="Button" parent="MarginContainer/VSplitContainer/MainBar"]
|
||||
margin_left = 360.0
|
||||
|
@ -91,14 +91,14 @@ margin_right = 536.0
|
|||
margin_bottom = 191.0
|
||||
focus_mode = 0
|
||||
toggle_mode = true
|
||||
icon = ExtResource( 5 )
|
||||
icon = ExtResource( 2 )
|
||||
|
||||
[node name="QuitToggle" type="Button" parent="MarginContainer/VSplitContainer/MainBar"]
|
||||
margin_left = 540.0
|
||||
margin_right = 716.0
|
||||
margin_bottom = 191.0
|
||||
toggle_mode = true
|
||||
icon = ExtResource( 8 )
|
||||
icon = ExtResource( 4 )
|
||||
|
||||
[node name="Quit" type="Button" parent="MarginContainer/VSplitContainer/MainBar/QuitToggle"]
|
||||
visible = false
|
||||
|
@ -107,7 +107,7 @@ margin_top = -199.0
|
|||
margin_right = 915.0
|
||||
margin_bottom = -8.0
|
||||
text = "Really quit?"
|
||||
icon = ExtResource( 8 )
|
||||
icon = ExtResource( 4 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
30
ovr-utils/special_overlays/UnknownType.tscn
Normal file
30
ovr-utils/special_overlays/UnknownType.tscn
Normal file
|
@ -0,0 +1,30 @@
|
|||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://styles/menu.theme" type="Theme" id=1]
|
||||
[ext_resource path="res://overlay_scripts/unknown_type.gd" type="Script" id=2]
|
||||
|
||||
[node name="UnknownType" type="Control"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
theme = ExtResource( 1 )
|
||||
script = ExtResource( 2 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
color = Color( 1, 0, 0, 0.501961 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Label" type="Label" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
text = "Missing overlay scene:
|
||||
"
|
||||
align = 1
|
||||
valign = 1
|
||||
autowrap = true
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=15 format=2]
|
||||
[gd_scene load_steps=18 format=2]
|
||||
|
||||
[ext_resource path="res://ui/overlay_list_item.gd" type="Script" id=1]
|
||||
[ext_resource path="res://icons/remove.svg" type="Texture" id=2]
|
||||
|
@ -14,6 +14,12 @@
|
|||
[ext_resource path="res://icons/alpha.svg" type="Texture" id=12]
|
||||
[ext_resource path="res://icons/tracking/hand_l.svg" type="Texture" id=13]
|
||||
[ext_resource path="res://icons/tracking/world.svg" type="Texture" id=14]
|
||||
[ext_resource path="res://icons/warning.svg" type="Texture" id=15]
|
||||
[ext_resource path="res://fonts/OpenSans-Italic.ttf" type="DynamicFontData" id=16]
|
||||
|
||||
[sub_resource type="DynamicFont" id=1]
|
||||
size = 48
|
||||
font_data = ExtResource( 16 )
|
||||
|
||||
[node name="ListOverlayItem" type="MarginContainer"]
|
||||
margin_top = 1727.0
|
||||
|
@ -53,6 +59,35 @@ __meta__ = {
|
|||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Warning" type="Button" parent="BasicOptions/List"]
|
||||
visible = false
|
||||
margin_left = 1316.0
|
||||
margin_right = 1492.0
|
||||
margin_bottom = 191.0
|
||||
toggle_mode = true
|
||||
icon = ExtResource( 15 )
|
||||
|
||||
[node name="WarningInfo" type="PanelContainer" parent="BasicOptions/List/Warning"]
|
||||
visible = false
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = -191.0
|
||||
margin_top = -165.0
|
||||
margin_right = 122.0
|
||||
margin_bottom = -203.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Label" type="Label" parent="BasicOptions/List/Warning/WarningInfo"]
|
||||
margin_left = 8.0
|
||||
margin_top = 8.0
|
||||
margin_right = 481.0
|
||||
margin_bottom = 145.0
|
||||
custom_fonts/font = SubResource( 1 )
|
||||
text = "res://overlays/not_real
|
||||
not found"
|
||||
|
||||
[node name="Grab" type="Button" parent="BasicOptions/List"]
|
||||
margin_left = 1496.0
|
||||
margin_right = 1672.0
|
||||
|
@ -77,6 +112,7 @@ margin_bottom = 191.0
|
|||
icon = ExtResource( 10 )
|
||||
|
||||
[node name="MoreOptions" type="HSplitContainer" parent="."]
|
||||
visible = false
|
||||
margin_top = 8.0
|
||||
margin_right = 2048.0
|
||||
margin_bottom = 215.0
|
||||
|
@ -192,6 +228,7 @@ margin_bottom = 191.0
|
|||
focus_mode = 0
|
||||
icon = ExtResource( 11 )
|
||||
|
||||
[connection signal="toggled" from="BasicOptions/List/Warning" to="." method="_on_Warning_toggled"]
|
||||
[connection signal="toggled" from="BasicOptions/List/Grab" to="." method="_on_Grab_toggled"]
|
||||
[connection signal="toggled" from="BasicOptions/List/Visibility" to="." method="_on_Visibility_toggled"]
|
||||
[connection signal="pressed" from="BasicOptions/List/Options" to="." method="_on_Options_pressed"]
|
||||
|
|
|
@ -5,15 +5,20 @@ var overlay
|
|||
|
||||
func _ready() -> void:
|
||||
overlay = OverlayManager.get_node(overlay_name)
|
||||
|
||||
$MoreOptions/Container/List/SetSize/PanelContainer.visible = false
|
||||
$MoreOptions/Container/List/SetAlpha/PanelContainer.visible = false
|
||||
$MoreOptions/Container/List/SetSize/PanelContainer/SizeSlider.value = overlay.width_meters
|
||||
$MoreOptions.visible = false
|
||||
|
||||
$BasicOptions/Label.text = overlay_name
|
||||
name = overlay_name
|
||||
$MoreOptions/Container/List/Target.selected = overlay.TARGETS.find(overlay.target)
|
||||
overlay.connect("overlay_visibility_changed", self, "_overlay_visibility_changed")
|
||||
|
||||
$BasicOptions/List/Warning.visible = overlay.overlay_scene == preload("res://special_overlays/UnknownType.tscn")
|
||||
$BasicOptions/List/Warning/WarningInfo/Label.text = overlay.type + "\nnot found"
|
||||
|
||||
|
||||
func _on_Visibility_toggled(state: bool) -> void:
|
||||
if overlay.type and overlay.type != "main":
|
||||
|
@ -67,3 +72,8 @@ func _on_SizeSlider_value_changed(value: float) -> void:
|
|||
|
||||
func _on_AlphaSlider_value_changed(value: float) -> void:
|
||||
overlay.alpha = value
|
||||
|
||||
|
||||
func _on_Warning_toggled(state: bool) -> void:
|
||||
$BasicOptions/List/Warning/WarningInfo.visible = state
|
||||
|
||||
|
|
Loading…
Reference in a new issue