Skip to content

Commit

Permalink
Add a variable in Global for setting file dialogs as native, and add …
Browse files Browse the repository at this point in the history
…a "FileDialogs" node group

This settings is not exposed in the preferences in this commit
  • Loading branch information
OverloadedOrama committed Jan 24, 2024
1 parent b08420d commit 4bc0fba
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 10 deletions.
14 changes: 11 additions & 3 deletions src/Autoload/Global.gd
Original file line number Diff line number Diff line change
Expand Up @@ -148,16 +148,23 @@ var integer_zoom := false:
zoom_slider.step = 1
zoom_slider.value = zoom_slider.value # to trigger signal emission

## Found in Preferences. The scale of the Interface.
## Found in Preferences. The scale of the interface.
var shrink := 1.0
## Found in Preferences. The font size used by the Interface.
## Found in Preferences. The font size used by the interface.
var font_size := 16:
set(value):
font_size = value
control.theme.default_font_size = value
control.theme.set_font_size("font_size", "HeaderSmall", value + 2)
## Found in Preferences. If [code]true[/code], the Interface dims on popups.
## Found in Preferences. If [code]true[/code], the interface dims on popups.
var dim_on_popup := true
var use_native_file_dialogs := false:
set(value):
use_native_file_dialogs = value
if not is_inside_tree():
await tree_entered
await get_tree().process_frame
get_tree().set_group(&"FileDialogs", "use_native_dialog", value)
## Found in Preferences. The modulation color (or simply color) of icons.
var modulate_icon_color := Color.GRAY
## Found in Preferences. Determines if [member modulate_icon_color] uses custom or theme color.
Expand Down Expand Up @@ -1055,6 +1062,7 @@ func create_ui_for_shader_uniforms(
file_dialog.access = FileDialog.ACCESS_FILESYSTEM
file_dialog.size = Vector2(384, 281)
file_dialog.file_selected.connect(file_selected.bind(u_name))
file_dialog.use_native_dialog = use_native_file_dialogs
var button := Button.new()
button.text = "Load texture"
button.pressed.connect(file_dialog.popup_centered)
Expand Down
2 changes: 1 addition & 1 deletion src/Palette/EditPaletteDialog.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ text = "Delete Palette?"
horizontal_alignment = 1
vertical_alignment = 1

[node name="ExportFileDialog" type="FileDialog" parent="."]
[node name="ExportFileDialog" type="FileDialog" parent="." groups=["FileDialogs"]]
size = Vector2i(677, 400)
access = 2
filters = PackedStringArray("*.png ; PNG Image", "*.jpg,*.jpeg ; JPEG Image", "*.webp ; WebP Image")
Expand Down
2 changes: 1 addition & 1 deletion src/Preferences/PreferencesDialog.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -1320,7 +1320,7 @@ grow_horizontal = 2
grow_vertical = 2
mouse_filter = 2

[node name="AddExtensionFileDialog" type="FileDialog" parent="Popups"]
[node name="AddExtensionFileDialog" type="FileDialog" parent="Popups" groups=["FileDialogs"]]
mode = 1
title = "Open File(s)"
size = Vector2i(560, 400)
Expand Down
2 changes: 1 addition & 1 deletion src/Tools/3DTools/3DShapeEdit.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,7 @@ script = ExtResource("5")
wait_time = 0.2
one_shot = true

[node name="LoadModelDialog" type="FileDialog" parent="." index="6"]
[node name="LoadModelDialog" type="FileDialog" parent="." index="6" groups=["FileDialogs"]]
mode = 1
title = "Open File(s)"
size = Vector2i(558, 300)
Expand Down
2 changes: 1 addition & 1 deletion src/UI/Dialogs/ExportDialog.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ offset_right = 692.0
offset_bottom = 551.0
mouse_filter = 2

[node name="PathDialog" type="FileDialog" parent="Popups"]
[node name="PathDialog" type="FileDialog" parent="Popups" groups=["FileDialogs"]]
mode = 2
title = "Open a Directory"
size = Vector2i(675, 500)
Expand Down
2 changes: 1 addition & 1 deletion src/UI/Dialogs/ImageEffects/ShaderEffect.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ text = "No shader loaded!"
[node name="ShaderParams" type="VBoxContainer" parent="VBoxContainer"]
layout_mode = 2

[node name="FileDialog" type="FileDialog" parent="."]
[node name="FileDialog" type="FileDialog" parent="." groups=["FileDialogs"]]
access = 2
filters = PackedStringArray("*gdshader; Godot Shader File")
show_hidden_files = true
Expand Down
2 changes: 1 addition & 1 deletion src/UI/Dialogs/OpenSprite.tscn
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[gd_scene format=3 uid="uid://b3aeqj2k58wdk"]

[node name="OpenSprite" type="FileDialog"]
[node name="OpenSprite" type="FileDialog" groups=["FileDialogs"]]
title = "Open File(s)"
size = Vector2i(558, 400)
exclusive = false
Expand Down
2 changes: 1 addition & 1 deletion src/UI/Dialogs/SaveSprite.tscn
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[gd_scene format=3 uid="uid://d4euwo633u33b"]

[node name="SaveSprite" type="FileDialog"]
[node name="SaveSprite" type="FileDialog" groups=["FileDialogs"]]
size = Vector2i(675, 400)
exclusive = false
popup_window = true
Expand Down

0 comments on commit 4bc0fba

Please sign in to comment.