Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions material_maker/globals.gd
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ const DEFAULT_CONFIG : Dictionary = {
auto_size_comment = true,
graph_line_curvature = 0.5,
graph_line_style = 1,
ui_use_native_file_dialogs = true,
}


Expand Down
14 changes: 9 additions & 5 deletions material_maker/windows/file_dialog/file_dialog.gd
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var _content_scale_factor: float = 1.0
var left_panel = null
var volume_option = null

const DIALOG_HACK : bool = true
var dialog_hack : bool = true

signal return_paths(path_list)

Expand All @@ -16,6 +16,8 @@ func _context_menu_about_to_popup(context_menu : PopupMenu):
func _ready() -> void:
if file_mode == FileMode.FILE_MODE_SAVE_FILE:
ok_button_text = tr("Save")

use_native_dialog = mm_globals.get_config("ui_use_native_file_dialogs")
_content_scale_factor = mm_globals.main_window.get_window().content_scale_factor
content_scale_factor = _content_scale_factor

Expand All @@ -31,7 +33,9 @@ func _ready() -> void:
context_menu.about_to_popup.connect(
_context_menu_about_to_popup.bind(context_menu))

if DIALOG_HACK:
dialog_hack = dialog_hack or not use_native_dialog

if dialog_hack:
var vbox = get_vbox()
var hbox = HSplitContainer.new()
add_child(hbox)
Expand Down Expand Up @@ -59,12 +63,12 @@ func get_full_current_dir() -> String:
return prefix+get_current_dir()

func _on_FileDialog_file_selected(path) -> void:
if DIALOG_HACK:
if dialog_hack:
left_panel.add_recent(get_full_current_dir())
emit_signal("return_paths", [ path ])

func _on_FileDialog_files_selected(paths) -> void:
if DIALOG_HACK:
if dialog_hack:
left_panel.add_recent(get_full_current_dir())
emit_signal("return_paths", paths)

Expand All @@ -83,7 +87,7 @@ func select_files() -> Array:
return result

func add_favorite():
if DIALOG_HACK:
if dialog_hack:
left_panel.add_favorite(get_full_current_dir())

func _on_child_entered_tree(node: Node) -> void:
Expand Down
2 changes: 1 addition & 1 deletion material_maker/windows/file_dialog/file_dialog.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
title = "Open a File"
initial_position = 2
size = Vector2i(500, 400)
visible = true
visible = false
ok_button_text = "Open"
file_mode = 0
access = 2
Expand Down
9 changes: 9 additions & 0 deletions material_maker/windows/preferences/preferences.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,15 @@ max_value = 2.0
step = 0.01
float_only = true

[node name="HBoxContainer2" type="HBoxContainer" parent="VBoxContainer/TabContainer/General"]
layout_mode = 2

[node name="GuiUseNativeFileDialogs" parent="VBoxContainer/TabContainer/General/HBoxContainer2" instance=ExtResource("1")]
layout_mode = 2
tooltip_text = "Prefer the use of native file dialogs"
text = "Use native file dialogs"
config_variable = "ui_use_native_file_dialogs"

[node name="Gui3DPreviewResolution" type="HBoxContainer" parent="VBoxContainer/TabContainer/General"]
layout_mode = 2

Expand Down