diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2020-06-19 16:46:08 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-19 16:46:08 +0200 |
commit | ac2c1434203f771e38bbccd65aa1f69412898cad (patch) | |
tree | 030a1485131f7ba97e02eb6b33245388ef269f3a | |
parent | 1cd8e835be5b08e4c0be8b691e5c7fb9eb4d740a (diff) | |
parent | d731f43794d13ff9866561090011ad94655f8a24 (diff) |
Merge pull request #39665 from Sl3dge78/animation_save_name
Autofilled path gets set properly on animation subresources saving
-rw-r--r-- | editor/plugins/animation_player_editor_plugin.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp index 1e0a9535e2..9a5b825683 100644 --- a/editor/plugins/animation_player_editor_plugin.cpp +++ b/editor/plugins/animation_player_editor_plugin.cpp @@ -380,26 +380,25 @@ void AnimationPlayerEditor::_animation_save_as(const Ref<Resource> &p_resource) file->add_filter("*." + extensions[i] + " ; " + extensions[i].to_upper()); } + String path; //file->set_current_path(current_path); if (p_resource->get_path() != "") { - file->set_current_path(p_resource->get_path()); + path = p_resource->get_path(); if (extensions.size()) { - String ext = p_resource->get_path().get_extension().to_lower(); - if (extensions.find(ext) == nullptr) { - file->set_current_path(p_resource->get_path().replacen("." + ext, "." + extensions.front()->get())); + if (extensions.find(p_resource->get_path().get_extension().to_lower()) == nullptr) { + path = p_resource->get_path().get_base_dir() + p_resource->get_name() + "." + extensions.front()->get(); } } } else { - String existing; if (extensions.size()) { if (p_resource->get_name() != "") { - existing = p_resource->get_name() + "." + extensions.front()->get().to_lower(); + path = p_resource->get_name() + "." + extensions.front()->get().to_lower(); } else { - existing = "new_" + p_resource->get_class().to_lower() + "." + extensions.front()->get().to_lower(); + path = "new_" + p_resource->get_class().to_lower() + "." + extensions.front()->get().to_lower(); } } - file->set_current_path(existing); } + file->set_current_path(path); file->popup_centered_ratio(); file->set_title(TTR("Save Resource As...")); current_option = RESOURCE_SAVE; |