ephread / inkgd

Implementation of inkle's Ink in pure GDScript for Godot, with editor support.
MIT License
305 stars 33 forks source link

Fix path not filled when file is selected #40

Closed videlanicolas closed 2 years ago

videlanicolas commented 2 years ago

Checklist for this pull request

Description

Currently if one presses any folder button on the dock to the right, nothing happens. This is because the popup first emits popup_hide and then file_selected, causing the signal connection to break before file_selected is fired.

To solve this I propose adding an enum that will change depending on the button is pressed. It'll be redundant to use 4 identical EditorFileDialog, we can still use one and change it's parameters. A new variable will hold the enum of the button pressed, and file_selected will execute _on_file_selected method that'll do a match on the selected enum and perform the correct action. If the FileDialog is canceled then file_selected0 is not fired and the enum continues holding the past value. This value is overriden when a new button is pressed.

If for some reason we end up with UNKNOWN that means this function was called from somewhere else other than the 4 buttons, which is not expected.

videlanicolas commented 2 years ago

This fixes #36.

ephread commented 2 years ago

Thanks for the PR @videlanicolas! I'll try to have a look tomorrow.

videlanicolas commented 2 years ago

Thanks!

ephread commented 2 years ago

Great improvement!