immersive-home/app/content/ui/components/tabs/tabs.gd

29 lines
594 B
GDScript3
Raw Normal View History

2024-01-23 18:48:13 +02:00
extends Node3D
class_name Tabs3D
signal on_select(selected: int)
var selected: Node3D
@export var initial_selected: Node3D
var proxy_group = ProxyGroup.new()
func _ready():
if initial_selected != null:
selected = initial_selected
on_select.emit(selected.get_index())
for option in get_children():
if option is Button3D == false:
continue
var proxy = proxy_group.proxy(func():
return selected == option
, func(value: bool):
if value == true:
selected = option
on_select.emit(selected.get_index())
)
option.external_value = proxy
2024-01-23 19:02:41 +02:00
option.toggleable = true