Fix errors and improve UX relating to new animation libraries

- Fix a bug causing an error message when a scene containing an AnimationPlayer with a reset track is saved, by correctly referencing the temporary "default" library.
- Make library dropdown in new animation window assign correct library when creating an animation.
- Similarly allow choice of library when duplicating animation.
- Make library dropdown default to library of currently selected animation.
- Make library dropdown show when exactly one library exists, and it isn't [Global]. Include [Global] on the dropdown in this case (will be newly created if dialog is confirmed).
- When appending (x) to avoid New Anim name collisions, correctly check target library instead of [Global].
- Add parentheses when appending x when duplicating animations in the library editor, for consistency.
- Change titles and prompts to be distinct in name/rename/duplicate dialiogs.
- Fix bug in OprionButton.get_selectable_item(true) when last is not selectable.
- Fix issues where animation wasn't found on deletion/rename by correctly prepending library name.
- Remove an extraneous print_line from animation_track_editor.
- Add messages to errors when an animation isn't found.
This commit is contained in:
SnailRhymer 2022-05-14 17:54:14 +01:00
parent 067c1eb923
commit d79818acb6
7 changed files with 161 additions and 51 deletions

View file

@ -75,12 +75,16 @@ void AnimationLibraryEditor::_add_library_validate(const String &p_name) {
add_library_validate->set_text(error);
add_library_dialog->get_ok_button()->set_disabled(true);
} else {
add_library_validate->add_theme_color_override("font_color", get_theme_color(SNAME("success_color"), SNAME("Editor")));
if (p_name == "") {
add_library_validate->set_text(TTR("Global library will be created."));
if (adding_animation) {
add_library_validate->set_text(TTR("Animation name is valid."));
} else {
add_library_validate->set_text(TTR("Library name is valid."));
if (p_name == "") {
add_library_validate->set_text(TTR("Global library will be created."));
} else {
add_library_validate->set_text(TTR("Library name is valid."));
}
}
add_library_validate->add_theme_color_override("font_color", get_theme_color(SNAME("success_color"), SNAME("Editor")));
add_library_dialog->get_ok_button()->set_disabled(false);
}
}
@ -469,7 +473,7 @@ void AnimationLibraryEditor::_button_pressed(TreeItem *p_item, int p_column, int
int attempt = 1;
while (al->has_animation(name)) {
attempt++;
name = base_name + " " + itos(attempt);
name = base_name + " (" + itos(attempt) + ")";
}
UndoRedo *undo_redo = EditorNode::get_singleton()->get_undo_redo();