[x] I have checked that my code additions did not fail tests.
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.
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 thenfile_selected
, causing the signal connection to break beforefile_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, andfile_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 thenfile_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.