summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfoxydevloper <12120644+foxydevloper@users.noreply.github.com>2021-07-29 20:42:07 -0400
committerfoxydevloper <12120644+foxydevloper@users.noreply.github.com>2021-07-29 20:53:33 -0400
commitae7a74625d7a6a27285508657a128fb157581412 (patch)
tree757d40be7f97e7ec7838cc668beeaaf6dfdf1f68
parentbdcc8741e4826ce27850bbffa5880c57451e3be5 (diff)
Name new resource files with `snake_case`
-rw-r--r--editor/editor_node.cpp6
-rw-r--r--editor/plugins/animation_player_editor_plugin.cpp3
2 files changed, 6 insertions, 3 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 46d76a946f..2dfad8f05a 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -1168,7 +1168,8 @@ void EditorNode::save_resource_as(const Ref<Resource> &p_resource, const String
file->set_current_file(p_resource->get_path().get_file());
} else {
if (extensions.size()) {
- file->set_current_file("new_" + p_resource->get_class().to_lower() + "." + preferred.front()->get().to_lower());
+ String resource_name_snake_case = p_resource->get_class().camelcase_to_underscore();
+ file->set_current_file("new_" + resource_name_snake_case + "." + preferred.front()->get().to_lower());
} else {
file->set_current_file(String());
}
@@ -1184,7 +1185,8 @@ void EditorNode::save_resource_as(const Ref<Resource> &p_resource, const String
} else if (preferred.size()) {
String existing;
if (extensions.size()) {
- existing = "new_" + p_resource->get_class().to_lower() + "." + preferred.front()->get().to_lower();
+ String resource_name_snake_case = p_resource->get_class().camelcase_to_underscore();
+ existing = "new_" + resource_name_snake_case + "." + preferred.front()->get().to_lower();
}
file->set_current_path(existing);
}
diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp
index 4ba9147955..681c3e7195 100644
--- a/editor/plugins/animation_player_editor_plugin.cpp
+++ b/editor/plugins/animation_player_editor_plugin.cpp
@@ -408,7 +408,8 @@ void AnimationPlayerEditor::_animation_save_as(const Ref<Resource> &p_resource)
if (p_resource->get_name() != "") {
path = p_resource->get_name() + "." + extensions.front()->get().to_lower();
} else {
- path = "new_" + p_resource->get_class().to_lower() + "." + extensions.front()->get().to_lower();
+ String resource_name_snake_case = p_resource->get_class().camelcase_to_underscore();
+ path = "new_" + resource_name_snake_case + "." + extensions.front()->get().to_lower();
}
}
}