FileDirPicker
August 15, 2024

This is a rather simple widget that displays a text with a button besides it. Clicking the button brings a FileDialog. Selecting a file (or directory) then assigns the path into the text. The mode between file or directory can be changed.

The screenshot bellow shows this widget when the file res://icon.svg has been selected.

FileDirPicker

Indeed this is a rather simplistic widget and might be completely useless in games. However this has been created to be used in tools. Indeed, the Database plugin does use this widget!

Usage

There isn't much to this control, really! The thing is, it basically wraps a button, a read only LineEdit and a FileDialog! That said, selecting an instance of this widget in editor shows the following in the Inspector:

With the exception of the pick_mode, all properties are directly from the FileDialog. So, referring to the file dialog documentation should provide all the information regarding the exposed properties here!

Now, the pick_mode property offers either File or Directory and determines if the file dialog should be in the open file or open directory mode.

When either directory or file is selected and assigned into the inner LineEdit a signal is emitted, the path_selected. The provided argument is the path to the directory or file, depending on the pick_mode mode.

Whenever you want to access the "selected value", ideally query the current_path property.

That's basically it for the usage! Indeed, there are no additional functions provided.

Other

Styling this is a bit different from any other custom Control provided by this extension pack. Instead of providing custom theme entries like the other controls, this one relies on effectively dealing with the Button, LineEdit and FileDialog styling. Setting custom theme styles for those three controls, in a theme resource that affects any FileDirPicker parent, should affect the wrapped ones of this control.