EditorPopupMenu.gd 434 B

123456789101112131415161718192021222324
  1. extends Control
  2. var active := false
  3. signal closed
  4. func _ready() -> void:
  5. set_process(false)
  6. func _process(_delta: float) -> void:
  7. if Input.is_action_just_pressed("ui_cancel") or Input.is_action_just_pressed("editor_open_menu"):
  8. close()
  9. func open() -> void:
  10. set_process(true)
  11. show()
  12. active = true
  13. func close() -> void:
  14. set_process(false)
  15. hide()
  16. active = false
  17. await get_tree().create_timer(0.1).timeout
  18. closed.emit()