mirror of
https://github.com/CrispyPin/ovr-utils.git
synced 2024-11-10 02:40:25 +01:00
menu rework - add submenu for more options in overlay list
This commit is contained in:
parent
6b18c51391
commit
670df66b38
7 changed files with 163 additions and 70 deletions
1
ovr-utils/icons/close.svg
Normal file
1
ovr-utils/icons/close.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="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 |
34
ovr-utils/icons/close.svg.import
Normal file
34
ovr-utils/icons/close.svg.import
Normal 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
|
Binary file not shown.
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=10 format=2]
|
[gd_scene load_steps=12 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://ui/overlay_list_item.gd" type="Script" id=1]
|
[ext_resource path="res://ui/overlay_list_item.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://icons/remove.svg" type="Texture" id=2]
|
[ext_resource path="res://icons/remove.svg" type="Texture" id=2]
|
||||||
|
@ -9,84 +9,134 @@
|
||||||
[ext_resource path="res://icons/person.svg" type="Texture" id=7]
|
[ext_resource path="res://icons/person.svg" type="Texture" id=7]
|
||||||
[ext_resource path="res://icons/visible.svg" type="Texture" id=8]
|
[ext_resource path="res://icons/visible.svg" type="Texture" id=8]
|
||||||
[ext_resource path="res://styles/menu.theme" type="Theme" id=9]
|
[ext_resource path="res://styles/menu.theme" type="Theme" id=9]
|
||||||
|
[ext_resource path="res://icons/list.svg" type="Texture" id=10]
|
||||||
|
[ext_resource path="res://icons/close.svg" type="Texture" id=11]
|
||||||
|
|
||||||
[node name="ListOverlayItem" type="PanelContainer"]
|
[node name="ListOverlayItem" type="MarginContainer"]
|
||||||
margin_top = 1727.0
|
margin_top = 1727.0
|
||||||
margin_right = 2048.0
|
margin_right = 2048.0
|
||||||
margin_bottom = 1920.0
|
margin_bottom = 1920.0
|
||||||
rect_min_size = Vector2( 100, 128 )
|
rect_min_size = Vector2( 100, 128 )
|
||||||
theme = ExtResource( 9 )
|
theme = ExtResource( 9 )
|
||||||
|
custom_constants/margin_right = 8
|
||||||
|
custom_constants/margin_top = 8
|
||||||
|
custom_constants/margin_left = 8
|
||||||
|
custom_constants/margin_bottom = 8
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 1 )
|
||||||
__meta__ = {
|
__meta__ = {
|
||||||
"_edit_use_anchors_": false
|
"_edit_use_anchors_": false
|
||||||
}
|
}
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="."]
|
[node name="BasicOptions" type="PanelContainer" parent="."]
|
||||||
margin_left = 8.0
|
|
||||||
margin_top = 16.0
|
|
||||||
margin_right = 2040.0
|
|
||||||
margin_bottom = 191.0
|
|
||||||
text = "Main Menu"
|
|
||||||
|
|
||||||
[node name="HBoxContainer" type="HBoxContainer" parent="."]
|
|
||||||
margin_left = 8.0
|
margin_left = 8.0
|
||||||
margin_top = 8.0
|
margin_top = 8.0
|
||||||
margin_right = 2040.0
|
margin_right = 2040.0
|
||||||
|
margin_bottom = 215.0
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="BasicOptions"]
|
||||||
|
margin_left = 8.0
|
||||||
|
margin_top = 16.0
|
||||||
|
margin_right = 2024.0
|
||||||
|
margin_bottom = 191.0
|
||||||
|
text = "Main Menu"
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="List" type="HBoxContainer" parent="BasicOptions"]
|
||||||
|
margin_left = 8.0
|
||||||
|
margin_top = 8.0
|
||||||
|
margin_right = 2024.0
|
||||||
margin_bottom = 199.0
|
margin_bottom = 199.0
|
||||||
alignment = 2
|
alignment = 2
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
[node name="Remove" type="Button" parent="HBoxContainer"]
|
[node name="Grab" type="Button" parent="BasicOptions/List"]
|
||||||
margin_left = 952.0
|
margin_left = 1480.0
|
||||||
margin_right = 1128.0
|
margin_right = 1656.0
|
||||||
margin_bottom = 191.0
|
|
||||||
focus_mode = 0
|
|
||||||
icon = ExtResource( 2 )
|
|
||||||
|
|
||||||
[node name="Reset" type="Button" parent="HBoxContainer"]
|
|
||||||
margin_left = 1132.0
|
|
||||||
margin_right = 1308.0
|
|
||||||
margin_bottom = 191.0
|
|
||||||
focus_mode = 0
|
|
||||||
icon = ExtResource( 5 )
|
|
||||||
|
|
||||||
[node name="Target" type="OptionButton" parent="HBoxContainer"]
|
|
||||||
margin_left = 1312.0
|
|
||||||
margin_right = 1492.0
|
|
||||||
margin_bottom = 191.0
|
|
||||||
focus_mode = 0
|
|
||||||
text = "Left"
|
|
||||||
icon = ExtResource( 6 )
|
|
||||||
clip_text = true
|
|
||||||
items = [ "Head", ExtResource( 7 ), false, 0, null, "Left", ExtResource( 6 ), false, 1, null, "Right", ExtResource( 6 ), false, 2, null, "World", ExtResource( 3 ), false, 3, null ]
|
|
||||||
selected = 1
|
|
||||||
|
|
||||||
[node name="Size" type="Button" parent="HBoxContainer"]
|
|
||||||
margin_left = 1496.0
|
|
||||||
margin_right = 1672.0
|
|
||||||
margin_bottom = 191.0
|
|
||||||
focus_mode = 0
|
|
||||||
toggle_mode = true
|
|
||||||
icon = ExtResource( 4 )
|
|
||||||
|
|
||||||
[node name="Grab" type="Button" parent="HBoxContainer"]
|
|
||||||
margin_left = 1676.0
|
|
||||||
margin_right = 1852.0
|
|
||||||
margin_bottom = 191.0
|
margin_bottom = 191.0
|
||||||
focus_mode = 0
|
focus_mode = 0
|
||||||
toggle_mode = true
|
toggle_mode = true
|
||||||
icon = ExtResource( 3 )
|
icon = ExtResource( 3 )
|
||||||
|
|
||||||
[node name="Visibility" type="Button" parent="HBoxContainer"]
|
[node name="Visibility" type="Button" parent="BasicOptions/List"]
|
||||||
margin_left = 1856.0
|
margin_left = 1660.0
|
||||||
margin_right = 2032.0
|
margin_right = 1836.0
|
||||||
margin_bottom = 191.0
|
margin_bottom = 191.0
|
||||||
focus_mode = 0
|
focus_mode = 0
|
||||||
toggle_mode = true
|
toggle_mode = true
|
||||||
pressed = true
|
pressed = true
|
||||||
icon = ExtResource( 8 )
|
icon = ExtResource( 8 )
|
||||||
|
|
||||||
[connection signal="pressed" from="HBoxContainer/Remove" to="." method="_on_Remove_pressed"]
|
[node name="Options" type="Button" parent="BasicOptions/List"]
|
||||||
[connection signal="pressed" from="HBoxContainer/Reset" to="." method="_on_Reset_pressed"]
|
margin_left = 1840.0
|
||||||
[connection signal="item_selected" from="HBoxContainer/Target" to="." method="_on_Target_item_selected"]
|
margin_right = 2016.0
|
||||||
[connection signal="toggled" from="HBoxContainer/Grab" to="." method="_on_Grab_toggled"]
|
margin_bottom = 191.0
|
||||||
[connection signal="toggled" from="HBoxContainer/Visibility" to="." method="_on_Visibility_toggled"]
|
icon = ExtResource( 10 )
|
||||||
|
|
||||||
|
[node name="MoreOptions" type="HSplitContainer" parent="."]
|
||||||
|
margin_left = 8.0
|
||||||
|
margin_top = 8.0
|
||||||
|
margin_right = 2040.0
|
||||||
|
margin_bottom = 215.0
|
||||||
|
|
||||||
|
[node name="Spacer" type="Control" parent="MoreOptions"]
|
||||||
|
margin_right = 1104.0
|
||||||
|
margin_bottom = 207.0
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
|
||||||
|
[node name="Container" type="PanelContainer" parent="MoreOptions"]
|
||||||
|
margin_left = 1116.0
|
||||||
|
margin_right = 2032.0
|
||||||
|
margin_bottom = 207.0
|
||||||
|
|
||||||
|
[node name="List" type="HBoxContainer" parent="MoreOptions/Container"]
|
||||||
|
margin_left = 8.0
|
||||||
|
margin_top = 8.0
|
||||||
|
margin_right = 908.0
|
||||||
|
margin_bottom = 199.0
|
||||||
|
alignment = 2
|
||||||
|
|
||||||
|
[node name="Remove" type="Button" parent="MoreOptions/Container/List"]
|
||||||
|
margin_right = 176.0
|
||||||
|
margin_bottom = 191.0
|
||||||
|
icon = ExtResource( 2 )
|
||||||
|
|
||||||
|
[node name="Size" type="Button" parent="MoreOptions/Container/List"]
|
||||||
|
margin_left = 180.0
|
||||||
|
margin_right = 356.0
|
||||||
|
margin_bottom = 191.0
|
||||||
|
toggle_mode = true
|
||||||
|
icon = ExtResource( 4 )
|
||||||
|
|
||||||
|
[node name="Target" type="OptionButton" parent="MoreOptions/Container/List"]
|
||||||
|
margin_left = 360.0
|
||||||
|
margin_right = 540.0
|
||||||
|
margin_bottom = 191.0
|
||||||
|
text = "Left"
|
||||||
|
icon = ExtResource( 6 )
|
||||||
|
clip_text = true
|
||||||
|
items = [ "Head", ExtResource( 7 ), false, 0, null, "Left", ExtResource( 6 ), false, 1, null, "Right", ExtResource( 6 ), false, 2, null, "World", ExtResource( 3 ), false, 3, null ]
|
||||||
|
selected = 1
|
||||||
|
|
||||||
|
[node name="Reset" type="Button" parent="MoreOptions/Container/List"]
|
||||||
|
margin_left = 544.0
|
||||||
|
margin_right = 720.0
|
||||||
|
margin_bottom = 191.0
|
||||||
|
icon = ExtResource( 5 )
|
||||||
|
|
||||||
|
[node name="CloseOptions" type="Button" parent="MoreOptions/Container/List"]
|
||||||
|
margin_left = 724.0
|
||||||
|
margin_right = 900.0
|
||||||
|
margin_bottom = 191.0
|
||||||
|
icon = ExtResource( 11 )
|
||||||
|
|
||||||
|
[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"]
|
||||||
|
[connection signal="pressed" from="MoreOptions/Container/List/Remove" to="." method="_on_Remove_pressed"]
|
||||||
|
[connection signal="item_selected" from="MoreOptions/Container/List/Target" to="." method="_on_Target_item_selected"]
|
||||||
|
[connection signal="pressed" from="MoreOptions/Container/List/Reset" to="." method="_on_Reset_pressed"]
|
||||||
|
[connection signal="pressed" from="MoreOptions/Container/List/CloseOptions" to="." method="_on_CloseOptions_pressed"]
|
||||||
|
|
|
@ -39,7 +39,7 @@ __meta__ = {
|
||||||
}
|
}
|
||||||
|
|
||||||
[node name="ListOverlayItem" parent="VSplitContainer/Control/Overlays" instance=ExtResource( 7 )]
|
[node name="ListOverlayItem" parent="VSplitContainer/Control/Overlays" instance=ExtResource( 7 )]
|
||||||
margin_top = 1638.0
|
margin_top = 1717.0
|
||||||
margin_bottom = 1845.0
|
margin_bottom = 1845.0
|
||||||
overlay_name = "MainOverlay"
|
overlay_name = "MainOverlay"
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ func _ready() -> void:
|
||||||
|
|
||||||
|
|
||||||
func add_overlay(type):
|
func add_overlay(type):
|
||||||
OverlayManager.add_overlay(type, type + str(randi()%100))
|
OverlayManager.add_overlay(type, type + " " + str(randi()%1000))
|
||||||
visible = false
|
visible = false
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
extends PanelContainer
|
extends Control
|
||||||
|
|
||||||
export var overlay_name: String
|
export var overlay_name: String
|
||||||
var overlay
|
var overlay
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
overlay = OverlayManager.get_node(overlay_name)
|
overlay = OverlayManager.get_node(overlay_name)
|
||||||
$Label.text = overlay_name
|
$MoreOptions.visible = false
|
||||||
|
$BasicOptions/Label.text = overlay_name
|
||||||
name = overlay_name
|
name = overlay_name
|
||||||
$HBoxContainer/Target.selected = overlay.TARGETS.find(Settings.s.overlays[overlay_name].target)
|
$MoreOptions/Container/List/Target.selected = overlay.TARGETS.find(Settings.s.overlays[overlay_name].target)
|
||||||
overlay.connect("overlay_visibility_changed", self, "_overlay_visibility_changed")
|
overlay.connect("overlay_visibility_changed", self, "_overlay_visibility_changed")
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,27 +17,34 @@ func _on_Visibility_toggled(state: bool) -> void:
|
||||||
overlay.overlay_visible = state
|
overlay.overlay_visible = state
|
||||||
|
|
||||||
|
|
||||||
func _on_Target_item_selected(index: int) -> void:
|
|
||||||
overlay.target = overlay.TARGETS[index]
|
|
||||||
|
|
||||||
|
|
||||||
func _on_Reset_pressed() -> void:
|
|
||||||
overlay.reset_offset()
|
|
||||||
|
|
||||||
|
|
||||||
func _on_Grab_toggled(state: bool) -> void:
|
func _on_Grab_toggled(state: bool) -> void:
|
||||||
overlay.get_node("OverlayInteraction").grab_mode = state
|
overlay.get_node("OverlayInteraction").grab_mode = state
|
||||||
|
|
||||||
|
|
||||||
func _overlay_visibility_changed(state: bool):
|
func _overlay_visibility_changed(state: bool):
|
||||||
$HBoxContainer/Visibility.pressed = state
|
$BasicOptions/List/Visibility.pressed = state
|
||||||
if state:
|
if state:
|
||||||
$HBoxContainer/Visibility.icon = preload("res://icons/visible.svg")
|
$BasicOptions/List/Visibility.icon = preload("res://icons/visible.svg")
|
||||||
else:
|
else:
|
||||||
$HBoxContainer/Visibility.icon = preload("res://icons/hidden.svg")
|
$BasicOptions/List/Visibility.icon = preload("res://icons/hidden.svg")
|
||||||
|
|
||||||
|
|
||||||
func _on_Remove_pressed() -> void:
|
func _on_Remove_pressed() -> void:
|
||||||
if overlay.type and overlay.type != "main":
|
if overlay.type and overlay.type != "main":
|
||||||
OverlayManager.remove_overlay(overlay_name)
|
OverlayManager.remove_overlay(overlay_name)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Reset_pressed() -> void:
|
||||||
|
overlay.reset_offset()
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Target_item_selected(index: int) -> void:
|
||||||
|
overlay.target = overlay.TARGETS[index]
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Options_pressed() -> void:
|
||||||
|
$MoreOptions.visible = true
|
||||||
|
|
||||||
|
|
||||||
|
func _on_CloseOptions_pressed() -> void:
|
||||||
|
$MoreOptions.visible = false
|
||||||
|
|
Loading…
Reference in a new issue