mirror of
https://github.com/godotengine/godot.git
synced 2025-01-23 11:03:13 -05:00
Fix extensions when saving resource as
This commit is contained in:
parent
47bc374edf
commit
b0cee57d81
1 changed files with 6 additions and 9 deletions
|
@ -1427,7 +1427,7 @@ void EditorNode::save_resource_as(const Ref<Resource> &p_resource, const String
|
|||
if (p_resource->get_path().is_resource_file()) {
|
||||
file->set_current_file(p_resource->get_path().get_file());
|
||||
} else {
|
||||
if (extensions.size()) {
|
||||
if (!preferred.is_empty()) {
|
||||
String resource_name_snake_case = p_resource->get_class().to_snake_case();
|
||||
file->set_current_file("new_" + resource_name_snake_case + "." + preferred.front()->get().to_lower());
|
||||
} else {
|
||||
|
@ -1436,18 +1436,15 @@ void EditorNode::save_resource_as(const Ref<Resource> &p_resource, const String
|
|||
}
|
||||
} else if (!p_resource->get_path().is_empty()) {
|
||||
file->set_current_path(p_resource->get_path());
|
||||
if (extensions.size()) {
|
||||
String ext = p_resource->get_path().get_extension().to_lower();
|
||||
if (!extensions.is_empty()) {
|
||||
const 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()));
|
||||
}
|
||||
}
|
||||
} else if (preferred.size()) {
|
||||
String existing;
|
||||
if (extensions.size()) {
|
||||
String resource_name_snake_case = p_resource->get_class().to_snake_case();
|
||||
existing = "new_" + resource_name_snake_case + "." + preferred.front()->get().to_lower();
|
||||
}
|
||||
} else if (!preferred.is_empty()) {
|
||||
const String resource_name_snake_case = p_resource->get_class().to_snake_case();
|
||||
const String existing = "new_" + resource_name_snake_case + "." + preferred.front()->get().to_lower();
|
||||
file->set_current_path(existing);
|
||||
}
|
||||
file->set_title(TTR("Save Resource As..."));
|
||||
|
|
Loading…
Add table
Reference in a new issue