From 8466a378274ee6e8b83bbb2dd895a24efbd135f1 Mon Sep 17 00:00:00 2001 From: CrispyPin Date: Sun, 16 May 2021 12:05:40 +0200 Subject: [PATCH] adjust offsets better --- ovr-utils/Main.tscn | 11 +++---- .../addons/openvr_overlay/overlay_init.gd | 5 +++- ovr-utils/overlays/TimeOverlay.tscn | 30 ++++++++++--------- ovr-utils/overlays/time.gd | 4 ++- 4 files changed, 29 insertions(+), 21 deletions(-) diff --git a/ovr-utils/Main.tscn b/ovr-utils/Main.tscn index c8ebfc1..dba0841 100644 --- a/ovr-utils/Main.tscn +++ b/ovr-utils/Main.tscn @@ -8,16 +8,17 @@ [node name="Overlays" type="Node"] script = ExtResource( 4 ) -[node name="OverlayInstance" parent="." instance=ExtResource( 1 )] +[node name="OverlayInstance FPS" parent="." instance=ExtResource( 1 )] target = 1 overlay_scene = ExtResource( 2 ) offset_pos = Vector3( 0.05, -0.01, 0.15 ) -offset_rot = Vector3( 0, -90, 0 ) +offset_rot = Vector3( 0, -90, -135 ) fallback_to_hmd = true -[node name="OverlayInstance2" parent="." instance=ExtResource( 1 )] +[node name="OverlayInstance Time" parent="." instance=ExtResource( 1 )] target = 1 overlay_scene = ExtResource( 3 ) -offset_pos = Vector3( 0.05, 0, 0.15 ) -offset_rot = Vector3( 0, -90, 0 ) +offset_pos = Vector3( -0.05, 0.02, 0.15 ) +offset_rot = Vector3( 0, -90, -135 ) +width_meters = 0.8 fallback_to_hmd = true diff --git a/ovr-utils/addons/openvr_overlay/overlay_init.gd b/ovr-utils/addons/openvr_overlay/overlay_init.gd index 676549c..358f577 100644 --- a/ovr-utils/addons/openvr_overlay/overlay_init.gd +++ b/ovr-utils/addons/openvr_overlay/overlay_init.gd @@ -2,6 +2,7 @@ extends Node var ovr_interface: ARVRInterface + func _init() -> void: var ovr_config = preload("res://addons/godot-openvr/OpenVRConfig.gdns").new() ovr_config.set_application_type(2) # Set to OVERLAY MODE = 2, NORMAL MODE = 1 @@ -12,7 +13,9 @@ func _init() -> void: if ovr_interface and ovr_interface.initialize(): pass + func _ready() -> void: for i in ARVRServer.get_tracker_count(): var tracker = ARVRServer.get_tracker(i) - print(tracker.get_name(), ": hand ", tracker.get_hand()) + print(tracker.get_name(), ": hand ", tracker.get_hand()) + diff --git a/ovr-utils/overlays/TimeOverlay.tscn b/ovr-utils/overlays/TimeOverlay.tscn index a1ef9ab..50bdb97 100644 --- a/ovr-utils/overlays/TimeOverlay.tscn +++ b/ovr-utils/overlays/TimeOverlay.tscn @@ -1,8 +1,15 @@ -[gd_scene load_steps=4 format=2] +[gd_scene load_steps=5 format=2] [ext_resource path="res://overlays/time.gd" type="Script" id=1] [ext_resource path="res://fonts/OpenSans-Regular.ttf" type="DynamicFontData" id=2] +[sub_resource type="StyleBoxFlat" id=2] +bg_color = Color( 0, 0, 0, 0.705882 ) +expand_margin_left = 8.0 +expand_margin_right = 8.0 +expand_margin_top = 8.0 +expand_margin_bottom = 8.0 + [sub_resource type="DynamicFont" id=1] size = 48 font_data = ExtResource( 2 ) @@ -16,29 +23,24 @@ __meta__ = { "_edit_use_anchors_": false } -[node name="ColorRect" type="ColorRect" parent="."] +[node name="ColorRect" type="PanelContainer" parent="."] anchor_left = 0.5 anchor_top = 0.5 anchor_right = 0.5 anchor_bottom = 0.5 -margin_left = -222.0 +margin_left = -60.0 margin_top = -32.0 -margin_right = 222.0 -margin_bottom = 32.0 -color = Color( 0, 0, 0, 0.705882 ) +margin_right = 61.0 +margin_bottom = 35.0 +size_flags_horizontal = 0 +custom_styles/panel = SubResource( 2 ) __meta__ = { "_edit_use_anchors_": false } [node name="Label" type="Label" parent="ColorRect"] -anchor_left = 0.5 -anchor_top = 0.5 -anchor_right = 0.5 -anchor_bottom = 0.5 -margin_left = -512.0 -margin_top = -33.5 -margin_right = 512.0 -margin_bottom = 33.5 +margin_right = 121.0 +margin_bottom = 67.0 custom_fonts/font = SubResource( 1 ) text = "00:00" align = 1 diff --git a/ovr-utils/overlays/time.gd b/ovr-utils/overlays/time.gd index 84c9598..dc36182 100644 --- a/ovr-utils/overlays/time.gd +++ b/ovr-utils/overlays/time.gd @@ -4,12 +4,14 @@ extends Label func _ready() -> void: pass + func _process(delta: float) -> void: _update_time() + func _update_time(): var h = str(OS.get_time().hour) var m = str(OS.get_time().minute) h = h if len(h) == 2 else "0" + h m = m if len(m) == 2 else "0" + m - text = "%s:%s" % [h, m] + text = h + ":" + m