Warning The main branch of this repository now supports Godot 4.x. If you are looking for the Godot 3.x version, please check this branch.
Native Dialogs is a plugin for Godot that allows you to interact with OS-specific dialogs, such as notifications, messages and file dialogs. It adds four new nodes that wrap the functionality of the C++ Library portable-file-dialogs.
NativeAcceptDialog
is useful for small notifications to the user about an event. NativeConfirmationDialog
allows you to prompt the user about confirmation of actions. NativeNotification
would show the user a brief message and then fade away. And NativeFileDialog
is used to choose files and directories in the filesystem.
It supports the following operating systems:
- Windows
- MacOS
- Linux
Please note that this plugin follows Godot's file paths format, and it uses ProjectSettings
' globalize_path
method to resolve user://
, and res://
, so consult the documentation if you have any doubt.
As previously said, this plugin adds four new nodes. To use any of these nodes' functionality, you first need to add them to the scene. Then, update any of their properties if necessary. You also need to connect their signals to any method if you want to process the user's input. Finally, call the node's function that shows the native dialog to the user.
Probably the more intuitive way of using this plugin:
- Instantiate a Native Dialog's node in your scene.
- Change any of its properties, if needed.
- Connect its signal if you want to process the user's input.
- Make sure to call the
show
orsend
method of the Native Dialog's node. For example, via a button's signal.
If you want to instantiate nodes using GDScript, you may follow this example:
- Instantiate the desired node.
- Change any of its attributes.
- Connect its corresponding signals to the methods that would process the user's input.
- Add it to the scene.
- Call the
show
orsend
method when you need to show the native dialog.
Here is an overview on how to compile the plugin from source:
-
Check the official Godot documentation on how to compile the engine. You won't need to compile it, but it would help you install the necessary dependencies on your target platform.
-
Clone this repository recursively:
git clone --recursive https://github.com/98teg/NativeDialogs cd NativeDialogs
-
Build the C++ bindings:
cd godot-cpp scons cd ..
-
Compile the plugin:
scons
-
If you have encountered any problems, check the official Godot documentation on how to build a GDExtension plugin.
For more information about this plugin's classes, check the following documentation: