mirror of
https://github.com/CrispyPin/ovr-utils.git
synced 2024-11-22 15:40:25 +01:00
add dropdown to ui demo that changes tracking target
This commit is contained in:
parent
1c27c7f6b2
commit
d2e4c28a86
4 changed files with 26 additions and 18 deletions
|
@ -1,14 +0,0 @@
|
|||
extends Control
|
||||
|
||||
var ihandler
|
||||
|
||||
func _ready() -> void:
|
||||
ihandler = get_viewport().get_node("../OverlayInteraction")
|
||||
|
||||
|
||||
func _on_DragButton_button_down() -> void:
|
||||
ihandler.begin_move()
|
||||
|
||||
|
||||
func _on_DragButton_button_up() -> void:
|
||||
ihandler.finish_move()
|
|
@ -14,10 +14,10 @@ export var width_meters = 0.4 setget set_width_in_meters
|
|||
# if this is exported, all overlays sync offset when a controller is turned off/on
|
||||
# this seems to be a bug with the godot editor-
|
||||
var offsets:Dictionary = {
|
||||
"head": {"pos": Vector3(), "rot": Quat()},
|
||||
"head": {"pos": Vector3(0,0,-0.4), "rot": Quat()},
|
||||
"left": {"pos": Vector3(), "rot": Quat()},
|
||||
"right": {"pos": Vector3(), "rot": Quat()},
|
||||
"world": {"pos": Vector3(), "rot": Quat()}
|
||||
"world": {"pos": Vector3(0,1,0), "rot": Quat()}
|
||||
}
|
||||
|
||||
# what's actually tracking
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[gd_scene load_steps=9 format=2]
|
||||
|
||||
[ext_resource path="res://addons/openvr_overlay/move_overlay.gd" type="Script" id=1]
|
||||
[ext_resource path="res://overlays/move_overlay.gd" type="Script" id=1]
|
||||
[ext_resource path="res://fonts/OpenSans-Regular.ttf" type="DynamicFontData" id=2]
|
||||
[ext_resource path="res://fonts/OpenSans-Bold.ttf" type="DynamicFontData" id=3]
|
||||
|
||||
|
@ -47,7 +47,6 @@ margin_right = 111.0
|
|||
margin_bottom = 41.0
|
||||
theme = SubResource( 2 )
|
||||
text = "Item 0"
|
||||
items = [ "Item 0", null, false, 0, null, "Item 1", null, false, 1, null, "Item 2", null, false, 2, null, "Item 3", null, false, 3, null ]
|
||||
selected = 0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
|
@ -66,5 +65,6 @@ __meta__ = {
|
|||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[connection signal="item_selected" from="OptionButton" to="." method="_on_OptionButton_item_selected"]
|
||||
[connection signal="button_down" from="DragButton" to="." method="_on_DragButton_button_down"]
|
||||
[connection signal="button_up" from="DragButton" to="." method="_on_DragButton_button_up"]
|
||||
|
|
22
ovr-utils/overlays/move_overlay.gd
Normal file
22
ovr-utils/overlays/move_overlay.gd
Normal file
|
@ -0,0 +1,22 @@
|
|||
extends Control
|
||||
|
||||
var ihandler
|
||||
var oinst
|
||||
|
||||
func _ready() -> void:
|
||||
oinst = get_viewport().get_parent()
|
||||
ihandler = get_viewport().get_node("../OverlayInteraction")
|
||||
for t in oinst.TARGETS:
|
||||
$OptionButton.add_item(t)
|
||||
$OptionButton.selected = oinst.TARGETS.find(oinst.target)
|
||||
|
||||
func _on_DragButton_button_down() -> void:
|
||||
ihandler.begin_move()
|
||||
|
||||
|
||||
func _on_DragButton_button_up() -> void:
|
||||
ihandler.finish_move()
|
||||
|
||||
|
||||
func _on_OptionButton_item_selected(index: int) -> void:
|
||||
oinst.target = oinst.TARGETS[index]
|
Loading…
Reference in a new issue