Improve file dialog filters
This commit is contained in:
parent
62bff79339
commit
578ecb1d01
2 changed files with 14 additions and 5 deletions
|
@ -24,6 +24,14 @@ enum Status {OKAY, ERROR, UNKNOWN = -1}
|
|||
|
||||
#
|
||||
|
||||
func _ready() -> void:
|
||||
var exts = []
|
||||
for e in main.BATCH_MODE_SUPPORTED_EXTS:
|
||||
exts.append("*" + e)
|
||||
open_image_dialog.add_filter(", ".join(exts), "Image")
|
||||
open_shader_dialog.add_filter("*.gdshader", "Shader")
|
||||
save_image_dialog.add_filter("*.png", "Image")
|
||||
|
||||
func _input(event):
|
||||
if event.is_action_pressed("apply_shader"):
|
||||
_on_apply_shader_button_pressed()
|
||||
|
@ -33,8 +41,12 @@ func _input(event):
|
|||
#
|
||||
|
||||
func set_buttons_disabled(disabled: bool):
|
||||
for b in [open_shader_button, open_image_button, save_image_button, fit_image_button, apply_shader_button, status_indicator]:
|
||||
b.disabled = disabled
|
||||
if disabled:
|
||||
for b in [open_shader_button, open_image_button, save_image_button, fit_image_button, apply_shader_button, status_indicator]:
|
||||
b.disabled = disabled
|
||||
else:
|
||||
for b in [open_shader_button, open_image_button, fit_image_button, apply_shader_button, status_indicator]:
|
||||
b.disabled = disabled
|
||||
|
||||
#
|
||||
|
||||
|
|
|
@ -83,7 +83,6 @@ ok_button_text = "Open"
|
|||
mode_overrides_title = false
|
||||
file_mode = 0
|
||||
access = 2
|
||||
filters = PackedStringArray("*.gdshader")
|
||||
use_native_dialog = true
|
||||
|
||||
[node name="OpenImageDialog" type="FileDialog" parent="CanvasLayer/MainUI"]
|
||||
|
@ -95,7 +94,6 @@ ok_button_text = "Open"
|
|||
mode_overrides_title = false
|
||||
file_mode = 0
|
||||
access = 2
|
||||
filters = PackedStringArray("*.png", "*.jpg", "*.jpeg")
|
||||
use_native_dialog = true
|
||||
|
||||
[node name="SaveImageDialog" type="FileDialog" parent="CanvasLayer/MainUI"]
|
||||
|
@ -105,7 +103,6 @@ title = "Export Image"
|
|||
size = Vector2i(661, 175)
|
||||
mode_overrides_title = false
|
||||
access = 2
|
||||
filters = PackedStringArray("*.png")
|
||||
use_native_dialog = true
|
||||
|
||||
[node name="ErrorMessageDialog" type="AcceptDialog" parent="CanvasLayer/MainUI"]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue