Select RESET animation by default when opening a scene in the editor

This commit is contained in:
Aaron Franke 2026-01-06 03:38:54 -08:00
parent a3e84cc2af
commit 5a92ea5c24
No known key found for this signature in database
GPG key ID: 40A1750B977E56BF

View file

@ -1027,6 +1027,7 @@ void AnimationPlayerEditor::_update_player() {
player->get_animation_library_list(&libraries); player->get_animation_library_list(&libraries);
int active_idx = -1; int active_idx = -1;
int reset_index = -1;
bool no_anims_found = true; bool no_anims_found = true;
bool global_animation_library_is_readonly = false; bool global_animation_library_is_readonly = false;
bool all_animation_libraries_are_readonly = libraries.size() > 0; bool all_animation_libraries_are_readonly = libraries.size() > 0;
@ -1056,6 +1057,9 @@ void AnimationPlayerEditor::_update_player() {
path += "/"; path += "/";
} }
path += E; path += E;
if (E == SceneStringName(RESET)) {
reset_index = animation->get_item_count();
}
animation->add_item(path); animation->add_item(path);
if (player->get_assigned_animation() == path) { if (player->get_assigned_animation() == path) {
active_idx = animation->get_selectable_item(true); active_idx = animation->get_selectable_item(true);
@ -1075,7 +1079,10 @@ void AnimationPlayerEditor::_update_player() {
autoplay->set_pressed(animation->get_item_text(active_idx) == player->get_autoplay()); autoplay->set_pressed(animation->get_item_text(active_idx) == player->get_autoplay());
_animation_selected(active_idx); _animation_selected(active_idx);
} else if (animation->has_selectable_items()) { } else if (animation->has_selectable_items()) {
int item = animation->get_selectable_item(); int item = reset_index;
if (item == -1) {
item = animation->get_selectable_item();
}
animation->select(item); animation->select(item);
autoplay->set_pressed(animation->get_item_text(item) == player->get_autoplay()); autoplay->set_pressed(animation->get_item_text(item) == player->get_autoplay());
_animation_selected(item); _animation_selected(item);