LevelEditorTab.gd 619 B

12345678910111213141516171819202122232425
  1. extends MarginContainer
  2. static var current_tab = null
  3. @export var icon: Texture = null
  4. @export var title := ""
  5. @export var linked_control: Control = null
  6. @export var first_pick := false
  7. func _ready() -> void:
  8. if first_pick:
  9. tab_clicked()
  10. $HBoxContainer/Label.text = title
  11. $HBoxContainer/TextureRect.texture = icon
  12. update()
  13. func update() -> void:
  14. print(current_tab == self)
  15. $HBoxContainer/Label.visible = current_tab == self
  16. $Selected.visible = current_tab == self
  17. linked_control.visible = current_tab == self
  18. func tab_clicked() -> void:
  19. current_tab = self
  20. get_tree().call_group("EditorTabs", "update")