aboutsummaryrefslogtreecommitdiff
path: root/game/addons/zylann.hterrain/tools/load_texture_dialog.gd
blob: 6d1e8749d6af3412730e17340e8a0daa1fb1cb0f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
@tool
extends EditorFileDialog


func _init():
   #access = EditorFileDialog.ACCESS_RESOURCES
   file_mode = EditorFileDialog.FILE_MODE_OPEN_FILE
   # TODO I actually want a dialog to load a texture, not specifically a PNG...
   add_filter("*.png ; PNG files")
   add_filter("*.jpg ; JPG files")
   unresizable = false
   access = EditorFileDialog.ACCESS_RESOURCES
   close_requested.connect(call_deferred.bind("_on_close"))


func _on_close():
   # Disconnect listeners automatically,
   # so we can re-use the same dialog with different listeners
   var cons = get_signal_connection_list("file_selected")
   for con in cons:
      file_selected.disconnect(con.callable)