mirror of
https://github.com/CrispyPin/ovr-utils.git
synced 2024-11-22 15:40:25 +01:00
highlight selected overlays when in grab mode
This commit is contained in:
parent
b4df1ff599
commit
78c6fd76c1
2 changed files with 19 additions and 2 deletions
|
@ -1,8 +1,16 @@
|
||||||
[gd_scene load_steps=3 format=2]
|
[gd_scene load_steps=4 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://addons/openvr_overlay/overlay_instance.gd" type="Script" id=1]
|
[ext_resource path="res://addons/openvr_overlay/overlay_instance.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://addons/godot-openvr/OpenVROverlay.gdns" type="Script" id=3]
|
[ext_resource path="res://addons/godot-openvr/OpenVROverlay.gdns" type="Script" id=3]
|
||||||
|
|
||||||
|
[sub_resource type="StyleBoxFlat" id=1]
|
||||||
|
bg_color = Color( 0, 1, 1, 0.231373 )
|
||||||
|
border_width_left = 24
|
||||||
|
border_width_top = 24
|
||||||
|
border_width_right = 24
|
||||||
|
border_width_bottom = 24
|
||||||
|
border_color = Color( 0, 0.784314, 1, 0.611765 )
|
||||||
|
|
||||||
[node name="OverlayInstance" type="Spatial"]
|
[node name="OverlayInstance" type="Spatial"]
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 1 )
|
||||||
|
|
||||||
|
@ -22,3 +30,10 @@ overlay_width_in_meters = 0.4
|
||||||
[node name="Container" type="Control" parent="OverlayViewport"]
|
[node name="Container" type="Control" parent="OverlayViewport"]
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
|
|
||||||
|
[node name="Selected" type="Panel" parent="OverlayViewport"]
|
||||||
|
visible = false
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
mouse_filter = 2
|
||||||
|
custom_styles/panel = SubResource( 1 )
|
||||||
|
|
|
@ -56,6 +56,7 @@ func _on_OverlayArea_entered(body: Node) -> void:
|
||||||
return
|
return
|
||||||
touch_state = true
|
touch_state = true
|
||||||
active_controller = body.get_parent().name
|
active_controller = body.get_parent().name
|
||||||
|
get_parent().get_node("OverlayViewport/Selected").visible = Settings.s.grab_mode
|
||||||
emit_signal("touch_on")
|
emit_signal("touch_on")
|
||||||
|
|
||||||
|
|
||||||
|
@ -65,13 +66,14 @@ func _on_OverlayArea_exited(body: Node) -> void:
|
||||||
# TODO revert to other controller if both were touching (edge case)
|
# TODO revert to other controller if both were touching (edge case)
|
||||||
active_controller = ""
|
active_controller = ""
|
||||||
touch_state = false
|
touch_state = false
|
||||||
|
get_parent().get_node("OverlayViewport/Selected").visible = false
|
||||||
emit_signal("touch_off")
|
emit_signal("touch_off")
|
||||||
|
|
||||||
|
|
||||||
func _update_width():
|
func _update_width():
|
||||||
var ratio = OverlayInit.ovr_interface.get_render_targetsize()
|
var ratio = OverlayInit.ovr_interface.get_render_targetsize()
|
||||||
var extents = get_parent().width_meters * 0.5
|
var extents = get_parent().width_meters * 0.5
|
||||||
_overlay_area.get_child(0).shape.set_extents(Vector3(extents, extents * ratio.y/ratio.x, 0.1))
|
_overlay_area.get_child(0).shape.set_extents(Vector3(extents, extents * ratio.y/ratio.x, 0.05))
|
||||||
|
|
||||||
|
|
||||||
func _update_offset():
|
func _update_offset():
|
||||||
|
|
Loading…
Reference in a new issue