add panel container so overlays will be able to be selected (planned feature)

This commit is contained in:
Crispy 2021-05-16 20:15:56 +02:00
parent c64a5c9ba4
commit 3bdb121060
4 changed files with 10 additions and 10 deletions

View file

@ -7,7 +7,7 @@
script = ExtResource( 1 )
[node name="OverlayViewport" type="Viewport" parent="."]
size = Vector2( 2160, 2160 )
size = Vector2( 100, 100 )
transparent_bg = true
handle_input_locally = false
msaa = 3
@ -16,4 +16,8 @@ render_target_update_mode = 3
script = ExtResource( 3 )
overlay_width_in_meters = 0.4
[node name="PanelContainer" type="PanelContainer" parent="OverlayViewport"]
anchor_right = 1.0
anchor_bottom = 1.0
[node name="Offset" type="Spatial" parent="."]

View file

@ -18,16 +18,12 @@ func _ready() -> void:
$OverlayViewport.overlay_width_in_meters = width_meters
$OverlayViewport.size = OverlayInit.ovr_interface.get_render_targetsize()
if overlay_scene:
$OverlayViewport.add_child(overlay_scene.instance())
$OverlayViewport/PanelContainer.add_child(overlay_scene.instance())
update_tracker_id()
update_offset()
#func _process(_delta: float) -> void:
# update_offset()
func update_tracker_id() -> void:
_tracker_id = -1
@ -49,7 +45,7 @@ func update_tracker_id() -> void:
func update_offset() -> void:
$Offset.translation = offset_pos
$Offset.rotation_degrees = offset_rot
print(_tracker_id)
# print(_tracker_id)
match target:
TARGETS.head:
$OverlayViewport.track_relative_to_device(0, $Offset.transform)
@ -92,7 +88,7 @@ func _set_width_meters(width: float):
func _set_overlay_scene(scene: PackedScene):
overlay_scene = scene
if $OverlayViewport.get_children():
$OverlayViewport.get_child(0).queue_free()
$OverlayViewport.add_child(overlay_scene.instance())
if $OverlayViewport/PanelContainer.get_children():
$OverlayViewport/PanelContainer.get_child(0).queue_free()
$OverlayViewport/PanelContainer.add_child(overlay_scene.instance())

Binary file not shown.