-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathMenuButton.gd
More file actions
37 lines (28 loc) · 743 Bytes
/
MenuButton.gd
File metadata and controls
37 lines (28 loc) · 743 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
extends MenuButton
@onready var file_dialog = $FileDialog
signal model_load_triggered(path)
func _ready():
var popup = get_popup()
popup.connect("id_pressed", file_menu)
func file_menu(id):
match id:
0:
file_dialog.file_mode = 0
file_dialog.add_filter('glb')
file_dialog.add_filter('gltf')
file_dialog.ok_button_text = 'Select 3D model'
file_dialog.show()
1:
file_dialog.file_mode = 2
file_dialog.clear_filters()
file_dialog.ok_button_text = 'Select directory to save sprite sheets'
file_dialog.show()
print("open")
2:
print("save")
3:
get_tree().quit()
func get_dir():
file_dialog.show()
func _on_load_model_file_dialog_file_selected(path):
emit_signal("model_load_triggered", path)