aboutsummaryrefslogtreecommitdiff
path: root/game/addons/zylann.hterrain/tools/load_texture_dialog.gd
diff options
context:
space:
mode:
Diffstat (limited to 'game/addons/zylann.hterrain/tools/load_texture_dialog.gd')
-rw-r--r--game/addons/zylann.hterrain/tools/load_texture_dialog.gd22
1 files changed, 22 insertions, 0 deletions
diff --git a/game/addons/zylann.hterrain/tools/load_texture_dialog.gd b/game/addons/zylann.hterrain/tools/load_texture_dialog.gd
new file mode 100644
index 0000000..6d1e874
--- /dev/null
+++ b/game/addons/zylann.hterrain/tools/load_texture_dialog.gd
@@ -0,0 +1,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)
+