main menu loads a list of overlays, individual grabbing and setting tracking implemented

This commit is contained in:
Crispy 2021-05-30 20:12:16 +02:00
parent 634ea013b7
commit 6c15e9ff5f
24 changed files with 260 additions and 38 deletions

View file

@ -1,13 +1,18 @@
[gd_scene load_steps=4 format=2]
[gd_scene load_steps=9 format=2]
[ext_resource path="res://menu.theme" type="Theme" id=1]
[ext_resource path="res://styles/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]
[ext_resource path="res://icons/move.svg" type="Texture" id=4]
[ext_resource path="res://icons/remove.svg" type="Texture" id=5]
[ext_resource path="res://icons/reset.svg" type="Texture" id=6]
[ext_resource path="res://icons/size.svg" type="Texture" id=7]
[ext_resource path="res://icons/hand_r.svg" type="Texture" id=8]
[node name="ListOverlayItem" type="PanelContainer"]
margin_top = 1727.0
margin_right = 2048.0
margin_bottom = 1855.0
margin_bottom = 1920.0
rect_min_size = Vector2( 100, 128 )
theme = ExtResource( 1 )
script = ExtResource( 3 )
@ -16,25 +21,63 @@ __meta__ = {
}
[node name="Label" type="Label" parent="."]
margin_left = 7.0
margin_top = 10.0
margin_right = 2041.0
margin_bottom = 185.0
margin_left = 8.0
margin_top = 16.0
margin_right = 2040.0
margin_bottom = 191.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
margin_left = 8.0
margin_top = 8.0
margin_right = 2040.0
margin_bottom = 199.0
alignment = 2
[node name="Remove" type="Button" parent="HBoxContainer"]
margin_left = 1006.0
margin_right = 1182.0
margin_bottom = 191.0
toggle_mode = true
icon = ExtResource( 5 )
[node name="Reset" type="Button" parent="HBoxContainer"]
margin_left = 1186.0
margin_right = 1362.0
margin_bottom = 191.0
icon = ExtResource( 6 )
[node name="Target" type="OptionButton" parent="HBoxContainer"]
margin_left = 1366.0
margin_right = 1492.0
margin_bottom = 191.0
text = "H"
items = [ "H", null, false, 0, null, "L", ExtResource( 8 ), false, 1, null, "R", ExtResource( 8 ), false, 2, null, "W", null, false, 3, null ]
selected = 0
[node name="Size" type="Button" parent="HBoxContainer"]
margin_left = 1496.0
margin_right = 1672.0
margin_bottom = 191.0
toggle_mode = true
icon = ExtResource( 7 )
[node name="Grab" type="Button" parent="HBoxContainer"]
margin_left = 1676.0
margin_right = 1852.0
margin_bottom = 191.0
toggle_mode = true
icon = ExtResource( 4 )
[node name="Visibility" type="Button" parent="HBoxContainer"]
margin_left = 1862.0
margin_right = 2034.0
margin_bottom = 181.0
margin_left = 1856.0
margin_right = 2032.0
margin_bottom = 191.0
toggle_mode = true
pressed = true
icon = ExtResource( 2 )
[connection signal="pressed" from="HBoxContainer/Reset" to="." method="_on_Reset_pressed"]
[connection signal="item_selected" from="HBoxContainer/Target" to="." method="_on_Target_item_selected"]
[connection signal="toggled" from="HBoxContainer/Grab" to="." method="_on_Grab_toggled"]
[connection signal="toggled" from="HBoxContainer/Visibility" to="." method="_on_Visibility_toggled"]

View file

@ -9,6 +9,6 @@
[node name="OverlayManager" type="Node" parent="."]
script = ExtResource( 6 )
[node name="OverlayInstance" parent="OverlayManager" instance=ExtResource( 1 )]
[node name="MainOverlay" parent="OverlayManager" instance=ExtResource( 1 )]
overlay_scene = ExtResource( 2 )
add_cursor = true

View file

@ -23,7 +23,7 @@ func _ready() -> void:
func _trigger_on():
if Settings.s.grab_mode:
if Settings.s.grab_mode or _interaction.grab_mode:
begin_move()

View file

@ -5,8 +5,9 @@ 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 touch_state := false
var trigger_state := false
var grab_mode := false
# controller that currently the trigger down
var active_controller := ""
@ -56,7 +57,7 @@ func _on_OverlayArea_entered(body: Node) -> void:
return
touch_state = true
active_controller = body.get_parent().name
get_parent().get_node("OverlayViewport/Selected").visible = Settings.s.grab_mode
get_parent().get_node("OverlayViewport/Selected").visible = Settings.s.grab_mode or grab_mode
emit_signal("touch_on")

View file

@ -185,6 +185,15 @@ func set_overlay_scene(scene: PackedScene):
container.add_child(overlay_scene.instance())
func reset_offset():
_offsets[current_target].rot = Quat()
_offsets[current_target].pos = Vector3()
if current_target == "world":
_offsets[current_target].pos.z = -0.5
update_offset()
save_settings()
func _notification(what: int) -> void:
if what == NOTIFICATION_TRANSFORM_CHANGED:
update_offset()

View file

@ -59,7 +59,7 @@ const DEF = {
}
},
"default": {
"main": {
"MainOverlay": {
"type": "MainOverlay",
"width": 0.4,
"target": "left",

View file

@ -1 +1 @@
<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><g fill="#e0e0e0" transform="translate(-26.001 -1046.2683)"><path d="m27.917081 1047.5557c-.422624 0-.763672.3411-.763672.7637v11.8301c0 .4226.341048.7637.763672.7637h12.507813c.422624 0 .761719-.3411.761719-.7637v-11.8301c0-.4226-.339095-.7637-.761719-.7637zm1.898438 1.6954h8.642578c.422624 0 .763672.341.763672.7636v8.5078c0 .4227-.341048.7618-.763672.7618h-8.642578c-.422625 0-.763672-.3391-.763672-.7618v-8.5078c0-.4226.341047-.7636.763672-.7636z"/><rect height="2.372881" ry=".76286" width="7.79661" x="30.20439" y="1052.9802"/><rect height="7.525424" ry=".729978" stroke-width=".882536" width="2.372881" x="32.916256" y="1050.3361"/></g></svg>
<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>

Before

Width:  |  Height:  |  Size: 734 B

After

Width:  |  Height:  |  Size: 149 B

View file

@ -0,0 +1 @@
<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m10 1a1 1 0 0 0 -1 1v6h-1v-5a1 1 0 0 0 -1-1 1 1 0 0 0 -1 1v8 .033203l-2.4746-1.8086c-.52015-.3803-1.1948-.4556-1.6504 0-.45566.4556-.45561 1.1948 0 1.6504l4.125 4.125h6a2 2 0 0 0 2-2v-5-4a1 1 0 0 0 -1-1 1 1 0 0 0 -1 1v4h-1v-6a1 1 0 0 0 -1-1z" fill="#e0e0e0" fill-opacity=".99608"/></svg>

After

Width:  |  Height:  |  Size: 380 B

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/hand_r.svg-acd4ed4e6db8416fe852bbec606de215.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://icons/hand_r.svg"
dest_files=[ "res://.import/hand_r.svg-acd4ed4e6db8416fe852bbec606de215.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
ovr-utils/icons/move.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.9844 1.002a1.0001 1.0001 0 0 0 -.69141.29102l-2 2 1.4141 1.4141 1.293-1.293 1.293 1.293 1.4141-1.4141-2-2a1.0001 1.0001 0 0 0 -.72266-.29102zm-4.6914 4.291-2 2a1.0001 1.0001 0 0 0 0 1.4141l2 2 1.4141-1.4141-1.293-1.293 1.293-1.293-1.4141-1.4141zm9.4141 0-1.4141 1.4141 1.293 1.293-1.293 1.293 1.4141 1.4141 2-2a1.0001 1.0001 0 0 0 0-1.4141l-2-2zm-4.707.70703a2 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-2zm-1.293 5.293-1.4141 1.4141 2 2a1.0001 1.0001 0 0 0 1.4141 0l2-2-1.4141-1.4141-1.293 1.293-1.293-1.293z" fill="#e0e0e0" fill-opacity=".99608"/></svg>

After

Width:  |  Height:  |  Size: 662 B

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/move.svg-769d9a61af1be19356fb6cc2fedb4397.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://icons/move.svg"
dest_files=[ "res://.import/move.svg-769d9a61af1be19356fb6cc2fedb4397.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

View file

@ -1 +1 @@
<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m4 7v-2l-3 3 3 3v-2h8v2l3-3-3-3v2z" fill="#e0e0e0" fill-opacity=".99608"/></svg>
<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m9 1a1 1 0 0 0 -1 1 1 1 0 0 0 1 1h2.5859l-1.293 1.293 1.4141 1.4141 1.293-1.293v2.5859a1 1 0 0 0 1 1 1 1 0 0 0 1-1v-5a1.0001 1.0001 0 0 0 -1-1zm-1 5a2 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-2zm-6 2a1 1 0 0 0 -1 1v5a1.0001 1.0001 0 0 0 1 1h5a1 1 0 0 0 1-1 1 1 0 0 0 -1-1h-2.5859l1.293-1.293-1.4141-1.4141-1.293 1.293v-2.5859a1 1 0 0 0 -1-1z" fill="#e0e0e0" fill-opacity=".99608"/></svg>

Before

Width:  |  Height:  |  Size: 173 B

After

Width:  |  Height:  |  Size: 493 B

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 1v4h2v-4zm-6 6v2h4v-2zm10 0v2h4v-2zm-4 4v4h2v-4z" fill="#fc9c9c" fill-opacity=".99608"/></svg>

After

Width:  |  Height:  |  Size: 190 B

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/target.svg-39090ce3e818f4facf7f77d9c62c8a63.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://icons/target.svg"
dest_files=[ "res://.import/target.svg-39090ce3e818f4facf7f77d9c62c8a63.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

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 1a1 1 0 0 0 -1 1v2a1 1 0 0 0 1 1h2v-1h-1-1v-2h8v2h-2v1h2a1 1 0 0 0 1-1v-2a1 1 0 0 0 -1-1zm4 2a1 1 0 0 0 -1 1v7 .033203l-2.4746-1.8086c-.52015-.3803-1.1948-.4556-1.6504 0-.45566.4556-.45561 1.1948 0 1.6504l4.125 4.125h6c1.1046 0 2-.8954 2-2v-5h-6v-4a1 1 0 0 0 -1-1z" fill="#a5b7f3" fill-opacity=".98824"/></svg>

After

Width:  |  Height:  |  Size: 406 B

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/touch.svg-f1357a34a6f400ba02ad51eed084a137.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://icons/touch.svg"
dest_files=[ "res://.import/touch.svg-f1357a34a6f400ba02ad51eed084a137.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.

View file

@ -1,9 +1,12 @@
extends PanelContainer
export var overlay_name: String
var overlay
func _ready() -> void:
overlay = get_node("/root/Main/OverlayManager").get_child(1)
overlay = get_node("/root/Main/OverlayManager").get_node(overlay_name)
$Label.text = overlay_name
$HBoxContainer/Target.selected = overlay.TARGETS.find(overlay.target)
func _on_Visibility_toggled(state: bool) -> void:
@ -12,3 +15,15 @@ func _on_Visibility_toggled(state: bool) -> void:
$HBoxContainer/Visibility.icon = preload("res://icons/visible.svg")
else:
$HBoxContainer/Visibility.icon = preload("res://icons/hidden.svg")
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:
overlay.get_node("OverlayInteraction").grab_mode = state

View file

@ -2,6 +2,10 @@ extends Control
func _ready() -> void:
for o in Settings.s.overlays:
var new = preload("res://ListOverlayItem.tscn").instance()
new.overlay_name = o
$VSplitContainer/Control/Overlays.add_child(new)
$VSplitContainer/Control/Overlays.visible = false
@ -12,3 +16,7 @@ func _on_GrabMode_toggled(state: bool) -> void:
func _on_ShowOverlays_toggled(state: bool) -> void:
$VSplitContainer/Control/Overlays.visible = state
func _on_AddOverlay_pressed() -> void:
pass # Replace with function body.

View file

@ -1,8 +1,10 @@
[gd_scene load_steps=4 format=2]
[gd_scene load_steps=6 format=2]
[ext_resource path="res://overlay_scripts/main_menu.gd" type="Script" id=1]
[ext_resource path="res://menu.theme" type="Theme" id=2]
[ext_resource path="res://ListOverlayItem.tscn" type="PackedScene" id=3]
[ext_resource path="res://styles/menu.theme" type="Theme" id=2]
[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]
[node name="MainOverlay" type="Control"]
anchor_right = 1.0
@ -22,7 +24,7 @@ __meta__ = {
[node name="Control" type="Control" parent="VSplitContainer"]
margin_right = 2048.0
margin_bottom = 1855.0
margin_bottom = 1845.0
size_flags_vertical = 3
[node name="Overlays" type="VBoxContainer" parent="VSplitContainer/Control"]
@ -34,11 +36,8 @@ __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_top = 1857.0
margin_right = 2048.0
margin_bottom = 2048.0
__meta__ = {
@ -46,17 +45,24 @@ __meta__ = {
}
[node name="GrabMode" type="Button" parent="VSplitContainer/MainBar"]
margin_right = 716.0
margin_bottom = 181.0
margin_right = 176.0
margin_bottom = 191.0
toggle_mode = true
text = "Grab mode"
icon = ExtResource( 5 )
[node name="ShowOverlays" type="Button" parent="VSplitContainer/MainBar"]
margin_left = 720.0
margin_right = 1294.0
margin_bottom = 181.0
margin_left = 180.0
margin_right = 356.0
margin_bottom = 191.0
toggle_mode = true
text = "Overlays"
icon = ExtResource( 6 )
[node name="AddOverlay" type="Button" parent="VSplitContainer/MainBar"]
margin_left = 360.0
margin_right = 536.0
margin_bottom = 191.0
icon = ExtResource( 4 )
[connection signal="toggled" from="VSplitContainer/MainBar/GrabMode" to="." method="_on_GrabMode_toggled"]
[connection signal="toggled" from="VSplitContainer/MainBar/ShowOverlays" to="." method="_on_ShowOverlays_toggled"]
[connection signal="pressed" from="VSplitContainer/MainBar/AddOverlay" to="." method="_on_AddOverlay_pressed"]

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
ovr-utils/styles/menu.theme Normal file

Binary file not shown.