diff options
author | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2021-05-09 09:06:37 +0200 |
---|---|---|
committer | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2022-07-13 19:57:48 +0200 |
commit | 23dcc3345bb4b81a2801c143767fdc57b6715dd7 (patch) | |
tree | 4f483453d42abc9f15ff8d1cc0874e2e695402a2 /editor | |
parent | 98d5b37a4cf3c5dd008022752514109ff621d268 (diff) |
Tweak the name for new animations in the editor
- Use snake_case to "suggest" the naming that fits the Godot style guide.
- Fully spell out "new_animation" since both editors can fit it in full.
- Don't internationalize the new animation name to have consistent
behavior between both editors.
- Since the recommendation is to follow snake_case, special characters
should also be avoided in the name to make animations easier to refer
to in code.
Diffstat (limited to 'editor')
-rw-r--r-- | editor/plugins/animation_player_editor_plugin.cpp | 4 | ||||
-rw-r--r-- | editor/plugins/sprite_frames_editor_plugin.cpp | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp index 3d4701a54a..069ca09465 100644 --- a/editor/plugins/animation_player_editor_plugin.cpp +++ b/editor/plugins/animation_player_editor_plugin.cpp @@ -304,7 +304,7 @@ void AnimationPlayerEditor::_animation_selected(int p_which) { void AnimationPlayerEditor::_animation_new() { int count = 1; - String base = TTR("New Anim"); + String base = "new_animation"; String current_library_name = ""; if (animation->has_selectable_items()) { String current_animation_name = animation->get_item_text(animation->get_selected()); @@ -317,7 +317,7 @@ void AnimationPlayerEditor::_animation_new() { while (true) { String attempt = base; if (count > 1) { - attempt += " (" + itos(count) + ")"; + attempt += vformat("_%d", count); } if (player->has_animation(attempt_prefix + attempt)) { count++; diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp index edd900f7d8..6765f7ec1f 100644 --- a/editor/plugins/sprite_frames_editor_plugin.cpp +++ b/editor/plugins/sprite_frames_editor_plugin.cpp @@ -756,11 +756,11 @@ void SpriteFramesEditor::_animation_name_edited() { } void SpriteFramesEditor::_animation_add() { - String name = "New Anim"; + String name = "new_animation"; int counter = 0; while (frames->has_animation(name)) { counter++; - name = "New Anim " + itos(counter); + name = vformat("new_animation_%d", counter); } List<Node *> nodes; |