aboutsummaryrefslogtreecommitdiff
path: root/game/addons/zylann.hterrain/tools/progress_window.gd
blob: 791717f6e90f7f2d6a74650932b36cf3a03255b4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
@tool
extends AcceptDialog


#onready var _label = get_node("VBoxContainer/Label")
@onready var _progress_bar : ProgressBar = $VBoxContainer/ProgressBar


func _init():
   get_ok_button().hide()


func _show_progress(message, progress):
   self.title = message
   _progress_bar.ratio = progress


func handle_progress(info: Dictionary):
   if info.has("finished") and info.finished:
      hide()
   
   else:
      if not visible:
         popup_centered()
      
      var message = ""
      if info.has("message"):
         message = info.message
      
      _show_progress(info.message, info.progress)
      # TODO Have builtin modal progress bar
      # https://github.com/godotengine/godot/issues/17763