Merge pull request #114648 from aaronfranke/editor-anim-reset

Select RESET animation by default when opening a scene in the editor
This commit is contained in:
Thaddeus Crews 2026-02-26 08:15:15 -06:00
commit 985c952a86
No known key found for this signature in database
GPG key ID: 8C6E5FEB5FC03CCC

View file

@ -1037,6 +1037,7 @@ void AnimationPlayerEditor::_update_player() {
player->get_animation_library_list(&libraries);
int active_idx = -1;
int reset_index = -1;
bool no_anims_found = true;
bool global_animation_library_is_readonly = false;
bool all_animation_libraries_are_readonly = libraries.size() > 0;
@ -1066,6 +1067,9 @@ void AnimationPlayerEditor::_update_player() {
path += "/";
}
path += E;
if (E == SceneStringName(RESET)) {
reset_index = animation->get_item_count();
}
animation->add_item(path);
if (player->get_assigned_animation() == path) {
active_idx = animation->get_selectable_item(true);
@ -1085,7 +1089,10 @@ void AnimationPlayerEditor::_update_player() {
autoplay->set_pressed(animation->get_item_text(active_idx) == player->get_autoplay());
_animation_selected(active_idx);
} 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);
autoplay->set_pressed(animation->get_item_text(item) == player->get_autoplay());
_animation_selected(item);