Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DisplayServer file_dialog_show callable callback not firing. #83156

Closed
grumpOldman opened this issue Oct 11, 2023 · 6 comments · Fixed by #83181
Closed

DisplayServer file_dialog_show callable callback not firing. #83156

grumpOldman opened this issue Oct 11, 2023 · 6 comments · Fixed by #83181

Comments

@grumpOldman
Copy link

Godot version

v4.2.dev6.official [57a6813]

System information

Windows 10, Forward+

Issue description

Callable isn't called.

Tried function and lambda.

Steps to reproduce

Simple, Use provided script.

Minimal reproduction project

extends Node
	
func _ready():
	var error = DisplayServer.file_dialog_show("Select GDScripts", "C:/", "", false, DisplayServer.FILE_DIALOG_MODE_OPEN_FILES, PackedStringArray(["*.gd"]), process_files)
	if error == OK:
		print("file dialog is working")

func process_files(status, files, index):
	print("file dialog callback is working")
	print(status)
@KoBeWi
Copy link
Member

KoBeWi commented Oct 11, 2023

Your callable has too many arguments.
Isn't there any error in the output?

@AThousandShips
Copy link
Member

This calalble is supposed to take three arguments

@KoBeWi
Copy link
Member

KoBeWi commented Oct 11, 2023

But the documentation says

Callbacks have the following arguments: bool status, PackedStringArray selected_paths.

Where the index comes from?

@AThousandShips
Copy link
Member

AThousandShips commented Oct 11, 2023

It says:

Callbacks have the following arguments: bool status, PackedStringArray selected_paths, int selected_filter_index.

@akien-mga
Copy link
Member

This was changed intentionally in #81218.

It's a new feature in 4.2 so breaking compat between dev snapshots is ok.

@KoBeWi
Copy link
Member

KoBeWi commented Oct 11, 2023

Well I don't see this in dev6, which explains this issue.

Godot version
v4.2.dev6.official

EDIT:

I tested and indeed the code works on master, but not in dev6, which is expected. However there is no proper error reporting when the callable fails. It needs the same treatment as in #82194

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants