Enhance editor file dialog

1. show valid directory path when opening editor file dialog
2. keep file name when changing path by entering path
3. add first extension in filter automatically if not given
4. remove directory in recent list if it's not valid anymore
This commit is contained in:
volzhs
2020-10-14 03:28:45 +09:00
parent a22c7eff0f
commit 1f4b1e1488
3 changed files with 28 additions and 16 deletions

View File

@@ -2262,7 +2262,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
int scene_idx = (p_option == FILE_SAVE_SCENE) ? -1 : tab_closing;
Node *scene = editor_data.get_edited_scene_root(scene_idx);
if (scene && scene->get_filename() != "") {
if (scene && scene->get_filename() != "" && FileAccess::exists(scene->get_filename())) {
if (scene_idx != editor_data.get_edited_scene()) {
_save_scene_with_preview(scene->get_filename(), scene_idx);
} else {
@@ -2307,11 +2307,12 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
}
if (scene->get_filename() != "") {
file->set_current_path(scene->get_filename());
String path = scene->get_filename();
file->set_current_path(path);
if (extensions.size()) {
String ext = scene->get_filename().get_extension().to_lower();
String ext = path.get_extension().to_lower();
if (extensions.find(ext) == nullptr) {
file->set_current_path(scene->get_filename().replacen("." + ext, "." + extensions.front()->get()));
file->set_current_path(path.replacen("." + ext, "." + extensions.front()->get()));
}
}
} else {